def on_key_press_event(self, *args):

        keyval, keycode, state = get_key_press_event_args(*args)
        self.select_transfers()

        keycodes, mods = parse_accelerator("t")

        if keycode in keycodes:
            self.abort_transfers()
            return True

        keycodes, mods = parse_accelerator("r")

        if keycode in keycodes:
            self.retry_transfers()
            return True

        keycodes, mods = parse_accelerator("<Primary>c")

        if state & mods and keycode in keycodes:
            self.on_copy_file_path()
            return True

        keycodes, mods = parse_accelerator("Delete")

        if keycode in keycodes:
            self.abort_transfers(clear=True)
            return True

        # No key match, continue event
        return False
Beispiel #2
0
    def on_key_press_event(self, *args):

        keyval, keycode, state = get_key_press_event_args(*args)
        keycodes, mods = parse_accelerator("<Primary>f")

        if state & mods and keycode in keycodes:
            self.show_search_bar()
            return True

        return False
    def on_key_press_event(self, is_file, *args):

        keyval, keycode, state = get_key_press_event_args(*args)
        self.select_files()

        keycodes, mods = parse_accelerator("<Primary>c")

        if state & mods and keycode in keycodes:
            self.copy_selected_path(is_file=is_file)
        else:
            # No key match, continue event
            return False

        return True
Beispiel #4
0
    def on_key_press_event(self, *args):

        keyval, keycode, state = get_key_press_event_args(*args)
        keycodes_w, mods = parse_accelerator("<Primary>w")
        keycodes_f4, mods = parse_accelerator("<Primary>F4")

        if state & mods and (keycode in keycodes_w or keycode in keycodes_f4):
            # Ctrl+W and Ctrl+F4: close current tab

            page = self.get_nth_page(self.get_current_page())
            tab_label, menu_label = self.get_labels(page)
            tab_label.onclose(None)
            return True

        return False
Beispiel #5
0
    def on_key_press_event(self, *args):

        keyval, keycode, state = get_key_press_event_args(*args)
        keycodes, mods = parse_accelerator("Tab")

        if keycode not in keycodes:
            return False

        if not config.sections["words"]["tab"]:
            return False

        # "Hello there Miss<tab> how are you doing"
        # "0  3  6  9  12 15      18 21 24 27 30 33
        #   1  4  7  10 13      16 19 22 25 28 31
        #    2  5  8  11 14      17 20 23 26 29 32
        #
        # ix = 16
        # text = Miss
        # preix = 12
        ix = self.entry.get_position()
        text = self.entry.get_text()[:ix].split(" ")[-1]
        preix = ix - len(text)

        if not config.sections["words"]["cycle"]:
            completion, single = self.get_completion(text, self.completion_list)
            if completion:
                if single and ix == len(text) and text[:1] != "/":
                    completion += ": "
                self.entry.delete_text(preix, ix)
                self.entry.insert_text(completion, preix)
                self.entry.set_position(preix + len(completion))

            return True

        if not self.midwaycompletion:
            self.completions['completions'] = self.get_completions(text, self.completion_list)

            if self.completions['completions']:
                self.midwaycompletion = True
                self.completions['currentindex'] = -1
                currentnick = text
        else:
            currentnick = self.completions['completions'][self.completions['currentindex']]

        if self.midwaycompletion:
            # We're still completing, block handler to avoid modifying midwaycompletion value
            with self.entry.handler_block(self.entry_changed_handler):
                self.entry.delete_text(ix - len(currentnick), ix)
                direction = 1  # Forward cycle

                if state & Gdk.ModifierType.SHIFT_MASK:
                    direction = -1  # Backward cycle

                self.completions['currentindex'] = ((self.completions['currentindex'] + direction) %
                                                    len(self.completions['completions']))

                newnick = self.completions['completions'][self.completions['currentindex']]
                self.entry.insert_text(newnick, preix)
                self.entry.set_position(preix + len(newnick))

        return True