Changeset 780:1687ac1948d0 in hatta-dev for hatta_qticon.py


Ignore:
Timestamp:
07/16/10 20:18:33 (22 months ago)
Author:
Cezary Krzyżanowski <cezary.krzyzanowski@…>
Branch:
default
Message:

Moved ui and png to resources. Get the png packed. Make dialog find it's icon while debugging and when frozen.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • hatta_qticon.py

    r779 r780  
    3939from error_dialog import ErrorDialog 
    4040 
     41def 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 
    4152def we_are_frozen(): 
    4253    """Returns whether we are frozen via py2exe. 
     
    4455 
    4556    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  
    5857 
    5958class HattaThread(QThread): 
     
    278277        # First setup tray icon and display inform user about starting 
    279278        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 
    281280            self.debug_icon)) 
    282281        self.menu = QMenu(QString(_(u'Hatta Wiki menu'))) 
     
    594593            quote(error_dialog.get_bug_dump())) 
    595594        webbrowser.open(link) 
    596     QApplication.exit() 
     595    #QApplication.exit() 
    597596 
    598597if __name__ == '__main__': 
     
    613612            app = QApplication(sys.argv) 
    614613            QApplication.setQuitOnLastWindowClosed(False) 
    615             error_dialog = ErrorDialog() 
     614            error_dialog = ErrorDialog(module_path()) 
    616615            status_icon = HattaTrayIcon() 
     616            raise AttributeError("DUPA") 
    617617            app.exec_() 
    618618        except Exception as e: 
Note: See TracChangeset for help on using the changeset viewer.