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


Python wx.SingleChoiceDialog方法代码示例

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


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

示例1: OnRemoveSlaveMenu

# 需要导入模块: import wx [as 别名]
# 或者: from wx import SingleChoiceDialog [as 别名]
def OnRemoveSlaveMenu(self, event):
        slavenames = self.NodeList.GetSlaveNames()
        slaveids = self.NodeList.GetSlaveIDs()
        dialog = wx.SingleChoiceDialog(self.Frame, _("Choose a slave to remove"), _("Remove slave"), slavenames)
        if dialog.ShowModal() == wx.ID_OK:
            choice = dialog.GetSelection()
            result = self.NodeList.RemoveSlaveNode(slaveids[choice])
            if not result:
                slaveids.pop(choice)
                current = self.NetworkNodes.GetSelection()
                self.NetworkNodes.DeletePage(choice + 1)
                if self.NetworkNodes.GetPageCount() > 0:
                    new_selection = min(current, self.NetworkNodes.GetPageCount() - 1)
                    self.NetworkNodes.SetSelection(new_selection)
                    if new_selection > 0:
                        self.NodeList.SetCurrentSelected(slaveids[new_selection - 1])
                self.RefreshBufferState()
            else:
                self.ShowErrorMessage(result)
        dialog.Destroy() 
开发者ID:jgeisler0303,项目名称:CANFestivino,代码行数:22,代码来源:networkeditortemplate.py

示例2: OnExecute

# 需要导入模块: import wx [as 别名]
# 或者: from wx import SingleChoiceDialog [as 别名]
def OnExecute(parentWin, page):
    rdtype=None
    rtypes=[]
    for type in prioTypes:
      rtypes.append("%s - %s" % (type, DnsSupportedTypes[type]))
    for type in sorted(DnsSupportedTypes.keys()):
      if type not in prioTypes and type not in individualTypes:
        rtypes.append("%s - %s" % (type, DnsSupportedTypes[type]))
      
    dlg=wx.SingleChoiceDialog(parentWin, xlt("record type"), "Select record type", rtypes)
    if dlg.ShowModal() == wx.ID_OK:
      rdtype=rdatatype.from_text(dlg.GetStringSelection().split(' ')[0])
      dlg=page.EditDialog(rdtype)(parentWin, page.lastNode, "", rdtype)
      dlg.page=page
      if dlg.GoModal():
        page.Display(None, False) 
开发者ID:andreas-p,项目名称:admin4,代码行数:18,代码来源:Zone.py

示例3: OnCmdOpen

# 需要导入模块: import wx [as 别名]
# 或者: from wx import SingleChoiceDialog [as 别名]
def OnCmdOpen(self, dummyEvent):
        if self.CheckNeedsSave():
            return
        dialog = wx.SingleChoiceDialog(
            self,
            'Choose a language to edit',
            'Choose a language',
            self.langNames,
            wx.CHOICEDLG_STYLE
        )
        try:
            x = self.langKeys.index(Config.language)
        except ValueError:
            x = 0
        dialog.SetSelection(x)
        if dialog.ShowModal() == wx.ID_OK:
            self.LoadLanguage(self.langKeys[dialog.GetSelection()])
        dialog.Destroy() 
开发者ID:EventGhost,项目名称:EventGhost,代码行数:20,代码来源:LanguageEditor.py

示例4: on_button_new

# 需要导入模块: import wx [as 别名]
# 或者: from wx import SingleChoiceDialog [as 别名]
def on_button_new(self, event):  # wxGlade: DeviceManager.<event_handler>
        names = [name for name in self.device.registered['device']]
        dlg = wx.SingleChoiceDialog(None, _('What type of device is being added?'), _('Device Type'), names)
        dlg.SetSelection(0)
        if dlg.ShowModal() == wx.ID_OK:
            device_type = dlg.GetSelection()
            device_type = names[device_type]
        else:
            dlg.Destroy()
            return
        dlg.Destroy()
        device_uid = 0
        while device_uid <= 100:
            device_uid += 1
            device_match = self.device.read_persistent(str, 'device_name', default='', uid=device_uid)
            if device_match == '':
                break
        self.device.write_persistent('device_name', device_type, uid=device_uid)
        self.device.write_persistent('autoboot', True, uid=device_uid)
        devices = [d for d in self.device.list_devices.split(';') if d != '']
        devices.append(str(device_uid))
        self.device.list_devices = ';'.join(devices)
        self.device.write_persistent('list_devices', self.device.list_devices)
        self.refresh_device_list() 
开发者ID:meerk40t,项目名称:meerk40t,代码行数:26,代码来源:DeviceManager.py

示例5: AddNewJump

# 需要导入模块: import wx [as 别名]
# 或者: from wx import SingleChoiceDialog [as 别名]
def AddNewJump(self, bbox, wire=None):
        choices = []
        for block in self.Blocks.itervalues():
            if isinstance(block, SFC_Step):
                choices.append(block.GetName())
        dialog = wx.SingleChoiceDialog(self.ParentWindow,
                                       _("Add a new jump"),
                                       _("Please choose a target"),
                                       choices,
                                       wx.DEFAULT_DIALOG_STYLE | wx.OK | wx.CANCEL)
        if dialog.ShowModal() == wx.ID_OK:
            id = self.GetNewId()
            jump = SFC_Jump(self, dialog.GetStringSelection(), id)
            self.Controler.AddEditedElementJump(self.TagName, id)
            self.AddNewElement(jump, bbox, wire)
        dialog.Destroy() 
开发者ID:thiagoralves,项目名称:OpenPLC_Editor,代码行数:18,代码来源:Viewer.py

示例6: Display_Exception_Dialog

# 需要导入模块: import wx [as 别名]
# 或者: from wx import SingleChoiceDialog [as 别名]
def Display_Exception_Dialog(e_type,e_value,e_tb):
    trcbck_lst = []
    for i,line in enumerate(traceback.extract_tb(e_tb)):
        trcbck = " " + str(i+1) + _(". ")
        if line[0].find(os.getcwd()) == -1:
            trcbck += _("file : ") + str(line[0]) + _(",   ")
        else:
            trcbck += _("file : ") + str(line[0][len(os.getcwd()):]) + _(",   ")
        trcbck += _("line : ") + str(line[1]) + _(",   ") + _("function : ") + str(line[2])
        trcbck_lst.append(trcbck)
        
    # Allow clicking....
    cap = wx.Window_GetCapture()
    if cap:
        cap.ReleaseMouse()

    dlg = wx.SingleChoiceDialog(None, 
        _("""
An error happens.

Click on OK for saving an error report.

Please be kind enough to send this file to:
edouard.tisserant@gmail.com


Error:
""") +
        str(e_type) + _(" : ") + str(e_value), 
        _("Error"),
        trcbck_lst)
    try:
        res = (dlg.ShowModal() == wx.ID_OK)
    finally:
        dlg.Destroy()

    return res 
开发者ID:jgeisler0303,项目名称:CANFestivino,代码行数:39,代码来源:objdictedit.py

示例7: _ask_count

# 需要导入模块: import wx [as 别名]
# 或者: from wx import SingleChoiceDialog [as 别名]
def _ask_count(self, insert=True):
        # helper for next method (insertion/adding of multiple slots)
        choices = [str(n) for n in range(1,11)]
        if insert:
            dlg = wx.SingleChoiceDialog(None, "Select number of slots to be inserted", "Insert Slots", choices)
        else:
            dlg = wx.SingleChoiceDialog(None, "Select number of slots to be added", "Add Slots", choices)
        ret = 0  if dlg.ShowModal()==wx.ID_CANCEL  else   int(dlg.GetStringSelection())
        dlg.Destroy()
        return ret 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:12,代码来源:edit_sizers.py

示例8: handler_audio

# 需要导入模块: import wx [as 别名]
# 或者: from wx import SingleChoiceDialog [as 别名]
def handler_audio(sel_res):
            audio_info = sel_res.getAllAudioInfo()
            if audio_info:
                dlg = wx.SingleChoiceDialog(gui.frame_parse, u'Pick the AUDIO you prefer', u'Audio Choice', audio_info)
                if dlg.ShowModal() == wx.ID_OK:
                    index = audio_info.index(dlg.GetStringSelection())
                    sel_res.setSelAudio(index)
                    dlg.Destroy()
                else:
                    dlg.Destroy()
                    return False

            return True 
开发者ID:ZSAIm,项目名称:iqiyi-parser,代码行数:15,代码来源:flow.py

示例9: EditJumpContent

# 需要导入模块: import wx [as 别名]
# 或者: from wx import SingleChoiceDialog [as 别名]
def EditJumpContent(self, jump):
        choices = []
        for block in self.Blocks.itervalues():
            if isinstance(block, SFC_Step):
                choices.append(block.GetName())
        dialog = wx.SingleChoiceDialog(self.ParentWindow,
                                       _("Edit jump target"),
                                       _("Please choose a target"),
                                       choices,
                                       wx.DEFAULT_DIALOG_STYLE | wx.OK | wx.CANCEL)
        try:
            indx = choices.index(jump.GetTarget())
            dialog.SetSelection(indx)
        except ValueError:
            pass

        if dialog.ShowModal() == wx.ID_OK:
            value = dialog.GetStringSelection()
            rect = jump.GetRedrawRect(1, 1)
            jump.SetTarget(value)
            rect = rect.Union(jump.GetRedrawRect())
            self.RefreshJumpModel(jump)
            self.RefreshBuffer()
            self.RefreshScrollBars()
            self.RefreshVisibleElements()
            jump.Refresh(rect)
        dialog.Destroy() 
开发者ID:thiagoralves,项目名称:OpenPLC_Editor,代码行数:29,代码来源:Viewer.py

示例10: AddJump

# 需要导入模块: import wx [as 别名]
# 或者: from wx import SingleChoiceDialog [as 别名]
def AddJump(self):
        if isinstance(self.SelectedElement, SFC_Step) and not self.SelectedElement.Output:
            choices = []
            for block in self.Blocks:
                if isinstance(block, SFC_Step):
                    choices.append(block.GetName())
            dialog = wx.SingleChoiceDialog(self.ParentWindow,
                                           _("Add a new jump"),
                                           _("Please choose a target"),
                                           choices,
                                           wx.DEFAULT_DIALOG_STYLE | wx.OK | wx.CANCEL)
            if dialog.ShowModal() == wx.ID_OK:
                value = dialog.GetStringSelection()
                self.SelectedElement.AddOutput()
                self.RefreshStepModel(self.SelectedElement)
                step_connectors = self.SelectedElement.GetConnectors()
                transition = self.CreateTransition(step_connectors["output"])
                transition_connectors = transition.GetConnectors()
                id = self.GetNewId()
                jump = SFC_Jump(self, value, id)
                pos = transition_connectors["output"].GetPosition(False)
                jump.SetPosition(pos.x, pos.y + SFC_WIRE_MIN_SIZE)
                self.AddBlock(jump)
                self.Controler.AddEditedElementJump(self.TagName, id)
                jump_connector = jump.GetConnector()
                wire = self.ConnectConnectors(jump_connector, transition_connectors["output"])
                transition.RefreshOutputPosition()
                wire.SetPoints([wx.Point(pos.x, pos.y + SFC_WIRE_MIN_SIZE), wx.Point(pos.x, pos.y)])
                self.RefreshJumpModel(jump)
                self.RefreshBuffer()
                self.RefreshScrollBars()
                self.Refresh(False)
            dialog.Destroy() 
开发者ID:thiagoralves,项目名称:OpenPLC_Editor,代码行数:35,代码来源:SFCViewer.py

示例11: Display_Exception_Dialog

# 需要导入模块: import wx [as 别名]
# 或者: from wx import SingleChoiceDialog [as 别名]
def Display_Exception_Dialog(e_type, e_value, e_tb, bug_report_path, exit):
    trcbck_lst = []
    for i, line in enumerate(traceback.extract_tb(e_tb)):
        trcbck = " " + str(i+1) + ". "
        if line[0].find(os.getcwd()) == -1:
            trcbck += "file : " + str(line[0]) + ",   "
        else:
            trcbck += "file : " + str(line[0][len(os.getcwd()):]) + ",   "
        trcbck += "line : " + str(line[1]) + ",   " + "function : " + str(line[2])
        trcbck_lst.append(trcbck)

    # Allow clicking....
    cap = wx.Window_GetCapture()
    if cap:
        cap.ReleaseMouse()

    dlg = wx.SingleChoiceDialog(
        None,
        _("""
An unhandled exception (bug) occured. Bug report saved at :
(%s)

Please be kind enough to send this file to:
beremiz-devel@lists.sourceforge.net

You should now restart program.

Traceback:
""") % bug_report_path +
        repr(e_type) + " : " + repr(e_value),
        _("Error"),
        trcbck_lst)
    try:
        res = (dlg.ShowModal() == wx.ID_OK)
    finally:
        dlg.Destroy()

    if exit:
        sys.exit()  # wx.Exit()

    return res 
开发者ID:thiagoralves,项目名称:OpenPLC_Editor,代码行数:43,代码来源:ExceptionHandler.py

示例12: OnSuggest

# 需要导入模块: import wx [as 别名]
# 或者: from wx import SingleChoiceDialog [as 别名]
def OnSuggest(self, event):
        if not self.sc.word:
            return

        isAllCaps = self.sc.word == util.upper(self.sc.word)
        isCapitalized = self.sc.word[:1] == util.upper(self.sc.word[:1])

        word = util.lower(self.sc.word)

        wl = len(word)
        wstart = word[:2]
        d = 500
        fifo = util.FIFO(5)
        wx.BeginBusyCursor()

        for w in spellcheck.prefixDict[util.getWordPrefix(word)]:
            if w.startswith(wstart):
                d = self.tryWord(word, wl, w, d, fifo)

        for w in self.gScDict.words.iterkeys():
            if w.startswith(wstart):
                d = self.tryWord(word, wl, w, d, fifo)

        for w in self.ctrl.sp.scDict.words.iterkeys():
            if w.startswith(wstart):
                d = self.tryWord(word, wl, w, d, fifo)

        items = fifo.get()

        wx.EndBusyCursor()

        if len(items) == 0:
            wx.MessageBox("No similar words found.", "Results",
                          wx.OK, self)

            return

        dlg = wx.SingleChoiceDialog(
            self, "Most similar words:", "Suggestions", items)

        if dlg.ShowModal() == wx.ID_OK:
            sel = dlg.GetSelection()

            newWord = items[sel]

            if isAllCaps:
                newWord = util.upper(newWord)
            elif isCapitalized:
                newWord = util.capitalize(newWord)

            self.replaceEntry.SetValue(newWord)

        dlg.Destroy()

    # if w2 is closer to w1 in Levenshtein distance than d, add it to
    # fifo. return min(d, new_distance). 
开发者ID:trelby,项目名称:trelby,代码行数:58,代码来源:spellcheckdlg.py

示例13: OnFileOpen

# 需要导入模块: import wx [as 别名]
# 或者: from wx import SingleChoiceDialog [as 别名]
def OnFileOpen(self,event):
		""" 
		Open a csv data file and plot the data. Detuning is assumed to be in GHz. 
		Vertical units are assumed to be the same as in the theory curves 
		"""
		self.dirname= ''
		dlg_choice = wx.SingleChoiceDialog(self,"Choose type of data to be imported","Data import",choices=OutputTypes)
		
		# wait for OK to be clicked
		if dlg_choice.ShowModal() == wx.ID_OK:
			choice = dlg_choice.GetSelection()
			#print 'Choice:', choice
			self.expt_type = OutputTypes[choice]
			# use the choice index to select which axes the data appears on	- may be different 
			# if axes order is rearranged later?
			self.choice_index = OutputTypes_index[choice]
			#print self.choice_index
			
			dlg_choice.Destroy()
		
			dlg_open = wx.FileDialog(self,"Choose 2-column csv file (Detuning, Transmission)",
									self.dirname,"","*.csv",wx.FD_OPEN)
			
			# if OK button clicked, open and read file
			if dlg_open.ShowModal() == wx.ID_OK:
				#set experimental display on, and update menus
				self.display_expt_curves[self.choice_index] = True
				#self.showEplotsSubMenu.GetMenuItems()[self.choice_index].Check(True)
			
				self.filename = dlg_open.GetFilename()
				self.dirname = dlg_open.GetDirectory()
				#call read
				self.x_expt_arrays[self.choice_index],self.y_expt_arrays[self.choice_index] = np.loadtxt(os.path.join(self.dirname,self.filename),delimiter=',',usecols=[0,1]).T
				
				#overwrite fit_array data - i.e. last data to be loaded
				self.x_fit_array = self.x_expt_arrays[self.choice_index]
				self.y_fit_array = self.y_expt_arrays[self.choice_index]
				
				# implicit that the fit type is the same as last data imported
				self.fit_datatype = self.expt_type
				
				## create main plot				
				self.OnCreateAxes(self.figs[0],self.canvases[0],clear_current=True)
				
				
			dlg_open.Destroy() 
开发者ID:jameskeaveney,项目名称:ElecSus,代码行数:48,代码来源:elecsus_gui.py

示例14: OnBrowseButtonClick

# 需要导入模块: import wx [as 别名]
# 或者: from wx import SingleChoiceDialog [as 别名]
def OnBrowseButtonClick(self, event):
        # pop up the location browser dialog
        dialog = BrowseLocationsDialog(self, self.VarType, self.Controller)
        if dialog.ShowModal() == wx.ID_OK:
            infos = dialog.GetValues()
        else:
            infos = None
        dialog.Destroy()

        if infos is not None:
            location = infos["location"]
            # set the location
            if not infos["location"].startswith("%"):
                dialog = wx.SingleChoiceDialog(
                    self,
                    _("Select a variable class:"),
                    _("Variable class"),
                    [_("Input"), _("Output"), _("Memory")],
                    wx.DEFAULT_DIALOG_STYLE | wx.OK | wx.CANCEL)
                if dialog.ShowModal() == wx.ID_OK:
                    selected = dialog.GetSelection()
                else:
                    selected = None
                dialog.Destroy()
                if selected is None:
                    self.Location.SetFocus()
                    return
                if selected == 0:
                    location = "%I" + location
                elif selected == 1:
                    location = "%Q" + location
                else:
                    location = "%M" + location

            self.Location.SetValue(location)
            self.VariableName = infos["var_name"]
            self.VarType = infos["IEC_type"]

            # when user selected something, end editing immediately
            # so that changes over multiple colums appear
            wx.CallAfter(self.Parent.Parent.CloseEditControl)

        self.Location.SetFocus() 
开发者ID:thiagoralves,项目名称:OpenPLC_Editor,代码行数:45,代码来源:LocationCellEditor.py


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