From 77320f7918a453892ae4ba0aad411c54867859fc Mon Sep 17 00:00:00 2001 From: Antonio Gallo Date: Tue, 12 Apr 2011 00:40:00 +0000 Subject: h-client:improved synchronize --- h-client/hclient.py | 23 ++++++++++++++--------- h-client/hlibrary.py | 9 +++------ 2 files changed, 17 insertions(+), 15 deletions(-) (limited to 'h-client') diff --git a/h-client/hclient.py b/h-client/hclient.py index f97cbd3..2ef8fff 100644 --- a/h-client/hclient.py +++ b/h-client/hclient.py @@ -90,13 +90,7 @@ class hclient: self.resetButton.set_sensitive(True) self.submitButton.set_sensitive(True) - self.tihbox.show() - self.bigIcon.set_from_file("img/devices/big/"+self.currentDevice.getIcon()) - if self.client.devices[code][2] == 'insert': - self.deviceInfoLabel.set_markup("this device is not present in the server database,\n would you like to insert it?") - else: - self.deviceInfoLabel.set_markup("this device is already present in the server database,\n would you like to update it?") - #self.updateStatus() + self.setDeviceInfoLabel() else: #make non sensitive the apply button @@ -108,6 +102,14 @@ class hclient: #self.updateStatus() + #set the top label + def setDeviceInfoLabel(self): + if self.currentDeviceCode != None: + self.bigIcon.set_from_file("img/devices/big/"+self.currentDevice.getIcon()) + if self.client.devices[self.currentDeviceCode][2] == 'insert': + self.deviceInfoLabel.set_markup("this device is not present in the server database,\n would you like to insert it?") + else: + self.deviceInfoLabel.set_markup("this device is already present in the server database,\n would you like to update it?") #set the pyGTK device entries def setEntries(self): @@ -211,6 +213,7 @@ class hclient: self.client.errors = [] self.client.setNode(self.serverEntry.get_text()) self.updateStatus() + self.synchronize(None) #close the preferences window def closePref(self,widget): @@ -225,7 +228,7 @@ class hclient: if self.client.isLogged(): self.applyChanges(None) self.client.submit(self.currentDeviceCode) - self.printErrors() + self.synchronize(None) self._submitFlag = False @@ -239,11 +242,12 @@ class hclient: if self.client.isLogged(): self.client.submit(self.currentDeviceCode) + self.synchronize(None) else: self._submitFlag = True self.openLoginWindow(None) - self.printErrors() + self.updateStatus() #logout to the server @@ -440,6 +444,7 @@ class hclient: self.printErrors() #print self.client.errors self.setEntries() + self.setDeviceInfoLabel() def printErrors(self): diff --git a/h-client/hlibrary.py b/h-client/hlibrary.py index cc25edc..c86c66c 100644 --- a/h-client/hlibrary.py +++ b/h-client/hlibrary.py @@ -570,14 +570,11 @@ class Client: #find the class #Class = dev[1] vendorid_productid = key[2:] - #find the controller - #controller = self.getController(Class) - ##perform an http request - #self.request.contents = '' + #reset the device params + dev[2] = 'insert' + dev[3] = '0' - #result = self.request.perform('download/' + controller + '/en') - #parse the xml database try: xmldoc = minidom.parseString(self.request.contents) -- cgit v1.2.3