Example #1
0
 def _initToolbars(self):
     for ctrl in self.toolbar_ctrls:
         tree = ctrl.item_config.menu_path.split("/")
         if len(tree) == 1:
             continue
         action = InitUtil.getAction(tree, self.ui.menubar, checkable=True)
         action.triggered.connect(lambda checked, c=ctrl: self._toggleToolbar(c))
Example #2
0
 def _getActionManager(self, ctrl, tree):
     if ctrl.item_config.menu_path in self.action_managers:
         action_manager = self.action_managers[ctrl.item_config.menu_path]
     else:
         action_manager = InitUtil.createActionManager(
             tree, self.ui.menubar)
         self.action_managers[ctrl.item_config.menu_path] = action_manager
     return action_manager
Example #3
0
 def _initViewers(self):
     for v_ctrl in self.viewers:
         tree = v_ctrl.viewer_config.menu_path.split("/")
         if len(tree) == 1:
             continue
         action = InitUtil.getAction(tree, self.ui.menubar)
         action.triggered.connect(
             lambda evt, c=v_ctrl: installMissingAndExecute(c.viewer_config.required_pkg, self._openViewer, [c]))
Example #4
0
 def _initTools(self):
     for ctrl in self.tool_ctrls:
         tree = ctrl.item_config.menu_path.split("/")
         if len(tree) == 1:
             continue
         action = InitUtil.getAction(tree, self.ui.menubar, True)
         action.triggered.connect(lambda evt, c=ctrl, a=action: self._toggleTool(c, a))
         if ctrl.item_config.shortcut:
             QShortcut(ctrl.item_config.shortcut, self, lambda: action.trigger if action.isEnabled() else None)
Example #5
0
 def _initActions(self):
     for ctrl in self.action_ctrls:
         tree = ctrl.item_config.menu_path.split("/")
         if len(tree) == 1:
             continue
         action = InitUtil.getAction(tree, self.ui.menubar)
         action.triggered.connect(ctrl.onAction)
         self._subscribeItemSupportCheck(action, ctrl)
         if ctrl.item_config.shortcut:
             QShortcut(ctrl.item_config.shortcut, self, lambda a=action: a.trigger() if action.isEnabled() else None)