Skip to content

Commit

Permalink
Use standard types.SimpleNamespace instead of custom struct
Browse files Browse the repository at this point in the history
  • Loading branch information
akx committed Aug 13, 2024
1 parent da44445 commit 8bd2563
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
5 changes: 3 additions & 2 deletions labelme/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import os
import os.path as osp
import re
import types
import webbrowser

import imgviz
Expand Down Expand Up @@ -622,7 +623,7 @@ def __init__(
self.labelList.customContextMenuRequested.connect(self.popLabelListMenu)

# Store actions for further handling.
self.actions = utils.struct(
self.actions = types.SimpleNamespace(
saveAuto=saveAuto,
saveWithImageData=saveWithImageData,
changeOutputDir=changeOutputDir,
Expand Down Expand Up @@ -715,7 +716,7 @@ def __init__(

self.canvas.vertexSelected.connect(self.actions.removePoint.setEnabled)

self.menus = utils.struct(
self.menus = types.SimpleNamespace(
file=self.menu(self.tr("&File")),
edit=self.menu(self.tr("&Edit")),
view=self.menu(self.tr("&View")),
Expand Down
1 change: 0 additions & 1 deletion labelme/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
from .qt import newAction
from .qt import addActions
from .qt import labelValidator
from .qt import struct
from .qt import distance
from .qt import distancetoline
from .qt import fmtShortcut
5 changes: 0 additions & 5 deletions labelme/utils/qt.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,6 @@ def labelValidator():
return QtGui.QRegExpValidator(QtCore.QRegExp(r"^[^ \t].+"), None)


class struct(object):
def __init__(self, **kwargs):
self.__dict__.update(kwargs)


def distance(p):
return sqrt(p.x() * p.x() + p.y() * p.y())

Expand Down

0 comments on commit 8bd2563

Please sign in to comment.