コード例 #1
0
    def __init__(self, default_path=""):
        """
        Open a child dialog of a tkinter application to ask details about
        existing files parsing.

        Args:
            default_path: a default path to be added
        """
        self.app = tkinterDnD.Tk()
        Utils.setStyle(self.app)
        self.app.title("Upload result file")
        self.rvalue = None
        self.default = default_path
        appFrame = ttk.Frame(self.app)
        apiclient = APIClient.getInstance()
        self.form = FormPanel()
        self.form.addFormLabel("Import one file or choose a directory",
                               "",
                               side=tk.TOP)
        self.form.addFormFile("File",
                              ".+",
                              self.default,
                              width=50,
                              side=tk.TOP,
                              mode="file|directory")
        self.form.addFormLabel("Plugins", side=tk.TOP)
        self.form.addFormCombo("Plugin",
                               ["auto-detect"] + apiclient.getPlugins(),
                               "auto-detect",
                               side=tk.TOP)
        self.form.addFormButton("Parse", self.onOk, side=tk.RIGHT)

        self.form.constructView(appFrame)
        appFrame.pack(ipadx=10, ipady=10)

        try:
            self.app.wait_visibility()
            self.app.focus_force()
            self.app.grab_set()
            self.app.lift()
        except tk.TclError:
            pass
        self.app.mainloop()
        self.app.destroy()
コード例 #2
0
    def __init__(self, parent, info="Choose a file", default_path=""):
        """
        Open a child dialog of a tkinter application to ask details about
        existing files parsing.

        Args:
            default_path: a default path to be added
        """
        self.app = tkinterDnD.Tk()
        Utils.setStyle(self.app)
        self.app.title(info)
        self.rvalue = None
        self.default = default_path
        appFrame = ttk.Frame(self.app)
        self.form = FormPanel()
        self.form.addFormLabel("Choose one file", info, side=tk.TOP)
        self.fileForm = self.form.addFormFile("File",
                                              ".+",
                                              '',
                                              width=50,
                                              side=tk.TOP,
                                              mode="file")
        self.button = self.form.addFormButton("Cancel",
                                              self.onError,
                                              side=tk.RIGHT)
        self.form.addFormButton("OK", self.onOk, side=tk.RIGHT)

        self.form.constructView(appFrame)
        appFrame.pack(ipadx=10, ipady=10)

        try:
            self.app.wait_visibility()
            self.app.focus_force()
            self.app.grab_set()
            self.app.lift()
        except tk.TclError:
            pass
        self.app.mainloop()
        self.app.destroy()