Source

drivcenDRIVENvpackager / src / vpackager / bot.py

Diff from to

src/vpackager/bot.py

         self.bot_tab = StatusTab(_parentView = self,
                                  model = self.dbase_model)
         #self.bot_tab = StatusTab(model = self.dbase_model, )
-        self.statusbar = gtk.StatusBar()
+        self.statusbar = gtk.Statusbar()
+        self.refresh_statusbar()
 
         # Bot control and status bar.
         bot_controlbar = gtk.HBox()
         self.body.pack_start(self.tabstrip, True, True, 2)
         self.body.pack_start(self.statusbar, False, True, 2)
         self.add(self.body)
+        # Add an observer to to the dbase model so that the status bar gets updated
+        self.dbase_model.add_observer(self.refresh_statusbar, table='queue')
         self.show_all()
         #self.connect('destroy', self._exit)
         self.connect('delete-event', self._exit)
         self.dbase_model.RefreshHistory()
         self.StopBot(self.bt_bot_stop)
 
+    def refresh_statusbar(self, data=None):
+
+        if data:
+            if len(data) > 1:
+                _jobs = "jobs"
+            else:
+                _jobs = "job"
+            _str = "vpackager: %s %s in queue"% (len(data), _jobs)
+        else:
+            _str = "vpackager: 0 jobs in queue"
+        self.statusbar.push(0, _str)
+        return
+
     def StartBot(self, widget=None):
         """ Start the bot"""
         self.RUN_BOT = True