当前位置: 首页>>代码示例>>Python>>正文


Python CDMLib.dlgTextEntry方法代码示例

本文整理汇总了Python中CDMLib.dlgTextEntry方法的典型用法代码示例。如果您正苦于以下问题:Python CDMLib.dlgTextEntry方法的具体用法?Python CDMLib.dlgTextEntry怎么用?Python CDMLib.dlgTextEntry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CDMLib的用法示例。


在下文中一共展示了CDMLib.dlgTextEntry方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: SpecialRecordAdd

# 需要导入模块: import CDMLib [as 别名]
# 或者: from CDMLib import dlgTextEntry [as 别名]
    def SpecialRecordAdd(self, ClickedPanel):
        """ Add a special record - In this case this means a new population set
            Generated from a distribution population set """
        if ClickedPanel != None:
            RecordID = ClickedPanel.Key
            if (RecordID == 0 or RecordID == None) or not DB.PopulationSets.has_key(RecordID):
                ReturnRecord = None
            else:
                if not DB.PopulationSets[RecordID].IsDistributionBased():
                    # This is a data population set
                    cdml.dlgSimpleMsg(
                        "ERROR",
                        "This population set is not based on distribution and therefore cannot be used to generate new population data",
                        Parent=self,
                    )
                    ReturnRecord = None
                else:
                    # This means this population set is defined by distributions
                    dlg = wx.NumberEntryDialog(
                        self,
                        "Define population size",
                        "Please enter the size of the population to generate ",
                        "Population Size",
                        1000,
                        0,
                        100000,
                    )
                    dlg.CenterOnScreen()
                    if dlg.ShowModal() != wx.ID_OK:
                        # If 'Cancel' button is clicked
                        ReturnRecord = None
                    else:
                        NumberOfIndividuals = dlg.GetValue()  # Get selection index
                        dlg.Destroy()
                        PopulationTraceBack = None
                        # When in admin mode, also ask for traceback info
                        AskForTraceBack = cdml.GetAdminMode()
                        if AskForTraceBack:
                            TraceBackText = cdml.dlgTextEntry(
                                Message="Please enter the Pickled TraceBack information as appear in the hidden report of the population you are trying to reconstruct ",
                                Caption="Enter Pickled TraceBack Info",
                                DefaultValue="",
                                Parent=self,
                            )
                            if TraceBackText == "":
                                PopulationTraceBack = None
                            else:
                                try:
                                    PopulationTraceBack = DB.pickle.loads(TraceBackText)
                                except:
                                    raise ValueError, "TraceBack Error: Could not properly extract TraceBack - please make sure a proper TraceBack was entered"
                                    PopulationTraceBack = None

                        TheProgressDialog = None
                        try:
                            # version 2.5 does not support canceling simulation
                            TheProgressDialog = cdml.ProgressDialogTimeElapsed(
                                Parent=self, StartTimerUponCreation=False, AllowCancel=DB.SystemSupportsProcesses
                            )
                            # Define the Function to run on a thread/process
                            def GenerationStartMiniScript():
                                "Compile and execute the generation"
                                Pop = DB.PopulationSets[RecordID]
                                # Compile the generation script with default options
                                ScriptFileNameFullPath = Pop.CompilePopulationGeneration(
                                    GeneratedPopulationSize=NumberOfIndividuals,
                                    GenerationFileNamePrefix=None,
                                    OutputFileNamePrefix=None,
                                    RandomStateFileNamePrefix=None,
                                    GenerationOptions=None,
                                    RecreateFromTraceBack=PopulationTraceBack,
                                )
                                # run the generation script
                                DeleteScriptFileAfterRun = not cdml.GetAdminMode()
                                (ProcessList, PipeList) = Pop.RunPopulationGeneration(
                                    GenerationFileName=ScriptFileNameFullPath,
                                    NumberOfProcessesToRun=-1,
                                    DeleteScriptFileAfterRun=DeleteScriptFileAfterRun,
                                )
                                return (ProcessList, PipeList)

                            def GenerationEndMiniScript(ProcessList, PipeList):
                                "Complete Generation by collecting results"
                                Pop = DB.PopulationSets[RecordID]
                                # Collect the results
                                RetVal = Pop.CollectResults(ProcessList, PipeList)
                                return RetVal

                            ThreadObject = cdml.WorkerThread(GenerationStartMiniScript, GenerationEndMiniScript)
                            # Tell the dialog box what to do when cancel is pressed
                            TheProgressDialog.FunctionToRunUponCancel = ThreadObject.StopProcess
                            # Now start the timer for the progress dialog box
                            TheProgressDialog.StartTimer()
                            # wait until thread/process exits
                            Info = ThreadObject.WaitForJob()
                            # Cancel through the dialog box is no longer possible
                            TheProgressDialog.FunctionToRunUponCancel = None
                            # Properly destroy the dialog

                            WasCanceled = TheProgressDialog.WasCanceled
#.........这里部分代码省略.........
开发者ID:Jacob-Barhak,项目名称:MIST,代码行数:103,代码来源:PopulationSets.py

示例2: OnLeftDblClick

# 需要导入模块: import CDMLib [as 别名]
# 或者: from CDMLib import dlgTextEntry [as 别名]
    def OnLeftDblClick(self, event):
        """ Event handler to open child form"""

        ctrl = event.GetEventObject()

        type = ''
        if ctrl.Id == cdml.IDF_BUTTON3: # Population Set
            cc = self.cc_pset
            id_obj = cc.GetValue()
            form = 'PopulationSets'

        elif ctrl.Id == cdml.IDF_BUTTON4 : # Primary Model
            cc = self.cc_model
            id_obj = cc.GetValue()
            form = 'StudyModels'

        elif ctrl.Id == cdml.IDP_BUTTON4:
            # The notes rule text
            cc = ctrl
            TheTextControl = cc
            id_obj = cc.GetValue()
            DefaultText = id_obj
            form = ''

        else:

            cc = ctrl.GetParent()
            TheTextControl = cc.GetTextCtrl()
            if cc.Id == cdml.IDF_BUTTON1:
                id_obj = cc.GetValue()
                form = 'PopulationSets'

            elif cc.Id == cdml.IDF_BUTTON2:
                id_obj = cc.GetValue()
                form = 'StudyModels'

           
            else:
                id_obj = str(cc.GetValueString())
                DefaultText = id_obj

                if cc.Id == cdml.IDP_BUTTON1:
                    form = 'Parameters'
                    type = ['System Option']*(self.curPage==0) + ['Number','Integer','State Indicator']


                elif cc.Id == cdml.IDP_BUTTON2:
                    form = ''
                    type = 'Expression'

                elif cc.Id == cdml.IDP_BUTTON3:
                    form = ''
                    type = 'Expression'
                    if ('CostWizard' in DefaultText):
                        form = 'WIZARD'

        self.curCtrl = cc

        if form == 'WIZARD':
            try:
                Sequence = DB.CostWizardParserForGUI(DefaultText, True)
                dlg_wizard = Wizard.WizardDialog(data=Sequence, parent=self)
                dlg_wizard.CenterOnScreen()

                dlg_wizard.Show()
                dlg_wizard.MyMakeModal()
    
            except:
                cdml.dlgErrorMsg(Parent = self)

        elif form == '':
            TheText = cdml.dlgTextEntry(Message = 'Modify Text and Press OK, or Press Cancel to ignore changes', Caption = type, DefaultValue = DefaultText, Parent = self)
            TheTextControl.SetValue(str(TheText))
            # make sure focus returne properly to this form
            self.MyMakeModal()  
            self.Raise()
            
        else:
            if id_obj == 0 or id_obj == '' : id_obj = -1
            cdml.OpenForm(form, self, cdml.ID_MODE_SINGL, id_obj, type, self.idPrj)
开发者ID:arturochian,项目名称:MIST,代码行数:82,代码来源:Project.py


注:本文中的CDMLib.dlgTextEntry方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。