[sulfur] improve packages search bar experience
This commit is contained in:
BIN
sulfur/gfx/loading_small.gif
Normal file
BIN
sulfur/gfx/loading_small.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
@@ -143,6 +143,9 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin):
|
||||
sys.stderr = self.output
|
||||
sys.stdin = self.input
|
||||
|
||||
# load "loading" pix
|
||||
self._loading_pix_small = gtk.image_new_from_file(const.loading_pix_small)
|
||||
|
||||
self.queue = Queue(self)
|
||||
self.etpbase.connect_queue(self.queue)
|
||||
self.queueView = EntropyQueueView(self.ui.queueView, self.queue)
|
||||
|
||||
@@ -686,15 +686,32 @@ class SulfurApplicationEventsMixin:
|
||||
rc = questionDialog(self.ui.main, msg)
|
||||
if rc: self.abortQueueNow = True
|
||||
|
||||
def on_show_search_hit(self, do_show):
|
||||
if do_show:
|
||||
self.ui.pkgSearch.set_sensitive(False)
|
||||
self.ui.pkgSearchButtonEvent.remove(self.ui.pkgSearchButtonImg)
|
||||
self.ui.pkgSearchButtonEvent.add(self._loading_pix_small)
|
||||
self.ui.pkgSearchButtonEvent.show_all()
|
||||
else:
|
||||
self.ui.pkgSearchButtonEvent.remove(self._loading_pix_small)
|
||||
self.ui.pkgSearchButtonEvent.add(self.ui.pkgSearchButtonImg)
|
||||
self.ui.pkgSearch.show_all()
|
||||
self.ui.pkgSearch.set_sensitive(True)
|
||||
self.ui.main.queue_draw()
|
||||
while gtk.events_pending():
|
||||
gtk.main_iteration()
|
||||
|
||||
def on_search_clicked(self,widget):
|
||||
self.etpbase.set_filter(Filter.processFilters)
|
||||
''' Search entry+button handler'''
|
||||
txt = self.ui.pkgFilter.get_text()
|
||||
flt = Filter.get('KeywordFilter')
|
||||
if txt != '':
|
||||
self.on_show_search_hit(True)
|
||||
flt.activate()
|
||||
lst = txt.split()
|
||||
flt.setKeys(lst)
|
||||
self.on_show_search_hit(False)
|
||||
self.ui.pkgClr.show()
|
||||
else:
|
||||
flt.activate(False)
|
||||
|
||||
@@ -62,6 +62,7 @@ class const:
|
||||
star_empty_pixmap = PIXMAPS_PATH+'/star_empty.png'
|
||||
empty_background = PIXMAPS_PATH+'/empty.png'
|
||||
loading_pix = PIXMAPS_PATH+'/loading.gif'
|
||||
loading_pix_small = PIXMAPS_PATH+'/loading_small.gif'
|
||||
|
||||
# UGC
|
||||
ugc_ok_pix = PIXMAPS_PATH+'/ugc/ok.png'
|
||||
|
||||
@@ -518,14 +518,21 @@
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkButton" id="pkgSearch">
|
||||
<property name="width_request">32</property>
|
||||
<property name="height_request">32</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<signal name="clicked" handler="on_search_clicked"/>
|
||||
<child>
|
||||
<widget class="GtkImage" id="image177">
|
||||
<widget class="GtkEventBox" id="pkgSearchButtonEvent">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-find</property>
|
||||
<child>
|
||||
<widget class="GtkImage" id="pkgSearchButtonImg">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-find</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
Reference in New Issue
Block a user