Esempio n. 1
0
 def rename(self, old_name, new_name):
     logging.info("action: rename")
     if self.no_main_lines_exist():
         return
     old_path = self.cwd + old_name
     new_path = self.cwd + new_name
     terminal.move(old_path, new_path)
Esempio n. 2
0
    def paste(self):
        logging.info("action: paste")
        if self.path_to_copy == "":
            return
        folder_to_paste_in = self.cwd

        if self.copy_removes_source:
            terminal.move(self.path_to_copy, folder_to_paste_in)
        else:
            terminal.paste(self.path_to_copy, folder_to_paste_in)

        self.main_lines = self.query_pane_content(self.cwd)
        newly_pasted_item = utility.extract_item_name_from_path(
            self.path_to_copy)
        self.main_pane_selected_line_i = self.main_lines.index(
            newly_pasted_item)

        self.path_to_copy = ""
        self.copy_removes_source = False
Esempio n. 3
0
def patch_screen(widget):
    global _last_appearance
    appearance = widget.appearance(os.get_terminal_size())
    zip_func = itertools.zip_longest if len(appearance) > len(_last_appearance) else zip
    changed_lines = (
        str(terminal.move(0, row_index)) + line
        for row_index, (line, old_line) in enumerate(zip_func(appearance, _last_appearance))
        if line != old_line
    )
    print(*changed_lines, sep="", end="", flush=True)
    _last_appearance = appearance
Esempio n. 4
0
def draw_screen(widget):
    appearance = widget.appearance(os.get_terminal_size())
    print(terminal.move(0, 0), *appearance, sep="", end="", flush=True)