예제 #1
0
파일: QatMenu.py 프로젝트: ypid/qat_script
    def actionPerformed(self, event):
        command = event.getActionCommand()
        if self.itemType == "dialog":

            #False positives dialog
            if command == self.strings.getString("False_positives..."):
                self.app.falsePositiveDlg.show()

            #Preferences dialog
            elif command == self.strings.getString("Preferences..."):
                self.app.open_preferences("from menu")

            #About dialog
            elif command == self.strings.getString("About..."):
                try:
                    self.app.aboutDlg
                except AttributeError:
                    #build about dialog
                    self.app.aboutDlg = AboutDialog(
                        Main.parent, self.strings.getString("about_title"),
                        True, self.app)
                self.app.aboutDlg.show()

        #Web link of the tool
        elif self.itemType == "link":
            OpenBrowser.displayUrl(self.tool.uri)

        elif self.itemType in ("check", "local file"):
            #Open local GPX file with errors
            if self.itemType == "local file":
                fileNameExtensionFilter = FileNameExtensionFilter(
                    "files GPX (*.gpx)", ["gpx"])
                chooser = DiskAccessAction.createAndOpenFileChooser(
                    True, False, self.strings.getString("Open_a_GPX_file"),
                    fileNameExtensionFilter, JFileChooser.FILES_ONLY, None)
                if chooser is None:
                    return
                filePath = chooser.getSelectedFile()

                #remove former loaded local file
                for i, tool in enumerate(self.app.tools):
                    if filePath.getName() == tool.name:
                        self.app.dlg.toolsCombo.removeItemAt(i)
                        del self.app.tools[i]
                #create a new local file tool
                self.tool = LocalFileTool(self.app, filePath)
                self.view = self.tool.views[0]
                self.check = self.view.checks[0]
                self.app.tools.append(self.tool)
                #add tool to toggle dialog
                self.app.dlg.add_data_to_models(self.tool)

            selection = (self.tool, self.view, self.check)
            self.app.on_selection_changed("menu", selection)
 def aboutPopup(self):
     """Show about dialog
     """
     self.dialog = AboutDialog(self)
     self.dialog.exec_()
예제 #3
0
def open_about_dialog():
    """
    Open About dialog
    :return:None
    """
    AboutDialog()