Changeset 780:1687ac1948d0 in hatta-dev
- Timestamp:
- 07/16/10 20:18:33 (22 months ago)
- Branch:
- default
- Files:
-
- 4 edited
- 2 moved
-
error_dialog.py (modified) (2 diffs)
-
hatta_qticon.py (modified) (5 diffs)
-
resources/HattaError.ui (moved) (moved from HattaError.ui) (1 diff)
-
resources/error.png (moved) (moved from error.png)
-
setup.py (modified) (8 diffs)
-
ui_errorDialog.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
error_dialog.py
r779 r780 9 9 """ 10 10 import sys, os, locale 11 import os.path 11 12 import pprint 12 13 13 from PyQt4.QtGui import QDialog 14 from PyQt4.QtCore import (QString, QThread, pyqtSignal, pyqtSlot, Qt, 15 QPoint, QLocale) 14 from PyQt4.QtGui import QDialog, QPixmap 15 from PyQt4.QtCore import pyqtSlot, Qt 16 16 17 17 from ui_errorDialog import Ui_ErrorDialog … … 27 27 class ErrorDialog(QDialog, Ui_ErrorDialog): 28 28 """ Extends the UI with connectivity. """ 29 def __init__(self ):29 def __init__(self, module_path): 30 30 QDialog.__init__(self) 31 31 self.setupUi(self) 32 dist_icon = os.path.join(module_path, 33 u'share', u'icons', u'hicolor', u'64x64', u'error.png') 34 debug_icon = os.path.join(module_path, u'resources', u'error.png') 35 self.error_icon.setPixmap(QPixmap( 36 dist_icon if os.path.isfile(dist_icon) else debug_icon)) 32 37 33 38 self._caption = None -
hatta_qticon.py
r779 r780 39 39 from error_dialog import ErrorDialog 40 40 41 def module_path(): 42 """ This will get us the program's directory, 43 even if we are frozen using py2exe""" 44 45 if we_are_frozen(): 46 return os.path.dirname(unicode( 47 sys.executable, sys.getfilesystemencoding())) 48 49 return os.path.dirname(unicode(__file__, sys.getfilesystemencoding())) 50 51 41 52 def we_are_frozen(): 42 53 """Returns whether we are frozen via py2exe. … … 44 55 45 56 return hasattr(sys, "frozen") and sys.frozen == "windows_exe" 46 47 48 def module_path():49 """ This will get us the program's directory,50 even if we are frozen using py2exe"""51 52 if we_are_frozen():53 return os.path.dirname(unicode(54 sys.executable, sys.getfilesystemencoding()))55 56 return os.path.dirname(unicode(__file__, sys.getfilesystemencoding()))57 58 57 59 58 class HattaThread(QThread): … … 278 277 # First setup tray icon and display inform user about starting 279 278 self.hatta_icon = QIcon(QPixmap( 280 self.dist_icon if os.path.isfile(self.dist_icon) else 279 self.dist_icon if os.path.isfile(self.dist_icon) else 281 280 self.debug_icon)) 282 281 self.menu = QMenu(QString(_(u'Hatta Wiki menu'))) … … 594 593 quote(error_dialog.get_bug_dump())) 595 594 webbrowser.open(link) 596 QApplication.exit()595 #QApplication.exit() 597 596 598 597 if __name__ == '__main__': … … 613 612 app = QApplication(sys.argv) 614 613 QApplication.setQuitOnLastWindowClosed(False) 615 error_dialog = ErrorDialog( )614 error_dialog = ErrorDialog(module_path()) 616 615 status_icon = HattaTrayIcon() 616 raise AttributeError("DUPA") 617 617 app.exec_() 618 618 except Exception as e: -
resources/HattaError.ui
r779 r780 84 84 <property name="text"> 85 85 <string/> 86 </property>87 <property name="pixmap">88 <pixmap>error.png</pixmap>89 86 </property> 90 87 <property name="scaledContents"> -
setup.py
r765 r780 34 34 ('share/locale/sv/LC_MESSAGES', ['locale/sv/LC_MESSAGES/hatta.mo']), 35 35 ('share/icons/hicolor/scalable', ['resources/hatta.svg']), 36 ('share/icons/hicolor/64x64', ['resources/hatta.png']), 36 ('share/icons/hicolor/64x64', ['resources/hatta.png', 37 'resources/error.png']), 37 38 ('share/applications', ['resources/hatta.desktop']), 38 39 ('share/doc/hatta/examples', [ … … 45 46 requires=['werkzeug (>=0.3)', 'mercurial (>=1.0)', 46 47 'pybonjour (>=1.1.1)'], 47 setup_requires =['pybonjour'],48 setup_requires=['pybonjour'], 48 49 classifiers=[ 49 50 'License :: OSI Approved :: GNU General Public License (GPL)', … … 58 59 'Environment :: Web Environment', 59 60 ], 60 options ={61 options={ 61 62 'py2exe': { 62 'includes': ['sip'],63 'includes': ['sip'], 63 64 'packages': ['werkzeug', 'dbhash', 'encodings', 64 65 'Image', 'pygments'], 65 'excludes': ['_ssl', 'tcl', 'tkinter', 'Tkconstants' 66 ,'Tkinter'],66 'excludes': ['_ssl', 'tcl', 'tkinter', 'Tkconstants', 67 'Tkinter'], 67 68 'dll_excludes': ['tcl84.dll', 'tk84.dll'], 68 69 "compressed": 1, 69 70 "optimize": 2, 70 "bundle_files": 1,71 "bundle_files": 1, 71 72 }, 72 73 'py2app': { … … 121 122 if 'debug' in file: 122 123 print 'removing', file 123 os.remove(os.path.join(root, file))124 os.remove(os.path.join(root, file)) 124 125 125 126 # And run macdeployqt to copy plugins and build a dmg … … 136 137 elif sys.platform == 'win32': 137 138 ### Windows installer ### 138 # Hack to make py2exe import win32com139 # http://www.py2exe.org/index.cgi/WinShell139 # Hack to make py2exe import win32com 140 # http://www.py2exe.org/index.cgi/WinShell 140 141 # ModuleFinder can't handle runtime changes to __path__, but win32com uses them 141 142 import time … … 238 239 from datetime import datetime 239 240 version = version[:-3] + '.' + datetime.now().strftime('%Y%m%d%H%M') 240 241 241 242 # create the Installer, using the files py2exe has created. 242 243 script = InnoScript("hatta", lib_dir, dist_dir, … … 251 252 # Output subdirectory. 252 253 # class BuildInstaller 253 254 config['zipfile'] = None254 255 config['zipfile'] = None 255 256 config['cmdclass'] = {"py2exe": BuildInstaller} 256 257 config['windows'] = [{ 257 'script': 'hatta_qticon.py',258 'script': 'hatta_qticon.py', 258 259 'icon_resources': [(1, "resources/hatta.ico")], 259 260 }] 260 261 261 262 # Adding MS runtime C libraries 262 263 if sys.version.startswith('2.6'): … … 287 288 return 0 288 289 return origIsSystemDLL(pathname) 289 py2exe.build_exe.isSystemDLL = isSystemDLL 290 py2exe.build_exe.isSystemDLL = isSystemDLL 290 291 291 292 else: # Other UNIX-like 292 293 config['scripts'] = ['hatta_qticon.py', 'hatta_gtkicon.py'] 293 294 294 if __name__ =='__main__':295 if __name__ == '__main__': 295 296 setup(**config) 296 297 try: -
ui_errorDialog.py
r779 r780 1 1 # -*- coding: utf-8 -*- 2 2 3 # Form implementation generated from reading ui file ' HattaError.ui'3 # Form implementation generated from reading ui file 'resources/HattaError.ui' 4 4 # 5 # Created: Fri Jul 16 19: 42:0720105 # Created: Fri Jul 16 19:56:19 2010 6 6 # by: PyQt4 UI code generator 4.7.3 7 7 # … … 42 42 self.error_icon.setBaseSize(QtCore.QSize(64, 64)) 43 43 self.error_icon.setText("") 44 self.error_icon.setPixmap(QtGui.QPixmap("error.png"))45 44 self.error_icon.setScaledContents(False) 46 45 self.error_icon.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop) … … 115 114 self.error_traceback.setPlainText(QtGui.QApplication.translate("ErrorDialog", "Traceback here.", None, QtGui.QApplication.UnicodeUTF8)) 116 115 self.details_button.setText(QtGui.QApplication.translate("ErrorDialog", "&Details", None, QtGui.QApplication.UnicodeUTF8)) 117 118 #import icons_rc
Note: See TracChangeset
for help on using the changeset viewer.
