def build_widget(self): cc_options = [(1440, _("Every day")), (60, _("Every hour")), (30, _("Every 30 minutes")), (-1 , _("Manually"))] cc_option_menu = widgetset.OptionMenu([op[1] for op in cc_options]) attach_combo(cc_option_menu, prefs.CHECK_CHANNELS_EVERY_X_MN, [op[0] for op in cc_options]) ad_options = [("new", _("New")), ("all", _("All")), ("off", _("Off"))] ad_option_menu = widgetset.OptionMenu([op[1] for op in ad_options]) attach_combo(ad_option_menu, prefs.CHANNEL_AUTO_DEFAULT, [op[0] for op in ad_options]) max_options = [(0, _("0")), (20, _("20")), (50, _("50")), (100, _("100")), (1000, _("1000"))] max_option_menu = widgetset.OptionMenu([op[1] for op in max_options]) attach_combo(max_option_menu, prefs.MAX_OLD_ITEMS_DEFAULT, [op[0] for op in max_options]) grid = dialogwidgets.ControlGrid() grid.pack(dialogwidgets.heading(_("Default settings for new feeds:")), grid.ALIGN_LEFT, span=2) grid.end_line(spacing=2) grid.pack(dialogwidgets.note( _("(These can be changed using the feed's settings button)")), grid.ALIGN_LEFT, span=2) grid.end_line(spacing=12) grid.pack_label(_("Check for new content:"), dialogwidgets.ControlGrid.ALIGN_RIGHT) grid.pack(cc_option_menu) grid.end_line(spacing=4) grid.pack_label(_("Auto-download setting:"), dialogwidgets.ControlGrid.ALIGN_RIGHT) grid.pack(ad_option_menu) grid.end_line(spacing=4) grid.pack(dialogwidgets.label_with_note( _("Remember this many old items:"), _("(in addition to the current contents)")), dialogwidgets.ControlGrid.ALIGN_RIGHT) grid.pack(max_option_menu) grid.end_line() return grid.make_table()
def build_widget(self): vbox = widgetset.VBox() grid = dialogwidgets.ControlGrid() grid.pack_label(_('Maximum number of manual downloads at a time:')) max_manual = widgetset.TextEntry() max_manual.set_width(5) attach_integer(max_manual, prefs.MAX_MANUAL_DOWNLOADS, create_integer_checker(min=0)) grid.pack(max_manual) grid.end_line(spacing=6) grid.pack_label(_('Maximum number of auto-downloads at a time:')) max_auto = widgetset.TextEntry() max_auto.set_width(5) attach_integer(max_auto, prefs.DOWNLOADS_TARGET, create_integer_checker(min=0)) grid.pack(max_auto) grid.end_line(spacing=12) vbox.pack_start(grid.make_table()) grid = dialogwidgets.ControlGrid() grid.pack(dialogwidgets.heading(_("Bittorrent:")), grid.ALIGN_LEFT, span=3) grid.end_line(spacing=12) cbx = widgetset.Checkbox( _('Limit upstream bandwidth to:')) #avoid internet slowdowns')) limit = widgetset.TextEntry() limit.set_width(5) attach_boolean(cbx, prefs.LIMIT_UPSTREAM, (limit,)) max_kbs = sys.maxint / (2**10) # highest value accepted: sys.maxint # bits per second in kb/s attach_integer(limit, prefs.UPSTREAM_LIMIT_IN_KBS, create_integer_checker(min=0, max=max_kbs)) grid.pack(cbx) grid.pack(limit) grid.pack_label(_("KB/s")) grid.end_line(spacing=6) cbx = widgetset.Checkbox(_('Limit downstream bandwidth to:')) limit = widgetset.TextEntry() limit.set_width(5) attach_boolean(cbx, prefs.LIMIT_DOWNSTREAM_BT, (limit,)) attach_integer(limit, prefs.DOWNSTREAM_BT_LIMIT_IN_KBS, create_integer_checker(min=0, max=max_kbs)) grid.pack(cbx) grid.pack(limit) grid.pack_label(_("KB/s")) grid.end_line(spacing=6) cbx = widgetset.Checkbox(_('Limit torrent connections to:')) limit = widgetset.TextEntry() limit.set_width(5) attach_boolean(cbx, prefs.LIMIT_CONNECTIONS_BT, (limit,)) attach_integer(limit, prefs.CONNECTION_LIMIT_BT_NUM, create_integer_checker(min=0, max=65536)) grid.pack(cbx) grid.pack(limit) grid.end_line(spacing=6) min_port = widgetset.TextEntry() min_port.set_width(5) max_port = widgetset.TextEntry() max_port.set_width(5) attach_integer(min_port, prefs.BT_MIN_PORT, create_integer_checker(min=0, max=65535)) attach_integer(max_port, prefs.BT_MAX_PORT, create_integer_checker(min=0, max=65535)) grid.pack_label(_("Starting port:"), dialogwidgets.ControlGrid.ALIGN_RIGHT) grid.pack(min_port) grid.end_line(spacing=6) grid.pack_label(_("Ending port:"), dialogwidgets.ControlGrid.ALIGN_RIGHT) grid.pack(max_port) grid.end_line(spacing=12) vbox.pack_start(widgetutil.align_left(grid.make_table())) grid = dialogwidgets.ControlGrid() cbx = widgetset.Checkbox(_('Automatically forward ports. (UPNP)')) attach_boolean(cbx, prefs.USE_UPNP) vbox.pack_start(cbx, padding=4) cbx = widgetset.Checkbox(_('Ignore unencrypted connections.')) attach_boolean(cbx, prefs.BT_ENC_REQ) vbox.pack_start(cbx) cbx = widgetset.Checkbox(_('Stop torrent uploads when this ratio is reached:')) limit = widgetset.TextEntry() attach_boolean(cbx, prefs.LIMIT_UPLOAD_RATIO, (limit,)) attach_float(limit, prefs.UPLOAD_RATIO, create_float_checker(0.0, 1.0)) grid.pack(cbx) grid.pack(limit) grid.end_line(spacing=6) vbox.pack_start(widgetutil.align_left(grid.make_table())) return vbox