示例#1
0
    def show_shortcut_hints(self, show):
        curr_index = None
        children = self._listbox.get_children()

        if show:
            for index, row in enumerate(children):
                visible = utils.is_visible_on_scroll(
                    self._listbox.get_adjustment(), row)

                if visible:
                    if curr_index is None:
                        curr_index = 0
                    else:
                        curr_index += 1

                    row.get_child().show_shortcut_hint(curr_index + 1)
        else:
            for row in children:
                row.get_child().show_shortcut_hint(None)
示例#2
0
    def get_by_number(self, number):
        result = None
        curr_index = None
        children = self._listbox.get_children()

        for index, row in enumerate(children):
            visible = utils.is_visible_on_scroll(
                self._listbox.get_adjustment(), row)

            if visible:
                if curr_index is None:
                    curr_index = 0
                else:
                    curr_index += 1

            if not curr_index is None and curr_index == number:
                result = row.get_child().item
                break

        return result
示例#3
0
    def show_shortcut_hints(self, show):
        curr_index = None
        children = self._listbox.get_children()

        if show:
            for index, row in enumerate(children):
                visible = utils.is_visible_on_scroll(
                    self._listbox.get_adjustment(),
                    row
                )
                
                if visible:
                    if curr_index is None:
                        curr_index = 0
                    else:
                        curr_index += 1

                    row.get_child().show_shortcut_hint(curr_index + 1)
        else:
            for row in children:
                row.get_child().show_shortcut_hint(None)
示例#4
0
    def show_shortcut_hints(self, show):
        curr_index = -1
        children = self._listbox.get_children()

        if show:
            for index, row in enumerate(children):
                if curr_index >= 8: break
                if row.get_child().item.index == 0: continue

                visible = utils.is_visible_on_scroll(
                    self._listbox.get_adjustment(), row)

                if visible:
                    if curr_index == -1:
                        curr_index = 0
                    else:
                        curr_index += 1

                    row.get_child().show_shortcut_hint(curr_index + 1)
        else:
            for row in children:
                row.get_child().show_shortcut_hint(None)
示例#5
0
    def get_by_number(self, number):
        result = None
        curr_index = None
        children = self._listbox.get_children()

        for index, row in enumerate(children):
            visible = utils.is_visible_on_scroll(
                self._listbox.get_adjustment(),
                row
            )
            
            if visible:
                if curr_index is None:
                    curr_index = 0
                else:
                    curr_index += 1

            if not curr_index is None and curr_index == number:
                result = row.get_child().item
                break

        return result