~universal-applets-core/universal-applets/new_ui

« back to all changes in this revision

Viewing changes to src/bin/screenlets-manager

  • Committer: Przemyslaw Firszt
  • Date: 2008-09-05 17:34:30 UTC
  • Revision ID: pefi@epf.pl-20080905173430-m8uh3cok03jgm64t
Cleaning

Show diffs side-by-side

added added

removed removed

Lines of Context:
105
105
                self.window = self.builder.get_object("window_main")
106
106
                self.entry_search = self.builder.get_object("entry_search") #text search entry for all screenlets
107
107
                self.iconview_available_screenlets = self.builder.get_object("iconview_available_screenlets") #the icon view for all screenlets
108
 
 
 
108
                
109
109
                # Load the manager's icon and the fallback icon for individual screenlets missing an icon
110
110
                self.pixbuf = gtk.gdk.pixbuf_new_from_file(screenlets.INSTALL_PREFIX + '/share/icons/screenlets.svg')
111
111
                self.noimg = gtk.gdk.pixbuf_new_from_file_at_size(
170
170
                list_a.sort()
171
171
                
172
172
                # Get the list of running screenlets
173
 
                list_r = utils.list_running_screenlets()
 
173
#               list_r = utils.list_running_screenlets()
174
174
                
175
175
                # Loop over all of the screenlets and create/update the list
176
176
                for s in list_a:
199
199
                                self.screenlets[s] = slinfo
200
200
                                
201
201
                        # Set/Update an attribute indicating if the screenlet is running
202
 
                        self.screenlets[s].active = list_r.count(s + 'Screenlet') > 0
 
202
#                       self.screenlets[s].active = list_r.count(s + 'Screenlet') > 0
203
203
                        
204
204
        
205
205
        def load_model (self):
728
728
                        else:   screenlets.show_error(None,_("No HTML code found"))                     
729
729
                dialog.destroy()
730
730
                
731
 
        def selection_changed (self, iconview):
732
 
                """Callback for handling selection changes in the IconView."""
733
 
                # create a list of widgets to enable/disable
734
 
                widgets = [self.cb_autostart, self.button_add,
735
 
                         self.button_stop,
736
 
                        self.button_delete, 
737
 
                        self.button_reset, self.button_shortcut,
738
 
                        self.button_theme]
739
 
                
740
 
                # set the scrolled window's size
741
 
                self.slwindow.set_size_request(560, 300)
742
 
                
743
 
                # get the currently selected icon in the iconview
744
 
                info = self.get_selection()
745
 
                if info is not None:
746
 
                        # set the description label
747
 
                        self.label_info.set_markup('<big><b>%s </b>%s by %s</big>\n%s' % (info.name,
748
 
                                info.version, info.author, info.info))
749
 
                        # enable all of the widgets in the above list
750
 
                        for widget in widgets:
751
 
                                widget.set_sensitive(True)
752
 
                        
753
 
                        self.cb_autostart.set_active(info.autostart)
754
 
                        self.button_delete.set_sensitive(not info.system)
755
 
                else:
756
 
                        # set the description label
757
 
                        self.label_info.set_label('')
758
 
                        
759
 
                        # disable all of the widgets
760
 
                        for widget in widgets:
761
 
                                widget.set_sensitive(False)
762
 
 
763
 
                        self.cb_autostart.set_active(False)
764
731
        
765
732
        def item_activated (self, iconview, item):
766
733
                """Callback for handling doubleclick/ENTER in the IconView."""
804
771
        def temp_file_changed (self, file_obj, path):
805
772
                self.load_screenlets()
806
773
                self.load_model()
807
 
        
808
 
        # start the app
 
774
 
809
775
        def start (self):
 
776
                """Start the main gtk loop."""
810
777
                gtk.main()
811
778
 
812
 
        #"delete_event" is called when user is closing window using window manager button 
 
779
        def on_window_main_destroy(self, widget, data=None):
 
780
                """Callback function for Gmain_window destroy signal"""
 
781
                self.quit()
 
782
 
813
783
        def delete_event (self, widget, event):
 
784
                """This function is called when user is closing window using window manager button """
814
785
                gtk.widget_pop_colormap()
815
786
                log.info("%s: Quit!", APP_NAME)
816
787
                return False #"return True" would prevent windows manager from closing application
817
 
        
 
788
 
818
789
        @dbus.service.method(IFACE)
819
790
        def quit (self, *args):
 
791
                """Quit from the main gtk loop."""
820
792
                log.info("Closing : %s", APP_NAME)
821
793
                gtk.main_quit()
822
 
        
823
 
        def on_window_main_destroy(self, widget, data=None):
824
 
                self.quit()
825
 
                
 
794
 
826
795
if __name__ == '__main__':
827
796
        app = ScreenletsManager()
828
797
        app.start()