Merge branch 'gtkui-search-by-name'
This commit is contained in:
commit
ec74f9aae3
|
@ -78,6 +78,12 @@ def filter_one_keyword(torrent_ids, keyword):
|
|||
yield torrent_id
|
||||
break
|
||||
|
||||
def filter_by_name(torrent_ids, search_string):
|
||||
all_torrents = component.get("TorrentManager").torrents
|
||||
for torrent_id in torrent_ids:
|
||||
if search_string[0].lower() in all_torrents[torrent_id].filename.lower():
|
||||
yield torrent_id
|
||||
|
||||
def tracker_error_filter(torrent_ids, values):
|
||||
filtered_torrent_ids = []
|
||||
tm = component.get("TorrentManager")
|
||||
|
@ -108,6 +114,7 @@ class FilterManager(component.Component):
|
|||
self.torrents = core.torrentmanager
|
||||
self.registered_filters = {}
|
||||
self.register_filter("keyword", filter_keywords)
|
||||
self.register_filter("name", filter_by_name)
|
||||
self.tree_fields = {}
|
||||
|
||||
self.register_tree_field("state", self._init_state_tree)
|
||||
|
|
|
@ -384,174 +384,217 @@
|
|||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkToolbar" id="toolbar">
|
||||
<widget class="GtkHBox" id="hbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<widget class="GtkToolButton" id="toolbutton_add">
|
||||
<widget class="GtkToolbar" id="toolbar">
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="tooltip" translatable="yes">Add torrent</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="label" translatable="yes">Add Torrent</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="stock_id">gtk-add</property>
|
||||
<signal name="clicked" handler="on_toolbutton_add_clicked"/>
|
||||
<child>
|
||||
<widget class="GtkToolButton" id="toolbutton_add">
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="has_tooltip">True</property>
|
||||
<property name="tooltip" translatable="yes">Add torrent</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="label" translatable="yes">Add Torrent</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="stock_id">gtk-add</property>
|
||||
<signal name="clicked" handler="on_toolbutton_add_clicked"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="homogeneous">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkToolButton" id="toolbutton_remove">
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="has_tooltip">True</property>
|
||||
<property name="tooltip" translatable="yes">Remove torrent</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="label" translatable="yes">Remove Torrent</property>
|
||||
<property name="stock_id">gtk-remove</property>
|
||||
<signal name="clicked" handler="on_toolbutton_remove_clicked"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="homogeneous">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkSeparatorToolItem" id="separatortoolitem1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkToolButton" id="toolbutton_pause">
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="has_tooltip">True</property>
|
||||
<property name="tooltip" translatable="yes">Pause the selected torrents</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="label" translatable="yes">Pause</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="stock_id">gtk-media-pause</property>
|
||||
<signal name="clicked" handler="on_toolbutton_pause_clicked"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="homogeneous">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkToolButton" id="toolbutton_resume">
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<property name="has_tooltip">True</property>
|
||||
<property name="tooltip" translatable="yes">Resume the selected torrents</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="label" translatable="yes">Resume</property>
|
||||
<property name="stock_id">gtk-media-play</property>
|
||||
<signal name="clicked" handler="on_toolbutton_resume_clicked"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="homogeneous">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkSeparatorToolItem" id="separatortoolitem2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkToolButton" id="toolbutton_queue_up">
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<property name="has_tooltip">True</property>
|
||||
<property name="tooltip" translatable="yes">Queue Torrent Up</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="label" translatable="yes">Queue Up</property>
|
||||
<property name="stock_id">gtk-go-up</property>
|
||||
<signal name="clicked" handler="on_toolbutton_queue_up_clicked"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="homogeneous">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkToolButton" id="toolbutton_queue_down">
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<property name="has_tooltip">True</property>
|
||||
<property name="tooltip" translatable="yes">Queue Torrent Down</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="label" translatable="yes">Queue Down</property>
|
||||
<property name="stock_id">gtk-go-down</property>
|
||||
<signal name="clicked" handler="on_toolbutton_queue_down_clicked"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="homogeneous">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkSeparatorToolItem" id="toolbutton1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkToolButton" id="toolbutton_preferences">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="has_tooltip">True</property>
|
||||
<property name="tooltip" translatable="yes">Preferences</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="label" translatable="yes">Preferences</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="stock_id">gtk-preferences</property>
|
||||
<signal name="clicked" handler="on_toolbutton_preferences_clicked"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="homogeneous">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkToolButton" id="toolbutton_connectionmanager">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<property name="has_tooltip">True</property>
|
||||
<property name="tooltip" translatable="yes">Connection Manager</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="label" translatable="yes">Connection Manager</property>
|
||||
<property name="stock_id">gtk-network</property>
|
||||
<signal name="clicked" handler="on_toolbutton_connectionmanager_clicked"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="homogeneous">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="homogeneous">True</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkToolButton" id="toolbutton_remove">
|
||||
<widget class="GtkEntry" id="search_torrents_entry">
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="tooltip" translatable="yes">Remove torrent</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="label" translatable="yes">Remove Torrent</property>
|
||||
<property name="stock_id">gtk-remove</property>
|
||||
<signal name="clicked" handler="on_toolbutton_remove_clicked"/>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="tooltip" translatable="yes">Search torrents by name</property>
|
||||
<property name="invisible_char">•</property>
|
||||
<property name="truncate_multiline">True</property>
|
||||
<property name="caps_lock_warning">False</property>
|
||||
<property name="secondary_icon_stock">gtk-clear</property>
|
||||
<property name="primary_icon_activatable">False</property>
|
||||
<property name="secondary_icon_activatable">True</property>
|
||||
<property name="primary_icon_sensitive">False</property>
|
||||
<property name="secondary_icon_sensitive">True</property>
|
||||
<property name="secondary_icon_tooltip_text" translatable="yes">Clear the search</property>
|
||||
<signal name="changed" handler="on_search_torrents_entry_changed"/>
|
||||
<signal name="icon_press" handler="on_search_torrents_entry_icon_press"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="homogeneous">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkSeparatorToolItem" id="separatortoolitem1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkToolButton" id="toolbutton_pause">
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="tooltip" translatable="yes">Pause the selected torrents</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="label" translatable="yes">Pause</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="stock_id">gtk-media-pause</property>
|
||||
<signal name="clicked" handler="on_toolbutton_pause_clicked"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="homogeneous">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkToolButton" id="toolbutton_resume">
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<property name="tooltip" translatable="yes">Resume the selected torrents</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="label" translatable="yes">Resume</property>
|
||||
<property name="stock_id">gtk-media-play</property>
|
||||
<signal name="clicked" handler="on_toolbutton_resume_clicked"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="homogeneous">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkSeparatorToolItem" id="separatortoolitem2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkToolButton" id="toolbutton_queue_up">
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<property name="tooltip" translatable="yes">Queue Torrent Up</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="label" translatable="yes">Queue Up</property>
|
||||
<property name="stock_id">gtk-go-up</property>
|
||||
<signal name="clicked" handler="on_toolbutton_queue_up_clicked"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="homogeneous">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkToolButton" id="toolbutton_queue_down">
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<property name="tooltip" translatable="yes">Queue Torrent Down</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="label" translatable="yes">Queue Down</property>
|
||||
<property name="stock_id">gtk-go-down</property>
|
||||
<signal name="clicked" handler="on_toolbutton_queue_down_clicked"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="homogeneous">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkSeparatorToolItem" id="toolbutton1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkToolButton" id="toolbutton_preferences">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="tooltip" translatable="yes">Preferences</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="label" translatable="yes">Preferences</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="stock_id">gtk-preferences</property>
|
||||
<signal name="clicked" handler="on_toolbutton_preferences_clicked"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="homogeneous">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkToolButton" id="toolbutton_connectionmanager">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<property name="tooltip" translatable="yes">Connection Manager</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="label" translatable="yes">Connection Manager</property>
|
||||
<property name="stock_id">gtk-network</property>
|
||||
<signal name="clicked" handler="on_toolbutton_connectionmanager_clicked"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="homogeneous">True</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="padding">5</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
@ -641,152 +684,6 @@
|
|||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<widget class="GtkMenu" id="menu_file_tab">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<widget class="GtkImageMenuItem" id="menuitem_open_file">
|
||||
<property name="label">gtk-open</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
<signal name="activate" handler="on_menuitem_open_file_activate"/>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkSeparatorMenuItem" id="menuitem3">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkImageMenuItem" id="menuitem_expand_all">
|
||||
<property name="label" translatable="yes">_Expand All</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_stock">False</property>
|
||||
<signal name="activate" handler="on_menuitem_expand_all_activate"/>
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-zoom-fit</property>
|
||||
<property name="icon-size">1</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkSeparatorMenuItem" id="menuitem_priority_sep">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkImageMenuItem" id="menuitem_donotdownload">
|
||||
<property name="label" translatable="yes">_Do Not Download</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_stock">False</property>
|
||||
<signal name="activate" handler="on_menuitem_donotdownload_activate"/>
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-no</property>
|
||||
<property name="icon-size">1</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkImageMenuItem" id="menuitem_normal">
|
||||
<property name="label" translatable="yes">_Normal Priority</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_stock">False</property>
|
||||
<signal name="activate" handler="on_menuitem_normal_activate"/>
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image3">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-yes</property>
|
||||
<property name="icon-size">1</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkImageMenuItem" id="menuitem_high">
|
||||
<property name="label" translatable="yes">_High Priority</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_stock">False</property>
|
||||
<signal name="activate" handler="on_menuitem_high_activate"/>
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image4">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-go-up</property>
|
||||
<property name="icon-size">1</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkImageMenuItem" id="menuitem_highest">
|
||||
<property name="label" translatable="yes">Hi_ghest Priority</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_stock">False</property>
|
||||
<signal name="activate" handler="on_menuitem_highest_activate"/>
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image5">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-goto-top</property>
|
||||
<property name="icon-size">1</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<widget class="GtkMenu" id="menu_peer_tab">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<widget class="GtkImageMenuItem" id="menuitem4">
|
||||
<property name="label" translatable="yes">_Add Peer</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="tooltip" translatable="yes">Add a peer by its IP</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_stock">False</property>
|
||||
<signal name="activate" handler="on_menuitem_add_peer_activate"/>
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-add</property>
|
||||
<property name="icon-size">1</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<widget class="GtkDialog" id="move_storage_dialog">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
|
|
|
@ -46,6 +46,8 @@ import logging
|
|||
import warnings
|
||||
from urlparse import urlparse
|
||||
|
||||
from twisted.internet import reactor
|
||||
|
||||
import deluge.common
|
||||
import deluge.component as component
|
||||
from deluge.ui.client import client
|
||||
|
@ -270,6 +272,7 @@ class TorrentView(listview.ListView, component.Component):
|
|||
|
||||
# Set filter to None for now
|
||||
self.filter = None
|
||||
self.search_pending = None
|
||||
|
||||
### Connect Signals ###
|
||||
# Connect to the 'button-press-event' to know when to bring up the
|
||||
|
@ -287,6 +290,15 @@ class TorrentView(listview.ListView, component.Component):
|
|||
self.treeview.connect("key-press-event", self.on_key_press_event)
|
||||
self.treeview.connect("columns-changed", self.on_columns_changed_event)
|
||||
|
||||
self.search_torrents_entry = self.window.main_glade.get_widget("search_torrents_entry")
|
||||
self.search_torrents_entry.connect(
|
||||
"icon-press", self.on_search_torrents_entry_icon_press
|
||||
)
|
||||
self.search_torrents_entry.connect(
|
||||
"changed", self.on_search_torrents_entry_changed
|
||||
)
|
||||
|
||||
|
||||
client.register_event_handler("TorrentStateChangedEvent", self.on_torrentstatechanged_event)
|
||||
client.register_event_handler("TorrentAddedEvent", self.on_torrentadded_event)
|
||||
client.register_event_handler("TorrentRemovedEvent", self.on_torrentremoved_event)
|
||||
|
@ -319,6 +331,8 @@ class TorrentView(listview.ListView, component.Component):
|
|||
# We need to clear the liststore
|
||||
self.liststore.clear()
|
||||
self.prev_status = {}
|
||||
self.filter = None
|
||||
self.search_torrents_entry.set_text("")
|
||||
|
||||
def shutdown(self):
|
||||
"""Called when GtkUi is exiting"""
|
||||
|
@ -335,7 +349,10 @@ class TorrentView(listview.ListView, component.Component):
|
|||
"""Sets filters for the torrentview..
|
||||
see: core.get_torrents_status
|
||||
"""
|
||||
search_filter = self.filter and self.filter.get('name', None) or None
|
||||
self.filter = dict(filter_dict) #copied version of filter_dict.
|
||||
if search_filter and 'name' not in filter_dict:
|
||||
self.filter['name'] = search_filter
|
||||
self.update()
|
||||
|
||||
def set_columns_to_update(self, columns=None):
|
||||
|
@ -379,6 +396,9 @@ class TorrentView(listview.ListView, component.Component):
|
|||
|
||||
def update(self):
|
||||
if self.got_state:
|
||||
if self.search_pending is not None and self.search_pending.active():
|
||||
# An update request is scheduled, let's wait for that one
|
||||
return
|
||||
# Send a status request
|
||||
gobject.idle_add(self.send_status_request)
|
||||
|
||||
|
@ -600,3 +620,33 @@ class TorrentView(listview.ListView, component.Component):
|
|||
torrentmenu = component.get("MenuBar").torrentmenu
|
||||
torrentmenu.popup(None, None, None, 3, event.time)
|
||||
return True
|
||||
|
||||
def on_search_torrents_entry_icon_press(self, entry, icon, event):
|
||||
if icon != gtk.ENTRY_ICON_SECONDARY:
|
||||
return
|
||||
|
||||
if self.search_pending and self.search_pending.active():
|
||||
self.search_pending.cancel()
|
||||
|
||||
entry.set_text("")
|
||||
if self.filter and 'name' in self.filter:
|
||||
self.filter.pop('name', None)
|
||||
self.search_pending = reactor.callLater(0.7, self.update)
|
||||
|
||||
def on_search_torrents_entry_changed(self, widget):
|
||||
search_string = widget.get_text().lower()
|
||||
|
||||
if self.search_pending and self.search_pending.active():
|
||||
self.search_pending.cancel()
|
||||
|
||||
if not search_string:
|
||||
if self.filter and 'name' in self.filter:
|
||||
self.filter.pop('name', None)
|
||||
self.search_pending = reactor.callLater(0.7, self.update)
|
||||
return
|
||||
|
||||
if self.filter is None:
|
||||
self.filter = {}
|
||||
|
||||
self.filter['name'] = search_string
|
||||
self.search_pending = reactor.callLater(0.7, self.update)
|
||||
|
|
Loading…
Reference in New Issue