r6869 - in bigboard/trunk: . bigboard/stocks/search



Author: hp
Date: 2007-11-02 15:41:44 -0500 (Fri, 02 Nov 2007)
New Revision: 6869

Modified:
   bigboard/trunk/bigboard/stocks/search/SearchStock.py
   bigboard/trunk/main.py
Log:
select first search result by default, so you can just type "fi<Enter>" and launch firefox

Modified: bigboard/trunk/bigboard/stocks/search/SearchStock.py
===================================================================
--- bigboard/trunk/bigboard/stocks/search/SearchStock.py	2007-11-02 20:20:47 UTC (rev 6868)
+++ bigboard/trunk/bigboard/stocks/search/SearchStock.py	2007-11-02 20:41:44 UTC (rev 6869)
@@ -85,6 +85,8 @@
         
         self.__view.append_column(column)
 
+        ## BROWSE means don't let user select nothing (as with SINGLE)
+        self.__view.get_selection().set_mode(gtk.SELECTION_BROWSE)
         self.__view.get_selection().connect('changed', self.__on_selection_changed)
         self.__view.connect('row-activated', self.__on_row_activated)
 
@@ -196,6 +198,7 @@
         return markup
 
     def add_results(self, results):
+        was_empty = not self.__store.get_iter_first()
         for i,r in enumerate(results):
             if i >= self.RESULT_TYPE_MAX:
                 break
@@ -231,6 +234,12 @@
         ## sort headings in alpha order
         self.__store.set_sort_column_id(3, gtk.SORT_ASCENDING)            
 
+        ## if we were empty, select first item
+        if was_empty:
+            iter = self.__store.get_iter_first()
+            if iter:
+                self.__view.get_selection().select_iter(iter)
+
         self.__update_showing()
                     
     def __findobj(self, obj, idx=0):

Modified: bigboard/trunk/main.py
===================================================================
--- bigboard/trunk/main.py	2007-11-02 20:20:47 UTC (rev 6868)
+++ bigboard/trunk/main.py	2007-11-02 20:41:44 UTC (rev 6869)
@@ -877,7 +877,7 @@
     #bigboard.presence.get_presence() # for side effect of creating Presence object
         
     gtk.gdk.threads_enter()
-    _logger.debug("Enter mainloop")    
+    _logger.debug("Enter mainloop")
     gtk.main()
     gtk.gdk.threads_leave()
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]