Brendan Howell avatar Brendan Howell committed fa098e6 Merge

Merge branch 'master' of https://bitbucket.org/bhowell/pycessing

Comments (0)

Files changed (3)

Add a comment to this file

examples/wrappingpaper-cir.jpg

Old
Old image
New
New image
 
 from PyQt4 import QtGui, QtCore, Qsci
 import os, subprocess, signal, tempfile, sys, glob
+from pkg_resources import resource_string, resource_stream, resource_listdir
 
 class MainWindow(QtGui.QMainWindow):
     def __init__(self):
 
         
     def about(self):
-        QtGui.QMessageBox.about(self,"About Pycessing","Copyright 2011 <br />Brendan Howell<br />Under the GPL.")
+        QtGui.QMessageBox.about(self,"About Pycessing","Copyright 2012 <br />Brendan Howell<br />Licensed Under the GPL3.")
         
     #TODO: this should open a new tab (or window)
     def newFile(self):
     def openExample(self, filename):
         if not(self.newFile()):
             return
-        exfile = os.path.join(self.cwd, 'examples/' + filename + ".cess")
-        examplecode = open(exfile)
-        self.textEdit.setText(examplecode.read())
-        examplecode.close()
+        examplecode = resource_string(__name__,'examples/' + filename + '.cess')
+        self.textEdit.setText(examplecode)
         self.setWindowTitle('PyCessing - ' + filename)
             
     def setupEditor(self):
 """
-This is a setup.py script generated by py2applet
+This is a setup.py script for PyCessing
 
 Usage:
     python setup.py py2app
 """
-
-from setuptools import setup
+import sys
+from glob import glob
+from setuptools import setup, find_packages
 
 APP = ['pycessing.py']
 DATA_FILES = []
-OPTIONS = {'argv_emulation': True, 
-		'includes': ['sip','PyQt4','PyQt4.QtGui','PyQt4.QtCore','pygame',
+VERSION = "0.3"
+
+MAC_OPTIONS = {'argv_emulation': True, 
+		       'includes': ['sip','PyQt4','PyQt4.QtGui','PyQt4.QtCore','pygame',
 		             'numpy','Image','cairo','json','xml.dom.minidom'],
-		'excludes': ['PyQt4.QtDesigner', 'PyQt4.QtNetwork', 'PyQt4.QtOpenGL',
+		        'excludes': ['PyQt4.QtDesigner', 'PyQt4.QtNetwork', 'PyQt4.QtOpenGL',
 		             'PyQt4.QtScript', 'PyQt4.QtSql', 'PyQt4.QtTest', 
 					 'PyQt4.QtWebKit', 'PyQt4.QtXml', 'PyQt4.phonon']}
 
+if sys.platform == "darwin":
+    extra_options = dict(
+        app=APP,
+        data_files=DATA_FILES,
+        options={'py2app': MAC_OPTIONS},
+        setup_requires=['py2app'],
+	)
+elif sys.platform == 'win32':
+     extra_options = dict(
+         setup_requires=['py2exe'],
+         app=[APP],
+     )
+else:
+     extra_options = dict(
+         entry_points = {
+             'gui_scripts': [ 'pycessing = pycessing' ]
+         },
+         scripts = APP,
+         #packages = ["mainwindow.py","run.py"],
+         py_modules = ["mainwindow","run","drawing_cairo","images","pycess","sounds","typo"],
+         data_files = [("examples",glob(r'examples/*')),
+                       ("help",glob(r'help/*')),
+                       ("icons",glob(r'icons/*')),
+         ],
+         version = VERSION,
+         author = "Brendan Howell",
+         author_email = "brendan@pycessing.org",
+         license = "GPLv3",
+         url = "http://pycessing.org",
+         classifiers = [
+            "Development Status :: 4 - Beta",
+	    "License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
+	    'Operating System :: MacOS :: MacOS X',
+            'Operating System :: Microsoft :: Windows',
+            'Operating System :: POSIX',
+            'Programming Language :: Python',
+         ],
+     )
+
 setup(
-    app=APP,
-    data_files=DATA_FILES,
-    options={'py2app': OPTIONS},
-    setup_requires=['py2app'],
+    name="PyCessing",
+    **extra_options
 )
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.