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)
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)
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))
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))
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)
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)
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)
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)
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)
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)
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)