Changeset 3134

Show
Ignore:
Timestamp:
07/11/08 01:17:35 (5 years ago)
Author:
nopper
Message:

restart umit warning fixes

Location:
branch/UmitPlugins
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • branch/UmitPlugins/higwidgets/higrichlists.py

    r3102 r3134  
    333333    def set_activatable(self, value): 
    334334        self._activatable = value 
    335      
     335        self.__on_activate(self) 
     336 
    336337    def get_saturate(self): 
    337338        return self._saturate 
     
    412413 
    413414        self.vbox.foreach(remove, self.vbox) 
     415     
     416    def get_rows(self): 
     417        return len(self.vbox) 
    414418 
    415419    def foreach(self, callback, userdata): 
  • branch/UmitPlugins/umitPlugin/PathPage.py

    r3132 r3134  
    196196        self.p_window.engine.plugins.save_changes() 
    197197 
    198         # Warn the user 
    199         self.p_window.animated_bar.label = \ 
    200             _('Remember that you have to restart umit to changes makes effect') 
    201         self.p_window.animated_bar.start_animation(True) 
    202  
    203198        PluginEngine().recache() 
    204         self.p_window.plug_page.clear(False) 
     199 
     200        if self.p_window.plug_page.clear(False) > 0: 
     201            # Warn the user 
     202            self.p_window.animated_bar.label = _("Remember that you have to " 
     203                                                 "restart umit to changes makes" 
     204                                                 ". Plugins disable pending.") 
     205            self.p_window.animated_bar.start_animation(True) 
     206 
     207            def block_row(row, blah): 
     208                row.activatable = False 
     209                row.message = _("Need umit restart to disable.") 
     210 
     211            self.p_window.plug_page.richlist.foreach(block_row, None) 
     212 
    205213        self.p_window.plug_page.populate() 
  • branch/UmitPlugins/umitPlugin/PluginPage.py

    r3132 r3134  
    9191 
    9292        self.richlist.foreach(remove, self.richlist) 
     93        return self.richlist.get_rows() 
    9394 
    9495    def populate(self): 
    9596        "Populate the richlist using avaiable_plugins field" 
    9697 
     98        # We need a list of present plugin row to check for dup 
     99        presents = [] 
     100 
     101        def add_to_list(row, list): 
     102            list.append(row) 
     103 
     104        self.richlist.foreach(add_to_list, presents) 
     105 
     106        warn_reboot = False 
     107 
    97108        # We have to load avaiable_plugins from engine 
    98109        for reader in self.p_window.engine.avaiable_plugins: 
     110 
     111            # Check if it's already present then remove the original 
     112            # and add the new in case something is getting update. 
    99113            row = PluginRow(self.richlist, reader) 
     114 
     115            for old in presents: 
     116                # FIXME? we need to check also for version equality 
     117                # and if are different just ignore the addition and 
     118                # continue with the loop 
     119                if old.reader.get_path() == row.reader.get_path(): 
     120                    self.richlist.remove_row(old) 
     121                    row.enabled = True 
     122                    warn_reboot = True 
    100123 
    101124            # Connect the various buttons 
     
    108131 
    109132            self.richlist.append_row(row) 
    110      
     133 
     134        if warn_reboot: 
     135            # Warn the user 
     136            self.p_window.animated_bar.label = \ 
     137                _('Remember that you have to restart umit to make new version' \ 
     138                  ' of plugins to be loaded correctly.') 
     139            self.p_window.animated_bar.start_animation(True) 
     140 
    111141    def __on_restart(self, widget): 
    112142        "Called when the user click on the restart button" 
     
    241271 
    242272            self.p_window.update_eng.updating = False 
     273            self.find_updates_btn.set_sensitive(True) 
     274            self.menu_enabled = True 
     275 
     276            self.populate() 
    243277            return 
    244278 
     
    337371        "Popup menu" 
    338372 
    339         if not self.menu_enabled: 
     373        if not self.menu_enabled or not row.activatable: 
    340374            return 
    341375