Exemple #1
0
 def refresh(self):
     self.screen.erase()
     height = self.get_content_height()
     self.ensure_content_pane_height(height + self.border_off_north +
                                     self.border_off_south)
     BaseInputPane.render_inputs(self, focused=True)
     BaseWindow.refresh(self)
Exemple #2
0
    def __init__(self,
                 parent_mode,
                 title,
                 width_req=0,
                 height_req=0,
                 align=ALIGN.DEFAULT,
                 close_cb=None,
                 encoding=None,
                 base_popup=None,
                 **kwargs):
        """
        Init a new popup.  The default constructor will handle sizing and borders and the like.

        Args:
            parent_mode (basemode subclass): The mode which the popup will be drawn over
            title (str): the title of the popup window
            width_req (int or float): An integer value will be used as the width of the popup in character.
                                      A float value will indicate the requested ratio in relation to the
                                      parents screen width.
            height_req (int or float): An integer value will be used as the height of the popup in character.
                                       A float value will indicate the requested ratio in relation to the
                                       parents screen height.
            align (ALIGN): The alignment controlling the position of the popup on the screen.
            close_cb (func): Function to be called when the popup is closed
            encoding (str): The terminal encoding
            base_popup (Popup): A popup used to inherit width_req and height_req if not explicitly specified.

        Note: The parent mode is responsible for calling refresh on any popups it wants to show.
            This should be called as the last thing in the parents refresh method.

            The parent *must* also call read_input on the popup instead of/in addition to
            running its own read_input code if it wants to have the popup handle user input.

        Popups have two methods that must be implemented:

        refresh(self) - draw the popup window to screen.  this default mode simply draws a bordered window
                        with the supplied title to the screen

        read_input(self) - handle user input to the popup.

        """
        InputKeyHandler.__init__(self)
        self.parent = parent_mode
        self.close_cb = close_cb
        self.height_req = height_req
        self.width_req = width_req
        self.align = align
        if base_popup:
            if not self.width_req:
                self.width_req = base_popup.width_req
            if not self.height_req:
                self.height_req = base_popup.height_req

        hr, wr, posy, posx = self.calculate_size()
        BaseWindow.__init__(self, title, wr, hr, encoding=None)
        self.move_window(posy, posx)
        self._closed = False
    def __init__(self, name, preferences):
        PopupsHandler.__init__(self)
        self.preferences = preferences
        BaseWindow.__init__(self, '%s' % name, self.pane_width, preferences.height, posy=1, posx=self.pane_x_pos)
        BaseInputPane.__init__(self, preferences, border_off_east=1)
        self.name = name

        # have we scrolled down in the list
        self.input_offset = 0
Exemple #4
0
 def __init__(self,
              torrentlist,
              width,
              height,
              title=None,
              allow_resize=False,
              **kwargs):
     BaseWindow.__init__(self, title, width, height, posy=1)
     BaseInputPane.__init__(self, self, immediate_action=True, **kwargs)
     self.parent = torrentlist
     self.focused = False
     self.allow_resize = allow_resize
Exemple #5
0
    def __init__(self, name, preferences):
        PopupsHandler.__init__(self)
        self.preferences = preferences
        BaseWindow.__init__(self,
                            '%s' % name,
                            self.pane_width,
                            preferences.height,
                            posy=1,
                            posx=self.pane_x_pos)
        BaseInputPane.__init__(self, preferences, border_off_east=1)
        self.name = name

        # have we scrolled down in the list
        self.input_offset = 0
Exemple #6
0
 def refresh(self):
     BaseWindow.refresh(self)
     if self.popup:
         self.popup.refresh()
Exemple #7
0
 def refresh(self):
     height = self.get_content_height()
     self.ensure_content_pane_height(height + self.border_off_north +
                                     self.border_off_south)
     BaseInputPane.render_inputs(self, focused=self.has_focus())
     BaseWindow.refresh(self)
Exemple #8
0
 def _refresh(self):
     self.screen.erase()
     height = self.get_content_height()
     self.ensure_content_pane_height(height + self.border_off_north + self.border_off_south)
     BaseInputPane.render_inputs(self, focused=True)
     BaseWindow.refresh(self)
Exemple #9
0
 def refresh(self):
     height = self.get_content_height()
     self.ensure_content_pane_height(height + self.border_off_north + self.border_off_south)
     BaseInputPane.render_inputs(self, focused=self.has_focus())
     BaseWindow.refresh(self)
Exemple #10
0
 def __init__(self, torrentlist, width, height, title=None, allow_resize=False, **kwargs):
     BaseWindow.__init__(self, title, width, height, posy=1)
     BaseInputPane.__init__(self, self, immediate_action=True, **kwargs)
     self.parent = torrentlist
     self.focused = False
     self.allow_resize = allow_resize
 def refresh(self):
     BaseWindow.refresh(self)
     if self.popup:
         self.popup.refresh()