diff options
author | Antonio Gallo <tonicucoz@gmail.com> | 2011-04-08 06:26:05 +0000 |
---|---|---|
committer | Antonio Gallo <tonicucoz@gmail.com> | 2011-04-08 06:26:05 +0000 |
commit | 3b31721ba386168596bd3078003c7cc9a0949e27 (patch) | |
tree | 444963fbc5820881fd12b0acdd969a365f956c51 | |
parent | 014fe46a53d8aa387b3f9f145b8b0b0982f06aa9 (diff) |
h-client:implemented information button
-rw-r--r-- | h-client/hclient.py | 48 | ||||
-rw-r--r-- | h-client/hlibrary.py | 11 |
2 files changed, 47 insertions, 12 deletions
diff --git a/h-client/hclient.py b/h-client/hclient.py index d6141c6..1868add 100644 --- a/h-client/hclient.py +++ b/h-client/hclient.py @@ -242,6 +242,40 @@ class hclient: def closeLicenseNoticeWindow(self,widget): self.licenseNoticeWindow.destroy() + #close the info window + def closeInfoWindowWindow(self,widget): + self.infoWindow.destroy() + + def openInfoWindow(self,widget): + self.infoWindow = gtk.Window(gtk.WINDOW_TOPLEVEL) + self.infoWindow.set_title("info") + self.infoWindow.set_position(gtk.WIN_POS_CENTER) + self.infoWindow.set_icon_from_file("img/icon.png") + #self.infoWindow.set_size_request(300, -1) + + vbox = gtk.VBox(False, 0) + vbox.set_border_width(10) + self.infoWindow.add(vbox) + + label = gtk.Label("<b>h-node client</b>") + label.set_use_markup(True) + vbox.pack_start(label, False, True, 5) + + label = gtk.Label("Copyright (C) 2011 Antonio Gallo") + label.set_use_markup(True) + vbox.pack_start(label, False, True, 5) + + label = gtk.Label("GPLv3") + label.set_use_markup(True) + vbox.pack_start(label, False, True, 5) + + closeButton = gtk.Button(stock=gtk.STOCK_CLOSE) + closeButton.connect("clicked", self.closeInfoWindowWindow) + vbox.pack_start(closeButton, False, True, 5) + + self.infoWindow.show_all() + + #start the window containing the license notice def openLicenseNoticeWindow(self,widget): #window for preferences @@ -259,9 +293,6 @@ class hclient: #print result ##if result - #label = gtk.Label(result) - #label.set_use_markup(True) - #description input sw = gtk.ScrolledWindow() #sw.set_shadow_type(gtk.SHADOW_ETCHED_IN) @@ -436,8 +467,9 @@ class hclient: self.loginButton.hide() self.logoutButton.show() info = self.client.getUserInfo() - if info == True: - self.statusLabel.set_markup("<i>hello</i> <b>"+info['username']+"</b>, <i>you are logged in</i>") + if info != False: + if info != -2: + self.statusLabel.set_markup("<i>hello</i> <b>"+info['username']+"</b>, <i>you are logged in</i>") if self.currentDeviceCode != None: self.submitButton.set_sensitive(True) @@ -504,6 +536,7 @@ class hclient: sync.connect("clicked", self.synchronize) info = gtk.ToolButton(gtk.STOCK_INFO) info.set_tooltip_text('Information') + info.connect("clicked",self.openInfoWindow); toolbar.insert(sync, 0) toolbar.insert(pref, 1) @@ -734,18 +767,21 @@ class hclient: self.applyButton = gtk.Button(stock=gtk.STOCK_APPLY) self.applyButton.set_sensitive(False) self.applyButton.connect("clicked", self.applyChanges) + self.applyButton.set_tooltip_text('apply your local modifications: no change will be applied to the server') #reset button self.resetButton = gtk.Button(stock=gtk.STOCK_REVERT_TO_SAVED) self.resetButton.set_sensitive(False) self.resetButton.connect("clicked", self.resetChanges) + self.resetButton.set_tooltip_text('restore the entries') #submit button self.submitButton = gtk.Button("Submit") self.submitButton.set_sensitive(False) self.submitButton.connect("clicked", self.openLicenseNoticeWindow) + self.submitButton.set_tooltip_text('submit your modifications to the server') hboxBelowEntries.pack_end(self.applyButton, False, True, 0) hboxBelowEntries.pack_end(self.resetButton, False, True, 0) - hboxBelowEntries.pack_end(self.submitButton, False, True, 0) + hboxBelowEntries.pack_start(self.submitButton, False, True, 0) hboxBelowEntries.show_all() #start the left vertical box diff --git a/h-client/hlibrary.py b/h-client/hlibrary.py index 46454ea..969239c 100644 --- a/h-client/hlibrary.py +++ b/h-client/hlibrary.py @@ -607,12 +607,11 @@ class Client: kernel_libre = device.getElementsByTagName("kernel_libre")[0].childNodes[0].data.encode('utf-8') dev[0].setKernel(kernel_libre) - #driverNode = device.getElementsByTagName("driver")[0] - #if driverNode: - #if driverNode.hasChildNodes(): - #driver = driverNode.childNodes[0].data.encode('utf-8') - #dev[0].setDriver(driver) - + if device.getElementsByTagName("driver")[0].hasChildNodes(): + driver = device.getElementsByTagName("driver")[0].childNodes[0].data.encode('utf-8') + dev[0].setDriver(driver) + else: + dev[0].setDriver('') #print modelName dev[0].setModel(modelName) |