コード例 #1
0
ファイル: search_mode.py プロジェクト: zluca/deluge
 def update_cursor(self):
     util.safe_curs_set(util.Curser.VERY_VISIBLE)
     move_cursor(
         self.torrentlist.stdscr,
         self.torrentlist.rows - 1,
         len(self.search_string) + 17,
     )
コード例 #2
0
 def update(self):
     if not component.get('ConsoleUI').is_active_mode(self):
         return
     # Update just the status bars
     self.draw_statusbars(bottom_row=-2, bottombar_help=False)
     move_cursor(self.stdscr, self.rows - 1, min(self.input_cursor, curses.COLS - 1))
     self.stdscr.refresh()
コード例 #3
0
ファイル: cmdline.py プロジェクト: deluge-torrent/deluge
 def update(self):
     if not component.get('ConsoleUI').is_active_mode(self):
         return
     # Update just the status bars
     self.draw_statusbars(bottom_row=-2, bottombar_help=False)
     move_cursor(self.stdscr, self.rows - 1, min(self.input_cursor, curses.COLS - 1))
     self.stdscr.refresh()
コード例 #4
0
    def render_inputs(self, focused=False):
        self._cursor_row = -1
        self._cursor_col = -1
        util.safe_curs_set(util.Curser.INVISIBLE)

        self.ensure_active_visible()

        crow = self.border_off_north
        for i, ipt in enumerate(self.inputs):
            if ipt.depend_skip():
                continue
            col = self.border_off_west
            field_width = self.width - self.border_off_east - self.border_off_west
            cursor_offset = self.border_off_west

            if ipt.default_col != -1:
                default_col = int(ipt.default_col)
                if isinstance(ipt.default_col, ''.__class__) and ipt.default_col[0] in ['+', '-']:
                    col += default_col
                    cursor_offset += default_col
                    field_width -= default_col  # Increase to col must be reflected here
                else:
                    col = default_col
            crow += ipt.render(self.screen, crow, width=field_width, active=i == self.active_input,
                               focused=focused, col=col, cursor_offset=cursor_offset)

        if self._cursor_row >= 0:
            util.safe_curs_set(util.Curser.VERY_VISIBLE)
            move_cursor(self.screen, self._cursor_row, self._cursor_col)
コード例 #5
0
ファイル: cmdline.py プロジェクト: Aniverse/deluge-2
    def refresh(self):
        """
        Refreshes the screen.
        Updates the lines based on the`:attr:lines` based on the `:attr:display_lines_offset`
        attribute and the status bars.
        """
        if not component.get('ConsoleUI').is_active_mode(self):
            return
        self.stdscr.erase()

        # Update the status bars
        self.add_string(0, self.statusbars.topbar)
        self.add_string(self.rows - 2, self.statusbars.bottombar)

        # The number of rows minus the status bars and the input line
        available_lines = self.rows - 3
        # If the amount of lines exceeds the number of rows, we need to figure out
        # which ones to display based on the offset
        if len(self.lines) > available_lines:
            # Get the lines to display based on the offset
            offset = len(self.lines) - self.display_lines_offset
            lines = self.lines[-(available_lines - offset):offset]
        elif len(self.lines) == available_lines:
            lines = self.lines
        else:
            lines = [''] * (available_lines - len(self.lines))
            lines.extend(self.lines)

        # Add the lines to the screen
        for index, line in enumerate(lines):
            self.add_string(index + 1, line)

        # Add the input string
        self.add_string(self.rows - 1, self.input, pad=False, trim=False)

        move_cursor(self.stdscr, self.rows - 1,
                    min(self.input_cursor, curses.COLS - 1))
        self.stdscr.redrawwin()
        self.stdscr.refresh()
コード例 #6
0
ファイル: cmdline.py プロジェクト: deluge-torrent/deluge
    def refresh(self):
        """
        Refreshes the screen.
        Updates the lines based on the`:attr:lines` based on the `:attr:display_lines_offset`
        attribute and the status bars.
        """
        if not component.get('ConsoleUI').is_active_mode(self):
            return
        self.stdscr.erase()

        # Update the status bars
        self.add_string(0, self.statusbars.topbar)
        self.add_string(self.rows - 2, self.statusbars.bottombar)

        # The number of rows minus the status bars and the input line
        available_lines = self.rows - 3
        # If the amount of lines exceeds the number of rows, we need to figure out
        # which ones to display based on the offset
        if len(self.lines) > available_lines:
            # Get the lines to display based on the offset
            offset = len(self.lines) - self.display_lines_offset
            lines = self.lines[-(available_lines - offset):offset]
        elif len(self.lines) == available_lines:
            lines = self.lines
        else:
            lines = [''] * (available_lines - len(self.lines))
            lines.extend(self.lines)

        # Add the lines to the screen
        for index, line in enumerate(lines):
            self.add_string(index + 1, line)

        # Add the input string
        self.add_string(self.rows - 1, self.input, pad=False, trim=False)

        move_cursor(self.stdscr, self.rows - 1, min(self.input_cursor, curses.COLS - 1))
        self.stdscr.redrawwin()
        self.stdscr.refresh()
コード例 #7
0
ファイル: search_mode.py プロジェクト: deluge-torrent/deluge
 def update_cursor(self):
     util.safe_curs_set(util.Curser.VERY_VISIBLE)
     move_cursor(self.torrentlist.stdscr, self.torrentlist.rows - 1, len(self.search_string) + 17)