Anonymous avatar Anonymous committed b8d4eec

Fixed bug when re-opening the user properties/add window

Comments (0)

Files changed (2)

Binary file modified.

user_add/user_mod.py

         basic = BasicInfo(account = self.account)
         privilege = PrivilegeInfo(account = self.account)
         advanced = AdvancedInfo(account = self.account)
+        __tabs__ = []
         __tabs__.append(basic)
         __tabs__.append(privilege)
         __tabs__.append(advanced)
         
         for tab in __tabs__:
             self.notebook.append_page(tab, tab.label)
+            if not self.account.is_new:
+                tab.refresh_info()
+            
 
     ## Bottom toolbar
         toolbar = gtk.HBox()
         
         adj = gtk.Adjustment(1000, min_, 10000, 1, 10, 0)
         spinner = gtk.SpinButton(adj, 0, 0)
+        self._spinner = spinner
         spinner.connect('value-changed', self.set_account_uid)
         if not self.account.is_new:
             ## find the uid for the existing user and pre-select it
                 spinner.set_value(0.0)
                 spinner.set_property('sensitive', False)
             else:
+                adj.set_all(1000,1000,10000,1,10,0)
                 for line in data:
-                    if line.startswith(self.account.login):
+                    if line.startswith(self.account.login.strip()):
                         spl1 = line.split(':')
                         uid = int(spl[2])
                         spinner.set_value(uid)
     def set_account_maingroup(self, widget):
         self.account.maingroup = widget.get_active_text()
     def set_account_uid(self, widget):
+        if not self.account.is_new: return
         self.account.uid = int(widget.get_value())
     def refresh_info(self):
-        self._homedir_entry.set_text(self.account.homedir)
+        if not self.account.is_new:
+            self._homedir_entry.set_text(self.account.homedir)
+            self._spinner.set_value(float(self.account.uid))
+            #print 'values are set'
+        else:
+            if self.account.login:
+                self._homedir_entry.set_text(os.path.join('/home', self.account.login))
+        
+
     
         
 class PrivilegeInfo(Tab):  
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.