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
|
yield torrent_id
|
||||||
break
|
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):
|
def tracker_error_filter(torrent_ids, values):
|
||||||
filtered_torrent_ids = []
|
filtered_torrent_ids = []
|
||||||
tm = component.get("TorrentManager")
|
tm = component.get("TorrentManager")
|
||||||
|
@ -108,6 +114,7 @@ class FilterManager(component.Component):
|
||||||
self.torrents = core.torrentmanager
|
self.torrents = core.torrentmanager
|
||||||
self.registered_filters = {}
|
self.registered_filters = {}
|
||||||
self.register_filter("keyword", filter_keywords)
|
self.register_filter("keyword", filter_keywords)
|
||||||
|
self.register_filter("name", filter_by_name)
|
||||||
self.tree_fields = {}
|
self.tree_fields = {}
|
||||||
|
|
||||||
self.register_tree_field("state", self._init_state_tree)
|
self.register_tree_field("state", self._init_state_tree)
|
||||||
|
|
|
@ -383,6 +383,10 @@
|
||||||
<property name="position">0</property>
|
<property name="position">0</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkHBox" id="hbox1">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkToolbar" id="toolbar">
|
<widget class="GtkToolbar" id="toolbar">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
@ -392,6 +396,7 @@
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="sensitive">False</property>
|
<property name="sensitive">False</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
|
<property name="has_tooltip">True</property>
|
||||||
<property name="tooltip" translatable="yes">Add torrent</property>
|
<property name="tooltip" translatable="yes">Add torrent</property>
|
||||||
<property name="use_action_appearance">False</property>
|
<property name="use_action_appearance">False</property>
|
||||||
<property name="label" translatable="yes">Add Torrent</property>
|
<property name="label" translatable="yes">Add Torrent</property>
|
||||||
|
@ -409,6 +414,7 @@
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="sensitive">False</property>
|
<property name="sensitive">False</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
|
<property name="has_tooltip">True</property>
|
||||||
<property name="tooltip" translatable="yes">Remove torrent</property>
|
<property name="tooltip" translatable="yes">Remove torrent</property>
|
||||||
<property name="use_action_appearance">False</property>
|
<property name="use_action_appearance">False</property>
|
||||||
<property name="label" translatable="yes">Remove Torrent</property>
|
<property name="label" translatable="yes">Remove Torrent</property>
|
||||||
|
@ -434,6 +440,7 @@
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="sensitive">False</property>
|
<property name="sensitive">False</property>
|
||||||
<property name="can_focus">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="tooltip" translatable="yes">Pause the selected torrents</property>
|
||||||
<property name="use_action_appearance">False</property>
|
<property name="use_action_appearance">False</property>
|
||||||
<property name="label" translatable="yes">Pause</property>
|
<property name="label" translatable="yes">Pause</property>
|
||||||
|
@ -452,6 +459,7 @@
|
||||||
<property name="sensitive">False</property>
|
<property name="sensitive">False</property>
|
||||||
<property name="can_focus">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="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="tooltip" translatable="yes">Resume the selected torrents</property>
|
||||||
<property name="use_action_appearance">False</property>
|
<property name="use_action_appearance">False</property>
|
||||||
<property name="label" translatable="yes">Resume</property>
|
<property name="label" translatable="yes">Resume</property>
|
||||||
|
@ -478,6 +486,7 @@
|
||||||
<property name="sensitive">False</property>
|
<property name="sensitive">False</property>
|
||||||
<property name="can_focus">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="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="tooltip" translatable="yes">Queue Torrent Up</property>
|
||||||
<property name="use_action_appearance">False</property>
|
<property name="use_action_appearance">False</property>
|
||||||
<property name="label" translatable="yes">Queue Up</property>
|
<property name="label" translatable="yes">Queue Up</property>
|
||||||
|
@ -495,6 +504,7 @@
|
||||||
<property name="sensitive">False</property>
|
<property name="sensitive">False</property>
|
||||||
<property name="can_focus">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="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="tooltip" translatable="yes">Queue Torrent Down</property>
|
||||||
<property name="use_action_appearance">False</property>
|
<property name="use_action_appearance">False</property>
|
||||||
<property name="label" translatable="yes">Queue Down</property>
|
<property name="label" translatable="yes">Queue Down</property>
|
||||||
|
@ -520,6 +530,7 @@
|
||||||
<widget class="GtkToolButton" id="toolbutton_preferences">
|
<widget class="GtkToolButton" id="toolbutton_preferences">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
|
<property name="has_tooltip">True</property>
|
||||||
<property name="tooltip" translatable="yes">Preferences</property>
|
<property name="tooltip" translatable="yes">Preferences</property>
|
||||||
<property name="use_action_appearance">False</property>
|
<property name="use_action_appearance">False</property>
|
||||||
<property name="label" translatable="yes">Preferences</property>
|
<property name="label" translatable="yes">Preferences</property>
|
||||||
|
@ -537,6 +548,7 @@
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">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="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="tooltip" translatable="yes">Connection Manager</property>
|
||||||
<property name="use_action_appearance">False</property>
|
<property name="use_action_appearance">False</property>
|
||||||
<property name="label" translatable="yes">Connection Manager</property>
|
<property name="label" translatable="yes">Connection Manager</property>
|
||||||
|
@ -550,8 +562,39 @@
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
</widget>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">True</property>
|
||||||
<property name="fill">True</property>
|
<property name="fill">True</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkEntry" id="search_torrents_entry">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<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="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">False</property>
|
||||||
<property name="position">1</property>
|
<property name="position">1</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
@ -641,152 +684,6 @@
|
||||||
</widget>
|
</widget>
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
</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">
|
<widget class="GtkDialog" id="move_storage_dialog">
|
||||||
<property name="can_focus">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="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
|
import warnings
|
||||||
from urlparse import urlparse
|
from urlparse import urlparse
|
||||||
|
|
||||||
|
from twisted.internet import reactor
|
||||||
|
|
||||||
import deluge.common
|
import deluge.common
|
||||||
import deluge.component as component
|
import deluge.component as component
|
||||||
from deluge.ui.client import client
|
from deluge.ui.client import client
|
||||||
|
@ -270,6 +272,7 @@ class TorrentView(listview.ListView, component.Component):
|
||||||
|
|
||||||
# Set filter to None for now
|
# Set filter to None for now
|
||||||
self.filter = None
|
self.filter = None
|
||||||
|
self.search_pending = None
|
||||||
|
|
||||||
### Connect Signals ###
|
### Connect Signals ###
|
||||||
# Connect to the 'button-press-event' to know when to bring up the
|
# 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("key-press-event", self.on_key_press_event)
|
||||||
self.treeview.connect("columns-changed", self.on_columns_changed_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("TorrentStateChangedEvent", self.on_torrentstatechanged_event)
|
||||||
client.register_event_handler("TorrentAddedEvent", self.on_torrentadded_event)
|
client.register_event_handler("TorrentAddedEvent", self.on_torrentadded_event)
|
||||||
client.register_event_handler("TorrentRemovedEvent", self.on_torrentremoved_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
|
# We need to clear the liststore
|
||||||
self.liststore.clear()
|
self.liststore.clear()
|
||||||
self.prev_status = {}
|
self.prev_status = {}
|
||||||
|
self.filter = None
|
||||||
|
self.search_torrents_entry.set_text("")
|
||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
"""Called when GtkUi is exiting"""
|
"""Called when GtkUi is exiting"""
|
||||||
|
@ -335,7 +349,10 @@ class TorrentView(listview.ListView, component.Component):
|
||||||
"""Sets filters for the torrentview..
|
"""Sets filters for the torrentview..
|
||||||
see: core.get_torrents_status
|
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.
|
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()
|
self.update()
|
||||||
|
|
||||||
def set_columns_to_update(self, columns=None):
|
def set_columns_to_update(self, columns=None):
|
||||||
|
@ -379,6 +396,9 @@ class TorrentView(listview.ListView, component.Component):
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
if self.got_state:
|
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
|
# Send a status request
|
||||||
gobject.idle_add(self.send_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 = component.get("MenuBar").torrentmenu
|
||||||
torrentmenu.popup(None, None, None, 3, event.time)
|
torrentmenu.popup(None, None, None, 3, event.time)
|
||||||
return True
|
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