Commits

Brendan Howell committed 026fd7a

started implementing package resources for internal files

Comments (0)

Files changed (2)

 
 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):
     python setup.py py2app
 """
 import sys
+from glob import glob
 from setuptools import setup, find_packages
 
 APP = ['pycessing.py']
      )
 else:
      extra_options = dict(
+         entry_points = {
+             'gui_scripts': [ 'pycessing = pycessing' ]
+         },
          scripts = APP,
          #packages = ["mainwindow.py","run.py"],
-         py_modules = ["mainwindow","run"],
+         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",
          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',
          ],
      )