Jelajahi Sumber

Remove resources.qrc with refactring newIcon function

Kentaro Wada 7 tahun lalu
induk
melakukan
6d26f8ddf7
6 mengubah file dengan 16 tambahan dan 82 penghapusan
  1. 3 3
      README.md
  2. 6 7
      labelme/app.py
  3. 0 0
      labelme/icons/color-line.png
  4. 6 1
      labelme/icons/next.png
  5. 0 32
      labelme/resources.qrc
  6. 1 39
      setup.py

+ 3 - 3
README.md

@@ -68,11 +68,11 @@ chmod u+x labelme_on_docker
 ```bash
 # Ubuntu 14.04 / Ubuntu 16.04
 # Python2
-# sudo apt-get install python-qt4 pyqt4-dev-tools  # PyQt4
-sudo apt-get install python-pyqt5 pyqt5-dev-tools  # PyQt5
+# sudo apt-get install python-qt4  # PyQt4
+sudo apt-get install python-pyqt5  # PyQt5
 sudo pip install labelme
 # Python3
-sudo apt-get install python3-pyqt5 pyqt5-dev-tools  # PyQt5
+sudo apt-get install python3-pyqt5  # PyQt5
 sudo pip3 install labelme
 ```
 

+ 6 - 7
labelme/app.py

@@ -29,7 +29,6 @@ from labelme.lib import fmtShortcut
 from labelme.lib import newAction
 from labelme.lib import newIcon
 from labelme.lib import struct
-from labelme import resources  # NOQA
 from labelme.shape import DEFAULT_FILL_COLOR
 from labelme.shape import DEFAULT_LINE_COLOR
 from labelme.shape import Shape
@@ -252,14 +251,14 @@ class MainWindow(QtWidgets.QMainWindow, WindowMixin):
                         'Ctrl+Shift+L', 'color', 'Choose polygon fill color')
 
         createMode = action('Create\nPolygo&ns', self.setCreateMode, 'Ctrl+N',
-                            'new', 'Start drawing polygons', enabled=False)
+                            'objects', 'Start drawing polygons', enabled=False)
         editMode = action('&Edit\nPolygons', self.setEditMode, 'Ctrl+J',
                           'edit', 'Move and edit polygons', enabled=False)
 
         create = action('Create\nPolygo&n', self.createShape, 'Ctrl+N', 'new',
                         'Draw a new polygon', enabled=False)
         delete = action('Delete\nPolygon', self.deleteSelectedShape, 'Delete',
-                        'delete', 'Delete', enabled=False)
+                        'cancel', 'Delete', enabled=False)
         copy = action('&Duplicate\nPolygon', self.copySelectedShape, 'Ctrl+D',
                       'copy', 'Create a duplicate of the selected polygon',
                       enabled=False)
@@ -273,10 +272,10 @@ class MainWindow(QtWidgets.QMainWindow, WindowMixin):
 
         hideAll = action('&Hide\nPolygons',
                          functools.partial(self.togglePolygons, False),
-                         'Ctrl+H', 'hide', 'Hide all polygons', enabled=False)
+                         'Ctrl+H', 'eye', 'Hide all polygons', enabled=False)
         showAll = action('&Show\nPolygons',
                          functools.partial(self.togglePolygons, True),
-                         'Ctrl+A', 'hide', 'Show all polygons', enabled=False)
+                         'Ctrl+A', 'eye', 'Show all polygons', enabled=False)
 
         help = action('&Tutorial', self.tutorial, 'Ctrl+T', 'help',
                       'Show screencast of introductory tutorial')
@@ -322,7 +321,7 @@ class MainWindow(QtWidgets.QMainWindow, WindowMixin):
         self.editButton.setDefaultAction(edit)
 
         shapeLineColor = action(
-            'Shape &Line Color', self.chshapeLineColor, icon='color_line',
+            'Shape &Line Color', self.chshapeLineColor, icon='color-line',
             tip='Change the line color for this specific shape', enabled=False)
         shapeFillColor = action(
             'Shape &Fill Color', self.chshapeFillColor, icon='color',
@@ -1243,7 +1242,7 @@ def main():
 
     app = QtWidgets.QApplication(sys.argv)
     app.setApplicationName(__appname__)
-    app.setWindowIcon(newIcon("app"))
+    app.setWindowIcon(newIcon("icon"))
     win = MainWindow(
         filename=args.filename,
         output=args.output,

+ 0 - 0
labelme/icons/color_line.png → labelme/icons/color-line.png


+ 6 - 1
labelme/icons/next.png


+ 0 - 32
labelme/resources.qrc

@@ -1,32 +0,0 @@
-<!DOCTYPE RCC><RCC version="1.0">
-<qresource>
-
-<file alias="help">icons/help.png</file>
-<file alias="app">icons/icon.png</file>
-<file alias="expert">icons/expert.png</file>
-<file alias="done">icons/done.png</file>
-<file alias="file">icons/file.png</file>
-<file alias="labels">icons/labels.png</file>
-<file alias="new">icons/objects.png</file>
-<file alias="close">icons/close.png</file>
-<file alias="fit-width">icons/fit-width.png</file>
-<file alias="fit-window">icons/fit-window.png</file>
-<file alias="undo">icons/undo.png</file>
-<file alias="hide">icons/eye.png</file>
-<file alias="quit">icons/quit.png</file>
-<file alias="copy">icons/copy.png</file>
-<file alias="edit">icons/edit.png</file>
-<file alias="open">icons/open.png</file>
-<file alias="next">icons/next.png</file>
-<file alias="prev">icons/prev.png</file>
-<file alias="save">icons/save.png</file>
-<file alias="save-as">icons/save-as.png</file>
-<file alias="color">icons/color.png</file>
-<file alias="color_line">icons/color_line.png</file>
-<file alias="zoom">icons/zoom.png</file>
-<file alias="zoom-in">icons/zoom-in.png</file>
-<file alias="zoom-out">icons/zoom-out.png</file>
-<file alias="delete">icons/cancel.png</file>
-
-</qresource>
-</RCC>

+ 1 - 39
setup.py

@@ -54,48 +54,10 @@ if sys.argv[1] == 'release':
     sys.exit(sum(subprocess.call(shlex.split(cmd)) for cmd in commands))
 
 
-here = osp.dirname(osp.abspath(__file__))
-
-
-def customize(command_subclass):
-    orig_run = command_subclass.run
-
-    def customized_run(self):
-        pyrcc = 'pyrcc{:d}'.format(PYQT_VERSION)
-        if find_executable(pyrcc) is None:
-            sys.stderr.write('Please install {:s} command.\n'.format(pyrcc))
-            sys.stderr.write('(See https://github.com/wkentaro/labelme.git)\n')
-            sys.exit(1)
-        package_dir = osp.join(here, 'labelme')
-        src = 'resources.qrc'
-        dst = 'resources.py'
-        cmd = '{pyrcc} -o {dst} {src}'.format(pyrcc=pyrcc, src=src, dst=dst)
-        print('+ {:s}'.format(cmd))
-        subprocess.call(shlex.split(cmd), cwd=package_dir)
-        orig_run(self)
-
-    command_subclass.run = customized_run
-    return command_subclass
-
-
-@customize
-class CustomDevelopCommand(DevelopCommand):
-    pass
-
-
-@customize
-class CustomInstallCommand(InstallCommand):
-    pass
-
-
 setup(
     name='labelme',
     version=version,
     packages=find_packages(),
-    cmdclass={
-        'develop': CustomDevelopCommand,
-        'install': CustomInstallCommand,
-    },
     description='Image Polygonal Annotation with Python.',
     long_description=open('README.md').read(),
     long_description_content_type='text/markdown',
@@ -112,7 +74,7 @@ setup(
         'Operating System :: POSIX',
         'Topic :: Internet :: WWW/HTTP',
     ],
-    package_data={'labelme': ['icons/*', 'resources.qrc']},
+    package_data={'labelme': ['icons/*']},
     entry_points={
         'console_scripts': [
             'labelme=labelme.app:main',