Commits

Vladimir Kolev committed eed6bb3

Added completition capabilities in the search entry
and fixed some pep8 problems

  • Participants
  • Parent commits 592785a

Comments (0)

Files changed (3)

data/gsharkdown.ini

 show_stat_icon = 0
 repeat_playlist = 1
 shuffle_playlist = 1
+completition = Roni Size|Eminem|Madonna|Skillet|DMX|Dr. Dre|Ceca|Ceca Velickovic|Syrenia|Within temptation|

data/main_window.ui

             <child>
               <object class="GtkToolButton" id="toolbutton3">
                 <property name="visible">True</property>
-                <property name="tooltip_text" translatable="yes">Play selected</property>
-                <property name="label" translatable="yes">Play</property>
+                <property name="tooltip_text" translatable="yes">Play/Stop</property>
+                <property name="label" translatable="yes">Play/Stop</property>
                 <property name="use_underline">True</property>
                 <property name="icon_name">media-playback-start</property>
                 <signal name="clicked" handler="play_selected"/>
         shuffle_button.set_active(int(CONFIG['shuffle_playlist']))
         self.player = gst.element_factory_make("playbin", "player")
 
+        # Completition configuration
+        self.entry = builder.get_object('entry1')
+        completition = gtk.EntryCompletion()
+        comp_store = gtk.ListStore(str)
+        completition.set_model(comp_store)
+        for item in CONFIG['completition'].split("|"):
+            comp_store.append([item])
+        completition.set_minimum_key_length(1)
+        completition.set_text_column(0)
+        self.entry.set_completion(completition)
         # Results List definition
         self.result = gtk.ListStore(str, str, str, str)
         self.result_view = builder.get_object('treeview1')
         column = gtk.TreeViewColumn("Title", rendererText, text=0)
         column.set_max_width(180)
         self.play_view.append_column(column)
-        
+
         rendererText = gtk.CellRendererText()
         column = gtk.TreeViewColumn("Artist", rendererText, text=1)
         column.set_max_width(100)
                 t = t_play(self, song)
                 t.start()
 
-
     def on_volume_change(self, widget, data=0.5):
         """
         Volume change handler
         self.player.set_property("volume", float(data))
         return True
 
-
     def show_info(self, widget, data=None):
         """
         Song infromation dialog for item selected from the search results
         if widget.get_text() == "":
             pass
         else:
+            if widget.get_text() in CONFIG['completition']:
+                pass
+            else:
+                CONFIG['completition'] = CONFIG['completition'] + widget.get_text() + "|"
+                CONFIG.write()
             search_thread = t_search(self, widget.get_text(), "Songs")
             search_thread.run()
 
             pass
 
     def show_error(self, error):
+        """
+        Displays an error message when error with groove.py
+        """
         dialog = gtk.MessageDialog(None,
                                   gtk.DIALOG_DESTROY_WITH_PARENT,
                                   gtk.MESSAGE_ERROR,