def OnRunSimpleWizard(self, evt): # Create the wizard and the pages wizard = wiz.Wizard(self, -1, "Simple Wizard", images.WizTest1.GetBitmap()) page1 = TitledPage(wizard, "Page 1") page2 = TitledPage(wizard, "Page 2") page3 = TitledPage(wizard, "Page 3") page4 = TitledPage(wizard, "Page 4") self.page1 = page1 page1.sizer.Add( wx.StaticText( page1, -1, """ This wizard is totally useless, but is meant to show how to chain simple wizard pages together in a non-dynamic manner. IOW, the order of the pages never changes, and so the wxWizardPageSimple class can easily be used for the pages.""")) wizard.FitToPage(page1) page4.sizer.Add(wx.StaticText(page4, -1, "\nThis is the last page.")) # Use the convenience Chain function to connect the pages wiz.WizardPageSimple.Chain(page1, page2) wiz.WizardPageSimple.Chain(page2, page3) wiz.WizardPageSimple.Chain(page3, page4) wizard.GetPageAreaSizer().Add(page1) if wizard.RunWizard(page1): wx.MessageBox("Wizard completed successfully", "That's all folks!") else: wx.MessageBox("Wizard was cancelled", "That's all folks!")
def runPublicWizard(Parent_, PrjResFileName_): """ Запуск визарда создания пакета публикации. @param Parent_: Родительское окно. @param PrjResFileName_: Имя ресурса проекта. """ public_maker = zipPublicSystem(ic_file.DirName(PrjResFileName_)) wiz = wizard.Wizard(Parent_, -1, u'Создание пакета публикации', imglib.imgInstallWizard) page = PublicPage(wiz, u'Атрибуты пакета публикации', public_maker) wiz.FitToPage(page) if wiz.RunWizard(page): # Сохранить атрибуты проекта public_maker.setPrjName(page.sizer.evalSpace['_dict_obj']['TextPrjName'].GetValue()) public_maker.setAutoVer(page.sizer.evalSpace['_dict_obj']['AutoVerCheckBox'].GetValue()) public_maker.setPrjVersion(page.sizer.evalSpace['_dict_obj']['TextVersion'].GetValue()) public_maker.setArchivator(page.sizer.evalSpace['_dict_obj']['TextArchiveSys'].GetValue()) public_maker.makeInstallPackage() ic_dlg.icMsgBox(u'ВНИМАНИЕ', u'Создан пакет публикации.') else: ic_dlg.icMsgBox(u'ВЫХОД', u'Выход из визарда создания пакета публикации')
def runDemoWizard(Parent_, PrjResFileName_): """ Запуск визарда создания инсталяционного пакета. @param Parent_: Родительское окно. @param PrjResFileName_: Имя ресурса проекта. """ install_maker = py2exeInstallSystem(os.path.dirname(PrjResFileName_)) wiz = wizard.Wizard(Parent_, -1, u'Создание демо-проекта', imglib.imgInstallWizard) page = DemoPage(wiz, u'Атрибуты демо-проекта', install_maker) wiz.FitToPage(page) if wiz.RunWizard(page): # Сохранить атрибуты проекта install_maker.setPrjName(page.sizer.evalSpace['_dict_obj']['TextPrjName'].GetValue()) install_maker.setPrjTitle(page.sizer.evalSpace['_dict_obj']['TextDiscr'].GetValue()) install_maker.setPrjAuthor(page.sizer.evalSpace['_dict_obj']['TextAuthor'].GetValue()) install_maker.setPrjCopyright(page.sizer.evalSpace['_dict_obj']['TextCopyright'].GetValue()) install_maker.setPrjIcon(page.sizer.evalSpace['_dict_obj']['TextIcon'].GetValue()) install_maker.setConsole(page.sizer.evalSpace['_dict_obj']['ConsoleCheckBox'].GetValue()) install_maker.makeInstallPackage() ic_dlg.icMsgBox(u'ВНИМАНИЕ', u'Создан демо-проект.') else: ic_dlg.icMsgBox(u'ВЫХОД', u'Выход из визарда создания демо-проекта')
def show_wizard(): wizard = wiz.Wizard(None, -1, _("Pieberry Setup Wizard")) page1 = SelRootPage(wizard) page2 = SelDeskPage(wizard) wiz.WizardPageSimple_Chain(page1, page2) wizard.FitToPage(page1) a = wizard.RunWizard(page1) wizard.Destroy() return a, (page1.rootdirctrl.GetPath(), page2.deskdirctrl.GetPath())
def RunWizard(parent): """ Create the wizard and the pages. """ wizard = wiz.Wizard(parent, -1, _('Create Component Wizard'), common.imgUserCompWizard) page1 = FirstPage(wizard, _('Base parameters')) page2 = AttrPage(wizard, _('Class attributes')) page3 = MsgPage(wizard, _('Event attributes')) page4 = EditModulPage(wizard, _('Edit module')) parent.page1 = page1 wizard.FitToPage(page1) page1.SetNext(page2) page2.SetPrev(page1) page2.SetNext(page3) page3.SetPrev(page2) page3.SetNext(page4) page4.SetPrev(page3) if wizard.RunWizard(page1): # Сохраняем модуль в библиотеке пользовательских компонентов txt = page4.editor.GetText() if resource.icGetResPath(): user_mod_dir = resource.icGetResPath() + '/usercomponents' else: user_mod_dir = None if not user_mod_dir: module_name = resource.icGetICPath( ) + '/components/user/' + page4.modulName.GetLabel() elif not os.path.isdir(user_mod_dir): # Создаем пакет ic_res.CreatePackage(user_mod_dir) module_name = user_mod_dir + '/' + page4.modulName.GetLabel() else: module_name = user_mod_dir + '/' + page4.modulName.GetLabel() bCr = wx.ID_YES if os.path.isfile(module_name): bCr = msg.MsgBox(None, _('Module %s already exist. Rewrite?') % module_name, style=wx.YES_NO | wx.NO_DEFAULT) if bCr == wx.ID_YES: f = open(module_name, 'w') io_prnt.outLog(u'CREATE MODULE: <%s>' % module_name) f.write(txt.encode('utf-8')) f.close() wx.MessageBox(_('Module %s is created.') % module_name, '') else: wx.MessageBox(_('Wizard was cancelled'), u'')
def Run(self): global x2ProfilerApp x2ProfilerApp = self self.DetermineProfilesPaths() self.repo = None self.changes = False ### for debugging ### self.repo_url = 'D:\\tmp\\.x2sw' self.repo_url = 'http://github.com/dob71/x2sw_profiles.git' self.selection = None self.tmp_repo_path = None image = wx.Image(self.imagefile("wiz.png"), wx.BITMAP_TYPE_PNG).ConvertToBitmap() self.wizard = wiz.Wizard(None, -1, "X2 Profile Manager", image) self.page1 = UpdateRepoPage(self.wizard, "Update Profiles") self.page2 = DownloadingPage(self.wizard, "Downloading") self.page3 = SelectProfilesPage(self.wizard, "Select Profile") self.page4 = ChooseModePage(self.wizard, "Storage Mode") self.page5 = DeployPage(self.wizard, "Deploy Profile") self.page6 = ReportResultPage(self.wizard, "Deploying") # Set the initial order of the pages self.page1.SetNext(self.page2) self.page2.SetPrev(self.page1) self.page2.SetNext(self.page3) self.page3.SetPrev(self.page1) # Always skip downloading page on the way back self.page3.SetNext(self.page4) self.page4.SetPrev(self.page3) self.page4.SetNext(self.page5) self.page5.SetPrev(self.page4) self.page5.SetNext(self.page6) self.page6.SetPrev(self.page5) iconpath = os.path.join(os.path.abspath(os.path.dirname(sys.argv[0])), 'x2.ico') if os.path.exists(iconpath): self.wizard.SetIcon(wx.Icon(iconpath,wx.BITMAP_TYPE_ICO)) self.wizard.Bind(wiz.EVT_WIZARD_PAGE_CHANGING, self.OnPageChanging) self.wizard.Bind(wx.wizard.EVT_WIZARD_PAGE_CHANGED, self.OnPageChanged) self.wizard.FitToPage(self.page1) self.wizard.GetPageAreaSizer().Add(self.page1) self.wizard.RunWizard(self.page1) self.wizard.Destroy() if not x2ProfilerApp.tmp_repo_path == None: try: shutil.rmtree(x2ProfilerApp.tmp_repo_path) x2ProfilerApp.tmp_repo_path = None except: pass return self.changes
def __init__(self): """ Initializes the wizard """ self.wizard = wiz.Wizard(None, -1, "HeRoN network creation wizard") self.wizard.SetPageSize(wx.Size(402, 416)) self.page1 = ParametersPage(self.wizard) self.page2 = ProgressPage(self.wizard) self.page3 = SavePage(self.wizard) wiz.WizardPageSimple_Chain(self.page1, self.page2) wiz.WizardPageSimple_Chain(self.page2, self.page3)
def ShowModal(self): wizard = wiz.Wizard(self.parent, -1, _("Create new test run")) page1 = SelectProductDatabasePage( wizard, _("Step 1/4: Select product database"), self.config['lastafdir']) page2 = SelectTestsuitePage(wizard, _("Step 2/4: Select test suite")) page3 = EnterTestrunInfo(wizard, _("Step 3/4: Enter test description")) page4 = SelectOutputFilePage( wizard, _("Step 4/4: Select test run output file")) self.pages = (page1, page2, page3, page4) wiz.WizardPageSimple_Chain(page1, page2) wiz.WizardPageSimple_Chain(page2, page3) wiz.WizardPageSimple_Chain(page3, page4) wizard.GetPageAreaSizer().Add(page1) return wizard.RunWizard(page1)
def __init__(self, parent, ID, title, pos, size, style): wx.Frame.__init__(self, parent, ID, title, pos, size, style) # bind event with its handlers. self.Bind(wiz.EVT_WIZARD_PAGE_CHANGING, self.OnWizPageChanging) self.Bind(wiz.EVT_WIZARD_PAGE_CHANGED, self.OnWizPageChanged) self.Bind(wiz.EVT_WIZARD_FINISHED, self.OnWizPageFinished) self.Bind(wiz.EVT_WIZARD_CANCEL, self.OnWizPageCancel) # Create the wizard and the its pages. self.wizard = wiz.Wizard(self, -1, "Mangalore Application Wizard", getwizimage1Bitmap()) self.page1 = TitledPage(self.wizard, "Mangalore AppWizard") self.page2 = AppGenPage(self.wizard, "General Setting", cwd) self.page3 = AppModPage(self.wizard, "Module Setting") #twhit self.page4 = DispPage (self.wizard, "Display Setting") self.page4 = AppEntryPage(self.wizard, "App Entry Setting") self.page5 = BldPage(self.wizard, "Bld File Setting") self.page6 = FinPage(self.wizard, "Finished", self) # Set the initial order of the pages. self.page1.SetNext(self.page2) self.page2.SetPrev(self.page1) self.page2.SetNext(self.page3) self.page3.SetPrev(self.page2) self.page3.SetNext(self.page4) self.page4.SetPrev(self.page3) self.page4.SetNext(self.page5) self.page5.SetPrev(self.page4) self.page5.SetNext(self.page6) self.page6.SetPrev(self.page5) #twhit self.page6.SetNext(self.page7) #twhit self.page7.SetPrev(self.page6) # specifies the size of the wizard. (set the wizard size fit to the page1) self.wizard.FitToPage(self.page1) # run self.wizard msgBoxTitle = "Mangalore Application Wizard" if self.wizard.RunWizard(self.page1): wx.MessageBox("AppWizard completed successfully", msgBoxTitle) else: wx.MessageBox("AppWizard was cancelled", msgBoxTitle)
def OnRunDynamicWizard(self, evt): # Create the wizard and the pages #wizard = wx.PreWizard() #wizard.SetExtraStyle(wx.WIZARD_EX_HELPBUTTON) #wizard.Create(self, self.ID_wiz, "Simple Wizard", # images.WizTest1.GetBitmap()) wizard = wiz.Wizard(self, -1, "Dynamic Wizard", images.WizTest1.GetBitmap()) page1 = TitledPage(wizard, "Page 1") page2 = SkipNextPage(wizard, "Page 2") page3 = TitledPage(wizard, "Page 3") page4 = UseAltBitmapPage(wizard, "Page 4") page5 = TitledPage(wizard, "Page 5") self.page1 = page1 page1.sizer.Add( wx.StaticText( page1, -1, """ This wizard shows the ability to choose at runtime the order of the pages and also which bitmap is shown. """)) wizard.FitToPage(page1) page5.sizer.Add(wx.StaticText(page5, -1, "\nThis is the last page.")) # Set the initial order of the pages page1.SetNext(page2) page2.SetPrev(page1) page2.SetNext(page3) page3.SetPrev(page2) page3.SetNext(page4) page4.SetPrev(page3) page4.SetNext(page5) page5.SetPrev(page4) wizard.GetPageAreaSizer().Add(page1) if wizard.RunWizard(page1): wx.MessageBox("Wizard completed successfully", "That's all folks!") else: wx.MessageBox("Wizard was cancelled", "That's all folks!")
def __init__(self, parent, title="", pagesinfo=[], values={}, bitmap=wx.NullBitmap): self.title = title self.pages = [] self.pagesinfo = pagesinfo self.values = values if bitmap and isinstance(bitmap, (str, unicode)): self.bitmap = wx.Image(bitmap).ConvertToBitmap() else: self.bitmap = bitmap self.wizard = wiz.Wizard(parent, -1, title=title, bitmap=self.bitmap, style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER) self.installPages() self.wizard.FitToPage(self.page1)
def run_wizard_first_run(parent): w = wiz.Wizard(parent, -1, "User Settings", wikimages.getWizLogoBitmap()) page_usercfg = WikPageConfigLocation(w) w.GetPageAreaSizer().Add(page_usercfg) if not w.RunWizard(page_usercfg): return None # user cancelled r = page_usercfg.get() if r == 0: startconfig(CfgPathUser()) elif r == 1: startconfig(CfgPathExe()) elif r == 2: wm.info( parent, "Run program with the '--cfgpath' option to set the folder location." ) sys.exit(0) else: raise Exception("Bad choice") return 0
def runInstallWizard(Parent_,PrjResFileName_): """ Запуск визарда создания инсталяционного пакета. @param Parent_: Родительское окно. @param PrjResFileName_: Имя ресурса проекта. """ install_maker = NullsoftInstallSystem(os.path.dirname(PrjResFileName_)) wiz = wizard.Wizard(Parent_, -1, u'Создание инсталяционного пакета проекта', imglib.imgInstallWizard) page1 = PrjAttrPage(wiz, u'Атрибуты инсталяционного пакета проекта', install_maker) page2 = PackagePage(wiz, u'Необходимые пакеты', install_maker) wiz.FitToPage(page1) page1.SetNext(page2) page2.SetPrev(page1) if wiz.RunWizard(page1): # Сохранить атрибуты проекта install_maker.setPrjName(page1.sizer.evalSpace['_dict_obj']['TextPrjName'].GetValue()) install_maker.setPrjTitle(page1.sizer.evalSpace['_dict_obj']['TextDiscr'].GetValue()) install_maker.setPrjAuthor(page1.sizer.evalSpace['_dict_obj']['TextAuthor'].GetValue()) install_maker.setPrjCopyright(page1.sizer.evalSpace['_dict_obj']['TextCopyright'].GetValue()) install_maker.setPrjIcon(page1.sizer.evalSpace['_dict_obj']['TextIcon'].GetValue()) install_maker.setInstallMaker(page1.sizer.evalSpace['_dict_obj']['TextInstallSys'].GetValue()) install_maker.setOpenSource(page1.sizer.evalSpace['_dict_obj']['OpenSourceCheckBox'].GetValue()) install_maker.setPackages(page2.sizer.evalSpace['_dict_obj']['packageList'].getStringsByCol(0)) install_maker.makeInstallPackage() ic_dlg.icMsgBox(u'ВНИМАНИЕ', u'Создан инсталяционный пакет проекта.') else: ic_dlg.icMsgBox(u'ВЫХОД', u'Выход из визарда создания инсталяционного пакета проекта')
def __init__(self, logfile=None, working_dir=None): if working_dir is not None: if not os.path.isdir(working_dir): os.makedirs(working_dir) print 'chdir', working_dir os.chdir(working_dir) self.working_dir = working_dir or '.' if logfile is None: self.app = wx.App(redirect=False) else: logfile = os.path.abspath(logfile) if os.path.isfile(logfile): os.remove(logfile) print 'All output will be redirected to %r' % (logfile) print 'When finished, press ENTER to close this program...' self.app = wx.App(redirect=True, filename=logfile) self.logfile = logfile print 'time.ctime()->%r' % (time.ctime()) print 'sys.executable=%r' % (sys.executable) print 'sys.path=%r' % (sys.path) print 'sys.platform=%r' % (sys.platform) print 'os.name=%r' % (os.name) print 'platform.uname()->%r' % (platform.uname(), ) print 'os.environ["PATH"]=%r' % (os.environ["PATH"]) print 'os.getcwd()->%r' % (os.getcwd()) print 'isadmin()->%r' % (isadmin()) wx.Frame.__init__(self, None, -1) self.Bind(wiz.EVT_WIZARD_PAGE_CHANGED, self.OnWizPageChanged) self.Bind(wiz.EVT_WIZARD_PAGE_CHANGING, self.OnWizPageChanging) #nb = wx.Notebook(self, -1) wizard = wiz.Wizard(self, -1, __file__) wizard.SetPageSize((600, 500)) wizard.model = self self.wizard = wizard
def ui_wizard(ui, parent): """ Creates a wizard-based wxPython user interface for a specified UI object. """ # Create the copy of the 'context' we will need while editing: context = ui.context ui._context = context new_context = {} for name, value in context.items(): if value is not None: new_context[name] = value.clone_traits() else: new_context[name] = None ui.context = new_context # Now bind the context values to the 'info' object: ui.info.bind_context() # Create the wxPython wizard window: title = ui.view.title if title == '': title = DefaultTitle ui.control = wizard = wz.Wizard(parent, -1, title) # Create all of the wizard pages: pages = [] editor_pages = [] info = ui.info shadow_group = ui.view.content.get_shadow(ui) min_dx = min_dy = 0 # Create a dictionary mapping each contained group in shadow_group to # its id and enabled_when fields. group_fields_mapping = {} for group in shadow_group.get_content(): # FIXME: When the group's id or enabled_when or visible_when is # set, the "fill_panel_for_group" will create a new Panel to hold the # contents of the group (instead of adding them to the page itself). # This leads to an incorrect sizing of the panel(not sure why # actually): example would be 'test_ui2.py' in # Traits/integrationtests/ui. In addition, # it leads to incorrect bindings (of the id) on the UIInfo object: # the id is bound to the GroupEditor created in "fill_panel.." # instead of the PageGroupEditor created here. # A simple solution is to clear out these fields before calling # "fill_panel_for_group", and then reset these traits. group_fields_mapping[group] = (group.id, group.enabled_when) (group.id, group.enabled_when) = ('', '') page = UIWizardPage(wizard, editor_pages) pages.append(page) fill_panel_for_group(page, group, ui) # Size the page correctly, then calculate cumulative minimum size: sizer = page.GetSizer() sizer.Fit(page) size = sizer.CalcMin() min_dx = max(min_dx, size.GetWidth()) min_dy = max(min_dy, size.GetHeight()) # If necessary, create a PageGroupEditor and attach it to the right # places: (group.id, group.enabled_when) = group_fields_mapping[group] if group.id or group.enabled_when: page.editor = editor = PageGroupEditor(control=page) if group.id: page.id = group.id editor_pages.append(page) info.bind(page.id, editor) if group.enabled_when: ui.add_enabled(group.enabled_when, editor) # Size the wizard correctly: wizard.SetPageSize(wx.Size(min_dx, min_dy)) # Set up the wizard 'page changing' event handler: wz.EVT_WIZARD_PAGE_CHANGING(wizard, wizard.GetId(), page_changing) # Size the wizard and the individual pages appropriately: prev_page = pages[0] wizard.FitToPage(prev_page) # Link the pages together: for page in pages[1:]: page.SetPrev(prev_page) prev_page.SetNext(page) prev_page = page # Finalize the display of the wizard: try: ui.prepare_ui() except: ui.control.Destroy() ui.control.ui = None ui.control = None ui.result = False raise # Position the wizard on the display: ui.handler.position(ui.info) # Restore the user_preference items for the user interface: restore_window(ui) # Run the wizard: if wizard.RunWizard(pages[0]): # If successful, apply the modified context to the original context: original = ui._context for name, value in ui.context.items(): if value is not None: original[name].copy_traits(value) else: original[name] = None ui.result = True else: ui.result = False # Clean up loose ends, like restoring the original context: save_window(ui) ui.finish() ui.context = ui._context ui._context = {}
+ self.Parent.outDB + '.' + self.Parent.outPerImage + '", "' + self.Parent.outDB + '.' + self.Parent.outPerObject + '", "' + self.Parent.outDB + '.' + prefix + '_table_index")') except: print('Logging merge to CPA_Merged_Tables.merged failed.') dlg.Destroy() dlg = wx.MessageDialog(self, 'Tables merged successfully!', 'Success!', wx.OK | wx.ICON_INFORMATION) dlg.ShowModal() app = wx.PySimpleApp() wizard = wiz.Wizard(None, -1, "Create Master Table", style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER) page1 = Page1(wizard) page2 = Page2(wizard) page3 = Page3(wizard) page4 = Page4(wizard) wiz.WizardPageSimple_Chain(page1, page2) wiz.WizardPageSimple_Chain(page2, page3) wiz.WizardPageSimple_Chain(page3, page4) wizard.FitToPage(page1) wizard.RunWizard(page1) wizard.Destroy() app.MainLoop()
def RunWizard(self): Wizard = wiz.Wizard(self.parent, -1, "RToolDS Setup Wizard", GFX.getGFX_WizardBitmap(), style=wx.DEFAULT_DIALOG_STYLE | wx.SYSTEM_MENU | wx.CLOSE_BOX) Page1 = TitledPage(Wizard, _("RToolDS Setup - Page") + " 1/7") Page2 = TitledPage(Wizard, _("RToolDS Setup - Page") + " 2/7") Page3 = TitledPage(Wizard, _("RToolDS Setup - Page") + " 3/7") Page4 = TitledPage(Wizard, _("RToolDS Setup - Page") + " 4/7") Page5 = TitledPage(Wizard, _("RToolDS Setup - Page") + " 5/7") Page6 = TitledPage(Wizard, _("RToolDS Setup - Page") + " 6/7") Page7 = TitledPage(Wizard, _("RToolDS Setup - Page") + " 7/7") # dialogTitle = _("Select Device Directory") + " : ", labelText = _("Device") + " : ") Page1.sizer.Add( wx.StaticText(Page1, -1, "Welcome to RToolDS Initial Configuration\n")) Page1.sizer.Add( wx.StaticText(Page1, -1, _("Please Select Your ROM Directory :"))) if sys.platform == "linux2" or sys.platform == "darwin": self.ROM_Path = filebrowse.DirBrowseButton( Page1, -1, labelText="", dialogTitle=_("Select ROMs Directory") + " : ", newDirectory=True, startDirectory=os.path.expanduser("~/")) self.ROM_Path.SetValue(os.path.expanduser("~/")) else: self.ROM_Path = filebrowse.DirBrowseButton( Page1, -1, labelText="", dialogTitle=_("Select ROMs Directory") + " : ", newDirectory=True) Page1.sizer.Add(self.ROM_Path, 0, wx.EXPAND | wx.TOP, 10) self.SubDirs = wx.RadioBox(Page1, -1, _('Search Sub-Directories?'), choices=[_('No'), _('Yes')]) self.SubDirs.SetStringSelection(_("Yes")) Page1.sizer.Add(self.SubDirs) Page1.sizer.Add( wx.StaticText( Page1, -1, "\n" + _("RToolDS accepts Uncompressed, Zip, 7-Zip and RAR archived ROM files." ))) Page2.sizer.Add( wx.StaticText( Page2, -1, _("Select a Default Save Game Database Directory :"))) self.Save_Path = filebrowse.DirBrowseButton( Page2, -1, labelText="", newDirectory=True, dialogTitle=_("Select Save Game Database Directory") + " : ", startDirectory=os.path.join(os.getcwd(), "cache", "saves")) # if sys.platform != "linux2": self.Save_Path.SetValue(os.path.join(os.getcwd(), "cache", "saves")) Page2.sizer.Add(self.Save_Path, 0, wx.EXPAND | wx.TOP, 10) Page2.sizer.Add( wx.StaticText( Page2, -1, "\n" + _("Note: Do not select a previous linker device save directory" ))) Page2.sizer.Add( wx.StaticText( Page2, -1, _("when choosing a location! Previous linker device saves will" ))) Page2.sizer.Add( wx.StaticText( Page2, -1, _("need to be imported within RToolDS before use, and any current" ))) Page2.sizer.Add( wx.StaticText( Page2, -1, _("saves within the chosen directory will not be automatically detected." ))) Page3.sizer.Add( wx.StaticText(Page3, -1, _("Select a Default Image Directory :"))) # Page3.sizer.Add ( wx.StaticText ( Page3, -1, _( "(It is Safe to Keep the Default)" ) ) ) self.Image_Path = filebrowse.DirBrowseButton( Page3, -1, labelText="", newDirectory=True, dialogTitle=_("Select Images Directory") + " : ", startDirectory=os.path.join(os.getcwd(), "cache", "img")) # if sys.platform != "linux2": self.Image_Path.SetValue(os.path.join(os.getcwd(), "cache", "img")) Page3.sizer.Add(self.Image_Path, 0, wx.EXPAND | wx.TOP, 10) Page3.sizer.Add( wx.StaticText(Page3, -1, "\n" + _("Select a Default NFO Directory :"))) self.NFO_Path = filebrowse.DirBrowseButton( Page3, -1, labelText="", newDirectory=True, dialogTitle=_("Select NFO Directory") + " : ", startDirectory=os.path.join(os.getcwd(), "cache", "nfo")) # if sys.platform != "linux2": self.NFO_Path.SetValue(os.path.join(os.getcwd(), "cache", "nfo")) Page3.sizer.Add(self.NFO_Path, 0, wx.EXPAND | wx.TOP, 10) Page3.sizer.Add( wx.StaticText( Page3, -1, "\n" + _("Note: Keeping the default directories is recommended."))) Page3.sizer.Add( wx.StaticText( Page3, -1, _("Directories will contain ROM images and NFO files,"))) Page3.sizer.Add( wx.StaticText( Page3, -1, _("downloaded during the update process, which are associated") )) Page3.sizer.Add( wx.StaticText(Page3, -1, _("with your ROM collection."))) self.Use_Trimmed = wx.RadioBox(Page4, -1, _('Enable ROM Trimming by default?'), choices=[_('No'), _('Yes')]) self.Use_Trimmed.SetStringSelection(_("Yes")) Page4.sizer.Add(self.Use_Trimmed) Page4.sizer.Add( wx.StaticText( Page4, -1, "\n" + _("Enabling this option saves memory, as all ROM files are"))) Page4.sizer.Add( wx.StaticText(Page4, -1, _("compressed before being copied to the device."))) self.DLGFX = wx.RadioBox( Page5, -1, _('Update Image and NFO Database upon initial start-up?'), choices=[_('No'), _('Yes')]) self.DLGFX.SetStringSelection(_("No")) Page5.sizer.Add(self.DLGFX) Page5.sizer.Add( wx.StaticText( Page5, -1, "\n" + _("Warning: This process will take a long time and requires"))) Page5.sizer.Add( wx.StaticText( Page5, -1, _("an Internet connection! This process includes updating Images and" ))) Page5.sizer.Add( wx.StaticText(Page5, -1, _("NFO files associated with your ROM collection."))) self.Find_Unknown = wx.RadioBox( Page6, -1, _('Enable Unknown/Homebrew ROM File Detection?'), choices=[_('No'), _('Yes')]) self.Find_Unknown.SetStringSelection(_("Yes")) Page6.sizer.Add(self.Find_Unknown) Page6.sizer.Add( wx.StaticText( Page6, -1, "\n" + _("Enabling this option allows RToolDS to detect ROMs which are not" ))) Page6.sizer.Add( wx.StaticText( Page6, -1, _("categorised in our database. This option is recommended and is required" ))) Page6.sizer.Add( wx.StaticText( Page6, -1, _("to detect newly released ROMs and uncategorised homebrew files." ))) Page7.sizer.Add( wx.StaticText(Page7, -1, _("Select Your Linker Device Drive :"))) self.Device_Path = filebrowse.DirBrowseButton( Page7, -1, labelText="", dialogTitle=_("Select Device Directory") + " : ", newDirectory=True) Page7.sizer.Add(self.Device_Path, 0, wx.EXPAND | wx.TOP, 10) Page7.sizer.Add( wx.StaticText(Page7, -1, "\n" + _("Select Your Linker Device Type :"))) self.Default_Device = wx.Choice(Page7, -1, choices=[]) for Device in Config.Config["Devices"]: if Device[2] != "": self.Default_Device.Append(Device[2]) Page7.sizer.Add(self.Default_Device, 0, wx.EXPAND | wx.TOP | wx.LEFT, 10) Page7.sizer.Add( wx.StaticText( Page7, -1, "\n" + _("Note: You can leave these options blank and select them at a" ))) Page7.sizer.Add( wx.StaticText( Page7, -1, _("later time from the options menu. Completing these selections enables" ))) Page7.sizer.Add( wx.StaticText( Page7, -1, _("enhanced RToolDS integration with your linker device."))) Wizard.FitToPage(Page1) wiz.WizardPageSimple_Chain(Page1, Page2) wiz.WizardPageSimple_Chain(Page2, Page3) wiz.WizardPageSimple_Chain(Page3, Page4) wiz.WizardPageSimple_Chain(Page4, Page5) wiz.WizardPageSimple_Chain(Page5, Page6) wiz.WizardPageSimple_Chain(Page6, Page7) Wizard.GetPageAreaSizer().Add(Page1) Wizard.Fit() Wizard.Layout() self.Wizard = Wizard self.Page1 = Page1 self.Page2 = Page2 self.Page3 = Page3 self.Page4 = Page4 self.Page5 = Page5 self.Page6 = Page6 self.Page7 = Page7 Wizard.Bind(wiz.EVT_WIZARD_PAGE_CHANGING, self.OnWizPageChanging) Result = Wizard.RunWizard(Page1) del (Wizard) return Result
path=os.getcwd(), style=wx.DIRP_USE_TEXTCTRL | wx.DIRP_DIR_MUST_EXIST) self.sizer.AddWindow((20, 20), 1) self.sizer.AddWindow(self.deskdirctrl, 0, wx.ALIGN_CENTRE | wx.EXPAND | wx.ALL, 5) self.sizer.AddWindow((20, 20), 1) def show_wizard(): wizard = wiz.Wizard(None, -1, _("Pieberry Setup Wizard")) page1 = SelRootPage(wizard) page2 = SelDeskPage(wizard) wiz.WizardPageSimple_Chain(page1, page2) wizard.FitToPage(page1) a = wizard.RunWizard(page1) wizard.Destroy() return a, (page1.rootdirctrl.GetPath(), page2.deskdirctrl.GetPath()) if __name__ == '__main__': app = wx.PySimpleApp() wizard = wiz.Wizard(None, -1, "Simple Wizard") page1 = SelRootPage(wizard) page2 = SelDeskPage(wizard) wiz.WizardPageSimple_Chain(page1, page2) wizard.FitToPage(page1) a = wizard.RunWizard(page1) print a wizard.Destroy() app.MainLoop()
def onPageChanged(event): if event.GetDirection(): # True means moving forward. page = event.GetPage() try: page._changedToThisPage(event) except AttributeError: pass if __name__ == '__main__': app = wx.PySimpleApp() id = wx.NewId() wizard = wiz.Wizard(None, id, "Summarize Sales For A Month") wizard.data = {} page1 = ChooseFolderPage(wizard) page2 = ReadyPage(wizard) page3 = FeedbackPage(wizard) page1.SetNext(page2) page2.SetPrev(page1) page2.SetNext(page3) wiz.EVT_WIZARD_PAGE_CHANGING(app, id, onPageChanging) wiz.EVT_WIZARD_PAGE_CHANGED(app, id, onPageChanged) wizard.FitToPage(page1) wizard.RunWizard(page1)
def run_wizard_create_wiki(parent): w = wiz.Wizard(parent, -1, "Add Wiki", wikimages.getWizLogoBitmap()) page_folder = WizPageFolder(w) page_format = WizPageFormat(w) page_html = WizPageHTMLName(w) page_sqlite = WizPageSQLiteName(w) page_server = WizPageServer(w) page_tuning = WizPageTuning(w) page_summary = WizPageSummary(w) page_folder.SetNext(page_format) page_format.SetPrev(page_folder) page_html.SetNext(page_server) page_sqlite.SetNext(page_server) page_server.SetNext(page_tuning) page_tuning.SetPrev(page_server) page_tuning.SetNext(page_summary) page_summary.SetPrev(page_tuning) # rest of links are set dynamically page_format.SetPages(page_html, page_sqlite, page_server) page_summary.SetPages(page_folder, page_format, page_html, page_sqlite, page_server, page_tuning) w.GetPageAreaSizer().Add(page_folder) if not w.RunWizard(page_folder): return None # user cancelled from wikklytext.scripts.wik import do_create_wiki path = page_folder.getfolder() kind = page_format.getformat() if kind == 0: kind = 'text' filename = None elif kind == 1: kind = 'tiddlywiki' filename = page_html.getfilename() elif kind == 2: kind = 'sqlite' filename = page_sqlite.getfilename() else: raise Exception("Bad format") addr = page_server.getaddr() port = int(page_server.getport()) prg = wx.ProgressDialog("Creating Wiki", ".....................................") do_create_wiki(path, kind, filename, addr, port, show_progress, prg) # set tuning parameters prg.Update(99, 'Tuning performance ...') wiki = WikklyWiki(path) storage = page_tuning.getstorage() if storage == 0: # local hard drive wiki.set_session_storage('file') wiki.set_session_timeout(60 * 60) wiki.set_cache_flag(True) wiki.set_metadb_flag(True) elif storage == 1: # network storage # file sessions are buggy over network storage wiki.set_session_storage('ram') wiki.set_session_timeout(60 * 60) wiki.set_cache_flag(True) wiki.set_metadb_flag(True) elif storage == 2: # USB # turn off all writing to conserve USB life wiki.set_session_storage('ram') wiki.set_session_timeout(60 * 60) wiki.set_cache_flag(False) wiki.set_metadb_flag(False) prg.Update(100, '') prg.Destroy() # else app will hang on exit wm.info( parent, "Wiki created OK!\n\nYou can now double-click on the wiki to run it and\nopen a browser window." ) return path
def ui_wizard(ui, parent): # Create the copy of the 'context' we will need while editing: context = ui.context ui._context = context new_context = {} for name, value in context.items(): new_context[name] = value.clone_traits() ui.context = new_context # Now bind the context values to the 'info' object: ui.info.bind_context() # Create the Tkinter wizard window: ui.control = wizard = wz.Wizard(parent, -1, ui.view.title) # Create all of the wizard pages: pages = [] editor_pages = [] info = ui.info shadow_group = ui.view.content.get_shadow(ui) min_dx = min_dy = 0 for group in shadow_group.get_content(): page = UIWizardPage(wizard, editor_pages) pages.append(page) fill_panel_for_group(page, group, ui) # Size the page correctly, then calculate cumulative minimum size: sizer = page.GetSizer() sizer.Fit(page) size = sizer.CalcMin() min_dx = max(min_dx, size.GetWidth()) min_dy = max(min_dy, size.GetHeight()) # If necessary, create a GroupEditor and attach it to the right places: id = group.id if id or group.enabled_when: page.editor = editor = GroupEditor(control=page) if id: page.id = id editor_pages.append(page) info.bind(id, editor) if group.enabled_when: ui.add_enabled(group.enabled_when, editor) # Size the wizard correctly: wizard.SetPageSize(wx.Size(min_dx, min_dy)) # Set up the wizard 'page changing' event handler: wz.EVT_WIZARD_PAGE_CHANGING(wizard, wizard.GetId(), page_changing) # Size the wizard and the individual pages appropriately: prev_page = pages[0] wizard.FitToPage(prev_page) # Link the pages together: for page in pages[1:]: page.SetPrev(prev_page) prev_page.SetNext(page) prev_page = page # Finalize the display of the wizard: try: ui.prepare_ui() except: ui.control.Destroy() ui.control.ui = None ui.control = None ui.result = False raise # Position the wizard on the display: ui.handler.position(ui.info) # Run the wizard: if wizard.RunWizard(pages[0]): # If successful, apply the modified context to the original context: original = ui._context for name, value in ui.context.items(): original[name].copy_traits(value) ui.result = True else: ui.result = False # Clean up loose ends, like restoring the original context: ui.control.Destroy() ui.control = None ui.context = ui._context ui._context = {}
def Run(self, onlyIfVersionCheckFails = False): global x2ProfilerApp x2ProfilerApp = self self.DetermineProfilesPaths() self.repo = None self.changes = False ### for debugging ### self.repo_url = 'D:\\tmp\\.x2sw' self.repo_url = 'https://github.com/dob71/x2sw_profiles.git' self.selection = None self.tmp_repo_path = None # Read our version (x2ProfilerApp.ver array contains strings from version.txt) self.ReadOurVersion() # If running for version check only, be done if have copatible profiles if onlyIfVersionCheckFails: if self.IsProfileCompatible(): return else: msg = "The current profile is not compatible with X2SW v" + self.ver[0] + ". "\ "Would you like to run X2Profiler and download compatible set of profiles? "\ "\n\n"\ "Click [Cancel] to mark the currnet profile compatible and no loger display this message "\ "(dangerous, the app might no longer start). Click [No] to skip the update just for now. "\ "You'll be asked to update again next time app starts."\ "\n\n"\ "Profile path: " + self.x2swProfilesPath res = wx.MessageBox(msg, style = wx.YES_NO|wx.CANCEL|wx.YES_DEFAULT|wx.ICON_QUESTION) if res == wx.CANCEL: self.UpdateCompatFile() return elif res == wx.NO: return image = wx.Image(self.imagefile("wiz.png"), wx.BITMAP_TYPE_PNG).ConvertToBitmap() self.wizard = wiz.Wizard(None, -1, "X2 Profile Manager", image) self.page1 = UpdateRepoPage(self.wizard, "Update Profiles") self.page2 = DownloadingPage(self.wizard, "Downloading") self.page3 = SelectProfilesPage(self.wizard, "Select Profile") self.page4 = ChooseModePage(self.wizard, "Storage Mode") self.page5 = DeployPage(self.wizard, "Deploy Profile") self.page6 = ReportResultPage(self.wizard, "Deploying") # Set the initial order of the pages self.page1.SetNext(self.page2) self.page2.SetPrev(self.page1) self.page2.SetNext(self.page3) self.page3.SetPrev(self.page1) # Always skip downloading page on the way back self.page3.SetNext(self.page4) self.page4.SetPrev(self.page3) self.page4.SetNext(self.page5) self.page5.SetPrev(self.page4) self.page5.SetNext(self.page6) self.page6.SetPrev(self.page5) iconpath = os.path.join(os.path.abspath(os.path.dirname(sys.argv[0])), 'x2.ico') if os.path.exists(iconpath): self.wizard.SetIcon(wx.Icon(iconpath,wx.BITMAP_TYPE_ICO)) self.wizard.Bind(wiz.EVT_WIZARD_PAGE_CHANGING, self.OnPageChanging) self.wizard.Bind(wx.wizard.EVT_WIZARD_PAGE_CHANGED, self.OnPageChanged) self.wizard.FitToPage(self.page1) self.wizard.GetPageAreaSizer().Add(self.page1) self.wizard.RunWizard(self.page1) self.wizard.Destroy() if not x2ProfilerApp.tmp_repo_path == None: try: shutil.rmtree(x2ProfilerApp.tmp_repo_path) x2ProfilerApp.tmp_repo_path = None except: pass return self.changes