diff --git a/labelme/app.py b/labelme/app.py index 207a769cf..43b43b6a9 100644 --- a/labelme/app.py +++ b/labelme/app.py @@ -6,6 +6,7 @@ import os import os.path as osp import re +import types import webbrowser import imgviz @@ -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, @@ -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")), diff --git a/labelme/utils/__init__.py b/labelme/utils/__init__.py index 7fa2154fe..499d52811 100644 --- a/labelme/utils/__init__.py +++ b/labelme/utils/__init__.py @@ -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 diff --git a/labelme/utils/qt.py b/labelme/utils/qt.py index 7fed3ad18..f6b3798c4 100644 --- a/labelme/utils/qt.py +++ b/labelme/utils/qt.py @@ -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())