def finalize(self): BlissWidget.setRunMode(False) # call .stop() for each brick self.hardwareRepository.close() QtGui.QApplication.sendPostedEvents() QtGui.QApplication.processEvents() self.saveSize()
def finalize(self): """Finalize gui load""" BlissWidget.setRunMode(False) # call .stop() for each brick self.hardware_repository.close() QApplication.sendPostedEvents() QApplication.processEvents() self.save_size()
def execute(self, config): """Start in execution mode""" self.splash_screen.set_message("Executing configuration...") self.display() main_window = None if len(self.windows) > 0: main_window = self.windows[0] main_window.configuration = config QApplication.setActiveWindow(main_window) if self.no_border: main_window.move(0, 0) width = QApplication.desktop().width() height = QApplication.desktop().height() main_window.resize(QSize(width, height)) # make connections widgets_dict = dict([(isinstance(w.objectName, \ collections.Callable) and str(w.objectName()) or None, w) \ for w in QApplication.allWidgets()]) def make_connections(items_list): """Creates connections""" for item in items_list: try: sender = widgets_dict[item["name"]] except KeyError: logging.getLogger().error(\ "Could not find receiver widget %s" % \ item["name"]) else: for connection in item["connections"]: _receiver = connection["receiver"] or \ connection["receiverWindow"] try: receiver = widgets_dict[_receiver] except KeyError: logging.getLogger().error("Could not find " + \ "receiver widget %s", _receiver) else: try: slot = getattr(receiver, connection["slot"]) #etattr(sender, connection["signal"]).connect(slot) except AttributeError: logging.getLogger().error(\ "No slot '%s' " % connection["slot"] + \ "in receiver %s" % _receiver) else: getattr(sender, connection["signal"]).connect(slot) #sender.connect(sender, # QtCore.SIGNAL(connection["signal"]), # slot) make_connections(item["children"]) self.splash_screen.set_message("Connecting bricks...") make_connections(config.windows_list) # set run mode for every brick self.splash_screen.set_message("Setting run mode...") BlissWidget.setRunMode(True) if self.show_maximized: main_window.showMaximized() else: main_window.show() for window in self.windows: if window._show: window.show() if BlissWidget._menuBar: BlissWidget._menuBar.set_exp_mode(False) return main_window
def execute(self, config): # # start in execution mode # self.windows = Qt4_GUIDisplay.display(config, noBorder=self.noBorder) main_window = None if len(self.windows) > 0: main_window = self.windows[0] main_window.configuration = config QtGui.QApplication.setActiveWindow(main_window) if self.noBorder: main_window.move(0, 0) w = QtGui.QApplication.desktop().width() h = QtGui.QApplicaitoj.desktop().height() main_window.resize(QtCore.QSize(w,h)) # # make connections # widgets_dict = dict([(callable(w.objectName) and str(w.objectName()) or None, w) for w in QtGui.QApplication.allWidgets()]) def make_connections(items_list): for item in items_list: try: sender = widgets_dict[item["name"]] except KeyError: logging.getLogger().error("Could not find receiver widget %s", item["name"]) else: for connection in item["connections"]: _receiver = connection["receiver"] or connection["receiverWindow"] try: receiver = widgets_dict[_receiver] except KeyError: logging.getLogger().error("Could not find receiver widget %s", _receiver) else: try: slot = getattr(receiver, connection["slot"]) except AttributeError: logging.getLogger().error("No slot '%s' in receiver %s", connection["slot"], _receiver) else: sender.connect(sender, QtCore.SIGNAL(connection["signal"]), slot) make_connections(item["children"]) make_connections(config.windows_list) # # set run mode for every brick # BlissWidget.setRunMode(True) if self.showMaximized: main_window.showMaximized() else: main_window.show() for window in self.windows: """window._fontSizeMinusKey = QtGui.QShortcut(window) window._fontSizeMinusKey.setKey(QtCore.Qt.CTRL + QtCore.Qt.Key_Minus) window._fontSizePlusKey = QtGui.QShortcut(window) window._fontSizePlusKey.setKey(QtCore.Qt.CTRL + QtCore.Qt.Key_Plus) window._fontSizeAsteriskKey = QtGui.QShortcut(window) window._fontSizeAsteriskKey.setKey(QtCore.Qt.CTRL + QtCore.Qt.Key_Asterisk) window._whatsThisKey = QtGui.QShortcut(window) window._whatsThisKey.setKey(QtCore.Qt.Key_F1) window._reloadKey = QtGui.QShortcut(window) window._reloadKey.setKey(QtCore.Qt.CTRL + QtCore.Qt.SHIFT + QtCore.Qt.Key_F5) window._splitterPositionAccel = QtGui.QShortcut(window) for key in [QtCore.Qt.Key_F9, QtCore.Qt.Key_F10, QtCore.Qt.Key_F11, QtCore.Qt.Key_F12] : window._splitterPositionAccel.setKey(QtCore.Qt.SHIFT+key) window._splitterPositionAccel.setKey(QtCore.Qt.CTRL+key) window._splitterPositionAccel.setKey(key) QtCore.QObject.connect(window._splitterPositionAccel, QtCore.SIGNAL('activated()'),self.saveOrReloadSize) QtCore.QObject.connect(window._fontSizeMinusKey, QtCore.SIGNAL('activated()'), self.changeFontSize) QtCore.QObject.connect(window._whatsThisAccel, QtCore.SIGNAL('activated()'), BlissWidget.updateWhatsThis) QtCore.QObject.connect(window._reloadAccel, QtCore.SIGNAL('activated()'), self.reloadGUI)""" if window._show: window.show() if BlissWidget._menuBar: BlissWidget._menuBar.set_exp_mode(False) return main_window
def execute(self, config): # # start in execution mode # self.windows = Qt4_GUIDisplay.display(config, noBorder=self.noBorder) main_window = None if len(self.windows) > 0: main_window = self.windows[0] main_window.configuration = config QtGui.QApplication.setActiveWindow(main_window) if self.noBorder: main_window.move(0, 0) w = QtGui.QApplication.desktop().width() h = QtGui.QApplicaitoj.desktop().height() main_window.resize(QtCore.QSize(w, h)) # # make connections # widgets_dict = dict([ (isinstance(w.objectName, collections.Callable) and str(w.objectName()) or None, w) for w in QtGui.QApplication.allWidgets() ]) def make_connections(items_list): for item in items_list: try: sender = widgets_dict[item["name"]] except KeyError: logging.getLogger().error( "Could not find receiver widget %s", item["name"]) else: for connection in item["connections"]: _receiver = connection["receiver"] or connection[ "receiverWindow"] try: receiver = widgets_dict[_receiver] except KeyError: logging.getLogger().error( "Could not find receiver widget %s", _receiver) else: try: slot = getattr(receiver, connection["slot"]) except AttributeError: logging.getLogger().error( "No slot '%s' in receiver %s", connection["slot"], _receiver) else: sender.connect( sender, QtCore.SIGNAL(connection["signal"]), slot) make_connections(item["children"]) make_connections(config.windows_list) # # set run mode for every brick # BlissWidget.setRunMode(True) if self.showMaximized: main_window.showMaximized() else: main_window.show() for window in self.windows: """window._fontSizeMinusKey = QtGui.QShortcut(window) window._fontSizeMinusKey.setKey(QtCore.Qt.CTRL + QtCore.Qt.Key_Minus) window._fontSizePlusKey = QtGui.QShortcut(window) window._fontSizePlusKey.setKey(QtCore.Qt.CTRL + QtCore.Qt.Key_Plus) window._fontSizeAsteriskKey = QtGui.QShortcut(window) window._fontSizeAsteriskKey.setKey(QtCore.Qt.CTRL + QtCore.Qt.Key_Asterisk) window._whatsThisKey = QtGui.QShortcut(window) window._whatsThisKey.setKey(QtCore.Qt.Key_F1) window._reloadKey = QtGui.QShortcut(window) window._reloadKey.setKey(QtCore.Qt.CTRL + QtCore.Qt.SHIFT + QtCore.Qt.Key_F5) window._splitterPositionAccel = QtGui.QShortcut(window) for key in [QtCore.Qt.Key_F9, QtCore.Qt.Key_F10, QtCore.Qt.Key_F11, QtCore.Qt.Key_F12] : window._splitterPositionAccel.setKey(QtCore.Qt.SHIFT+key) window._splitterPositionAccel.setKey(QtCore.Qt.CTRL+key) window._splitterPositionAccel.setKey(key) QtCore.QObject.connect(window._splitterPositionAccel, QtCore.SIGNAL('activated()'),self.saveOrReloadSize) QtCore.QObject.connect(window._fontSizeMinusKey, QtCore.SIGNAL('activated()'), self.changeFontSize) QtCore.QObject.connect(window._whatsThisAccel, QtCore.SIGNAL('activated()'), BlissWidget.updateWhatsThis) QtCore.QObject.connect(window._reloadAccel, QtCore.SIGNAL('activated()'), self.reloadGUI)""" if window._show: window.show() if BlissWidget._menuBar: BlissWidget._menuBar.set_exp_mode(False) return main_window