Esempio n. 1
0
def main(app=None):
    if app is None: app = initialize()
    try:
        # Set up splash screen
        pixmap = QtGui.QPixmap(get_icon("luminoso_splash.png"))
        splash = QtGui.QSplashScreen(pixmap)
        splash.show()
        splash.raise_()
        app.processEvents()
        # Set up error handling
        QtGui.QErrorMessage.qtHandler()
        sys.excepthook = qt_exception_hook
        
        from luminoso.window import MainWindow
        window = MainWindow()
        window.setup()
        window.show()
        window.activateWindow()
        window.raise_()
        app.setOrganizationName("Common Sense Computing Initiative")
        app.setApplicationName("Luminoso")
        splash.finish(window)
        app.exec_()
    except:
        traceback.print_exc(file=sys._stderr)
Esempio n. 2
0
 def add_action(self, menu, name, func, shortcut=None, toolbar_icon=None):
     """
     Define an action that can be taken using the GUI, and associate it with
     a slot. Add it to a menu, optionally to the toolbar, and optionally
     associate it with a keyboard shortcut.
     """
     if menu not in self.menus:
         self.menus[menu] = self.menuBar().addMenu(menu)
     if toolbar_icon is not None:
         action = QtGui.QAction(QtGui.QIcon(get_icon(toolbar_icon)), name, self)
     else:
         action = QtGui.QAction(name, self)
     self.actions[name] = action
     action.triggered.connect(func)
     self.menus[menu].addAction(action)
     if shortcut is not None:
         action.setShortcut(shortcut)
     if toolbar_icon is not None:
         self.toolbar.addAction(action)
     return action
Esempio n. 3
0
 def add_action(self, menu, name, func, shortcut=None, toolbar_icon=None):
     """
     Define an action that can be taken using the GUI, and associate it with
     a slot. Add it to a menu, optionally to the toolbar, and optionally
     associate it with a keyboard shortcut.
     """
     if menu not in self.menus:
         self.menus[menu] = self.menuBar().addMenu(menu)
     if toolbar_icon is not None:
         action = QtGui.QAction(QtGui.QIcon(get_icon(toolbar_icon)), name,
                                self)
     else:
         action = QtGui.QAction(name, self)
     self.actions[name] = action
     action.triggered.connect(func)
     self.menus[menu].addAction(action)
     if shortcut is not None:
         action.setShortcut(shortcut)
     if toolbar_icon is not None:
         self.toolbar.addAction(action)
     return action