Browse Source

Prepare source to release pypi

Kentaro Wada 9 years ago
parent
commit
9ba752183c
50 changed files with 71 additions and 67 deletions
  1. 5 6
      .gitignore
  2. 0 6
      Makefile
  3. 3 5
      README.md
  4. 0 0
      labelme/__init__.py
  5. 2 2
      labelme/canvas.py
  6. 0 0
      labelme/colorDialog.py
  7. 0 0
      labelme/icons/cancel.png
  8. 0 0
      labelme/icons/close.png
  9. 0 0
      labelme/icons/color.png
  10. 0 0
      labelme/icons/color_line.png
  11. 0 0
      labelme/icons/copy.png
  12. 0 0
      labelme/icons/delete.png
  13. 0 0
      labelme/icons/done.png
  14. 0 0
      labelme/icons/done.svg
  15. 0 0
      labelme/icons/edit.png
  16. 0 0
      labelme/icons/expert1.png
  17. 0 0
      labelme/icons/expert2.png
  18. 0 0
      labelme/icons/eye.png
  19. 0 0
      labelme/icons/feBlend-icon.png
  20. 0 0
      labelme/icons/file.png
  21. 0 0
      labelme/icons/fit-width.png
  22. 0 0
      labelme/icons/fit-window.png
  23. 0 0
      labelme/icons/fit.png
  24. 0 0
      labelme/icons/help.png
  25. 0 0
      labelme/icons/labels.png
  26. 0 0
      labelme/icons/labels.svg
  27. 0 0
      labelme/icons/new.png
  28. 0 0
      labelme/icons/objects.png
  29. 0 0
      labelme/icons/open.png
  30. 0 0
      labelme/icons/open.svg
  31. 0 0
      labelme/icons/quit.png
  32. 0 0
      labelme/icons/save-as.png
  33. 0 0
      labelme/icons/save-as.svg
  34. 0 0
      labelme/icons/save.png
  35. 0 0
      labelme/icons/save.svg
  36. 0 0
      labelme/icons/undo-cross.png
  37. 0 0
      labelme/icons/undo.png
  38. 0 0
      labelme/icons/zoom-in.png
  39. 0 0
      labelme/icons/zoom-out.png
  40. 0 0
      labelme/icons/zoom.png
  41. 0 0
      labelme/labelDialog.py
  42. 0 0
      labelme/labelFile.py
  43. 0 0
      labelme/lib.py
  44. 0 0
      labelme/resources.qrc
  45. 0 0
      labelme/shape.py
  46. 0 0
      labelme/toolBar.py
  47. 0 0
      labelme/zoomWidget.py
  48. 9 10
      scripts/labelme
  49. 52 0
      setup.py
  50. 0 38
      test.py

+ 5 - 6
.gitignore

@@ -1,8 +1,7 @@
+build/
+dist/
+*.py[cdo]
+*.egg-info/
 
 icons/.DS_Store
-
-resources.py
-
-*.pyc
-.*.swp
-
+labelme/resources.py

+ 0 - 6
Makefile

@@ -1,6 +0,0 @@
-
-all: resources.py
-
-%.py: %.qrc
-	pyrcc4 -o $@ $<
-

+ 3 - 5
README.md

@@ -1,4 +1,3 @@
-
 # Labelme
 
 Labelme is a graphical image annotation tool inspired by
@@ -6,13 +5,13 @@ http://labelme.csail.mit.edu.
 
 It is written in Python and uses Qt for its graphical interface.
 
-# Dependencies
+## Dependencies
 
 Labelme requires at least [Python 2.6](http://www.python.org/getit/) and
 has been tested with [PyQt
 4.8](http://www.riverbankcomputing.co.uk/software/pyqt/intro).
 
-# Usage
+## Usage
 
 After cloning the code you should first run `make` to generate the
 resource file (a Python module containing all the icons).
@@ -24,8 +23,7 @@ At the moment annotations are saved as a [JSON](http://www.json.org/) file.
 The file includes the image itself. In the feature support for XML
 output or possibly even [SVG](http://www.w3.org/Graphics/SVG/) will be added.
 
-# TODO
+## TODO
 
 - Refactor into a Python package.
 - Add installation script.
-

+ 0 - 0
labelme/__init__.py


+ 2 - 2
canvas.py → labelme/canvas.py

@@ -21,8 +21,8 @@ from PyQt4.QtGui import *
 from PyQt4.QtCore import *
 #from PyQt4.QtOpenGL import *
 
-from shape import Shape
-from lib import distance
+from labelme.shape import Shape
+from labelme.lib import distance
 
 # TODO:
 # - [maybe] Find optimal epsilon value.

+ 0 - 0
colorDialog.py → labelme/colorDialog.py


+ 0 - 0
icons/cancel.png → labelme/icons/cancel.png


+ 0 - 0
icons/close.png → labelme/icons/close.png


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


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


+ 0 - 0
icons/copy.png → labelme/icons/copy.png


+ 0 - 0
icons/delete.png → labelme/icons/delete.png


+ 0 - 0
icons/done.png → labelme/icons/done.png


+ 0 - 0
icons/done.svg → labelme/icons/done.svg


+ 0 - 0
icons/edit.png → labelme/icons/edit.png


+ 0 - 0
icons/expert1.png → labelme/icons/expert1.png


+ 0 - 0
icons/expert2.png → labelme/icons/expert2.png


+ 0 - 0
icons/eye.png → labelme/icons/eye.png


+ 0 - 0
icons/feBlend-icon.png → labelme/icons/feBlend-icon.png


+ 0 - 0
icons/file.png → labelme/icons/file.png


+ 0 - 0
icons/fit-width.png → labelme/icons/fit-width.png


+ 0 - 0
icons/fit-window.png → labelme/icons/fit-window.png


+ 0 - 0
icons/fit.png → labelme/icons/fit.png


+ 0 - 0
icons/help.png → labelme/icons/help.png


+ 0 - 0
icons/labels.png → labelme/icons/labels.png


+ 0 - 0
icons/labels.svg → labelme/icons/labels.svg


+ 0 - 0
icons/new.png → labelme/icons/new.png


+ 0 - 0
icons/objects.png → labelme/icons/objects.png


+ 0 - 0
icons/open.png → labelme/icons/open.png


+ 0 - 0
icons/open.svg → labelme/icons/open.svg


+ 0 - 0
icons/quit.png → labelme/icons/quit.png


+ 0 - 0
icons/save-as.png → labelme/icons/save-as.png


+ 0 - 0
icons/save-as.svg → labelme/icons/save-as.svg


+ 0 - 0
icons/save.png → labelme/icons/save.png


+ 0 - 0
icons/save.svg → labelme/icons/save.svg


+ 0 - 0
icons/undo-cross.png → labelme/icons/undo-cross.png


+ 0 - 0
icons/undo.png → labelme/icons/undo.png


+ 0 - 0
icons/zoom-in.png → labelme/icons/zoom-in.png


+ 0 - 0
icons/zoom-out.png → labelme/icons/zoom-out.png


+ 0 - 0
icons/zoom.png → labelme/icons/zoom.png


+ 0 - 0
labelDialog.py → labelme/labelDialog.py


+ 0 - 0
labelFile.py → labelme/labelFile.py


+ 0 - 0
lib.py → labelme/lib.py


+ 0 - 0
resources.qrc → labelme/resources.qrc


+ 0 - 0
shape.py → labelme/shape.py


+ 0 - 0
toolBar.py → labelme/toolBar.py


+ 0 - 0
zoomWidget.py → labelme/zoomWidget.py


+ 9 - 10
labelme.py → scripts/labelme

@@ -30,16 +30,15 @@ from collections import defaultdict
 from PyQt4.QtGui import *
 from PyQt4.QtCore import *
 
-import resources
-
-from lib import struct, newAction, newIcon, addActions, fmtShortcut
-from shape import Shape, DEFAULT_LINE_COLOR, DEFAULT_FILL_COLOR
-from canvas import Canvas
-from zoomWidget import ZoomWidget
-from labelDialog import LabelDialog
-from colorDialog import ColorDialog
-from labelFile import LabelFile, LabelFileError
-from toolBar import ToolBar
+from labelme import resources
+from labelme.lib import struct, newAction, newIcon, addActions, fmtShortcut
+from labelme.shape import Shape, DEFAULT_LINE_COLOR, DEFAULT_FILL_COLOR
+from labelme.canvas import Canvas
+from labelme.zoomWidget import ZoomWidget
+from labelme.labelDialog import LabelDialog
+from labelme.colorDialog import ColorDialog
+from labelme.labelFile import LabelFile, LabelFileError
+from labelme.toolBar import ToolBar
 
 
 __appname__ = 'labelme'

+ 52 - 0
setup.py

@@ -0,0 +1,52 @@
+from distutils.command.build_py import build_py as BuildPyCommand
+from setuptools import find_packages
+from setuptools import setup
+import shlex
+import subprocess
+import sys
+
+
+version = '1.0'
+
+
+class LabelmeBuildPyCommand(BuildPyCommand):
+
+    def run(self):
+        BuildPyCommand.run(self)
+        src = 'labelme/resources.py'
+        dst = 'labelme/resources.qrc'
+        cmd = 'pyrcc4 -o {0} {1}'.format(src, dst)
+        print('converting {0} -> {1}'.format(src, dst))
+        subprocess.check_call(shlex.split(cmd))
+
+
+try:
+    import PyQt4
+except ImportError:
+    sys.stderr.write('Please install PyQt4.\n')
+    sys.exit(1)
+
+
+setup(
+    name='labelme',
+    version=version,
+    packages=find_packages(),
+    cmdclass={'build_py': LabelmeBuildPyCommand},
+    description='Simple Image Annotation Tool.',
+    long_description=open('README.md').read(),
+    author='mpitid',
+    author_email='mpitid@gmail.com',
+    url='https://github.com/mpitid/pylabelme',
+    install_requires=[],
+    license='MIT',
+    keywords='Image Annotation, Machine Learning',
+    classifiers=[
+        'Development Status :: 5 - Production/Stable',
+        'Intended Audience :: Developers',
+        'License :: OSI Approved :: MIT License',
+        'Operating System :: POSIX',
+        'Topic :: Internet :: WWW/HTTP',
+    ],
+    package_data={'labelme': ['icons']},
+    scripts=['scripts/labelme'],
+)

+ 0 - 38
test.py

@@ -1,38 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf8 -*-
-
-import sys
-
-from PyQt4.QtGui import *
-from PyQt4.QtCore import *
-
-class MainWindow(QMainWindow):
-    def __init__(self):
-        super(MainWindow, self).__init__()
-        self.setWindowTitle("test")
-
-        quit = QAction("&Quit", self)
-        quit.triggered.connect(self.close)
-
-        menu = self.menuBar().addMenu('&File')
-        menu.addAction(quit)
-
-        self.notepad = QTabWidget()
-        tabs = [("hello", QWidget(), "test")]
-        for i, (name, widget, title) in enumerate(tabs):
-            self.notepad.addTab(widget, title)
-
-        self.setCentralWidget(self.notepad)
-        self.statusBar().show()
-
-
-def main(argv):
-    app = QApplication(argv)
-    app.setApplicationName("test")
-    win = MainWindow()
-    win.show()
-    return app.exec_()
-
-if __name__ == '__main__':
-    sys.exit(main(sys.argv))
-