Commits

Damián Nohales committed b95c4de

Show an error label on preferences when pylast is not installed.

Comments (0)

Files changed (2)

data/preferenes_dialog.ui

                     <property name="can_focus">False</property>
                     <property name="spacing">5</property>
                     <child>
+                      <object class="GtkCheckButton" id="checkbutton_lastfm">
+                        <property name="label" translatable="yes">Enable Last.fm Scrobbling</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="use_action_appearance">False</property>
+                        <property name="draw_indicator">True</property>
+                        <signal name="toggled" handler="on_scrobble_toggle" swapped="no"/>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="padding">3</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
                       <object class="GtkHBox" id="hbox4">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                       <packing>
                         <property name="expand">False</property>
                         <property name="fill">True</property>
-                        <property name="position">0</property>
+                        <property name="position">1</property>
                       </packing>
                     </child>
                     <child>
                       <packing>
                         <property name="expand">False</property>
                         <property name="fill">True</property>
-                        <property name="position">1</property>
+                        <property name="position">2</property>
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkCheckButton" id="checkbutton3">
-                        <property name="label" translatable="yes">Enable Last.fm Scrobbling</property>
+                      <object class="GtkLabel" id="label_pylasterror">
                         <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="receives_default">False</property>
-                        <property name="use_action_appearance">False</property>
-                        <property name="draw_indicator">True</property>
-                        <signal name="toggled" handler="on_scrobble_toggle" swapped="no"/>
+                        <property name="can_focus">False</property>
+                        <property name="label" translatable="yes">You need to install pylast to use Last.fm.
+Please execute "sudo pip install pylast" to install it.</property>
+                        <property name="justify">center</property>
+                        <attributes>
+                          <attribute name="foreground" value="#ffff00000000"/>
+                        </attributes>
                       </object>
                       <packing>
-                        <property name="expand">False</property>
+                        <property name="expand">True</property>
                         <property name="fill">True</property>
-                        <property name="position">2</property>
+                        <property name="position">3</property>
                       </packing>
                     </child>
                   </object>
               </object>
             </child>
             <child type="label">
-              <object class="GtkLabel" id="label2">
+              <object class="GtkLabel" id="label_lastfm_header">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="ypad">3</property>
             self.bubble.set_active(int(config()['show_notification']))
         else:
             self.bubble.set_sensitive(False)
-
+        
         self.lastuser = builder.get_object("entry2")
         self.lastuser.set_text(config()['lastuser'])
         self.lastpass = builder.get_object("entry3")
         self.lastpass.set_visibility(False)
         self.lastpass.set_text(config()['lastpass'])
-        self.scrobble = builder.get_object("checkbutton3")
+        self.scrobble = builder.get_object("checkbutton_lastfm")
 
         if env().HAVE_PYLAST:
             self.scrobble.set_active(int(config()['scrobbling']))
+            builder.get_object("label_pylasterror").destroy()
         else:
+            self.scrobble.set_active(False)
             self.scrobble.set_sensitive(False)
 
         self.lastuser.set_sensitive(self.scrobble.get_active())