Commits

Moises Henriquez  committed 5f683ab

Filling in the job history tab

  • Participants
  • Parent commits bd33aea

Comments (0)

Files changed (4)

 import gtk
 from vpackager import guitools
 import jobmanage
+import historymanager
 
 __author__ = 'M0E-lnx'
 __author_email__ = 'moc.liamg@xnl.E0M'[::-1]
         self.pack_start(cont, True, True, 2)
         self._parent.queueman = cont
 
+class TabHistory(Tab):
+    """ Tab displaying the job build history"""
+    def __init__(self, *args, **kwargs):
+        Tab.__init__(self, label = 'Job History',
+                stock=gtk.STOCK_JUSTIFY_FILL, **kwargs)
+        cont = historymanager.Main()
+        self.pack_start(cont, True, True, 2)
+        self._parent.historyman = cont
+
 class TabStrip(gtk.Notebook):
     """ Tabstrip used to display the main content of the application"""
     def __init__(self):
         self.body.pack_start(self._get_bottombar(), False, False, 4)
 
         self.queueman = None
+        self.historyman = None
 
         self.add(self.body)
 
         queuet = TabQueue(parent=self)
         strip.append_page(queuet, queuet.label)
 
-        Tab2 = Tab(label = 'Job History', stock=gtk.STOCK_JUSTIFY_FILL)
-        strip.append_page(Tab2, Tab2.label)
+        history = TabHistory(parent=self)
+        strip.append_page(history, history.label)
 
 
         return strip

File historymanage.py

-#!/usr/bin/env python
-
-#    This file is part of vpackager.
-#
-#    vpackager is free software: you can redistribute it and/or modify
-#    it under the terms of the GNU General Public License v2 as published by
-#    the Free Software Foundation.
-#
-#    vpackager is distributed in the hope that it will be useful,
-#    but WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#    GNU General Public License for more details.
-#
-#    You should have received a copy of the GNU General Public License
-#    along with vpackager.  If not, see <http://www.gnu.org/licenses/>.
-
-import gtk
-from vpackager import dbutils

File historymanager.py

+#!/usr/bin/env python
+
+#    This file is part of vpackager.
+#
+#    vpackager is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License v2 as published by
+#    the Free Software Foundation.
+#
+#    vpackager is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with vpackager.  If not, see <http://www.gnu.org/licenses/>.
+
+import gtk
+from vpackager import dbutils
+
+__author__ = 'M0E-lnx'
+__author_email__ = 'moc.liamg@xnl.E0M'[::-1]
+__version__ = '0.1'
+
+class Main(gtk.VBox):
+    ''' Container holding a treeview with convinient methods to work with the
+    job history'''
+    def __init__(self):
+        gtk.VBox.__init__(self)
+        self.model = gtk.ListStore(
+                int, str, str, str, str, str, str, str, str)
+        self.pack_start(gtk.Label('Job History'), False, True, 2)
+        self.pack_start(self._get_tree())
+        self.show_all()
+
+
+    def _get_tree(self):
+        self.tree = gtk.TreeView(model = self.model)
+        i = 0
+        for field in ('ID', 'Package', 'Version', 'Source URI', 'Description',
+                'Build Start', 'Build End', 'Output', 'Result'):
+            col = gtk.TreeViewColumn(field)
+            crt = gtk.CellRendererText()
+            col.pack_start(crt)
+            col.add_attribute(crt, 'text', i)
+            self.tree.append_column(col)
+            i += 1
+        return self.tree
+
+

File vpackager/dbutils.py

     c.close()
     return ret
 
+def GetHistory():
+    c = db.cursor()
+    ret = c.execute('select * from history').fetchall()
+    c.close()
+    return ret
 
 
-