Commits

Anonymous committed 9f64387

Added signal events to implement functionality

  • Participants
  • Parent commits 48a6ff4

Comments (0)

Files changed (7)

 __author__ = 'Moises Henriquez'
 __author_email__ = 'moc.liamg]ta[xnl.E0M'.replace(']ta[', '@')[::-1]
 
+def _(str): return str
+
 class Gui(gtk.Window):
     '''Main GUI interface for the controlcenter.
     This window will incorporate modules and launch them using
     '''
     def __init__(self):
         gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL)
-        self.set_title('Control Center')
+        self.set_title(_('Control Center'))
         self.set_position(gtk.WIN_POS_CENTER)
         self.connect('destroy', gtk.main_quit)
 

File user_add/user_add.py

 import os
 
 n_account = None
-_tabs = []
+tabs_ = []
+g_btOK = None
+
+def _(str): return str
 
 class Account(object):
     '''Object for a user account. This object will have several properties
         self.shell = None
         self.password = None
         self.maingroup = None
-        self.groups = None
+        self.groups = []
         self.login = None
     
+    def preview(self):
+        '''Prints out the information stored about the user account. This 
+        information will reflect any changes that have been made and is 
+        for mere testing purposes, to make sure all required fields are 
+        filled'''
+        print _('Login Name:'), self.login
+        print _('User Name:'), self.name
+        print _('User ID:'), self.uid
+        print _('Home Directory:'), self.homedir
+        print _('Login Shell:'), self.shell
+        print _('Main Group:'), self.maingroup
+        print _('Groups List:'), ','.join(self.groups)
+        print _('Password: ****** '), 
+        
+    
     def load(self, login):
         '''Load the information stored in the system about a user account.
         Required arguments:
     def __init__(self):
         gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL)
         self.connect('destroy', gtk.main_quit)
-        self.set_property('title', 'Create User Account')
+        self.set_property('title', _('Create User Account'))
         body = gtk.VBox()
         self.add(body)
         self.tabstrip = gtk.Notebook()
         body.pack_start(self.tabstrip, True, True, 4)
         body.pack_start(btnbar, False, False, 4)
         
-        bt_OK = gtk.Button('OK', gtk.STOCK_OK)
-        bt_Cancel = gtk.Button('Cancel', gtk.STOCK_CANCEL)
+        bt_OK = gtk.Button(_('OK'), gtk.STOCK_OK)
+        bt_OK.connect('clicked', self.preview_account)
+        self.OK = bt_OK
+        bt_Cancel = gtk.Button(_('Cancel'), gtk.STOCK_CANCEL)
         bt_Cancel.connect('clicked', gtk.main_quit)
         
         btnbar.pack_end(bt_OK, False, False, 2)
 
         self.set_default_size(400,450)
         self.set_position(gtk.WIN_POS_CENTER)
-
-        ## Add Content to the window
-        tab0 = BasicSettingsTab()
-        self.tabstrip.append_page(tab0, tab0.label)
-        _tabs.append(tab0)
         
+        ## Create tab objects.
+        tab_basic= BasicSettingsTab()
+        tab_privileges = PrivilegesTab()
+        tab_advanced = AdvancedTab()
+        tabs_.append(tab_basic)
+        tabs_.append(tab_privileges)
+        tabs_.append(tab_advanced)
         
-        tab1 = PrivilegesTab()
-        self.tabstrip.append_page(tab1, tab1.label)
-        _tabs.append(tab1)
+        ## Add the tabs to the window
+        for tab in tabs_:
+            self.tabstrip.append_page(tab, tab.label)
+    def preview_account(self, widget):
+        '''Trigger account preview'''
+        return n_account.preview()
         
-        adv = AdvancedTab()
-        self.tabstrip.append_page(adv, adv.label)
-        _tabs.append(adv)
     
     def load_account(self, account):
         self.n_account.load(account)
     def __init__(self, text):
         gtk.Label.__init__(self)
         self.set_property('use-markup', True)
-        self.set_property('label', '<b>%s</b>'%text)
+        self.set_property('label', '<b>%s</b>'% text)
         self.set_property('xalign', 0.0)
         self.set_property('xpad', 12)
         
         self.login_txt.set_sensitive(False)
         self.name_txt.set_text(n_account.name)
         return
+    
+    def update_login(self, widget):
+        '''Update login name field for user account'''
+        n_account.login = widget.get_text().strip() ## FIXME: strip this??
+        ## Also update the home directory
+        n_account.homedir = os.path.join('/home', n_account.login)
+        
+        ## Display this value on the advanced tab
+        for tab in tabs_:
+            tab.refresh_info()
+    
+    def update_realname(self, widget):
+        '''Update the real name field for user account'''
+        n_account.name = widget.get_text().strip()  ## FIXME: strip this??
+    def set_pass_1(self, widget):
+        '''Set the first password entry for user account'''
+        n_account.password = widget.get_text()
+        
+    def verify_password(self, pass2):
+        ''' Make sure both password entires match'''
+        if pass2 == n_account.password:
+            return True
+        return False
+    def set_pass_2(self, widget):
+        '''Set the second password for the user account. Just to make sure'''
+        if g_btOK:
+            g_btOK.set_sensitive(self.verify_password(widget.get_text()))
+        else:
+            print 'no OK button'
+            
         
     def __init__(self):
-        Tab.__init__(self, 'Basic Settings')
-        banner = SectionLabel('Basic Information')
+        Tab.__init__(self, _('Basic Settings'))
+        banner = SectionLabel(_('Basic Information'))
         self.pack_start(banner, False, False, 4)
         
         spacer = gtk.Label()
         self.pack_start(spacer, False, False, 4)
         line_name = gtk.HBox()
-        login_label = LineLabel('Login Name')
+        login_label = LineLabel(_('Login Name'))
         login_txtbox = gtk.Entry()
+        login_txtbox.connect('changed', self.update_login)
         self.login_txt = login_txtbox
         line_name.pack_start(login_label, False, False, 2)
         line_name.pack_start(login_txtbox, True, True, 2)
         self.pack_start(line_name, False, False, 4)
         
         rname_box = gtk.HBox()
-        rname_label = LineLabel('Real Name')
+        rname_label = LineLabel(_('Real Name'))
         rname_txt = gtk.Entry()
+        rname_txt.connect('changed', self.update_realname)
         self.name_txt = rname_txt
         rname_box.pack_start(rname_label, False, False, 2)
         rname_box.pack_start(rname_txt, True, True, 2)
         spacer = gtk.Label()
         self.pack_start(spacer, False, False, 4)
         
-        banner1 = SectionLabel('Password')
+        banner1 = SectionLabel(_('Password'))
         self.pack_start(banner1, False, False, 4)
         pass1_box = gtk.HBox()
         pass2_box = gtk.HBox()
-        pass1_label = LineLabel('User Password')
+        pass1_label = LineLabel(_('User Password'))
         pass1_txt = gtk.Entry()
+        pass1_txt.connect('changed', self.set_pass_1)
         self.pass1_box = pass1_txt
         pass1_txt.set_property('visibility', False)
         pass1_box.pack_start(pass1_label, False, False, 2)
         pass1_box.pack_start(pass1_txt, True, True, 2)
         
-        pass2_label = LineLabel('Confirm Password')
+        pass2_label = LineLabel(_('Confirm Password'))
         pass2_txt = gtk.Entry()
+        pass2_txt.connect('changed', self.set_pass_2)
         self.pass2_box = pass2_txt
         pass2_txt.set_property('visibility', False)
         pass2_box.pack_start(pass2_label, False, False, 2)
     '''User privileges tab that allows the administrator to pick and choose what
     the user is allowed to do on the system'''
     def __init__(self):
-        Tab.__init__(self, 'Privileges')
-        banner = SectionLabel('User Privileges')
+        Tab.__init__(self, _('Privileges'))
+        banner = SectionLabel(_('User Privileges'))
         self.pack_start(banner, False, False, 4)
         self.rights_values = [
-        ('lpadmin', True,  'Manage system printers'), \
-        ('scaner', False, 'Use scanners'), \
-        ('video', True, 'Capture video from TV or webcam')
+        ('lpadmin', True,  _('Manage system printers')), \
+        ('scaner', False, _('Use scanners')), \
+        ('video', True, _('Capture video from TV or webcam'))
         ]
+        
+        ## set default grouplist
+        for entry in self.rights_values:
+            if entry[1]:
+                n_account.groups.append(entry[0])
+        
         sw = gtk.ScrolledWindow()
         sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
         tv = self._get_tree()
     
     def checkbox_toggle(self, widget, path, model):
         model[path][1] = not model[path][1]
+        for item in model:
+            if item[1]:
+                if not item[0] in n_account.groups:
+                    n_account.groups.append(item[0].strip())
+            else:
+                if item[0] in n_account.groups:
+                    n_account.groups.remove(item[0].strip())
+                
+        print n_account.groups
 
 
 class AdvancedTab(Tab):
     This tab will provide advanced settings for creating a user account.
     These settings are optional and default to the system defaults.
     '''
+    
+    def refresh_info(self):
+        '''Reflect changes made to the home directory especially from the
+        basic settings tab.'''
+        self.homedir_box.set_text(n_account.homedir)
+        
     def load_existing_data(self):
         self.homedir_box.set_text(n_account.homedir)
         self.homedir_box.set_sensitive(False)
                 self.shell_sel_combo.set_active(x)
                 self.shell_sel_combo.set_sensitive(False) ## Fixme: Disabled for now
                 break
+    
+    def update_homedir(self, widget):
+        '''Update the home directory on the account to the value specified in the
+        advanced tab'''
+        n_account.homedir = widget.get_text()
+    
+    def update_maingroup(self, widget):
+        '''Update the user's main group to the value selected from the
+        advanced tab'''
+        n_account.maingroup = widget.get_active_text()
+    
+    def update_shell(self, widget):
+        '''Update the user's login shell to the value selected from the
+        advanced tab'''
+        n_account.shell = widget.get_active_text()
+    
+    def update_uid(self, widget):
+        '''Update the uid value to the value selected from the advanced tab'''
+        n_account.uid = int(widget.get_value())
         
+        
+
     def __init__(self):
-        Tab.__init__(self, 'Advanced')
-        banner = SectionLabel('Advanced Settings')
+        Tab.__init__(self, _('Advanced'))
+        banner = SectionLabel(_('Advanced Settings'))
         spacer = gtk.Label()
         self.pack_start(banner, False, False, 4)
         self.pack_start(spacer, False, False, 4)
         
         homedir_line = gtk.HBox()
-        homedir_label = LineLabel('Home Directory')
+        homedir_label = LineLabel(_('Home Directory'))
         homedir_txt = gtk.Entry()
+        homedir_txt.connect('changed', self.update_homedir)
         self.homedir_box = homedir_txt
         homedir_line.pack_start(homedir_label, False, False, 2)
         homedir_line.pack_start(homedir_txt, True, True, 2)
         self.pack_start(homedir_line, False, False, 4)
         
         maingroup_line = gtk.HBox()
-        maingroup_label = LineLabel('Main Group')
+        maingroup_label = LineLabel(_('Main Group'))
         ulist = gtk.ListStore(str)
         ## Read /etc/group and list all groups =< 100  <-- FIXME:
         f = open('/etc/group', 'r')
                 ulist.append([spl[0].strip()])
         ## FIXME: ^^ User group policy?
         maingroup_sel = gtk.ComboBox(ulist)
+        maingroup_sel.connect('changed', self.update_maingroup)
         self.main_group_combo = maingroup_sel
         cell0 = gtk.CellRendererText()
         maingroup_sel.pack_start(cell0, True)
         shell_label = LineLabel('Login Shell')
         shell_list = gtk.ListStore(str)
         shell_sel = gtk.ComboBox(shell_list)
+        shell_sel.connect('changed', self.update_shell)
 
         self.shell_sel_combo = shell_sel
         
         self.pack_start(shell_line, False, False, 4)
         
         uid_line = gtk.HBox()
-        uid_label = LineLabel('User ID')
+        uid_label = LineLabel(_('User ID'))
         min_ = 1000
         n_list = []
         f = open('/etc/passwd', 'r')
                 n_list.append(int(spl[2]))
         n_list.sort()
         min_ = max(n_list)+1
+        ## Set default value to the user account
+        n_account.uid = int(min_)
         adj = gtk.Adjustment(1000, min_, 10000, 1, 10, 0)
         uid_spinner = gtk.SpinButton(adj, 0, 0)
+        uid_spinner.connect('value-changed', self.update_uid)
         self.uid_spinner = uid_spinner
         uid_line.pack_start(uid_label, False, False, 2)
         uid_line.pack_start(uid_spinner, True, True, 2)
 if __name__ == '__main__':
     n_account = Account()
     w = MainWin()
+    g_btOK = w.OK
+    g_btOK.set_sensitive(False) ## Disable the OK button until the password is provided
     w.show_all()
-    # Show account info for vluser
-##    n_account.load('vluser')
-##    w.set_title('Edit account vluser')
-##    for tab in _tabs: tab.load_existing_data()
     gtk.main()

File user_add/user_add.pyc

Binary file modified.

File user_add/user_add.py~

 #!/usr/bin/env python
 
+#    This file is part of controlcenter.
+#
+#    controlcenter is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License v2 as published by
+#    the Free Software Foundation.
+#
+#    controlcenter is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with controlcenter.  If not, see <http://www.gnu.org/licenses/>.
+
 
 __author__ = 'Moises Henriquez'
 __author_email__ = 'moc.liamg]ta[xnl.E0M'.replace(']ta[', '@')[::-1]
 import os
 
 n_account = None
-_tabs = []
+tabs_ = []
+g_btOK = None
+
+def _(str): return str
 
 class Account(object):
     '''Object for a user account. This object will have several properties
         self.shell = None
         self.password = None
         self.maingroup = None
-        self.groups = None
+        self.groups = []
         self.login = None
     
+    def preview(self):
+        '''Prints out the information stored about the user account. This 
+        information will reflect any changes that have been made and is 
+        for mere testing purposes, to make sure all required fields are 
+        filled'''
+        print _('Login Name:'), self.login
+        print _('User Name:'), self.name
+        print _('User ID:'), self.uid
+        print _('Home Directory:'), self.homedir
+        print _('Login Shell:'), self.shell
+        print _('Main Group:'), self.maingroup
+        print _('Groups List:'), ','.join(self.groups)
+        print _('Password: ****** '), 
+        
+    
     def load(self, login):
         '''Load the information stored in the system about a user account.
         Required arguments:
     def __init__(self):
         gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL)
         self.connect('destroy', gtk.main_quit)
-        self.set_property('title', 'Create User Account')
+        self.set_property('title', _('Create User Account'))
         body = gtk.VBox()
         self.add(body)
         self.tabstrip = gtk.Notebook()
         body.pack_start(self.tabstrip, True, True, 4)
         body.pack_start(btnbar, False, False, 4)
         
-        bt_OK = gtk.Button('OK', gtk.STOCK_OK)
-        bt_Cancel = gtk.Button('Cancel', gtk.STOCK_CANCEL)
+        bt_OK = gtk.Button(_('OK'), gtk.STOCK_OK)
+        bt_OK.connect('clicked', self.preview_account)
+        self.OK = bt_OK
+        bt_Cancel = gtk.Button(_('Cancel'), gtk.STOCK_CANCEL)
         bt_Cancel.connect('clicked', gtk.main_quit)
         
         btnbar.pack_end(bt_OK, False, False, 2)
 
         self.set_default_size(400,450)
         self.set_position(gtk.WIN_POS_CENTER)
-
-        ## Add Content to the window
-        tab0 = BasicSettingsTab()
-        self.tabstrip.append_page(tab0, tab0.label)
-        _tabs.append(tab0)
         
+        ## Create tab objects.
+        tab_basic= BasicSettingsTab()
+        tab_privileges = PrivilegesTab()
+        tab_advanced = AdvancedTab()
+        tabs_.append(tab_basic)
+        tabs_.append(tab_privileges)
+        tabs_.append(tab_advanced)
         
-        tab1 = PrivilegesTab()
-        self.tabstrip.append_page(tab1, tab1.label)
-        _tabs.append(tab1)
+        ## Add the tabs to the window
+        for tab in tabs_:
+            self.tabstrip.append_page(tab, tab.label)
+    def preview_account(self, widget):
+        '''Trigger account preview'''
+        return n_account.preview()
         
-        adv = AdvancedTab()
-        self.tabstrip.append_page(adv, adv.label)
-        _tabs.append(adv)
     
     def load_account(self, account):
         self.n_account.load(account)
     def __init__(self, text):
         gtk.Label.__init__(self)
         self.set_property('use-markup', True)
-        self.set_property('label', '<b>%s</b>'%text)
+        self.set_property('label', '<b>%s</b>'% text)
         self.set_property('xalign', 0.0)
         self.set_property('xpad', 12)
         
         self.login_txt.set_sensitive(False)
         self.name_txt.set_text(n_account.name)
         return
+    
+    def update_login(self, widget):
+        '''Update login name field for user account'''
+        n_account.login = widget.get_text().strip() ## FIXME: strip this??
+        ## Also update the home directory
+        n_account.homedir = os.path.join('/home', n_account.login)
+        
+        ## Display this value on the advanced tab
+        for tab in tabs_:
+            tab.refresh_info()
+    
+    def update_realname(self, widget):
+        '''Update the real name field for user account'''
+        n_account.name = widget.get_text().strip()  ## FIXME: strip this??
+    def set_pass_1(self, widget):
+        '''Set the first password entry for user account'''
+        n_account.password = widget.get_text()
+        
+    def verify_password(self, pass2):
+        ''' Make sure both password entires match'''
+        if pass2 == n_account.password:
+            return True
+        return False
+    def set_pass_2(self, widget):
+        '''Set the second password for the user account. Just to make sure'''
+        if g_btOK:
+            g_btOK.set_sensitive(self.verify_password(widget.get_text()))
+        else:
+            print 'no OK button'
+            
         
     def __init__(self):
-        Tab.__init__(self, 'Basic Settings')
-        banner = SectionLabel('Basic Information')
+        Tab.__init__(self, _('Basic Settings'))
+        banner = SectionLabel(_('Basic Information'))
         self.pack_start(banner, False, False, 4)
         
         spacer = gtk.Label()
         self.pack_start(spacer, False, False, 4)
         line_name = gtk.HBox()
-        login_label = LineLabel('Login Name')
+        login_label = LineLabel(_('Login Name'))
         login_txtbox = gtk.Entry()
+        login_txtbox.connect('changed', self.update_login)
         self.login_txt = login_txtbox
         line_name.pack_start(login_label, False, False, 2)
         line_name.pack_start(login_txtbox, True, True, 2)
         self.pack_start(line_name, False, False, 4)
         
         rname_box = gtk.HBox()
-        rname_label = LineLabel('Real Name')
+        rname_label = LineLabel(_('Real Name'))
         rname_txt = gtk.Entry()
+        rname_txt.connect('changed', self.update_realname)
         self.name_txt = rname_txt
         rname_box.pack_start(rname_label, False, False, 2)
         rname_box.pack_start(rname_txt, True, True, 2)
         spacer = gtk.Label()
         self.pack_start(spacer, False, False, 4)
         
-        banner1 = SectionLabel('Password')
+        banner1 = SectionLabel(_('Password'))
         self.pack_start(banner1, False, False, 4)
         pass1_box = gtk.HBox()
         pass2_box = gtk.HBox()
-        pass1_label = LineLabel('User Password')
+        pass1_label = LineLabel(_('User Password'))
         pass1_txt = gtk.Entry()
+        pass1_txt.connect('changed', self.set_pass_1)
         self.pass1_box = pass1_txt
         pass1_txt.set_property('visibility', False)
         pass1_box.pack_start(pass1_label, False, False, 2)
         pass1_box.pack_start(pass1_txt, True, True, 2)
         
-        pass2_label = LineLabel('Confirm Password')
+        pass2_label = LineLabel(_('Confirm Password'))
         pass2_txt = gtk.Entry()
+        pass2_txt.connect('changed', self.set_pass_2)
         self.pass2_box = pass2_txt
         pass2_txt.set_property('visibility', False)
         pass2_box.pack_start(pass2_label, False, False, 2)
     '''User privileges tab that allows the administrator to pick and choose what
     the user is allowed to do on the system'''
     def __init__(self):
-        Tab.__init__(self, 'Privileges')
-        banner = SectionLabel('User Privileges')
+        Tab.__init__(self, _('Privileges'))
+        banner = SectionLabel(_('User Privileges'))
         self.pack_start(banner, False, False, 4)
         self.rights_values = [
-        ('lpadmin', True,  'Manage system printers'), \
-        ('scaner', False, 'Use scanners'), \
-        ('video', True, 'Capture video from TV or webcam')
+        ('lpadmin', True,  _('Manage system printers')), \
+        ('scaner', False, _('Use scanners')), \
+        ('video', True, _('Capture video from TV or webcam'))
         ]
+        
+        ## set default grouplist
+        for entry in self.rights_values:
+            if entry[1]:
+                n_account.groups.append(entry[0])
+        
         sw = gtk.ScrolledWindow()
         sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
         tv = self._get_tree()
     
     def checkbox_toggle(self, widget, path, model):
         model[path][1] = not model[path][1]
+        for item in model:
+            if item[1]:
+                if not item[0] in n_account.groups:
+                    n_account.groups.append(item[0].strip())
+            else:
+                if item[0] in n_account.groups:
+                    n_account.groups.remove(item[0].strip())
+                
+        print n_account.groups
 
 
 class AdvancedTab(Tab):
     This tab will provide advanced settings for creating a user account.
     These settings are optional and default to the system defaults.
     '''
+    
+    def refresh_info(self):
+        '''Reflect changes made to the home directory especially from the
+        basic settings tab.'''
+        self.homedir_box.set_text(n_account.homedir)
+        
     def load_existing_data(self):
         self.homedir_box.set_text(n_account.homedir)
         self.homedir_box.set_sensitive(False)
                 self.shell_sel_combo.set_active(x)
                 self.shell_sel_combo.set_sensitive(False) ## Fixme: Disabled for now
                 break
+    
+    def update_homedir(self, widget):
+        '''Update the home directory on the account to the value specified in the
+        advanced tab'''
+        n_account.homedir = widget.get_text()
+    
+    def update_maingroup(self, widget):
+        '''Update the user's main group to the value selected from the
+        advanced tab'''
+        n_account.maingroup = widget.get_active_text()
+    
+    def update_shell(self, widget):
+        '''Update the user's login shell to the value selected from the
+        advanced tab'''
+        n_account.shell = widget.get_active_text()
+    
+    def update_uid(self, widget):
+        '''Update the uid value to the value selected from the advanced tab'''
+        n_account.uid = int(widget.get_value())
         
+        
+
     def __init__(self):
-        Tab.__init__(self, 'Advanced')
-        banner = SectionLabel('Advanced Settings')
+        Tab.__init__(self, _('Advanced'))
+        banner = SectionLabel(_('Advanced Settings'))
         spacer = gtk.Label()
         self.pack_start(banner, False, False, 4)
         self.pack_start(spacer, False, False, 4)
         
         homedir_line = gtk.HBox()
-        homedir_label = LineLabel('Home Directory')
+        homedir_label = LineLabel(_('Home Directory'))
         homedir_txt = gtk.Entry()
+        homedir_txt.connect('changed', self.update_homedir)
         self.homedir_box = homedir_txt
         homedir_line.pack_start(homedir_label, False, False, 2)
         homedir_line.pack_start(homedir_txt, True, True, 2)
         self.pack_start(homedir_line, False, False, 4)
         
         maingroup_line = gtk.HBox()
-        maingroup_label = LineLabel('Main Group')
+        maingroup_label = LineLabel(_('Main Group'))
         ulist = gtk.ListStore(str)
         ## Read /etc/group and list all groups =< 100  <-- FIXME:
         f = open('/etc/group', 'r')
                 ulist.append([spl[0].strip()])
         ## FIXME: ^^ User group policy?
         maingroup_sel = gtk.ComboBox(ulist)
+        maingroup_sel.connect('changed', self.update_maingroup)
         self.main_group_combo = maingroup_sel
         cell0 = gtk.CellRendererText()
         maingroup_sel.pack_start(cell0, True)
         shell_label = LineLabel('Login Shell')
         shell_list = gtk.ListStore(str)
         shell_sel = gtk.ComboBox(shell_list)
+        shell_sel.connect('changed', self.update_shell)
 
         self.shell_sel_combo = shell_sel
         
         self.pack_start(shell_line, False, False, 4)
         
         uid_line = gtk.HBox()
-        uid_label = LineLabel('User ID')
+        uid_label = LineLabel(_('User ID'))
         min_ = 1000
         n_list = []
         f = open('/etc/passwd', 'r')
                 n_list.append(int(spl[2]))
         n_list.sort()
         min_ = max(n_list)+1
+        ## Set default value to the user account
+        n_account.uid = int(min_)
         adj = gtk.Adjustment(1000, min_, 10000, 1, 10, 0)
         uid_spinner = gtk.SpinButton(adj, 0, 0)
+        uid_spinner.connect('value-changed', self.update_uid)
         self.uid_spinner = uid_spinner
         uid_line.pack_start(uid_label, False, False, 2)
         uid_line.pack_start(uid_spinner, True, True, 2)
 if __name__ == '__main__':
     n_account = Account()
     w = MainWin()
+    g_btOK = w.OK
+    g_btOK.set_sensitive(False) ## Disable the OK button until the password is provided
     w.show_all()
-    # Show account info for vluser
-##    n_account.load('vluser')
-##    w.set_title('Edit account vluser')
-##    for tab in _tabs: tab.load_existing_data()
     gtk.main()

File widgets/__init__.pyc

Binary file modified.

File widgets/message.py

 #    along with controlcenter.  If not, see <http://www.gnu.org/licenses/>.
 import gtk
 
+def _(str): return str
+
 class Error(gtk.MessageDialog):
     def __init__(self, parent=None, text=None):
         gtk.MessageDialog.__init__(self, type=gtk.MESSAGE_ERROR, parent=parent,
         buttons = gtk.BUTTONS_OK)
         self.set_property('text', text)
-        self.set_property('title', 'Error')
+        self.set_property('title', _('Error'))
     
 class Warning(gtk.MessageDialog):
     def __init__(self, parent=None, text=None):
         gtk.MessageDialog.__init__(self, type=gtk.MESSAGE_WARNING, parent=parent,
         buttons=gtk.BUTTONS_OK)
         self.set_property('text', text)
-        self.set_property('title', 'Warning')
+        self.set_property('title', _('Warning'))
         
 class Info(gtk.MessageDialog):
     def __init__(self, parent=None, text=None):
         gtk.MessageDialog.__init____(self, type=gtk.MESSAGE_INFO, parent=parent,
         buttons = gtk.BUTTONS_OK)
-        self.set_property('title', 'Info')
+        self.set_property('title', _('Info'))
         self.set_property('text', text)
 
 class Question(gtk.MessageDialog):
     def __init__(self, parent=None, text=None):
         gtk.MessageDialog.__init__(self, type=gtk.MESSAGE_QUESTION, parent=parent,
         buttons=gtk.BUTTONS_YES_NO)
-        self.set_property('title', 'Question')
+        self.set_property('title', _('Question'))
         self.set_property('text', text)
 
 

File widgets/message.pyc

Binary file modified.