예제 #1
0
 def _browse(self):
     path = ui_utils.askopenfilename(filetypes=[("bin-files",
                                                 ".bin"), ("all files",
                                                           ".*")])
     if path:
         self._firmware_entry.delete(0, "end")
         self._firmware_entry.insert(0, path)
예제 #2
0
    def _cmd_open_file(self):
        node = choose_node_for_file_operations(self.winfo_toplevel(),
                                               "Where to open from?")
        if not node:
            return

        if node == "local":
            initialdir = get_workbench().get_local_cwd()
            if (self.get_current_editor() is not None
                    and self.get_current_editor().get_filename() is not None):
                initialdir = os.path.dirname(
                    self.get_current_editor().get_filename())
            path = askopenfilename(filetypes=_dialog_filetypes,
                                   initialdir=initialdir,
                                   parent=get_workbench())
        else:
            assert node == "remote"
            target_path = ask_backend_path(self.winfo_toplevel(), "open")
            if not target_path:
                return

            path = make_remote_path(target_path)

        if path:
            # self.close_single_untitled_unmodified_editor()
            self.show_file(path, propose_dialog=False)
예제 #3
0
 def _select_file(self):
     result = askopenfilename (
         filetypes = [('UF2 files', '.uf2')], 
         initialdir = get_workbench().get_option("run.working_directory")
     )
     
     if result:
         self._path_var.set(os.path.normpath(result))
예제 #4
0
    def _select_file(self):
        result = askopenfilename(
            filetypes=[("UF2 files", ".uf2")],
            initialdir=get_workbench().get_option("run.working_directory"),
            parent=self.winfo_toplevel(),
        )

        if result:
            self._path_var.set(os.path.normpath(result))
예제 #5
0
    def _handle_install_requirements_click(self, event):
        if self._get_state() != "idle":
            return

        filename = askopenfilename(
            master=self,
            filetypes=[("requirements", ".txt"), (_("all files"), ".*")],
            initialdir=get_workbench().get_local_cwd,
        )
        if filename:  # Note that missing filename may be "" or () depending on tkinter version
            self._install_local_file(filename, True)
예제 #6
0
    def _handle_install_file_click(self, event):
        if self._get_state() != "idle":
            return

        filename = askopenfilename(
            master=self,
            filetypes=[(_("Package"), ".whl .zip .tar.gz"), (_("all files"), ".*")],
            initialdir=get_workbench().get_local_cwd,
        )
        if filename:  # Note that missing filename may be "" or () depending on tkinter version
            self._install_local_file(filename, False)
예제 #7
0
파일: code.py 프로젝트: vinniec/thonny
 def _cmd_open_file(self):
     filename = askopenfilename(
         master=get_workbench(),
         filetypes=_dialog_filetypes,
         initialdir=get_workbench().get_cwd(),
     )
     if (
             filename
     ):  # Note that missing filename may be "" or () depending on tkinter version
         # self.close_single_untitled_unmodified_editor()
         self.show_file(filename)
예제 #8
0
    def _select_executable(self):
        # TODO: get dir of current interpreter
        options = {"master": self}
        if running_on_windows():
            options["filetypes"] = [("Python interpreters", "python.exe"),
                                    ("all files", ".*")]

        filename = askopenfilename(**options)

        if filename:
            self._configuration_variable.set(filename)
예제 #9
0
    def _browse(self):
        initialdir = os.path.normpath(os.path.expanduser("~/Downloads"))
        if not os.path.isdir(initialdir):
            initialdir = None

        path = ui_utils.askopenfilename(
            filetypes=[("bin-files", ".bin"), ("all files", ".*")],
            parent=self.winfo_toplevel(),
            initialdir=initialdir,
        )
        if path:
            self._firmware_entry.delete(0, "end")
            self._firmware_entry.insert(0, path)
예제 #10
0
파일: __init__.py 프로젝트: sjhudek/thonny
    def _select_executable(self):
        # TODO: get dir of current interpreter
        options = {"parent": self.winfo_toplevel()}
        if running_on_windows():
            options["filetypes"] = [
                (tr("Python interpreters"), "python.exe"),
                (tr("all files"), ".*"),
            ]

        filename = askopenfilename(**options)
        if filename.endswith("/activate"):
            filename = filename[:-len("activate")] + "python3"

        if filename:
            self._configuration_variable.set(filename)
예제 #11
0
파일: code.py 프로젝트: c18gour/thonny
    def _cmd_open_file(self):
        node = choose_node_for_file_operations(self.winfo_toplevel(),
                                               "Where to open from?")
        if not node:
            return None

        if node == "local":
            path = askopenfilename(filetypes=_dialog_filetypes,
                                   initialdir=get_workbench().get_local_cwd())
        else:
            assert node == "remote"
            target_path = ask_backend_path(self.winfo_toplevel(), "open")
            if not target_path:
                return None

            path = make_remote_path(target_path)

        if path:
            # self.close_single_untitled_unmodified_editor()
            self.show_file(path)