def launch(self, doDebug = None): if doDebug: print "initializing sbcomplete module" self.vbox = gtk.VBox() self.vbox.set_size_request(400, 200) msg = (_("Setup Complete")) title_pix = functions.imageFromFile("workstation.png") internalVBox = gtk.VBox() internalVBox.set_border_width(10) label = gtk.Label(_("Your SpeechBridge setup is almost complete, but you still need to install your license key(s) and configure SpeechBridge from the administration website. " "If you are installing a SpeechBridge Pro system, or are including the TTS upgrade, you will need to log in and run the following command from a terminal:\n /home/speechbridge/software/neoinstall.sh\n" # "After you click 'Finish', click the \"Restart\" link at the bottom of the login screen in order to make sure all of the settings have taken effect. " # "After the system reboots, you will be taken to the login screen where " "After you click 'Finish' you will be taken to the login screen where " "you can start the SpeechBridge web administration " "site by launching Firefox and going to \"https://localhost\", or " "you can also start it from a browser on another machine by replacing " "\"localhost\" with the IP address you specified in the network configuration earlier. Enjoy! " "")) label.set_line_wrap(True) label.set_alignment(0.0, 0.5) label.set_size_request(500, -1) internalVBox.pack_start(label, False, True) self.vbox.pack_start(internalVBox, False, 5) pix = functions.ditheredImageFromFile("splash-small.png") self.vbox.pack_start(pix, True, True, 5) return self.vbox, title_pix, msg
def launch(self, doDebug=None): self.doDebug = doDebug if self.doDebug: print "initializing smolt module" self.vbox = gtk.VBox() self.vbox.set_size_request(400, 200) msg = (_("Hardware Profile")) title_pix = functions.imageFromFile("smolt.png") internalVBox = gtk.VBox() internalVBox.set_border_width(10) internalVBox.set_spacing(5) textBuffer = gtk.TextBuffer() textView = gtk.TextView() textView.set_editable(False) textSW = gtk.ScrolledWindow() textSW.set_shadow_type(gtk.SHADOW_IN) textSW.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) textSW.add(textView) label = gtk.Label( _("Smolt is a hardware profiler for The Fedora " "Project. Submitting your profile is a great way to give back " "to the community as this information is used to help focus our" " efforts on popular hardware and platforms. Submissions are " "anonymous. Sending your profile will enable a monthly update.") ) label.set_line_wrap(True) label.set_alignment(0.0, 0.5) label.set_size_request(500, -1) internalVBox.pack_start(label, False, True) iter = textBuffer.get_iter_at_offset(0) for line in os.popen('/usr/bin/smoltSendProfile -p', 'r'): textBuffer.insert(iter, line) textView.set_buffer(textBuffer) self.okButton = gtk.RadioButton(None, (_("_Send Profile"))) self.noButton = gtk.RadioButton(self.okButton, (_("D_o not send profile"))) self.noButton.set_active(True) internalVBox.pack_start(textSW, True) internalVBox.pack_start(self.okButton, False) internalVBox.pack_start(self.noButton, False) self.vbox.pack_start(internalVBox, True, 5) return self.vbox, title_pix, msg
def launch(self, doDebug = None): self.doDebug = doDebug if self.doDebug: print "initializing smolt module" self.vbox = gtk.VBox() self.vbox.set_size_request(400, 200) msg = (_("Hardware Profile")) title_pix = functions.imageFromFile("smolt.png") internalVBox = gtk.VBox() internalVBox.set_border_width(10) internalVBox.set_spacing(5) textBuffer = gtk.TextBuffer() textView = gtk.TextView() textView.set_editable(False) textSW = gtk.ScrolledWindow() textSW.set_shadow_type(gtk.SHADOW_IN) textSW.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) textSW.add(textView) label = gtk.Label(_("Smolt is a hardware profiler for The Fedora " "Project. Submitting your profile is a great way to give back " "to the community as this information is used to help focus our" " efforts on popular hardware and platforms. Submissions are " "anonymous. Sending your profile will enable a monthly update.")) label.set_line_wrap(True) label.set_alignment(0.0, 0.5) label.set_size_request(500, -1) internalVBox.pack_start(label, False, True) iter = textBuffer.get_iter_at_offset(0) for line in os.popen('/usr/bin/smoltSendProfile -p', 'r'): textBuffer.insert(iter, line) textView.set_buffer(textBuffer) self.okButton = gtk.RadioButton(None, (_("_Send Profile"))) self.noButton = gtk.RadioButton(self.okButton, (_("D_o not send profile"))) self.noButton.set_active(True) internalVBox.pack_start(textSW, True) internalVBox.pack_start(self.okButton, False) internalVBox.pack_start(self.noButton, False) self.vbox.pack_start(internalVBox, True, 5) return self.vbox, title_pix, msg
def loadModules(self): self.moduleList = [] self.moduleDict = {} # Generate a list of all of the module files (which becomes the list of # all non-hidden files in the directory with extensions other than .py. files = os.listdir(self.modulePath) lst = [] for f in files: if f[0] == '.': continue if f[-3:] != ".py": continue lst.append(f[:-3]) # Import each module, and filter out those for module in lst: cmd = ("import %s\nif %s.__dict__.has_key('childWindow'):" "obj = %s.childWindow()") % (module, module, module) try: exec(cmd) except: print _("module import of %s failed: %s") % (module, sys.exc_type) continue # if the exec fails, skip this module try: obj = obj except NameError: continue # XXX - hack to allow firstboot to pass in the parent class into language # this will allow the language module to change firstboot's current locale if module == "language" or hasattr(obj, "needsparent"): obj.passInParent(self) # if a module decides not to run, skip it first before trying any # of the other hooks. bz #158095 if hasattr(obj, "skipme"): # the module itself has decided for some reason that # that it should not be shown, so skip it continue # if the module needs network access, and we dont have it, skip # the module if hasattr(obj, "needsnetwork"): if not self.checkNetwork(): # we need a way to run some stuff from the modules # if they have no network if hasattr(obj, "noNetwork"): obj.noNetwork() continue # If the module defines a moduleClass, it has to match the mode # we're starting up in, otherwise it's always used. Add it to # a dictionary keyed by the module's declared priority. if hasattr(obj, "moduleClass"): if (self.doReconfig and (obj.moduleClass == "reconfig")): self.moduleDict[float(obj.runPriority)] = obj elif (not self.doReconfig and (obj.moduleClass != "reconfig")): self.moduleDict[float(obj.runPriority)] = obj else: self.moduleDict[float(obj.runPriority)] = obj # Get the list of module priorities, sort them to determine a run # order, and build a list with the modules in the proper order. modulePriorityList = self.moduleDict.keys() modulePriorityList.sort() # Add the modules to the proper lists. pages = 0 sidebarIndex = -1 self.moduleNameToIndex = {} for priority in modulePriorityList: # Add the module to the list of modules. module = self.moduleDict[priority] # Launch the module's GUI. vbox = None if self.doDebug: try: print "calling", module.moduleName result = module.launch(self.doDebug) if result is None: continue else: vbox, pix, title = result except: import exceptionWindow (ty, value, tb) = sys.exc_info() lst = traceback.format_exception(ty, value, tb) text = string.joinfields(lst, "") exceptionWindow.ExceptionWindow(module, text) pass else: try: result = module.launch() if result is None: continue else: vbox, pix, title = result except: import exceptionWindow (ty, value, tb) = sys.exc_info() lst = traceback.format_exception(ty, value, tb) text = string.joinfields(lst, "") exceptionWindow.ExceptionWindow(module, text) pass continue if vbox and title: # If it launched, add it to the module list. self.moduleList.append(module) title_label = gtk.Label("") title_label.set_alignment(0.0, 0.5) title_label.set_markup( "<span foreground='#000000' size='30000' font_family='Helvetica'><b>%s</b></span>" % (_(title))) titleBox = gtk.HBox() if pix: titleBox.pack_start(pix, False) titleBox.pack_start(title_label, True) titleBox.set_spacing(8) vbox.pack_start(titleBox, False) vbox.reorder_child(titleBox, 0) if self.lowRes: # If we're in 640x480 mode, remove the title bars vbox.remove(vbox.get_children()[0]) # If the module has a name, add it to the list of labels if hasattr(module, "moduleName"): if not hasattr(module, "noSidebar") or getattr( module, "noSidebar") == False: hbox = gtk.HBox(False, 5) pix = functions.imageFromFile("pointer-blank.png") label = gtk.Label("") label.set_markup( "<span foreground='#FFFFFF'><b>%s</b></span>" % (_(module.moduleName))) label.set_alignment(0.0, 0.5) # Wrap the lines if they're too long label.set_line_wrap(True) (w, h) = self.leftEventBox.get_size_request() label.set_size_request((int)(w * 0.8), -1) # Make sure the arrow is at the top of any wrapped line alignment = gtk.Alignment(yalign=0.2) alignment.add(pix) hbox.pack_start(alignment, False) hbox.pack_end(label, True) self.leftVBox.pack_start(hbox, False, True, 3) sidebarIndex += 1 # we need a non tranlated name for each module so we can # jump around self.moduleNameToIndex[module.__module__] = (pages, sidebarIndex) self.notebook.append_page(vbox, gtk.Label(_(module.moduleName))) else: self.notebook.append_page(vbox, gtk.Label(" ")) self.moduleNameToIndex["unamemodule-%s" % pages] = (pages, sidebarIndex) pages += 1
def launch(self, doDebug=None): self.doDebug = doDebug self.admin = libuser.admin() if doDebug: print "initializing networking module" self.usernameEntry = gtk.Entry() self.fullnameEntry = gtk.Entry() self.passwordEntry = gtk.Entry() self.passwordEntry.set_visibility(False) self.confirmEntry = gtk.Entry() self.confirmEntry.set_visibility(False) self.vbox = gtk.VBox() self.vbox.set_size_request(400, 200) title_pix = functions.imageFromFile("networking.png") internalVBox = gtk.VBox() internalVBox.set_border_width(10) internalVBox.set_spacing(10) label = gtk.Label( _("In order to correctly configure networking for your SpeechBridge appliance, please follow the instructions below:\n" " 1.) Select eth0 in the list below and click the 'Change Network Configuration' button.\n" " 2.) Select the eth0 device in the 'Networking' window, click the 'Edit' button, change to a static IP address, and click 'OK'.\n" " 3.) In the menu, select: File -> Save, and click the 'OK' button.\n" " 4.) Click the 'Deactivate' button, then the 'Activate' button.\n" " 5.) Select the 'DNS' tab and again select: File -> Save, and click the 'OK' button.\n" " 6.) Close the 'Networking' window and click the 'Forward' button to move to the next step.\n" "")) label.set_line_wrap(True) label.set_alignment(0.0, 0.5) label.set_size_request(500, -1) internalVBox.pack_start(label, False, True) self.deviceStore = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING) self.deviceView = gtk.TreeView() self.deviceView.set_size_request(-1, 200) self.deviceView.set_model(self.deviceStore) self.deviceSW = gtk.ScrolledWindow() self.deviceSW.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) self.deviceSW.set_shadow_type(gtk.SHADOW_IN) self.deviceSW.add(self.deviceView) self.deviceBox = gtk.HBox() self.deviceBox.pack_start(self.deviceSW, True) col = gtk.TreeViewColumn(_("Network Device"), gtk.CellRendererText(), text=0) self.deviceView.append_column(col) col = gtk.TreeViewColumn(_("Boot protocol"), gtk.CellRendererText(), text=1) self.deviceView.append_column(col) internalVBox.pack_start(self.deviceBox, False) self.updateLabels() networkButton = gtk.Button(_("_Change Network Configuration...")) networkButton.connect("clicked", self.run_neat) align = gtk.Alignment() align.add(networkButton) align.set(1.0, 0.5, 0.1, 1.0) internalVBox.pack_start(align, False) self.vbox.pack_start(internalVBox, False, 15) users = self.admin.enumerateUsersFull() self.normalUsersList = [] for userEnt in users: uidNumber = int(userEnt.get(libuser.UIDNUMBER)[0]) if uidNumber == 500: self.usernameEntry.set_text(userEnt.get(libuser.USERNAME)[0]) self.fullnameEntry.set_text(userEnt.get(libuser.GECOS)[0]) return self.vbox, title_pix, self.moduleName
def launch(self, doDebug=None): self.doDebug = doDebug self.admin = libuser.admin() if doDebug: print "initializing networking module" self.usernameEntry = gtk.Entry() self.fullnameEntry = gtk.Entry() self.passwordEntry = gtk.Entry() self.passwordEntry.set_visibility(False) self.confirmEntry = gtk.Entry() self.confirmEntry.set_visibility(False) self.vbox = gtk.VBox() self.vbox.set_size_request(400, 200) title_pix = functions.imageFromFile("networking.png") internalVBox = gtk.VBox() internalVBox.set_border_width(10) internalVBox.set_spacing(10) label = gtk.Label( _("The devices listed below have been detected on the system." "You must change the configuration for 'eth0' from DHCP to static-IP addressing (or reserve the IP address in your DHCP server.) " "Once you have saved your static IP, you will need to click 'Deactivate', then 'Activate', and close the Networking window. " "Then click 'Change...' again and set IP address for your DNS server. (This extra step will ensure that the DNS setting is properly saved.) " "")) label.set_line_wrap(True) label.set_alignment(0.0, 0.5) label.set_size_request(500, -1) internalVBox.pack_start(label, False, True) self.deviceStore = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING) self.deviceView = gtk.TreeView() self.deviceView.set_size_request(-1, 200) self.deviceView.set_model(self.deviceStore) self.deviceSW = gtk.ScrolledWindow() self.deviceSW.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) self.deviceSW.set_shadow_type(gtk.SHADOW_IN) self.deviceSW.add(self.deviceView) self.deviceBox = gtk.HBox() self.deviceBox.pack_start(self.deviceSW, True) col = gtk.TreeViewColumn(_("Network Device"), gtk.CellRendererText(), text=0) self.deviceView.append_column(col) col = gtk.TreeViewColumn(_("Boot protocol"), gtk.CellRendererText(), text=1) self.deviceView.append_column(col) internalVBox.pack_start(self.deviceBox, False) self.updateLabels() networkButton = gtk.Button(_("_Change Network Configuration...")) networkButton.connect("clicked", self.run_neat) align = gtk.Alignment() align.add(networkButton) align.set(1.0, 0.5, 0.1, 1.0) internalVBox.pack_start(align, False) self.vbox.pack_start(internalVBox, False, 15) users = self.admin.enumerateUsersFull() self.normalUsersList = [] for userEnt in users: uidNumber = int(userEnt.get(libuser.UIDNUMBER)[0]) if uidNumber == 500: self.usernameEntry.set_text(userEnt.get(libuser.USERNAME)[0]) self.fullnameEntry.set_text(userEnt.get(libuser.GECOS)[0]) return self.vbox, title_pix, self.moduleName