Пример #1
0
    def __init__(self, parent, title, modal, app):
        border = BorderFactory.createEmptyBorder(5, 7, 5, 7)
        self.getContentPane().setBorder(border)
        self.setLayout(BoxLayout(self.getContentPane(), BoxLayout.Y_AXIS))

        #Intro
        falsePositivePng = File.separator.join(
            [app.SCRIPTDIR, "images", "icons", "not_error36.png"])
        introLbl = JMultilineLabel(
            app.strings.getString("manual_false_positives_info"))
        introLbl.setMaxWidth(600)

        #Table
        table = JTable()
        columns = [
            app.strings.getString("Tool"),
            app.strings.getString("Check"),
            app.strings.getString("Error_id"),
            app.strings.getString("OSM_id")
        ]
        self.tableModel = MyTableModel([], columns)
        table.setModel(self.tableModel)
        scrollPane = JScrollPane(table)
        scrollPane.setAlignmentX(0.0)

        #OK button
        btnPanel = JPanel(FlowLayout(FlowLayout.CENTER))
        okBtn = JButton("OK",
                        ImageProvider.get("ok"),
                        actionPerformed=self.on_okBtn_clicked)
        btnPanel.add(okBtn)
        btnPanel.setAlignmentX(0.0)

        #Layout
        headerPnl = JPanel()
        headerPnl.setLayout(BoxLayout(headerPnl, BoxLayout.X_AXIS))
        headerPnl.add(JLabel(ImageIcon(falsePositivePng)))
        headerPnl.add(Box.createRigidArea(Dimension(10, 0)))
        headerPnl.add(introLbl)
        headerPnl.setAlignmentX(0.0)
        self.add(headerPnl)
        self.add(Box.createRigidArea(Dimension(0, 10)))
        self.add(scrollPane)
        self.add(Box.createRigidArea(Dimension(0, 10)))
        self.add(btnPanel)

        self.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE)
        self.pack()
Пример #2
0
    def __init__(self, parent, title, modal, app):
        border = BorderFactory.createEmptyBorder(5, 7, 5, 7)
        self.getContentPane().setBorder(border)
        self.setLayout(BoxLayout(self.getContentPane(), BoxLayout.Y_AXIS))

        #Intro
        falsePositivePng = File.separator.join([app.SCRIPTDIR,
                                                "images",
                                                "icons",
                                                "not_error36.png"])
        introLbl = JMultilineLabel(app.strings.getString("manual_false_positives_info"))
        introLbl.setMaxWidth(600)

        #Table
        table = JTable()
        columns = [app.strings.getString("Tool"),
                   app.strings.getString("Check"),
                   app.strings.getString("Error_id"),
                   app.strings.getString("OSM_id")]
        self.tableModel = MyTableModel([], columns)
        table.setModel(self.tableModel)
        scrollPane = JScrollPane(table)
        scrollPane.setAlignmentX(0.0)

        #OK button
        btnPanel = JPanel(FlowLayout(FlowLayout.CENTER))
        okBtn = JButton("OK",
                        ImageProvider.get("ok"),
                        actionPerformed=self.on_okBtn_clicked)
        btnPanel.add(okBtn)
        btnPanel.setAlignmentX(0.0)

        #Layout
        headerPnl = JPanel()
        headerPnl.setLayout(BoxLayout(headerPnl, BoxLayout.X_AXIS))
        headerPnl.add(JLabel(ImageIcon(falsePositivePng)))
        headerPnl.add(Box.createRigidArea(Dimension(10, 0)))
        headerPnl.add(introLbl)
        headerPnl.setAlignmentX(0.0)
        self.add(headerPnl)
        self.add(Box.createRigidArea(Dimension(0, 10)))
        self.add(scrollPane)
        self.add(Box.createRigidArea(Dimension(0, 10)))
        self.add(btnPanel)

        self.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE)
        self.pack()
Пример #3
0
    def __init__(self, parent, title, modal, app):
        """Restore the tools data by:
           - downloading the tools list
           - downloading the tools jar files
           - extracting the tools data from jar files
        """
        self.app = app
        border = BorderFactory.createEmptyBorder(5, 7, 5, 7)
        mainPane = self.getContentPane()
        mainPane.setLayout(BorderLayout(5, 5))
        mainPane.setBorder(border)
        self.setPreferredSize(Dimension(400, 200))
        self.taskOutput = JMultilineLabel(
            self.app.strings.getString("checking_for_updates"))
        self.taskOutput.setMaxWidth(350)
        self.progressBar = JProgressBar(0, 100, value=0, stringPainted=True)
        self.progressBar.setIndeterminate(True)
        self.cancelBtn = JButton("Cancel",
                                 actionPerformed=self.on_cancelBtn_clicked,
                                 enabled=True)
        self.okBtn = JButton("Ok",
                             actionPerformed=self.on_okBtn_clicked,
                             enabled=False)

        mainPane.add(self.taskOutput, BorderLayout.CENTER)
        bottomPanel = JPanel(BorderLayout(5, 5))
        bottomPanel.add(self.progressBar, BorderLayout.PAGE_START)
        buttonsPanel = JPanel()
        buttonsPanel.add(self.okBtn)
        buttonsPanel.add(self.cancelBtn)
        bottomPanel.add(buttonsPanel, BorderLayout.PAGE_END)
        mainPane.add(bottomPanel, BorderLayout.PAGE_END)
        self.pack()

        self.task = DownloaderTask(self)
        self.task.addPropertyChangeListener(self)
        self.task.execute()
Пример #4
0
    def __init__(self, parent, title, modal, app):
        """Restore the tools data by:
           - downloading the tools list
           - downloading the tools jar files
           - extracting the tools data from jar files
        """
        self.app = app
        border = BorderFactory.createEmptyBorder(5, 7, 5, 7)
        mainPane = self.getContentPane()
        mainPane.setLayout(BorderLayout(5, 5))
        mainPane.setBorder(border)
        self.setPreferredSize(Dimension(400, 200))
        self.taskOutput = JMultilineLabel(self.app.strings.getString("checking_for_updates"))
        self.taskOutput.setMaxWidth(350)
        self.progressBar = JProgressBar(0, 100, value=0, stringPainted=True)
        self.progressBar.setIndeterminate(True)
        self.cancelBtn = JButton("Cancel",
                                 actionPerformed=self.on_cancelBtn_clicked,
                                 enabled=True)
        self.okBtn = JButton("Ok",
                             actionPerformed=self.on_okBtn_clicked,
                             enabled=False)

        mainPane.add(self.taskOutput, BorderLayout.CENTER)
        bottomPanel = JPanel(BorderLayout(5, 5))
        bottomPanel.add(self.progressBar, BorderLayout.PAGE_START)
        buttonsPanel = JPanel()
        buttonsPanel.add(self.okBtn)
        buttonsPanel.add(self.cancelBtn)
        bottomPanel.add(buttonsPanel, BorderLayout.PAGE_END)
        mainPane.add(bottomPanel, BorderLayout.PAGE_END)
        self.pack()

        self.task = DownloaderTask(self)
        self.task.addPropertyChangeListener(self)
        self.task.execute()
Пример #5
0
class ToolsProgressDialog(JDialog, PropertyChangeListener):
    def __init__(self, parent, title, modal, app):
        """Restore the tools data by:
           - downloading the tools list
           - downloading the tools jar files
           - extracting the tools data from jar files
        """
        self.app = app
        border = BorderFactory.createEmptyBorder(5, 7, 5, 7)
        mainPane = self.getContentPane()
        mainPane.setLayout(BorderLayout(5, 5))
        mainPane.setBorder(border)
        self.setPreferredSize(Dimension(400, 200))
        self.taskOutput = JMultilineLabel(
            self.app.strings.getString("checking_for_updates"))
        self.taskOutput.setMaxWidth(350)
        self.progressBar = JProgressBar(0, 100, value=0, stringPainted=True)
        self.progressBar.setIndeterminate(True)
        self.cancelBtn = JButton("Cancel",
                                 actionPerformed=self.on_cancelBtn_clicked,
                                 enabled=True)
        self.okBtn = JButton("Ok",
                             actionPerformed=self.on_okBtn_clicked,
                             enabled=False)

        mainPane.add(self.taskOutput, BorderLayout.CENTER)
        bottomPanel = JPanel(BorderLayout(5, 5))
        bottomPanel.add(self.progressBar, BorderLayout.PAGE_START)
        buttonsPanel = JPanel()
        buttonsPanel.add(self.okBtn)
        buttonsPanel.add(self.cancelBtn)
        bottomPanel.add(buttonsPanel, BorderLayout.PAGE_END)
        mainPane.add(bottomPanel, BorderLayout.PAGE_END)
        self.pack()

        self.task = DownloaderTask(self)
        self.task.addPropertyChangeListener(self)
        self.task.execute()

    def propertyChange(self, e):
        # Invoked when task's progress property changes.
        if e.propertyName == "progress":
            if e.newValue == 2:
                text = self.app.strings.getString("downloading_tools_list")
            elif e.newValue == 3:
                text = self.app.strings.getString(
                    "tools_not_downloaded_warning")
            elif e.newValue == 5:
                text = self.app.strings.getString("downloading_tools_data")
            elif e.newValue == 6:
                text = self.app.strings.getString(
                    "i_cannot_download_the_tool_files")
            elif e.newValue == 7:
                text = self.app.strings.getString("extracting_jar_files")
            elif e.newValue == 8:
                text = self.app.strings.getString("tools_updated")
            self.taskOutput.setText("<html>" + text + "</html>")

    def on_cancelBtn_clicked(self, e):
        self.dispose()
        self.task.cancel(True)

    def on_okBtn_clicked(self, e):
        self.dispose()
Пример #6
0
class ToolsProgressDialog(JDialog, PropertyChangeListener):
    def __init__(self, parent, title, modal, app):
        """Restore the tools data by:
           - downloading the tools list
           - downloading the tools jar files
           - extracting the tools data from jar files
        """
        self.app = app
        border = BorderFactory.createEmptyBorder(5, 7, 5, 7)
        mainPane = self.getContentPane()
        mainPane.setLayout(BorderLayout(5, 5))
        mainPane.setBorder(border)
        self.setPreferredSize(Dimension(400, 200))
        self.taskOutput = JMultilineLabel(self.app.strings.getString("checking_for_updates"))
        self.taskOutput.setMaxWidth(350)
        self.progressBar = JProgressBar(0, 100, value=0, stringPainted=True)
        self.progressBar.setIndeterminate(True)
        self.cancelBtn = JButton("Cancel",
                                 actionPerformed=self.on_cancelBtn_clicked,
                                 enabled=True)
        self.okBtn = JButton("Ok",
                             actionPerformed=self.on_okBtn_clicked,
                             enabled=False)

        mainPane.add(self.taskOutput, BorderLayout.CENTER)
        bottomPanel = JPanel(BorderLayout(5, 5))
        bottomPanel.add(self.progressBar, BorderLayout.PAGE_START)
        buttonsPanel = JPanel()
        buttonsPanel.add(self.okBtn)
        buttonsPanel.add(self.cancelBtn)
        bottomPanel.add(buttonsPanel, BorderLayout.PAGE_END)
        mainPane.add(bottomPanel, BorderLayout.PAGE_END)
        self.pack()

        self.task = DownloaderTask(self)
        self.task.addPropertyChangeListener(self)
        self.task.execute()

    def propertyChange(self, e):
        # Invoked when task's progress property changes.
        if e.propertyName == "progress":
            if e.newValue == 2:
                text = self.app.strings.getString("downloading_tools_list")
            elif e.newValue == 3:
                text = self.app.strings.getString("tools_not_downloaded_warning")
            elif e.newValue == 5:
                text = self.app.strings.getString("downloading_tools_data")
            elif e.newValue == 6:
                text = self.app.strings.getString("i_cannot_download_the_tool_files")
            elif e.newValue == 7:
                text = self.app.strings.getString("extracting_jar_files")
            elif e.newValue == 8:
                text = self.app.strings.getString("tools_updated")
            self.taskOutput.setText("<html>" + text + "</html>")

    def on_cancelBtn_clicked(self, e):
        self.dispose()
        self.task.cancel(True)

    def on_okBtn_clicked(self, e):
        self.dispose()