From 80569fc6fdacd64ff61f75ab24991b488dd24143 Mon Sep 17 00:00:00 2001 From: Antonio Gallo Date: Sun, 27 Mar 2011 14:14:31 +0000 Subject: added error bar on the bottom side --- h-client/hclient.py | 36 +++++++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 7 deletions(-) (limited to 'h-client/hclient.py') diff --git a/h-client/hclient.py b/h-client/hclient.py index 709165a..e8783b8 100644 --- a/h-client/hclient.py +++ b/h-client/hclient.py @@ -25,7 +25,7 @@ from hlibrary import * class hclient: #the device that has to be displaced in the right window - currentDevice = '' + currentDevice = None #get the active text from a combo #combo: the gtk combo instance @@ -88,7 +88,9 @@ class hclient: self.resetButton.set_sensitive(True) else: - + #make non sensitive the apply button + self.applyButton.set_sensitive(False) + self.resetButton.set_sensitive(False) self.currentDevice = None @@ -237,13 +239,31 @@ class hclient: self.prefWindow.show_all() - + #synchronize with the server XML database def synchronize(self,widget): self.client.sync() - print self.client.errors + self.printErrors() + #print self.client.errors self.setEntries() - + + def printErrors(self): + if len(self.client.errors) > 0: + sw = gtk.ScrolledWindow() + #sw.set_shadow_type(gtk.SHADOW_ETCHED_IN) + sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_NEVER) + hbox = gtk.HBox(False, 0) + for error in self.client.errors: + label = gtk.Label("error: " + error) + hbox.pack_start(label, False, True, 0) + + sw.add_with_viewport(hbox) + sw.set_border_width(5) + sw.show_all() + self.bottomWindow.add(sw) + + self.client.errors = [] + #another callback def delete_event(self, widget, event, data=None): gtk.main_quit() @@ -273,7 +293,8 @@ class hclient: self.window.add(vbox) self.centerWindow = gtk.HBox(False, 0) - + self.bottomWindow = gtk.HBox(False, 0) + ## build the toolbar ## toolbar = gtk.Toolbar() toolbar.set_tooltips(True) @@ -297,6 +318,7 @@ class hclient: vbox.pack_start(self.centerWindow, True, True, 0) + vbox.pack_start(self.bottomWindow, True, True, 0) vbox.show() @@ -523,7 +545,7 @@ class hclient: #self.rframe.set_border_width(30) self.centerWindow.show_all() - + self.bottomWindow.show_all() self.leftWindow.show() self.window.show() -- cgit v1.2.3