def __init__(self, app, menuTitle): JMenu.__init__(self, menuTitle) self.app = app #quat dialog item dialogItem = JCheckBoxMenuItem(self.app.dlg.toggleAction) self.add(dialogItem) self.addSeparator() #tool submenu for tool in self.app.tools: if tool.name == "favourites": self.addSeparator() toolMenu = JMenu(tool.title) toolMenu.setIcon(tool.bigIcon) if tool.uri != "": #Website link iconFile = File.separator.join( [self.app.SCRIPTDIR, "images", "icons", "browser.png"]) urlItem = JMenuItem(tool.title) urlItem.setIcon(ImageIcon(iconFile)) urlItem.addActionListener( QatMenuActionListener(self.app, "link", tool)) toolMenu.add(urlItem) toolMenu.addSeparator() #View submenu for view in tool.views: viewMenu = JMenu(view.title) if tool.name == "favourites": self.app.favouritesMenu = viewMenu #Check item for check in view.checks: self.add_check_item(tool, view, check, viewMenu) toolMenu.add(viewMenu) self.add(toolMenu) #Local file with errors localFileItem = JMenuItem(self.app.strings.getString("Open_GPX")) localFileItem.setIcon(ImageProvider.get("open")) localFileItem.addActionListener( QatMenuActionListener(self.app, "local file")) self.add(localFileItem) self.addSeparator() #False positive dialog falsepositiveItem = JMenuItem( self.app.strings.getString("False_positives...")) falsepositiveItem.addActionListener( QatMenuActionListener(self.app, "dialog")) self.add(falsepositiveItem) #Preferences dialog preferencesItem = JMenuItem( self.app.strings.getString("Preferences...")) preferencesItem.addActionListener( QatMenuActionListener(self.app, "dialog")) self.add(preferencesItem) #About dialog item aboutItem = JMenuItem(self.app.strings.getString("About...")) aboutItem.addActionListener(QatMenuActionListener(self.app, "dialog")) self.add(aboutItem)
def __init__(self, app, menuTitle): JMenu.__init__(self, menuTitle) self.app = app #quat dialog item dialogItem = JCheckBoxMenuItem(self.app.dlg.toggleAction) self.add(dialogItem) self.addSeparator() #tool submenu for tool in self.app.tools: if tool.name == "favourites": self.addSeparator() toolMenu = JMenu(tool.title) toolMenu.setIcon(tool.bigIcon) if tool.uri != "": #Website link iconFile = File.separator.join([self.app.SCRIPTDIR, "images", "icons", "browser.png"]) urlItem = JMenuItem(tool.title) urlItem.setIcon(ImageIcon(iconFile)) urlItem.addActionListener(QatMenuActionListener(self.app, "link", tool)) toolMenu.add(urlItem) toolMenu.addSeparator() #View submenu for view in tool.views: viewMenu = JMenu(view.title) if tool.name == "favourites": self.app.favouritesMenu = viewMenu #Check item for check in view.checks: self.add_check_item(tool, view, check, viewMenu) toolMenu.add(viewMenu) self.add(toolMenu) #Local file with errors localFileItem = JMenuItem(self.app.strings.getString("Open_GPX")) localFileItem.setIcon(ImageProvider.get("open")) localFileItem.addActionListener(QatMenuActionListener(self.app, "local file")) self.add(localFileItem) self.addSeparator() #False positive dialog falsepositiveItem = JMenuItem(self.app.strings.getString("False_positives...")) falsepositiveItem.addActionListener(QatMenuActionListener(self.app, "dialog")) self.add(falsepositiveItem) #Preferences dialog preferencesItem = JMenuItem(self.app.strings.getString("Preferences...")) preferencesItem.addActionListener(QatMenuActionListener(self.app, "dialog")) self.add(preferencesItem) #About dialog item aboutItem = JMenuItem(self.app.strings.getString("About...")) aboutItem.addActionListener(QatMenuActionListener(self.app, "dialog")) self.add(aboutItem)