提交 01df3966 编写于 作者: K Kentaro Wada

Prepare source to release pypi

上级 af1e8896
build/
dist/
*.py[cdo]
*.egg-info/
icons/.DS_Store
resources.py
*.pyc
.*.swp
labelme/resources.py
all: resources.py
%.py: %.qrc
pyrcc4 -o $@ $<
# 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.
......@@ -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.
......
......@@ -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'
......
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'],
)
#!/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))
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册