def _add_recent_files_to_menu(self): if not self.recent_files: action = ActionInfo('File', 'No recent files') action.set_menu_position(before='Exit') self.register_action(action) else: for n, path in enumerate(self.recent_files): self._add_file_to_menu(path, n) sep = SeparatorInfo('File') sep.set_menu_position(before='Exit') self.register_action(sep)
def _create_menu(self, configs): self.unregister_actions() self.register_action(ActionInfo('Macros', 'Manage Run Configurations', self.OnManageConfigurations)) self.register_action(SeparatorInfo('Macros')) for index, cfg in enumerate(configs): self._add_config_to_menu(cfg, index+1)
def add_main_menu(self): self.unregister_actions() for menuItem in self.menu: if menuItem['name'] is None: self.register_action(SeparatorInfo(self.MENU_NAME)) else: action_info = ActionInfo(self.MENU_NAME, name=menuItem['name'], action=self.create_callable(menuItem['name'], menuItem['action'])) self.register_action(action_info)