def deactivate(self): value = True etc_files = self.controller.install_profile.get_etc_files() etc_files = self.create_etc_files(etc_files) if self.keymap.GetValue(): etc_files['conf.d/keymaps']['KEYMAP'] = self.keymap.GetValue() etc_files['conf.d/keymaps']['SET_WINDOWSKEYS'] = self.windowkeys.GetValue() if self.extkeymap.GetValue() != "": etc_files['conf.d/keymaps']['EXTENDED_KEYMAPS'] = self.extkeymap.GetValue() if self.font.GetValue(): if not "conf.d/consolefont" in etc_files: etc_files['conf.d/consolefont'] = {} etc_files['conf.d/consolefont']['CONSOLEFONT'] = self.font.GetValue() etc_files['conf.d/clock']['CLOCK'] = self.clock.GetValue() etc_files['rc.conf']['EDITOR'] = self.editor.GetValue() if self.displaymanager.GetValue() != "": etc_files['rc.conf']['DISPLAYMANAGER'] = self.displaymanager.GetValue() if self.xsession.GetValue() != "": etc_files['rc.conf']['XSESSION'] = self.xsession.GetValue() try: self.controller.install_profile.set_etc_files(etc_files) except: msgbox=Widgets().error_Box("Error","An internal error occurred!") msgbox.run() msgbox.destroy() return value
def deactivate(self): value = True etc_files = self.controller.install_profile.get_etc_files() etc_files = self.create_etc_files(etc_files) if self.keymap.GetValue(): etc_files['conf.d/keymaps']['KEYMAP'] = self.keymap.GetValue() etc_files['conf.d/keymaps'][ 'SET_WINDOWSKEYS'] = self.windowkeys.GetValue() if self.extkeymap.GetValue() != "": etc_files['conf.d/keymaps'][ 'EXTENDED_KEYMAPS'] = self.extkeymap.GetValue() if self.font.GetValue(): if not "conf.d/consolefont" in etc_files: etc_files['conf.d/consolefont'] = {} etc_files['conf.d/consolefont'][ 'CONSOLEFONT'] = self.font.GetValue() etc_files['conf.d/clock']['CLOCK'] = self.clock.GetValue() etc_files['rc.conf']['EDITOR'] = self.editor.GetValue() if self.displaymanager.GetValue() != "": etc_files['rc.conf'][ 'DISPLAYMANAGER'] = self.displaymanager.GetValue() if self.xsession.GetValue() != "": etc_files['rc.conf']['XSESSION'] = self.xsession.GetValue() try: self.controller.install_profile.set_etc_files(etc_files) except: msgbox = Widgets().error_Box("Error", "An internal error occurred!") msgbox.run() msgbox.destroy() return value
def deactivate(self): value = True rc_conf = self.generate_rc_conf_dictionary() #print "saving:"+str(rc_conf) try: self.etc_files['rc.conf'] = rc_conf self.controller.install_profile.set_etc_files(self.etc_files) except: msgbox=Widgets().error_Box("Error","An internal error occurred!") msgbox.run() msgbox.destroy() return value
def verify_root_password(self, widget, data=None): if self.root1.get_text() == self.root2.get_text() and self.root1.get_text()!="": # passwords match! self.root_verified = True # disable the boxen self.root1.set_sensitive(False) self.root2.set_sensitive(False) self.verified.set_from_stock(gtk.STOCK_APPLY, gtk.ICON_SIZE_SMALL_TOOLBAR) else: # password's don't match. msgbox=Widgets().error_Box("Error","Passwords do not match! ( or they are blank )") msgbox.run() msgbox.destroy()
def deactivate(self): value = True rc_conf = self.generate_rc_conf_dictionary() #print "saving:"+str(rc_conf) try: self.etc_files['rc.conf'] = rc_conf self.controller.install_profile.set_etc_files(self.etc_files) except: msgbox = Widgets().error_Box("Error", "An internal error occurred!") msgbox.run() msgbox.destroy() return value
def deactivate(self): # store everything if (self.root_verified): if self.is_root_pass_set(): # don't hash the password, just store it root_hash = self.root1.get_text() else: # hash the password root_hash = GLIUtility.hash_password(self.root1.get_text()) # store the root password self.controller.install_profile.set_root_pass_hash( None, root_hash, None) # now store all the entered users #( <user name>, <password hash>, (<tuple of groups>), <shell>, # <home directory>, <user id>, <user comment> ) # retrieve everything data = self.get_treeview_data() stored_users = [] # get the array of stored usernames for item in list(self.controller.install_profile.get_users()): stored_users.append(item[0]) for user in data: if user[0] not in self.current_users and user[ 0] not in stored_users: # user is not in stored profile, and hasn't been previously added self.controller.install_profile.add_user( None, (user[0], user[1], user[2], user[3], user[4], user[5], user[6]), None) #self.current_users.append(user[0]) elif user[0] in stored_users: # user is in stored profile, need to remove, then readd the user self.controller.install_profile.remove_user(user[0]) self.controller.install_profile.add_user( None, (user[0], user[1], user[2], user[3], user[4], user[5], user[6]), None) #self.current_users.append(user[0]) return True else: msgbox = Widgets().error_Box( "Error", "You have not verified your root password!") msgbox.run() msgbox.destroy()
def save_clicked(self, widget, data=None): # retrieve the data data = self.get_information() # only proceed if the ethernet device isn't blank if data["ethernet_device"] != "": # save the gateway if its not set # the user must unset the gateway to change it to a different device. if self.widgets["gateway"].get_text() != "": self.gateway[0] = self.widgets["ethernet_device"].get_child().get_text() self.gateway[1] = self.widgets["gateway"].get_text() self.gateway_is_set = True # this will occur when the gateway is unset! if self.widgets["gateway"].get_text() == "" and self.gateway_is_set == True and \ self.widgets["ethernet_device"].get_child().get_text() == self.gateway[0]: self.gateway[0] = "" self.gateway[1] = "" self.gateway_is_set = False if self.gateway_is_set == True and self.widgets["ethernet_device"].get_child().get_text() == self.gateway[0]: gateway = self.gateway[1] else: gateway = "" # store it in the top box. self.add_to_treedata([0, data["ethernet_device"], data["ipaddress"], data["broadcast"], data["netmask"], data["dhcp_options"],gateway]) else: msgdialog = Widgets().error_Box("No Ethernet Device","Please enter a device!") result = msgdialog.run() msgdialog.destroy()
def verify_root_password(self, widget, data=None): if self.root1.get_text() == self.root2.get_text( ) and self.root1.get_text() != "": # passwords match! self.root_verified = True # disable the boxen self.root1.set_sensitive(False) self.root2.set_sensitive(False) self.verified.set_from_stock(gtk.STOCK_APPLY, gtk.ICON_SIZE_SMALL_TOOLBAR) else: # password's don't match. msgbox = Widgets().error_Box( "Error", "Passwords do not match! ( or they are blank )") msgbox.run() msgbox.destroy()
def add_user(self, data): return_val = False # test to make sure uid is an INT!!! if data["userid"] != "": test = False try: uid_test = int(data["userid"]) test = True except: # its not an integer, raise the exception. msgbox = Widgets().error_Box( "Error", "UID must be an integer, and you entered a string!") msgbox.run() msgbox.destroy() else: test = True if self.is_data_empty(data) and test == True: # now add it to the box # ( <user name>, <password hash>, (<tuple of groups>), <shell>, # <home directory>, <user id>, <user comment> ) # if they were previously added, modify them if self.is_in_treeview(data['username']): list = self.find_iter(data) self.treedata.set(list[data['username']], 0, data["password"], 1, data['username'], 2, data["groups"], 3, data["shell"], 4, data["homedir"], 5, data["userid"], 6, data["comment"]) else: self.treedata.append([ data["password"], data["username"], data["groups"], data["shell"], data["homedir"], data["userid"], data["comment"] ]) #self.current_users.append(data['username']) return_val = True return return_val
def deactivate(self): # store everything if (self.root_verified): if self.is_root_pass_set(): # don't hash the password, just store it root_hash = self.root1.get_text() else: # hash the password root_hash = GLIUtility.hash_password(self.root1.get_text()) # store the root password self.controller.install_profile.set_root_pass_hash(None,root_hash,None) # now store all the entered users #( <user name>, <password hash>, (<tuple of groups>), <shell>, # <home directory>, <user id>, <user comment> ) # retrieve everything data = self.get_treeview_data() stored_users = [] # get the array of stored usernames for item in list(self.controller.install_profile.get_users()): stored_users.append(item[0]) for user in data: if user[0] not in self.current_users and user[0] not in stored_users: # user is not in stored profile, and hasn't been previously added self.controller.install_profile.add_user(None, (user[0], user[1], user[2], user[3], user[4], user[5], user[6]), None) #self.current_users.append(user[0]) elif user[0] in stored_users: # user is in stored profile, need to remove, then readd the user self.controller.install_profile.remove_user(user[0]) self.controller.install_profile.add_user(None, (user[0], user[1], user[2], user[3], user[4], user[5], user[6]), None) #self.current_users.append(user[0]) return True else: msgbox=Widgets().error_Box("Error","You have not verified your root password!") msgbox.run() msgbox.destroy()
def add_user(self,data): return_val = False # test to make sure uid is an INT!!! if data["userid"] != "": test = False try: uid_test = int(data["userid"]) test = True except: # its not an integer, raise the exception. msgbox=Widgets().error_Box("Error","UID must be an integer, and you entered a string!") msgbox.run() msgbox.destroy() else: test = True if self.is_data_empty(data) and test==True: # now add it to the box # ( <user name>, <password hash>, (<tuple of groups>), <shell>, # <home directory>, <user id>, <user comment> ) # if they were previously added, modify them if self.is_in_treeview(data['username']): list = self.find_iter(data) self.treedata.set(list[data['username']],0,data["password"], 1,data['username'], 2,data["groups"], 3,data["shell"], 4,data["homedir"], 5,data["userid"], 6,data["comment"] ) else: self.treedata.append([data["password"],data["username"], data["groups"], data["shell"], data["homedir"], data["userid"], data["comment"]]) #self.current_users.append(data['username']) return_val=True return return_val
def deactivate(self): return_value = False # save everything to profile interfaces={} # iterate over the liststore store = self.widgets["treedata"] iter = store.get_iter_first() while(iter != None): number, device, ip, broadcast, netmask, options, gateway = store.get(iter, 0, 1, 2, 3, 4, 5, 6) if ip != "dhcp": interfaces[device] = (ip, broadcast, netmask) else: print options interfaces[device]=(ip, options, None) if gateway != "": # store the gateway try: self.controller.install_profile.set_default_gateway(None,self.gateway[1], \ {'interface':self.gateway[0]}) except: msgdialog=Widgets().error_Box("Malformed IP","Malformed IP address in your gateway!") result = msgdialog.run() msgdialog.destroy() return False iter = store.iter_next(iter) # If there are no interfaces configured, confirm this is what the user actually wants if not interfaces: msgdlg = gtk.MessageDialog(parent=self.controller.window, type=gtk.MESSAGE_QUESTION, buttons=gtk.BUTTONS_YES_NO, message_format="You have not configured any interfaces. Continue?") resp = msgdlg.run() msgdlg.destroy() if resp == gtk.RESPONSE_NO: return False # store the stuff try: self.controller.install_profile.set_network_interfaces(interfaces) except: msgdialog=Widgets().error_Box("Malformed IP","Malformed IP address in one of your interfaces!") result = msgdialog.run() msgdialog.destroy() return False # store dnsdomainname and hostname hostname = self.widgets["hostname"].get_text() domainname = self.widgets["domainname"].get_text() if( hostname != "" and domainname != ""): self.controller.install_profile.set_hostname(None, hostname, None) self.controller.install_profile.set_domainname(None, domainname, None) return_value = True elif( self.first_run == True): msgdialog=Widgets().error_Box("Missing information","You didn't set your hostname and/or dnsdomainname!") result = msgdialog.run() msgdialog.destroy() return_value = False else: return_value = True return return_value