Python wx.ID_DELETE Examples

The following are 14 code examples of wx.ID_DELETE(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module wx , or try the search function .
Example #1
Source File: gutil.py    From trelby with GNU General Public License v2.0 6 votes vote down vote up
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. 
Example #2
Source File: templates_ui.py    From wxGlade with MIT License 6 votes vote down vote up
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 
Example #3
Source File: LanguageEditor.py    From EventGhost with GNU General Public License v2.0 6 votes vote down vote up
def OnValidateMenus(self, dummyEvent):
        menuBar = self.menuBar
        menuBar.Enable(wx.ID_SAVE, self.isDirty)
        newValueCtrl = self.newValueCtrl
        if self.FindFocus() == newValueCtrl:
            menuBar.Enable(wx.ID_UNDO, newValueCtrl.CanUndo())
            menuBar.Enable(wx.ID_REDO, newValueCtrl.CanRedo())
            menuBar.Enable(wx.ID_CUT, newValueCtrl.CanCut())
            menuBar.Enable(wx.ID_COPY, newValueCtrl.CanCopy())
            menuBar.Enable(wx.ID_PASTE, newValueCtrl.CanPaste())
            menuBar.Enable(wx.ID_DELETE, True)
        else:
            menuBar.Enable(wx.ID_UNDO, False)
            menuBar.Enable(wx.ID_REDO, False)
            menuBar.Enable(wx.ID_CUT, False)
            menuBar.Enable(wx.ID_COPY, False)
            menuBar.Enable(wx.ID_PASTE, False)
            menuBar.Enable(wx.ID_DELETE, False) 
Example #4
Source File: FillAreaAction.py    From kicad-action-scripts with GNU General Public License v3.0 5 votes vote down vote up
def onDeleteClick(self, event):
        return self.EndModal(wx.ID_DELETE) 
Example #5
Source File: networkedit.py    From CANFestivino with GNU Lesser General Public License v2.1 5 votes vote down vote up
def _init_coll_NetworkMenu_Items(self, parent):
        parent.Append(help='', id=wx.ID_ADD,
              kind=wx.ITEM_NORMAL, text=_('Add Slave Node'))
        parent.Append(help='', id=wx.ID_DELETE,
              kind=wx.ITEM_NORMAL, text=_('Remove Slave Node'))
        parent.AppendSeparator()
        parent.Append(help='', id=ID_NETWORKEDITNETWORKMENUBUILDMASTER,
              kind=wx.ITEM_NORMAL, text=_('Build Master Dictionary'))
        self.Bind(wx.EVT_MENU, self.OnAddSlaveMenu, id=wx.ID_ADD)
        self.Bind(wx.EVT_MENU, self.OnRemoveSlaveMenu, id=wx.ID_DELETE)
##        self.Bind(wx.EVT_MENU, self.OnBuildMasterMenu,
##              id=ID_NETWORKEDITNETWORKMENUBUILDMASTER) 
Example #6
Source File: __init__.py    From EventGhost with GNU General Public License v2.0 5 votes vote down vote up
def SetupEditMenu(self, menu):
        canCut, canCopy, canPython, canPaste, canDelete = self.GetEditCmdState()
        menu.Enable(wx.ID_CUT, canCut)
        menu.Enable(wx.ID_COPY, canCopy)
        menu.Enable(ID_PYTHON, canPython)
        menu.Enable(wx.ID_PASTE, canPaste)
        menu.Enable(wx.ID_DELETE, canDelete)
        selection = self.treeCtrl.GetSelectedNode()
        menu.Check(ID_DISABLED, selection is not None and not selection.isEnabled) 
Example #7
Source File: LanguageEditor.py    From EventGhost with GNU General Public License v2.0 5 votes vote down vote up
def CreateMenuBar(self):
        # menu creation
        menuBar = wx.MenuBar()

        def AddMenuItem(name, func, itemId):
            menu.Append(itemId, name)
            self.Bind(wx.EVT_MENU, func, id=itemId)

        # file menu
        menu = wx.Menu()
        menuBar.Append(menu, "&File")
        AddMenuItem("&Open...\tCtrl+O", self.OnCmdOpen, wx.ID_OPEN)
        AddMenuItem("&Save\tCtrl+S", self.OnCmdSave, wx.ID_SAVE)
        menu.AppendSeparator()
        AddMenuItem("E&xit\tAlt+F4", self.OnCmdExit, wx.ID_EXIT)

        # edit menu
        menu = wx.Menu()
        menuBar.Append(menu, "&Edit")
        AddMenuItem("&Undo\tCtrl+Z", self.OnCmdUndo, wx.ID_UNDO)
        AddMenuItem("&Redo\tCtrl+Y", self.OnCmdRedo, wx.ID_REDO)
        menu.AppendSeparator()
        AddMenuItem("Cu&t\tCtrl+X", self.OnCmdCut, wx.ID_CUT)
        AddMenuItem("&Copy\tCtrl+C", self.OnCmdCopy, wx.ID_COPY)
        AddMenuItem("&Paste\tCtrl+V", self.OnCmdPaste, wx.ID_PASTE)
        AddMenuItem("&Delete", self.OnCmdDelete, wx.ID_DELETE)
        menu.AppendSeparator()
        AddMenuItem(
            "Find &Next Untranslated\tF3", self.OnCmdFindNext, wx.ID_FIND
        )

        # help menu
        menu = wx.Menu()
        menuBar.Append(menu, "&Help")
        AddMenuItem("About Language Editor...", self.OnCmdAbout, wx.ID_ABOUT)

        self.SetMenuBar(menuBar)
        return menuBar 
Example #8
Source File: PythonEditorCtrl.py    From EventGhost with GNU General Public License v2.0 5 votes vote down vote up
def OnRightClick(self, dummyEvent):
        menu = self.popupMenu
        first, last = self.GetSelection()
        menu.Enable(wx.ID_UNDO, self.CanUndo())
        menu.Enable(wx.ID_REDO, self.CanUndo())
        menu.Enable(wx.ID_CUT, first != last)
        menu.Enable(wx.ID_COPY, first != last)
        menu.Enable(wx.ID_PASTE, self.CanPaste())
        menu.Enable(wx.ID_DELETE, first != last)
        menu.Enable(wx.ID_SELECTALL, True)
        self.PopupMenu(menu) 
Example #9
Source File: viafence_action.py    From RF-tools-KiCAD with GNU General Public License v3.0 5 votes vote down vote up
def onDeleteClick(self, event):
        return self.mainDlg.EndModal(wx.ID_DELETE) 
Example #10
Source File: trace_solder_expander.py    From RF-tools-KiCAD with GNU General Public License v3.0 5 votes vote down vote up
def onDeleteClick(self, event):
        return self.EndModal(wx.ID_DELETE) 
Example #11
Source File: round_trk.py    From RF-tools-KiCAD with GNU General Public License v3.0 5 votes vote down vote up
def onDeleteClick(self, event):
        return self.EndModal(wx.ID_DELETE) 
Example #12
Source File: FillAreaAction.py    From kicad-action-scripts with GNU General Public License v3.0 4 votes vote down vote up
def Run(self):
        a = FillAreaDialogEx(None)
        # a.m_SizeMM.SetValue("0.8")
        a.m_StepMM.SetValue("2.54")
        # a.m_DrillMM.SetValue("0.3")
        # a.m_Netname.SetValue("GND")
        # a.m_ClearanceMM.SetValue("0.2")
        a.m_Star.SetValue(True)
        a.m_bitmapStitching.SetBitmap(wx.Bitmap(os.path.join(os.path.dirname(os.path.realpath(__file__)), "stitching-vias-help.png")))
        self.board = pcbnew.GetBoard()
        self.boardDesignSettings = self.board.GetDesignSettings()
        a.m_SizeMM.SetValue(str(pcbnew.ToMM(self.boardDesignSettings.GetCurrentViaSize())))
        a.m_DrillMM.SetValue(str(pcbnew.ToMM(self.boardDesignSettings.GetCurrentViaDrill())))
        a.m_ClearanceMM.SetValue(str(pcbnew.ToMM(self.boardDesignSettings.GetDefault().GetClearance())))
        a.SetMinSize(a.GetSize())

        PopulateNets("GND", a)
        modal_result = a.ShowModal()
        if modal_result == wx.ID_OK:
            wx.LogMessage('Via Stitching: Version 1.5')
            if 1:  # try:
                fill = FillArea.FillArea()
                fill.SetStepMM(float(a.m_StepMM.GetValue().replace(',', '.')))
                fill.SetSizeMM(float(a.m_SizeMM.GetValue().replace(',', '.')))
                fill.SetDrillMM(float(a.m_DrillMM.GetValue().replace(',', '.')))
                fill.SetClearanceMM(float(a.m_ClearanceMM.GetValue().replace(',', '.')))
                # fill.SetNetname(a.m_Netname.GetValue())
                netname = a.m_cbNet.GetStringSelection()
                fill.SetNetname(netname)
                if a.m_Debug.IsChecked():
                    fill.SetDebug()
                fill.SetRandom(a.m_Random.IsChecked())
                if a.m_Star.IsChecked():
                    fill.SetStar()
                if a.m_only_selected.IsChecked():
                    fill.OnlyOnSelectedArea()
                fill.Run()
            else:  # except Exception:
                wx.MessageDialog(None, "Invalid parameter")
        elif modal_result == wx.ID_DELETE:
            if 1:  # try:
                fill = FillArea.FillArea()
                fill.SetNetname(a.m_cbNet.GetStringSelection())  # a.m_Netname.GetValue())
                if a.m_Debug.IsChecked():
                    fill.SetDebug()
                fill.DeleteVias()
                fill.Run()
            else:  # except Exception:
                wx.MessageDialog(None, "Invalid parameter for delete")
        else:
            print("Cancel")
        a.Destroy() 
Example #13
Source File: trace_solder_expander.py    From RF-tools-KiCAD with GNU General Public License v3.0 4 votes vote down vote up
def Run(self):
        #import pcbnew
        #pcb = pcbnew.GetBoard()
        # net_name = "GND"
        #aParameters = SolderExpanderDlg(None)
        _pcbnew_frame = [x for x in wx.GetTopLevelWindows() if x.GetTitle().lower().startswith('pcbnew')][0]
        aParameters = SolderExpander_Dlg(_pcbnew_frame)
        aParameters.m_clearanceMM.SetValue("0.2")
        aParameters.m_bitmap1.SetBitmap(wx.Bitmap( os.path.join(os.path.dirname(os.path.realpath(__file__)), "soldermask_clearance_help.png") ) )
        pcb = pcbnew.GetBoard()
        if hasattr(pcb, 'm_Uuid'):
            aParameters.m_buttonDelete.Disable()
        modal_result = aParameters.ShowModal()
        clearance = FromMM(self.CheckInput(aParameters.m_clearanceMM.GetValue(), "extra clearance from track width"))
        if clearance is not None:
            if modal_result == wx.ID_OK:
                #pcb = pcbnew.GetBoard()
                tracks=getSelTracks(pcb)
                if len(tracks) >0: #selected tracks >0
                    solderExpander(pcb,tracks,clearance)
                else:
                    pads=[]
                    for item in pcb.GetPads():
                        if item.IsSelected():
                            pads.append(item)
                    if len(pads) == 1:
                        tracks=[]
                        tracks = find_Tracks_inNet_Pad(pcb,pads[0])
                        c_tracks = get_contiguous_tracks(pcb,tracks,pads[0])
                        solderExpander(pcb,c_tracks,clearance)
                    else:
                        wx.LogMessage("Solder Mask Expander:\nSelect Tracks\nor One Pad to select connected Tracks")
                        
                #solderExpander(clearance)
            elif modal_result == wx.ID_DELETE:
                Delete_Segments(pcb)
                #wx.LogMessage('Solder Mask Segments on Track Net Deleted')
            else:
                None  # Cancel
        else:
            None  # Invalid input
        aParameters.Destroy()
# 
Example #14
Source File: round_trk.py    From RF-tools-KiCAD with GNU General Public License v3.0 4 votes vote down vote up
def Run(self):
        global delete_before_connect
        #self.pcb = GetBoard()
        # net_name = "GND"
        pcb = pcbnew.GetBoard()
        
        #from https://github.com/MitjaNemec/Kicad_action_plugins
        #hack wxFormBuilder py2/py3
        _pcbnew_frame = [x for x in wx.GetTopLevelWindows() if x.GetTitle().lower().startswith('pcbnew')][0]
        #aParameters = RoundTrackDlg(None)
        aParameters = RoundTrack_Dlg(_pcbnew_frame)
        if hasattr (pcb, 'm_Uuid'):
            aParameters.m_buttonDelete.Disable()
            aParameters.m_checkBoxDelete.Disable()
        #aParameters = RoundTrack_DlgEx(_pcbnew_frame)
        aParameters.Show()
        #end hack
        aParameters.m_distanceMM.SetValue("5")
        aParameters.m_segments.SetValue("16")
        aParameters.m_bitmap1.SetBitmap(wx.Bitmap( os.path.join(os.path.dirname(os.path.realpath(__file__)), "round_track_help.png") ) )
        modal_result = aParameters.ShowModal()
        segments = self.CheckSegmentsInput(
            aParameters.m_segments.GetValue(), "number of segments")
        distI = FromMM(self.CheckDistanceInput(aParameters.m_distanceMM.GetValue(), "distance from intersection"))
        if aParameters.m_checkBoxDelete.IsChecked():
            delete_before_connect = True
        else:
            delete_before_connect = False
        if segments is not None and distI is not None:
            if modal_result == wx.ID_OK:
                Round_Selection(pcb, distI, segments)
            elif modal_result == wx.ID_DELETE:
                Delete_Segments(pcb)
                #wx.LogMessage('Round Segments on Track Net Deleted')
            elif modal_result == wx.ID_REVERT:
                wxLogDebug('Connecting Tracks',debug)
                Connect_Segments(pcb)
            else:
                None  # Cancel
        else:
            None  # Invalid input
        aParameters.Destroy()
        
        #Round_Selection(pcb)
#