def __init__(self): Tab.__init__(self) glade_tab = gtk.glade.XML(get_resource("pieces_tab.glade")) self._name = "Pieces" self._child_widget = glade_tab.get_widget("pieces_tab") self._tab_label = glade_tab.get_widget("pieces_tab_label") self._ms = MultiSquare(0,['#000000','#FF0000','#0000FF'], display=self._child_widget.get_display(), menu=glade_tab.get_widget("priority_menu")) self._prios = {} vb = gtk.VBox() vb.add(self._ms) self.cb = gtk.CheckButton(label="Prioritize early pieces") self.cb.connect("toggled",self.onPrioTogg) vb.pack_end(self.cb,expand=False,fill=False,padding=5) vp = gtk.Viewport() vp.set_shadow_type(gtk.SHADOW_NONE) vp.add(vb) self._child_widget.add(vp) self._child_widget.get_parent().show_all() #keep track of the current selected torrent self._current = -1 self._showed_prio_warn = False
def __init__(self): Tab.__init__(self) glade = component.get("MainWindow").get_glade() self._name = "Options" self._child_widget = glade.get_widget("options_tab") self._tab_label = glade.get_widget("options_tab_label") self.spin_max_download = glade.get_widget("spin_max_download") self.spin_max_upload = glade.get_widget("spin_max_upload") self.spin_max_connections = glade.get_widget("spin_max_connections") self.spin_max_upload_slots = glade.get_widget("spin_max_upload_slots") self.chk_private = glade.get_widget("chk_private") self.chk_prioritize_first_last = glade.get_widget("chk_prioritize_first_last") self.chk_auto_managed = glade.get_widget("chk_auto_managed") self.chk_stop_at_ratio = glade.get_widget("chk_stop_at_ratio") self.chk_remove_at_ratio = glade.get_widget("chk_remove_at_ratio") self.spin_stop_ratio = glade.get_widget("spin_stop_ratio") self.chk_move_completed = glade.get_widget("chk_move_completed") self.filechooser_move_completed = glade.get_widget("filechooser_move_completed") self.entry_move_completed = glade.get_widget("entry_move_completed") self.prev_torrent_id = None self.prev_status = None glade.signal_autoconnect({ "on_button_apply_clicked": self._on_button_apply_clicked, "on_button_edit_trackers_clicked": self._on_button_edit_trackers_clicked, "on_chk_move_completed_toggled": self._on_chk_move_completed_toggled, "on_chk_stop_at_ratio_toggled": self._on_chk_stop_at_ratio_toggled })
def __init__(self): Tab.__init__(self) glade_tab = gtk.glade.XML(get_resource("pieces_tab.glade")) self._child_widget = glade_tab.get_widget("pieces_tab") self._tab_label = glade_tab.get_widget("pieces_tab_label") self.multisquare = MultiSquare( num_squares=0, colors=['#000000', '#FF0000', '#0000FF'], display=self._child_widget.get_display(), menu=glade_tab.get_widget("priority_menu") ) vbox = gtk.VBox() vbox.add(self.multisquare) self.checkbutton = gtk.CheckButton(label="Set priority of first un-downloaded piece to High") self.checkbutton.connect("toggled", self.on_priority_trigger) vbox.pack_end(self.checkbutton, expand=False, fill=False, padding=5) viewport = gtk.Viewport() viewport.set_shadow_type(gtk.SHADOW_NONE) viewport.add(vbox) self._child_widget.add(viewport) self._child_widget.get_parent().show_all() #keep track of the current selected torrent self._current = -1 self.showed_priority_warning = False
def __init__(self): Tab.__init__(self) # Get the labels we need to update. # widgetname, modifier function, status keys glade = component.get("MainWindow").main_glade self._name = "Status" self._child_widget = glade.get_object("status_tab") self._tab_label = glade.get_object("status_tab_label") self.label_widgets = [ (glade.get_object("summary_pieces"), fpeer_size_second, ("num_pieces", "piece_length")), (glade.get_object("summary_availability"), fratio, ("distributed_copies",)), (glade.get_object("summary_total_downloaded"), fpeer_sized, ("all_time_download", "total_payload_download")), (glade.get_object("summary_total_uploaded"), fpeer_sized, ("total_uploaded", "total_payload_upload")), (glade.get_object("summary_download_speed"), fspeed, ("download_payload_rate", "max_download_speed")), (glade.get_object("summary_upload_speed"), fspeed, ("upload_payload_rate", "max_upload_speed")), (glade.get_object("summary_seeders"), deluge.common.fpeer, ("num_seeds", "total_seeds")), (glade.get_object("summary_peers"), deluge.common.fpeer, ("num_peers", "total_peers")), (glade.get_object("summary_eta"), deluge.common.ftime, ("eta",)), (glade.get_object("summary_share_ratio"), fratio, ("ratio",)), (glade.get_object("summary_tracker_status"), None, ("tracker_status",)), (glade.get_object("summary_next_announce"), deluge.common.ftime, ("next_announce",)), (glade.get_object("summary_active_time"), deluge.common.ftime, ("active_time",)), (glade.get_object("summary_seed_time"), deluge.common.ftime, ("seeding_time",)), (glade.get_object("summary_seed_rank"), str, ("seed_rank",)), (glade.get_object("summary_auto_managed"), str, ("is_auto_managed",)), (glade.get_object("progressbar"), fpcnt, ("progress",)), (glade.get_object("summary_date_added"), deluge.common.fdate, ("time_added",)) ]
def __init__(self): Tab.__init__(self) glade_tab = gtk.glade.XML(get_resource("pieces_tab.glade")) self._name = "Pieces" self._child_widget = glade_tab.get_widget("pieces_tab") self._tab_label = glade_tab.get_widget("pieces_tab_label") self._ms = MultiSquare(0,['#000000','#FF0000','#0000FF'], display=self._child_widget.get_display(), menu=glade_tab.get_widget("priority_menu")) vb = gtk.VBox() vb.add(self._ms) self.cb = gtk.CheckButton(label="Set priority of first few un-downloaded pieces to High") self.cb.connect("toggled",self.onPrioTogg) vb.pack_end(self.cb,expand=False,fill=False,padding=5) vp = gtk.Viewport() vp.set_shadow_type(gtk.SHADOW_NONE) vp.add(vb) self._child_widget.add(vp) self._child_widget.get_parent().show_all() #keep track of the current selected torrent self._current = -1 self._showed_prio_warn = False
def __init__(self): Tab.__init__(self) builder = component.get("MainWindow").get_builder() self._name = "Options" self._child_widget = builder.get_object("options_tab") self._tab_label = builder.get_object("options_tab_label") self.spin_max_download = builder.get_object("spin_max_download") self.spin_max_upload = builder.get_object("spin_max_upload") self.spin_max_connections = builder.get_object("spin_max_connections") self.spin_max_upload_slots = builder.get_object( "spin_max_upload_slots") self.chk_private = builder.get_object("chk_private") self.chk_prioritize_first_last = builder.get_object( "chk_prioritize_first_last") self.chk_sequential_download = builder.get_object( "chk_sequential_download") self.chk_auto_managed = builder.get_object("chk_auto_managed") self.chk_stop_at_ratio = builder.get_object("chk_stop_at_ratio") self.chk_remove_at_ratio = builder.get_object("chk_remove_at_ratio") self.spin_stop_ratio = builder.get_object("spin_stop_ratio") self.chk_move_completed = builder.get_object("chk_move_completed") self.filechooser_move_completed = builder.get_object( "filechooser_move_completed") self.entry_move_completed = builder.get_object("entry_move_completed") self.chk_shared = builder.get_object("chk_shared") self.button_apply = builder.get_object("button_apply") self.prev_torrent_id = None self.prev_status = None component.get("MainWindow").connect_signals({ "on_button_apply_clicked": self._on_button_apply_clicked, "on_button_edit_trackers_clicked": self._on_button_edit_trackers_clicked, "on_chk_move_completed_toggled": self._on_chk_move_completed_toggled, "on_chk_stop_at_ratio_toggled": self._on_chk_stop_at_ratio_toggled, "on_chk_toggled": self._on_chk_toggled, "on_spin_value_changed": self._on_spin_value_changed, "on_move_completed_file_set": self._on_move_completed_file_set }) self.spin_max_download.connect("key-press-event", self._on_key_press_event) self.spin_max_upload.connect("key-press-event", self._on_key_press_event) self.spin_max_connections.connect("key-press-event", self._on_key_press_event) self.spin_max_upload_slots.connect("key-press-event", self._on_key_press_event) self.spin_stop_ratio.connect("key-press-event", self._on_key_press_event)
def __init__(self, glade): Tab.__init__(self) self._name = 'Graphs' self.glade = glade self.window = self.glade.get_widget('graph_tab') self.notebook = self.glade.get_widget('graph_notebook') self.label = self.glade.get_widget('graph_label') self.bandwidth_graph = self.glade.get_widget('bandwidth_graph') self.bandwidth_graph.connect('expose_event', self.bandwidth_expose) self.window.unparent() self.label.unparent()
def __init__(self): Tab.__init__(self) glade_tab = gtk.glade.XML(get_resource("text_tab.glade")) self._name = "TextTab" self._child_widget = glade_tab.get_widget("text_tab") self._tab_label = glade_tab.get_widget("text_tab_label") self._tab_label_label = glade_tab.get_widget("text_tab_label_label") self.textview = glade_tab.get_widget("text_tab_textview") self.textview.set_editable(False) self.textview.set_cursor_visible(False)
def __init__(self): Tab.__init__(self) builder = component.get("MainWindow").get_builder() self._name = "Options" self._child_widget = builder.get_object("options_tab") self._tab_label = builder.get_object("options_tab_label") self.spin_max_download = builder.get_object("spin_max_download") self.spin_max_upload = builder.get_object("spin_max_upload") self.spin_max_connections = builder.get_object("spin_max_connections") self.spin_max_upload_slots = builder.get_object("spin_max_upload_slots") self.chk_private = builder.get_object("chk_private") self.chk_prioritize_first_last = builder.get_object("chk_prioritize_first_last") self.chk_sequential_download = builder.get_object("chk_sequential_download") self.chk_auto_managed = builder.get_object("chk_auto_managed") self.chk_stop_at_ratio = builder.get_object("chk_stop_at_ratio") self.chk_remove_at_ratio = builder.get_object("chk_remove_at_ratio") self.spin_stop_ratio = builder.get_object("spin_stop_ratio") self.chk_move_completed = builder.get_object("chk_move_completed") self.filechooser_move_completed = builder.get_object("filechooser_move_completed") self.entry_move_completed = builder.get_object("entry_move_completed") self.chk_shared = builder.get_object("chk_shared") self.button_apply = builder.get_object("button_apply") self.prev_torrent_id = None self.prev_status = None component.get("MainWindow").connect_signals( { "on_button_apply_clicked": self._on_button_apply_clicked, "on_button_edit_trackers_clicked": self._on_button_edit_trackers_clicked, "on_chk_move_completed_toggled": self._on_chk_move_completed_toggled, "on_chk_stop_at_ratio_toggled": self._on_chk_stop_at_ratio_toggled, "on_chk_toggled": self._on_chk_toggled, "on_spin_value_changed": self._on_spin_value_changed, "on_move_completed_file_set": self._on_move_completed_file_set, } ) self.spin_max_download.connect("key-press-event", self._on_key_press_event) self.spin_max_upload.connect("key-press-event", self._on_key_press_event) self.spin_max_connections.connect("key-press-event", self._on_key_press_event) self.spin_max_upload_slots.connect("key-press-event", self._on_key_press_event) self.spin_stop_ratio.connect("key-press-event", self._on_key_press_event)
def __init__(self): Tab.__init__(self) # Get the labels we need to update. # widgetname, modifier function, status keys glade = component.get("MainWindow").main_glade self._name = "Status" self._child_widget = glade.get_widget("status_tab") self._tab_label = glade.get_widget("status_tab_label") self.label_widgets = [ (glade.get_widget("summary_pieces"), fpeer_size_second, ("num_pieces", "piece_length")), (glade.get_widget("summary_availability"), fratio, ("distributed_copies", )), (glade.get_widget("summary_total_downloaded"), fpeer_sized, ("all_time_download", "total_payload_download")), (glade.get_widget("summary_total_uploaded"), fpeer_sized, ("total_uploaded", "total_payload_upload")), (glade.get_widget("summary_download_speed"), fspeed, ("download_payload_rate", "max_download_speed")), (glade.get_widget("summary_upload_speed"), fspeed, ("upload_payload_rate", "max_upload_speed")), (glade.get_widget("summary_seeders"), deluge.common.fpeer, ("num_seeds", "total_seeds")), (glade.get_widget("summary_peers"), deluge.common.fpeer, ("num_peers", "total_peers")), (glade.get_widget("summary_eta"), deluge.common.ftime, ("eta", )), (glade.get_widget("summary_share_ratio"), fratio, ("ratio", )), (glade.get_widget("summary_tracker_status"), ftranslate, ("tracker_status", )), (glade.get_widget("summary_next_announce"), deluge.common.ftime, ("next_announce", )), (glade.get_widget("summary_active_time"), deluge.common.ftime, ("active_time", )), (glade.get_widget("summary_seed_time"), deluge.common.ftime, ("seeding_time", )), (glade.get_widget("summary_seed_rank"), str, ("seed_rank", )), (glade.get_widget("summary_auto_managed"), str, ("is_auto_managed", )), (glade.get_widget("progressbar"), fpcnt, ("progress", )), (glade.get_widget("summary_date_added"), deluge.common.fdate, ("time_added", )) ]
def __init__(self): Tab.__init__(self) # Get the labels we need to update. # widgetname, modifier function, status keys glade = component.get("MainWindow").main_glade self._name = "Details" self._child_widget = glade.get_widget("details_tab") self._tab_label = glade.get_widget("details_tab_label") self.label_widgets = [ (glade.get_widget("summary_name"), None, ("name",)), (glade.get_widget("summary_total_size"), fsize, ("total_size",)), (glade.get_widget("summary_num_files"), str, ("num_files",)), (glade.get_widget("summary_tracker"), None, ("tracker",)), (glade.get_widget("summary_torrent_path"), None, ("save_path",)), (glade.get_widget("summary_message"), str, ("message",)), (glade.get_widget("summary_hash"), str, ("hash",)), (glade.get_widget("summary_comments"), str, ("comment",)) ]
def __init__(self): Tab.__init__(self) # Get the labels we need to update. # widgetname, modifier function, status keys glade = component.get("MainWindow").main_glade self._name = "Details" self._child_widget = glade.get_widget("details_tab") self._tab_label = glade.get_widget("details_tab_label") self.label_widgets = [ (glade.get_widget("summary_name"), None, ("name", )), (glade.get_widget("summary_total_size"), fsize, ("total_size", )), (glade.get_widget("summary_num_files"), str, ("num_files", )), (glade.get_widget("summary_tracker"), None, ("tracker", )), (glade.get_widget("summary_torrent_path"), None, ("save_path", )), (glade.get_widget("summary_message"), str, ("message", )), (glade.get_widget("summary_hash"), str, ("hash", )), (glade.get_widget("summary_comments"), str, ("comment", )) ]
def __init__(self): Tab.__init__(self) loader = GladeLoader() self._name = "Magnet" self._child_widget = loader.get_object("magnet_tab") self._tab_label = loader.get_object("magnet_tab_label") vb = gtk.VBox() self.cb = gtk.Label("Magnet link goes here") self.cb.set_line_wrap(True) self.cb.set_line_wrap_mode(True) # Wrap on char vb.pack_end(self.cb, expand=True, fill=True, padding=5) vp = gtk.Viewport() vp.add(vb) self._child_widget.add(vp) self._child_widget.get_parent().show_all() #keep track of the current selected torrent self._current = -1
def __init__(self): Tab.__init__(self) window = component.get("MainWindow") glade = window.get_glade() self._name = "Options" self._child_widget = glade.get_object("options_tab") self._tab_label = glade.get_object("options_tab_label") self.spin_max_download = glade.get_object("spin_max_download") self.spin_max_upload = glade.get_object("spin_max_upload") self.spin_max_connections = glade.get_object("spin_max_connections") self.spin_max_upload_slots = glade.get_object("spin_max_upload_slots") self.chk_private = glade.get_object("chk_private") self.chk_prioritize_first_last = glade.get_object( "chk_prioritize_first_last") self.chk_auto_managed = glade.get_object("chk_auto_managed") self.chk_stop_at_ratio = glade.get_object("chk_stop_at_ratio") self.chk_remove_at_ratio = glade.get_object("chk_remove_at_ratio") self.spin_stop_ratio = glade.get_object("spin_stop_ratio") self.chk_move_completed = glade.get_object("chk_move_completed") self.filechooser_move_completed = glade.get_object( "filechooser_move_completed") self.entry_move_completed = glade.get_object("entry_move_completed") self.prev_torrent_id = None self.prev_status = None window.insert_signals({ "on_button_apply_clicked": self._on_button_apply_clicked, "on_button_edit_trackers_clicked": self._on_button_edit_trackers_clicked, "on_chk_move_completed_toggled": self._on_chk_move_completed_toggled, "on_chk_stop_at_ratio_toggled": self._on_chk_stop_at_ratio_toggled })
def __init__(self, glade, colors): Tab.__init__(self) self.glade = glade self.window = self.glade.get_widget('graph_tab') self.notebook = self.glade.get_widget('graph_notebook') self.label = self.glade.get_widget('graph_label') self._name = 'Graphs' self._child_widget = self.window self._tab_label = self.label self.colors = colors self.bandwidth_graph = self.glade.get_widget('bandwidth_graph') self.bandwidth_graph.connect('expose_event', self.graph_expose) self.connections_graph = self.glade.get_widget('connections_graph') self.connections_graph.connect('expose_event', self.graph_expose) self.seeds_graph = self.glade.get_widget('seeds_graph') self.seeds_graph.connect('expose_event', self.graph_expose) self.notebook.connect('switch-page', self._on_notebook_switch_page) self.selected_interval = 1 #should come from config or similar self.select_bandwidth_graph() self.window.unparent() self.label.unparent() self.intervals = None self.intervals_combo = self.glade.get_widget('combo_intervals') cell = gtk.CellRendererText() self.intervals_combo.pack_start(cell, True) self.intervals_combo.set_cell_data_func(cell, neat_time) self.intervals_combo.connect("changed", self._on_selected_interval_changed) self.update_intervals()
def __init__(self, glade, colors): Tab.__init__(self) self.glade = glade self.window = self.glade.get_widget("graph_tab") self.notebook = self.glade.get_widget("graph_notebook") self.label = self.glade.get_widget("graph_label") self._name = "Graphs" self._child_widget = self.window self._tab_label = self.label self.colors = colors self.bandwidth_graph = self.glade.get_widget("bandwidth_graph") self.bandwidth_graph.connect("expose_event", self.graph_expose) self.connections_graph = self.glade.get_widget("connections_graph") self.connections_graph.connect("expose_event", self.graph_expose) self.seeds_graph = self.glade.get_widget("seeds_graph") self.seeds_graph.connect("expose_event", self.graph_expose) self.notebook.connect("switch-page", self._on_notebook_switch_page) self.selected_interval = 1 # should come from config or similar self.select_bandwidth_graph() self.window.unparent() self.label.unparent() self.intervals = None self.intervals_combo = self.glade.get_widget("combo_intervals") cell = gtk.CellRendererText() self.intervals_combo.pack_start(cell, True) self.intervals_combo.set_cell_data_func(cell, neat_time) self.intervals_combo.connect("changed", self._on_selected_interval_changed) self.update_intervals()
def __init__(self): Tab.__init__(self) builder = component.get("MainWindow").get_builder() self._name = "Files" self._child_widget = builder.get_object("files_tab") self._tab_label = builder.get_object("files_tab_label") self.listview = builder.get_object("files_listview") # filename, size, progress string, progress value, priority, file index, icon id self.treestore = gtk.TreeStore(str, gobject.TYPE_UINT64, str, float, int, int, str) # We need to store the row that's being edited to prevent updating it until # it's been done editing self._editing_index = None # Filename column self.filename_column_name = _("Filename") column = gtk.TreeViewColumn(self.filename_column_name) render = gtk.CellRendererPixbuf() column.pack_start(render, False) column.add_attribute(render, "stock-id", 6) render = gtk.CellRendererText() render.set_property("editable", True) render.connect("edited", self._on_filename_edited) render.connect("editing-started", self._on_filename_editing_start) render.connect("editing-canceled", self._on_filename_editing_canceled) column.pack_start(render, True) column.add_attribute(render, "text", 0) column.set_sort_column_id(0) column.set_clickable(True) column.set_resizable(True) column.set_expand(False) column.set_min_width(200) column.set_reorderable(True) self.listview.append_column(column) # Size column column = gtk.TreeViewColumn(_("Size")) render = gtk.CellRendererText() column.pack_start(render, False) column.set_cell_data_func(render, deluge.ui.gtkui.listview.cell_data_size, 1) column.set_sort_column_id(1) column.set_clickable(True) column.set_resizable(True) column.set_expand(False) column.set_min_width(50) column.set_reorderable(True) self.listview.append_column(column) # Progress column column = gtk.TreeViewColumn(_("Progress")) render = gtk.CellRendererProgress() column.pack_start(render) column.set_cell_data_func(render, cell_progress, (2, 3)) column.set_sort_column_id(3) column.set_clickable(True) column.set_resizable(True) column.set_expand(False) column.set_min_width(100) column.set_reorderable(True) self.listview.append_column(column) # Priority column column = gtk.TreeViewColumn(_("Priority")) render = gtk.CellRendererPixbuf() column.pack_start(render, False) column.set_cell_data_func(render, cell_priority_icon, 4) render = gtk.CellRendererText() column.pack_start(render, False) column.set_cell_data_func(render, cell_priority, 4) column.set_sort_column_id(4) column.set_clickable(True) column.set_resizable(True) column.set_expand(False) column.set_min_width(100) # Bugfix: Last column needs max_width set to stop scrollbar appearing column.set_max_width(200) column.set_reorderable(True) self.listview.append_column(column) self.listview.set_model(self.treestore) self.listview.get_selection().set_mode(gtk.SELECTION_MULTIPLE) self.file_menu = builder.get_object("menu_file_tab") self.file_menu_priority_items = [ builder.get_object("menuitem_donotdownload"), builder.get_object("menuitem_normal"), builder.get_object("menuitem_high"), builder.get_object("menuitem_highest"), builder.get_object("menuitem_priority_sep") ] self.localhost_widgets = [ builder.get_object("menuitem_open_file"), builder.get_object("menuitem3") ] self.listview.connect("row-activated", self._on_row_activated) self.listview.connect("key-press-event", self._on_key_press_event) self.listview.connect("button-press-event", self._on_button_press_event) self.listview.enable_model_drag_source( gtk.gdk.BUTTON1_MASK, [('text/plain', 0, 0)], gtk.gdk.ACTION_DEFAULT | gtk.gdk.ACTION_MOVE) self.listview.enable_model_drag_dest([('text/plain', 0, 0)], gtk.gdk.ACTION_DEFAULT) self.listview.connect("drag_data_get", self._on_drag_data_get_data) self.listview.connect("drag_data_received", self._on_drag_data_received_data) component.get("MainWindow").connect_signals({ "on_menuitem_open_file_activate": self._on_menuitem_open_file_activate, "on_menuitem_donotdownload_activate": self._on_menuitem_donotdownload_activate, "on_menuitem_normal_activate": self._on_menuitem_normal_activate, "on_menuitem_high_activate": self._on_menuitem_high_activate, "on_menuitem_highest_activate": self._on_menuitem_highest_activate, "on_menuitem_expand_all_activate": self._on_menuitem_expand_all_activate }) # Connect to various events from the daemon client.register_event_handler("TorrentFileRenamedEvent", self._on_torrentfilerenamed_event) client.register_event_handler("TorrentFolderRenamedEvent", self._on_torrentfolderrenamed_event) client.register_event_handler("TorrentRemovedEvent", self._on_torrentremoved_event) # Attempt to load state self.load_state() # torrent_id: (filepath, size) self.files_list = {} self.torrent_id = None
def __init__(self): Tab.__init__(self) builder = component.get("MainWindow").get_builder() self._name = "Peers" self._child_widget = builder.get_object("peers_tab") self._tab_label = builder.get_object("peers_tab_label") self.peer_menu = builder.get_object("menu_peer_tab") component.get("MainWindow").connect_signals({ "on_menuitem_add_peer_activate": self._on_menuitem_add_peer_activate, }) self.listview = builder.get_object("peers_listview") self.listview.props.has_tooltip = True self.listview.connect("button-press-event", self._on_button_press_event) self.listview.connect("query-tooltip", self._on_query_tooltip) # country pixbuf, ip, client, downspeed, upspeed, country code, int_ip, seed/peer icon, progress self.liststore = gtk.ListStore(gtk.gdk.Pixbuf, str, str, int, int, str, float, gtk.gdk.Pixbuf, float) self.cached_flag_pixbufs = {} self.seed_pixbuf = gtk.gdk.pixbuf_new_from_file( deluge.common.get_pixmap("seeding16.png")) self.peer_pixbuf = gtk.gdk.pixbuf_new_from_file( deluge.common.get_pixmap("downloading16.png")) # key is ip address, item is row iter self.peers = {} # Country column column = gtk.TreeViewColumn() render = gtk.CellRendererPixbuf() column.pack_start(render, False) column.add_attribute(render, "pixbuf", 0) column.set_sort_column_id(5) column.set_clickable(True) column.set_resizable(True) column.set_expand(False) column.set_min_width(20) column.set_reorderable(True) self.listview.append_column(column) # Address column column = gtk.TreeViewColumn(_("Address")) render = gtk.CellRendererPixbuf() column.pack_start(render, False) column.add_attribute(render, "pixbuf", 7) render = gtk.CellRendererText() column.pack_start(render, False) column.add_attribute(render, "text", 1) column.set_sort_column_id(6) column.set_clickable(True) column.set_resizable(True) column.set_expand(False) column.set_min_width(100) column.set_reorderable(True) self.listview.append_column(column) # Client column column = gtk.TreeViewColumn(_("Client")) render = gtk.CellRendererText() column.pack_start(render, False) column.add_attribute(render, "text", 2) column.set_sort_column_id(2) column.set_clickable(True) column.set_resizable(True) column.set_expand(False) column.set_min_width(100) column.set_reorderable(True) self.listview.append_column(column) # Progress column column = gtk.TreeViewColumn(_("Progress")) render = gtk.CellRendererProgress() column.pack_start(render, True) column.set_cell_data_func(render, cell_data_progress, 8) column.set_sort_column_id(8) column.set_clickable(True) column.set_resizable(True) column.set_expand(False) column.set_min_width(100) column.set_reorderable(True) self.listview.append_column(column) # Down Speed column column = gtk.TreeViewColumn(_("Down Speed")) render = gtk.CellRendererText() column.pack_start(render, False) column.set_cell_data_func(render, cell_data_speed, 3) column.set_sort_column_id(3) column.set_clickable(True) column.set_resizable(True) column.set_expand(False) column.set_min_width(50) column.set_reorderable(True) self.listview.append_column(column) # Up Speed column column = gtk.TreeViewColumn(_("Up Speed")) render = gtk.CellRendererText() column.pack_start(render, False) column.set_cell_data_func(render, cell_data_speed, 4) column.set_sort_column_id(4) column.set_clickable(True) column.set_resizable(True) column.set_expand(False) column.set_min_width(50) # Bugfix: Last column needs max_width set to stop scrollbar appearing column.set_max_width(150) column.set_reorderable(True) self.listview.append_column(column) self.listview.set_model(self.liststore) self.load_state() self.torrent_id = None
def __init__(self): Tab.__init__(self) glade = component.get("MainWindow").get_glade() self._name = "Peers" self._child_widget = glade.get_widget("peers_tab") self._tab_label = glade.get_widget("peers_tab_label") self.peer_menu = glade.get_widget("menu_peer_tab") glade.signal_autoconnect({ "on_menuitem_add_peer_activate": self._on_menuitem_add_peer_activate, }) self.listview = glade.get_widget("peers_listview") self.listview.props.has_tooltip = True self.listview.connect("button-press-event", self._on_button_press_event) self.listview.connect("query-tooltip", self._on_query_tooltip) # country pixbuf, ip, client, downspeed, upspeed, country code, int_ip, seed/peer icon, progress self.liststore = gtk.ListStore(gtk.gdk.Pixbuf, str, str, int, int, str, float, gtk.gdk.Pixbuf, float) self.cached_flag_pixbufs = {} self.seed_pixbuf = gtk.gdk.pixbuf_new_from_file(deluge.common.get_pixmap("seeding16.png")) self.peer_pixbuf = gtk.gdk.pixbuf_new_from_file(deluge.common.get_pixmap("downloading16.png")) # key is ip address, item is row iter self.peers = {} # Country column column = gtk.TreeViewColumn() render = gtk.CellRendererPixbuf() column.pack_start(render, False) column.add_attribute(render, "pixbuf", 0) column.set_sort_column_id(5) column.set_clickable(True) column.set_resizable(True) column.set_expand(False) column.set_min_width(20) column.set_reorderable(True) self.listview.append_column(column) # Address column column = gtk.TreeViewColumn(_("Address")) render = gtk.CellRendererPixbuf() column.pack_start(render, False) column.add_attribute(render, "pixbuf", 7) render = gtk.CellRendererText() column.pack_start(render, False) column.add_attribute(render, "text", 1) column.set_sort_column_id(6) column.set_clickable(True) column.set_resizable(True) column.set_expand(False) column.set_min_width(100) column.set_reorderable(True) self.listview.append_column(column) # Client column column = gtk.TreeViewColumn(_("Client")) render = gtk.CellRendererText() column.pack_start(render, False) column.add_attribute(render, "text", 2) column.set_sort_column_id(2) column.set_clickable(True) column.set_resizable(True) column.set_expand(False) column.set_min_width(100) column.set_reorderable(True) self.listview.append_column(column) # Progress column column = gtk.TreeViewColumn(_("Progress")) render = gtk.CellRendererProgress() column.pack_start(render, True) column.set_cell_data_func(render, cell_data_progress, 8) column.set_sort_column_id(8) column.set_clickable(True) column.set_resizable(True) column.set_expand(False) column.set_min_width(100) column.set_reorderable(True) self.listview.append_column(column) # Down Speed column column = gtk.TreeViewColumn(_("Down Speed")) render = gtk.CellRendererText() column.pack_start(render, False) column.set_cell_data_func(render, cell_data_speed, 3) column.set_sort_column_id(3) column.set_clickable(True) column.set_resizable(True) column.set_expand(False) column.set_min_width(50) column.set_reorderable(True) self.listview.append_column(column) # Up Speed column column = gtk.TreeViewColumn(_("Up Speed")) render = gtk.CellRendererText() column.pack_start(render, False) column.set_cell_data_func(render, cell_data_speed, 4) column.set_sort_column_id(4) column.set_clickable(True) column.set_resizable(True) column.set_expand(False) column.set_min_width(50) # Bugfix: Last column needs max_width set to stop scrollbar appearing column.set_max_width(150) column.set_reorderable(True) self.listview.append_column(column) self.listview.set_model(self.liststore) self.load_state() self.torrent_id = None