aboutsummaryrefslogtreecommitdiff
path: root/h-client/hclient.py
diff options
context:
space:
mode:
authorAntonio Gallo <tonicucoz@gmail.com>2011-04-11 15:28:08 +0000
committerAntonio Gallo <tonicucoz@gmail.com>2011-04-11 15:28:08 +0000
commit41edb3195912124c3a214b6dddb42d29e9418d0c (patch)
treefa34bbeabb1ed02e21435d1364d2908af38d3d03 /h-client/hclient.py
parent6668f4d0d3e3aa8ba5eca58dbcc34f5b8f5b3876 (diff)
h-client:inproved submit process
Diffstat (limited to 'h-client/hclient.py')
-rw-r--r--h-client/hclient.py46
1 files changed, 31 insertions, 15 deletions
diff --git a/h-client/hclient.py b/h-client/hclient.py
index ebb0907..2679640 100644
--- a/h-client/hclient.py
+++ b/h-client/hclient.py
@@ -88,8 +88,9 @@ class hclient:
#make sensitive the apply button
self.applyButton.set_sensitive(True)
self.resetButton.set_sensitive(True)
+ self.submitButton.set_sensitive(True)
- self.updateStatus()
+ #self.updateStatus()
else:
#make non sensitive the apply button
@@ -98,7 +99,7 @@ class hclient:
self.submitButton.set_sensitive(False)
self.currentDevice = None
self.currentDeviceCode = None
- self.updateStatus()
+ #self.updateStatus()
#set the pyGTK device entries
@@ -211,23 +212,34 @@ class hclient:
def login(self,widget):
self.client.login(self.usernameEntry.get_text(),self.passwordEntry.get_text())
self.updateStatus()
+
+ if self._submitFlag:
+ if self.client.isLogged() != -2:
+ if self.client.isLogged():
+ self.applyChanges(None)
+ self.client.submit(self.currentDeviceCode)
+ self.printErrors()
+
+ self._submitFlag = False
+
#self.printErrors()
self.loginWindow.destroy()
#submit data to the server
def submit(self,widget):
self.applyChanges(None)
+ self.licenseNoticeWindow.destroy()
- if self.client.isLogged() == True:
- result = self.client.submit(self.currentDeviceCode)
- self.printErrors()
- else:
- self.client.errors.append("you are not logged")
- self.updateStatus()
+ if self.client.isLogged() != -2:
+ if self.client.isLogged():
+ self.client.submit(self.currentDeviceCode)
+ else:
+ self._submitFlag = True
+ self.openLoginWindow(None)
+
+ self.printErrors()
- self.licenseNoticeWindow.destroy()
-
#logout to the server
def logout(self,widget):
self.client.logout()
@@ -236,6 +248,8 @@ class hclient:
#close the login window
def closeLoginWindow(self,widget):
+ self._submitFlag = False
+ self.updateStatus()
self.loginWindow.destroy()
#close the license notice window
@@ -479,7 +493,6 @@ class hclient:
self.loginButton.show()
self.logoutButton.hide()
self.statusLabel.set_markup("<i>you are not logged in</i>")
- self.submitButton.set_sensitive(False)
#def setTreeViewCell(self,column, cell_renderer, model, iter):
##img = model.get_value(iter, 3)
@@ -499,8 +512,11 @@ class hclient:
def __init__(self):
+ #does it have to submit after the login?
+ self._submitFlag = False
+
#start the client object
- self.client = Client('http://www.h-node.com/')
+ self.client = Client('h-source')
self.client.createDevices()
# Create the main window
@@ -592,13 +608,13 @@ class hclient:
self.devices.add_attribute(device_name, "weight", 2)
- self.treestore = gtk.TreeStore(str,str,int,gtk.gdk.Pixbuf,int,str)
+ self.treestore = gtk.TreeStore(str,str,int,gtk.gdk.Pixbuf,int)
- pci = self.treestore.append(None, ["Your PCI Devices","",800,gtk.gdk.pixbuf_new_from_file('img/devices/unknown.png'),4,'no_image'])
+ pci = self.treestore.append(None, ["Your PCI Devices","",800,gtk.gdk.pixbuf_new_from_file('img/title_png.png'),4])
for key,dev in self.client.devices.iteritems():
if key[0] == 'p':
- self.treestore.append(pci, [dev[0].getType(),key,400,gtk.gdk.pixbuf_new_from_file('img/devices/'+dev[0].getIcon()),4,'image'])
+ self.treestore.append(pci, [dev[0].getType(),key,400,gtk.gdk.pixbuf_new_from_file('img/devices/small/'+dev[0].getIcon()),4])
selection = self.tree.get_selection()
selection.connect('changed', self.setCurrentDevice)