Example #1
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)
Example #2
0
    def ask_new_path(self):
        node = choose_node_for_file_operations(self.winfo_toplevel(), "Where to save to?")
        if not node:
            return None

        if node == "local":
            return self.ask_new_local_path()
        else:
            assert node == "remote"
            return self.ask_new_remote_path()
Example #3
0
    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)