Ejemplo n.º 1
0
 def build_plugins(self, parent: QWidget, item: MenuItem) -> None:
     if item.label:
         parent = parent.addMenu(item.label)
     subitems = self.api.cmd.get_plugin_menu_items()
     if subitems:
         for subitem in subitems:
             self.build(parent, subitem)
     else:
         action = QAction(parent)
         action.setText("(no plugins found)")
         action.setEnabled(False)
         parent.addAction(action)
Ejemplo n.º 2
0
 def build_recent_files(self, parent: QtWidgets.QWidget,
                        item: MenuItem) -> None:
     if item.label:
         parent = parent.addMenu(item.label)
     recent_files = self.api.cfg.opt.get("recent_files", [])
     if recent_files:
         for recent_file in recent_files:
             action = LoadRecentFileAction(self.api, recent_file, parent)
             parent.addAction(action)
     else:
         action = QtWidgets.QAction(parent)
         action.setText("(no recent files found)")
         action.setEnabled(False)
         parent.addAction(action)
Ejemplo n.º 3
0
 def build_submenu(self, parent: QWidget, item: MenuItem) -> None:
     submenu = parent.addMenu(item.label)
     for subitem in item.children or []:
         self.build(submenu, subitem)
Ejemplo n.º 4
0
 def build_themes(self, parent: QWidget, item: MenuItem) -> None:
     if item.label:
         parent = parent.addMenu(item.label)
     for theme in BaseTheme.__subclasses__():
         action = LoadThemeAction(self.api, theme, parent)
         parent.addAction(action)