Moises Henriquez avatar Moises Henriquez committed 2436299

Added status bar to main bot window

Comments (0)

Files changed (1)

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
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.