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


Python wx.ID_CANCEL属性代码示例

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


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

示例1: __on_open

# 需要导入模块: import wx [as 别名]
# 或者: from wx import ID_CANCEL [as 别名]
def __on_open(self, _event):
        if not self.__save_warning():
            return

        defDir, defFile = '', ''
        if self._filename is not None:
            defDir, defFile = os.path.split(self._filename)
        dlg = wx.FileDialog(self,
                            'Open File',
                            defDir, defFile,
                            'rfmon files (*.rfmon)|*.rfmon',
                            wx.FD_OPEN | wx.FD_FILE_MUST_EXIST)
        if dlg.ShowModal() == wx.ID_CANCEL:
            return

        self.open(dlg.GetPath())

        self._isSaved = True
        self.__set_title() 
开发者ID:EarToEarOak,项目名称:RF-Monitor,代码行数:21,代码来源:gui.py

示例2: __save

# 需要导入模块: import wx [as 别名]
# 或者: from wx import ID_CANCEL [as 别名]
def __save(self, prompt):
        if prompt or self._filename is None:
            defDir, defFile = '', ''
            if self._filename is not None:
                defDir, defFile = os.path.split(self._filename)
            dlg = wx.FileDialog(self,
                                'Save File',
                                defDir, defFile,
                                'rfmon files (*.rfmon)|*.rfmon',
                                wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT)
            if dlg.ShowModal() == wx.ID_CANCEL:
                return
            self._filename = dlg.GetPath()

        self.__update_settings()
        save_recordings(self._filename,
                        self._settings.get_freq(),
                        self._settings.get_gain(),
                        self._settings.get_cal(),
                        self._settings.get_dynamic_percentile(),
                        self._monitors)
        self.__set_title()

        self._isSaved = True
        self.__set_title() 
开发者ID:EarToEarOak,项目名称:RF-Monitor,代码行数:27,代码来源:gui.py

示例3: createStockButton

# 需要导入模块: import wx [as 别名]
# 或者: from wx import ID_CANCEL [as 别名]
def createStockButton(parent, label):
    # wxMSW does not really have them: it does not have any icons and it
    # inconsistently adds the shortcut key to some buttons, but not to
    # all, so it's better not to use them at all on Windows.
    if misc.isUnix:
        ids = {
            "OK" : wx.ID_OK,
            "Cancel" : wx.ID_CANCEL,
            "Apply" : wx.ID_APPLY,
            "Add" : wx.ID_ADD,
            "Delete" : wx.ID_DELETE,
            "Preview" : wx.ID_PREVIEW
            }

        return wx.Button(parent, ids[label])
    else:
        return wx.Button(parent, -1, label)

# wxWidgets has a bug in 2.6 on wxGTK2 where double clicking on a button
# does not send two wx.EVT_BUTTON events, only one. since the wxWidgets
# maintainers do not seem interested in fixing this
# (http://sourceforge.net/tracker/index.php?func=detail&aid=1449838&group_id=9863&atid=109863),
# we work around it ourselves by binding the left mouse button double
# click event to the same callback function on the buggy platforms. 
开发者ID:trelby,项目名称:trelby,代码行数:26,代码来源:gutil.py

示例4: Save_Template_As

# 需要导入模块: import wx [as 别名]
# 或者: from wx import ID_CANCEL [as 别名]
def Save_Template_As(self, e):
            openFileDialog = wx.FileDialog(self, 'Save Template As', self.save_into_directory, '',
                                           'Content files (*.yaml; *.json)|*.yaml;*.json|All files (*.*)|*.*',
                                           wx.FD_SAVE | wx.wx.FD_OVERWRITE_PROMPT)
            if openFileDialog.ShowModal() == wx.ID_CANCEL:
                return
            json_ext = '.json'
            filename = openFileDialog.GetPath()
            self.status('Saving Template content...')
            h = open(filename, 'w')
            if filename[-len(json_ext):] == json_ext:
                h.write(self.report.template_dump_json().encode('utf-8'))
            else:
                h.write(self.report.template_dump_yaml().encode('utf-8'))
            h.close()
            self.status('Template content saved') 
开发者ID:hvqzao,项目名称:report-ng,代码行数:18,代码来源:gui.py

示例5: Save_Report_As

# 需要导入模块: import wx [as 别名]
# 或者: from wx import ID_CANCEL [as 别名]
def Save_Report_As(self, e):
            openFileDialog = wx.FileDialog(self, 'Save Report As', self.save_into_directory, '',
                                           'XML files (*.xml)|*.xml|All files (*.*)|*.*',
                                           wx.FD_SAVE | wx.wx.FD_OVERWRITE_PROMPT)
            if openFileDialog.ShowModal() == wx.ID_CANCEL:
                return
            filename = openFileDialog.GetPath()
            if filename == self.report._template_filename:
                wx.MessageBox('For safety reasons, template overwriting with generated report is not allowed!', 'Error',
                              wx.OK | wx.ICON_ERROR)
                return
            self.status('Generating and saving the report...')
            self.report.scan = self.scan
            self._clean_template()
            #self.report.xml_apply_meta()
            self.report.xml_apply_meta(vulnparam_highlighting=self.menu_view_v.IsChecked(), truncation=self.menu_view_i.IsChecked(), pPr_annotation=self.menu_view_p.IsChecked())
            self.report.save_report_xml(filename)
            #self._clean_template()

            # merge kb before generate
            self.ctrl_tc_k.SetValue('')
            self.menu_tools_merge_kb_into_content.Enable(False)

            self.status('Report saved') 
开发者ID:hvqzao,项目名称:report-ng,代码行数:26,代码来源:gui.py

示例6: _buttonLoadCardDataOnButtonClick

# 需要导入模块: import wx [as 别名]
# 或者: from wx import ID_CANCEL [as 别名]
def _buttonLoadCardDataOnButtonClick(self, event):
        # Open file dialog;
        saveFileDialog = wx.FileDialog(self, "Load data from file ...", "", "", "All files (*.*)|*.*", wx.FD_OPEN)
        if saveFileDialog.ShowModal() == wx.ID_CANCEL:
            return
        file_path_name = saveFileDialog.GetPath()
        
        # Read card data from file;
        with open(file_path_name, 'rb') as f:
            card_data = f.read()
        if len(card_data) != 1024:
            self._Log('Invalid card data.', wx.LOG_Error)
            return
        
        # Set card data to Grid;
        for row_index in range(self._gridCardData.GetNumberRows()):
            for col_index in range(self._gridCardData.GetNumberCols()):
                self._gridCardData.SetCellValue(row_index, col_index, '%02X' % (ord(card_data[row_index * 0x10 + col_index])))
        self._Log('Card data has been loaded from file: %s.' % (file_path_name), wx.LOG_Info)
        return 
开发者ID:JavaCardOS,项目名称:pyResMan,代码行数:22,代码来源:pyResManDialog.py

示例7: onChooseTestImage

# 需要导入模块: import wx [as 别名]
# 或者: from wx import ID_CANCEL [as 别名]
def onChooseTestImage(self, event):
        """Open a file dialog to choose a test image."""
        with wx.FileDialog(self, "Choose a test image",
                           wildcard=("Image files (*.jpg;*.jpeg;*.png;*.bmp;*.gif;*.tiff;*.webp)"
                                     "|*.jpg;*.jpeg;*.png;*.bmp;*.gif;*.tiff;*.webp"),
                           defaultDir=self.frame.defdir,
                           style=wx.FD_OPEN | wx.FD_FILE_MUST_EXIST) as file_dialog:

            if file_dialog.ShowModal() == wx.ID_CANCEL:
                return     # the user changed their mind

            # Proceed loading the file chosen by the user
            self.test_image = file_dialog.GetPath()
            self.tc_testimage.SetValue(
                os.path.basename(self.test_image)
            )
        return 
开发者ID:hhannine,项目名称:superpaper,代码行数:19,代码来源:configuration_dialogs.py

示例8: _init_components

# 需要导入模块: import wx [as 别名]
# 或者: from wx import ID_CANCEL [as 别名]
def _init_components(self):
        self.cancel_button = self.button(_('cancel'), wx.ID_CANCEL, event_id=events.WINDOW_CANCEL)
        self.stop_button = self.button(_('stop'), wx.ID_OK, event_id=events.WINDOW_STOP)
        self.start_button = self.button(_('start'), wx.ID_OK, event_id=int(events.WINDOW_START))
        self.close_button = self.button(_("close"), wx.ID_OK, event_id=int(events.WINDOW_CLOSE))
        self.restart_button = self.button(_('restart'), wx.ID_OK, event_id=int(events.WINDOW_RESTART))
        self.edit_button = self.button(_('edit'), wx.ID_OK, event_id=int(events.WINDOW_EDIT))

        self.progress_bar = wx.Gauge(self, range=100)

        self.buttons = [self.cancel_button, self.start_button,
                        self.stop_button, self.close_button,
                        self.restart_button, self.edit_button]

        if self.buildSpec['disable_stop_button']:
            self.stop_button.Enable(False) 
开发者ID:chriskiehl,项目名称:Gooey,代码行数:18,代码来源:footer.py

示例9: on_open

# 需要导入模块: import wx [as 别名]
# 或者: from wx import ID_CANCEL [as 别名]
def on_open(self, event):
        """
        Recursively loads a KiCad schematic and all subsheets
        """
        #self.save_component_type_changes()
        open_dialog = wx.FileDialog(self, "Open KiCad Schematic", "", "",
                                         "Kicad Schematics (*.sch)|*.sch",
                                         wx.FD_OPEN | wx.FD_FILE_MUST_EXIST)

        if open_dialog.ShowModal() == wx.ID_CANCEL:
            return

        # Load Chosen Schematic
        print("opening File:", open_dialog.GetPath())

        # Store the path to the file history
        self.filehistory.AddFileToHistory(open_dialog.GetPath())
        self.filehistory.Save(self.config)
        self.config.Flush()

        self.load(open_dialog.GetPath()) 
开发者ID:Jeff-Ciesielski,项目名称:Boms-Away,代码行数:23,代码来源:bomsaway.py

示例10: on_export

# 需要导入模块: import wx [as 别名]
# 或者: from wx import ID_CANCEL [as 别名]
def on_export(self, event):
        """
        Gets a file path via popup, then exports content
        """

        exporters = plugin_loader.load_export_plugins()

        wildcards = '|'.join([x.wildcard for x in exporters])

        export_dialog = wx.FileDialog(self, "Export BOM", "", "",
                                      wildcards,
                                      wx.FD_SAVE|wx.FD_OVERWRITE_PROMPT)

        if export_dialog.ShowModal() == wx.ID_CANCEL:
            return

        base, ext = os.path.splitext(export_dialog.GetPath())
        filt_idx = export_dialog.GetFilterIndex()

        exporters[filt_idx]().export(base, self.component_type_map) 
开发者ID:Jeff-Ciesielski,项目名称:Boms-Away,代码行数:22,代码来源:bomsaway.py

示例11: compile

# 需要导入模块: import wx [as 别名]
# 或者: from wx import ID_CANCEL [as 别名]
def compile(event):
        """Return a compiled version of the capture currently loaded.

        For now it only returns a bytecode file.
        #TODO: Return a proper executable for the platform currently
        used **Without breaking the current workflow** which works both
        in development mode and in production
        """
        try:
            bytecode_path = py_compile.compile(TMP_PATH)
        except:
            wx.LogError("No capture loaded")
            return
        default_file = "capture.pyc"
        with wx.FileDialog(parent=event.GetEventObject().Parent, message="Save capture executable",
                           defaultDir=os.path.expanduser("~"), defaultFile=default_file, wildcard="*",
                           style=wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT) as fileDialog:

            if fileDialog.ShowModal() == wx.ID_CANCEL:
                return     # the user changed their mind
            pathname = fileDialog.GetPath()
            try:
                shutil.copy(bytecode_path, pathname)
            except IOError:
                wx.LogError(f"Cannot save current data in file {pathname}.") 
开发者ID:RMPR,项目名称:atbswp,代码行数:27,代码来源:control.py

示例12: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import ID_CANCEL [as 别名]
def __init__(self, *args, **kwds):
        kwds["style"] = wx.DEFAULT_DIALOG_STYLE
        wx.Dialog.__init__(self, *args, **kwds)
        self.label_2_copy = wx.StaticText(self, -1, _("Family:"))
        self.label_3_copy = wx.StaticText(self, -1, _("Style:"))
        self.label_4_copy = wx.StaticText(self, -1, _("Weight:"))
        self.family = wx.Choice(self, -1, choices=["Default", "Decorative", "Roman", "Script", "Swiss", "Modern"])
        self.style = wx.Choice(self, -1, choices=["Normal", "Slant", "Italic"])
        self.weight = wx.Choice(self, -1, choices=["Normal", "Light", "Bold"])
        self.label_1 = wx.StaticText(self, -1, _("Size in points:"))
        self.point_size = wx.SpinCtrl(self, -1, "", min=0, max=100)
        self.underline = wx.CheckBox(self, -1, _("Underlined"))
        self.font_btn = wx.Button(self, -1, _("Specific font..."))
        self.static_line_1 = wx.StaticLine(self, -1)
        self.ok_btn = wx.Button(self, wx.ID_OK, _("OK"))
        self.cancel_btn = wx.Button(self, wx.ID_CANCEL, _("Cancel"))

        self.__set_properties()
        self.__do_layout()
        self.value = None
        self.font_btn.Bind(wx.EVT_BUTTON, self.choose_specific_font)
        self.ok_btn.Bind(wx.EVT_BUTTON, self.on_ok) 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:24,代码来源:font_dialog.py

示例13: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import ID_CANCEL [as 别名]
def __init__(self, *args, **kwds):
        # begin wxGlade: TemplateListDialog.__init__
        kwds["style"] = wx.DEFAULT_DIALOG_STYLE
        wx.Dialog.__init__(self, *args, **kwds)
        self.template_names = wx.ListBox(self, wx.ID_ANY, choices=[])
        self.template_name = wx.StaticText(self, wx.ID_ANY, _("wxGlade template:\n"))
        self.author = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_READONLY)
        self.description = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_MULTILINE | wx.TE_READONLY)
        self.instructions = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_MULTILINE | wx.TE_READONLY)
        self.btn_open = wx.Button(self, wx.ID_OPEN, "")
        self.btn_edit = wx.Button(self, ID_EDIT, _("&Edit"))
        self.btn_delete = wx.Button(self, wx.ID_DELETE, "")
        self.btn_cancel = wx.Button(self, wx.ID_CANCEL, "")

        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_LISTBOX_DCLICK, self.on_open, self.template_names)
        self.Bind(wx.EVT_LISTBOX, self.on_select_template, self.template_names)
        self.Bind(wx.EVT_BUTTON, self.on_open, self.btn_open)
        self.Bind(wx.EVT_BUTTON, self.on_edit, id=ID_EDIT)
        self.Bind(wx.EVT_BUTTON, self.on_delete, self.btn_delete)
        # end wxGlade 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:25,代码来源:templates_ui.py

示例14: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import ID_CANCEL [as 别名]
def __init__(self, parent, title):
        wx.Dialog.__init__(self, parent, -1, title)
        self.sizer = sizer = wx.BoxSizer(wx.VERTICAL)
        self.message = wx.StaticText(self, -1, "")
        sizer.Add(self.message, 0, wx.TOP | wx.LEFT | wx.RIGHT | wx.EXPAND, 10)
        self.choices = wx.CheckListBox(self, -1, choices=[])
        sizer.Add(self.choices, 1, wx.EXPAND | wx.LEFT | wx.RIGHT, 10)
        sizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND | wx.ALL, 10)
        sz2 = wx.BoxSizer(wx.HORIZONTAL)
        sz2.Add(wx.Button(self, wx.ID_OK, ""), 0, wx.ALL, 10)
        sz2.Add(wx.Button(self, wx.ID_CANCEL, ""), 0, wx.ALL, 10)
        sizer.Add(sz2, 0, wx.ALIGN_CENTER)
        self.SetAutoLayout(True)
        self.SetSizer(sizer)
        sizer.Fit(self)
        self.CenterOnScreen() 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:18,代码来源:edit_sizers.py

示例15: _init_components

# 需要导入模块: import wx [as 别名]
# 或者: from wx import ID_CANCEL [as 别名]
def _init_components(self):
    self.cancel_button      = self.button(i18n._('cancel'),  wx.ID_CANCEL,  event_id=int(events.WINDOW_CANCEL))
    self.stop_button        = self.button(i18n._('stop'),    wx.ID_OK,      event_id=int(events.WINDOW_STOP))
    self.start_button       = self.button(i18n._('start'),   wx.ID_OK,      event_id=int(events.WINDOW_START))
    self.close_button       = self.button(i18n._("close"),   wx.ID_OK,      event_id=int(events.WINDOW_CLOSE))
    self.restart_button     = self.button(i18n._('restart'), wx.ID_OK,      event_id=int(events.WINDOW_RESTART))
    self.edit_button        = self.button(i18n._('edit'),    wx.ID_OK,      event_id=int(events.WINDOW_EDIT))

    self.progress_bar  = wx.Gauge(self, range=100)

    self.buttons = [self.cancel_button, self.start_button,
                    self.stop_button, self.close_button,
                    self.restart_button, self.edit_button] 
开发者ID:ME-ICA,项目名称:me-ica,代码行数:15,代码来源:footer.py


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