예제 #1
0
 def __init__(self, torrentlist, config):
     self.config = config
     height = curses.LINES - 2
     width = self.config['torrentview']['sidebar_width']
     Sidebar.__init__(
         self,
         torrentlist,
         width,
         height,
         title=' Filter ',
         border_off_north=1,
         allow_resize=True,
     )
     Component.__init__(self, 'FilterSidebar')
     self.checked_index = 0
     kwargs = {
         'checked_char': '*',
         'unchecked_char': '-',
         'checkbox_format': ' %s ',
         'col': 0,
     }
     self.add_checked_input('All', 'All', checked=True, **kwargs)
     self.add_checked_input('Active', 'Active', **kwargs)
     self.add_checked_input(
         'Downloading', 'Downloading', color='green,black', **kwargs
     )
     self.add_checked_input('Seeding', 'Seeding', color='cyan,black', **kwargs)
     self.add_checked_input('Paused', 'Paused', **kwargs)
     self.add_checked_input('Error', 'Error', color='red,black', **kwargs)
     self.add_checked_input('Checking', 'Checking', color='blue,black', **kwargs)
     self.add_checked_input('Queued', 'Queued', **kwargs)
     self.add_checked_input(
         'Allocating', 'Allocating', color='yellow,black', **kwargs
     )
     self.add_checked_input('Moving', 'Moving', color='green,black', **kwargs)
예제 #2
0
    def __init__(self, icon_dir=None, no_icon=None):
        """
        Initialises a new TrackerIcons object

        :param icon_dir: the (optional) directory of where to store the icons
        :type icon_dir: string
        :param no_icon: the (optional) path name of the icon to show when no icon
                       can be fetched
        :type no_icon: string
        """
        Component.__init__(self, "TrackerIcons")
        if not icon_dir:
            icon_dir = get_config_dir("icons")
        self.dir = icon_dir
        if not os.path.isdir(self.dir):
            os.makedirs(self.dir)

        self.icons = {}
        for icon in os.listdir(self.dir):
            if icon != no_icon:
                host = icon_name_to_host(icon)
                try:
                    self.icons[host] = TrackerIcon(os.path.join(self.dir, icon))
                except KeyError:
                    log.warning("invalid icon %s", icon)
        if no_icon:
            self.icons[None] = TrackerIcon(no_icon)
        else:
            self.icons[None] = None
        self.icons[''] = self.icons[None]

        self.pending = {}
        self.redirects = {}
예제 #3
0
    def __init__(self, icon_dir=None, no_icon=None):
        """
        Initialises a new TrackerIcons object

        :param icon_dir: the (optional) directory of where to store the icons
        :type icon_dir: string
        :param no_icon: the (optional) path name of the icon to show when no icon
                       can be fetched
        :type no_icon: string
        """
        Component.__init__(self, 'TrackerIcons')
        if not icon_dir:
            icon_dir = get_config_dir('icons')
        self.dir = icon_dir
        if not os.path.isdir(self.dir):
            os.makedirs(self.dir)

        self.icons = {}
        for icon in os.listdir(self.dir):
            if icon != no_icon:
                host = icon_name_to_host(icon)
                try:
                    self.icons[host] = TrackerIcon(os.path.join(
                        self.dir, icon))
                except KeyError:
                    log.warning('invalid icon %s', icon)
        if no_icon:
            self.icons[None] = TrackerIcon(no_icon)
        else:
            self.icons[None] = None
        self.icons[''] = self.icons[None]

        self.pending = {}
        self.redirects = {}