Commits

Brendan Howell committed dd01b97

fixed a few more missing resource paths

  • Participants
  • Parent commits 1b5ed20

Comments (0)

Files changed (1)

File mainwindow.py

     	#self.messageBox.setAutoFormatting(QtGui.QTextBrowser.LogText)
         
     def setupFileMenu(self):
-        iconfile = os.path.join(self.cwd, 'icons/exit.png')
+        iconfile = resource_filename(__name__,'icons/exit.png')
         exit = QtGui.QAction(QtGui.QIcon(iconfile), '&Quit', self)
         exit.setShortcut('Ctrl+Q')
         exit.setStatusTip('Exit application')
         fileMenu.addAction("&Print", self.printFile, QtGui.QKeySequence("Ctrl+P"))
         fileMenu.addAction(exit)
         
-        #exampleDir = os.path.join(self.cwd, 'examples/')
         exampleDir = resource_filename(__name__,"examples/")
         examples = glob.glob(exampleDir + '*.cess')
         #glob examples
 
     def setupToolbar(self):
         toolbar = self.addToolBar('Toolbar')
-        iconfile = os.path.join(self.cwd, 'icons/play.png')
+        iconfile = resource_filename(__name__,'icons/play.png')
         self.playToggle = QtGui.QAction(QtGui.QIcon(iconfile), 'Run Program', toolbar)
         self.connect(self.playToggle, QtCore.SIGNAL('triggered()'), self.togglePlaying)
         toolbar.addAction(self.playToggle)
         #add expandable spacer
         
         # find button
-        iconfile = os.path.join(self.cwd, "icons/Edit-find.png")
+        iconfile = resource_filename(__name__,"icons/Edit-find.png")
         self.findbutton = QtGui.QAction(QtGui.QIcon(iconfile), 'Find in Program', toolbar)
         self.connect(self.findbutton, QtCore.SIGNAL('triggered()'), self.findNext)
         toolbar.addAction(self.findbutton)
 
         #add help browser toggle        
-        iconfile = os.path.join(self.cwd, "icons/help-browser.png")
+        iconfile = resource_filename(__name__,"icons/help-browser.png")
         self.helptoggle = QtGui.QAction(QtGui.QIcon(iconfile), 'Show / Hide Help', toolbar)
         self.connect(self.helptoggle, QtCore.SIGNAL('triggered()'), self.toggleHelpBrowser)
         #help hide / show action
         toolbar.addAction(self.helptoggle)
         
     def setupHelpMenu(self):
-        iconfile = os.path.join(self.cwd, 'icons/about.png')
+        iconfile = resource_filename(__name__,'icons/about.png')
         aboutItem = QtGui.QAction(QtGui.QIcon('icons/about.png'), 'About', self)
         self.connect(aboutItem, QtCore.SIGNAL('triggered()'), self.about)
     
     	self.addDockWidget(QtCore.Qt.RightDockWidgetArea, self.helpwindow)
     	
     	helpbrowser = QtGui.QTextBrowser(self.helpwindow)
-    	indexpath = os.path.join(self.cwd, "help", "index.html")
+    	indexpath = resource_filename(__name__,"help/index.html")
     	url = QtCore.QUrl("file://" + indexpath)
     	helpbrowser.setSource(url)
     	helpbrowser.resize(400, self.helpwindow.height())
             if self.fileName != None:
                 progdir = os.path.dirname(str(self.fileName))
             else:
-                progdir = os.path.join(self.cwd, 'examples/')
-            args = ["-u", "run.py", self.tempFile, progdir]
+                progdir = resource_filename(__name__,'examples/')
+            run_py = resource_filename(__name__,"run.py")
+            args = ["-u", run_py, self.tempFile, progdir]
             self.sketchPID = QtCore.QProcess(self)
                               
             self.connect(self.sketchPID, QtCore.SIGNAL('finished(int,QProcess::ExitStatus)'), self._progStopped)
             self.sketchPID.waitForStarted()
             
             self.running = True
-            iconfile = os.path.join(self.cwd, 'icons/Process-stop.png')
+            iconfile = resource_filename(__name__,'icons/Process-stop.png')
             self.playToggle.setIcon(QtGui.QIcon(iconfile))
             self.playToggle.setToolTip("Stop running program")
             self.statusBar().showMessage("Program Running...")
         else:
             self.statusBar().showMessage("Oops! Program Crashed")
         self.running = False
-        iconfile = os.path.join(self.cwd, 'icons/play.png')
+        iconfile = resource_filename(__name__,'icons/play.png')
         self.playToggle.setIcon(QtGui.QIcon(iconfile))
         self.playToggle.setToolTip("Run program")