def initHomingMenu(self): if hasattr(self, 'menuHoming'): # remove any actions that were added in QtDesigner for menu_action in self.menuHoming.actions(): self.menuHoming.removeAction(menu_action) # Register the submenu with the action (so it will be disabled # if the actions are not valid), but don't connect it to method # home_action = action.Home(widget=self.menuHoming, method=None) # FIXME: # home_action = actions.bindWidget(self.menuHoming, 'machine.home.all.ok') menu_action = QAction(self) menu_action.setText("Home &All") actions.bindWidget(menu_action, 'machine.home.all') self.menuHoming.addAction(menu_action) # add homing actions for each axis for aletter in INFO.AXIS_LETTER_LIST: menu_action = QAction(self) menu_action.setText("Home &{}".format(aletter.upper())) actions.bindWidget(menu_action, 'machine.home.axis:{}'.format(aletter)) self.menuHoming.addAction(menu_action)
def actionName(self, action_name): """Sets the name of the action the checkbox should trigger. Args: action_name (str) : A fully qualified action name. """ self._action_name = action_name bindWidget(self, action_name)
def actionName(self, action_name): """Sets the name of the action the button should trigger and binds the widget to that action. Args: action_name (str) : A fully qualified action name. """ self._action_name = action_name bindWidget(self, action_name)
def initUi(self): STATUS.init_ui.emit() self.loadSplashGcode() self.initRecentFileMenu() self.initHomingMenu() s = time.time() menus = self.findChildren(QMenu) for menu in menus: menu_actions = menu.actions() for menu_action in menu_actions: if menu_action.isSeparator(): continue action_name = menu_action.property('actionName') if action_name: actions.bindWidget(menu_action, action_name) print "action time ", time.time() - s
def __init__(self, *args, **kwargs): super(MainWindow, self).__init__(*args, **kwargs) self.loadUi(UI_FILE) self.initUi() self.loadStylesheet(STYLESHEET) self.setWindowTitle("Brender VCP") #========================================================================== # Add/Override methods and slots below to customize the main window #========================================================================== actions.bindWidget(self.flood, action='coolant.flood.toggle') actions.bindWidget(self.floodCheckBox, action="coolant.flood.toggle") if actions.program.run.ok(): actions.program.run() else: print "RUN NOT OK: ", actions.program.run.ok.msg