Python wx.WXK_DELETE Examples
The following are 16
code examples of wx.WXK_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: APDUHexValidator.py From pyscard with GNU Lesser General Public License v2.1 | 6 votes |
def OnChar(self, event): key = event.GetKeyCode() if wx.WXK_SPACE == key or chr(key) in string.hexdigits: value = event.GetEventObject().GetValue() + chr(key) if apduregexp.match(value): event.Skip() return if key < wx.WXK_SPACE or key == wx.WXK_DELETE or key > 255: event.Skip() return if not wx.Validator_IsSilent(): wx.Bell() return
Example #2
Source File: DigitOnlyValidator.py From EventGhost with GNU General Public License v2.0 | 6 votes |
def OnChar(self, event): key = event.GetKeyCode() if key < wx.WXK_SPACE or key == wx.WXK_DELETE or key > 255: event.Skip() return if chr(key) in string.digits: event.Skip() return if not wx.Validator_IsSilent(): wx.Bell() # Returning without calling event.Skip eats the event before it # gets to the text control return
Example #3
Source File: CustomEditableListBox.py From OpenPLC_Editor with GNU General Public License v3.0 | 6 votes |
def OnKeyDown(self, event): button = None keycode = event.GetKeyCode() if keycode in (wx.WXK_ADD, wx.WXK_NUMPAD_ADD): button = self.GetNewButton() elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE): button = self.GetDelButton() elif keycode == wx.WXK_UP and event.ShiftDown(): button = self.GetUpButton() elif keycode == wx.WXK_DOWN and event.ShiftDown(): button = self.GetDownButton() elif keycode == wx.WXK_SPACE: button = self.GetEditButton() if button is not None and button.IsEnabled(): button.ProcessEvent(wx.CommandEvent(wx.EVT_BUTTON.typeId, button.GetId())) else: event.Skip()
Example #4
Source File: relay_modbus_gui.py From R421A08-rs485-8ch-relay-board with MIT License | 6 votes |
def OnLogKeyDown(self, event): ctrl_key = event.ControlDown() alt_key = event.AltDown() shift_key = event.ShiftDown() key_code = event.GetKeyCode() # print(ctrl_key, alt_key, shift_key, keycode) # Add keyboard shortcuts: # CTRL + DEL: Clear textbox # CTRL + A: Select all if ctrl_key and not alt_key and not shift_key and key_code == wx.WXK_DELETE: self.m_txtLog.Clear() elif 27 < key_code < 256: if ctrl_key and not alt_key and not shift_key and chr(key_code) == 'A': self.m_txtLog.SelectAll() # Handle other keyboard shortcuts event.Skip()
Example #5
Source File: Util.py From pyResMan with GNU General Public License v2.0 | 5 votes |
def OnChar(self, event): """Process values as they are entered into the control @param event: event that called this handler """ key = event.GetKeyCode() if event.CmdDown() or key < wx.WXK_SPACE or key == wx.WXK_DELETE or \ key > 255 or chr(key) in Util.HEXCHARS: event.Skip() return if not wx.Validator_IsSilent(): wx.Bell() return
Example #6
Source File: __init__.py From BitTorrent with GNU General Public License v3.0 | 5 votes |
def text_inserted(self, event): key = event.KeyCode() if key < wx.WXK_SPACE or key == wx.WXK_DELETE or key > 255: event.Skip() return if (self.valid_chars is not None) and (chr(key) not in self.valid_chars): return event.Skip()
Example #7
Source File: __init__.py From EventGhost with GNU General Public License v2.0 | 5 votes |
def OnChar(self, event): key = event.KeyCode if key < wx.WXK_SPACE or key == wx.WXK_DELETE or key > 255: event.Skip() return textCtrl = self.GetWindow() startPos, endPos = textCtrl.GetSelection() length = textCtrl.GetLastPosition() - (endPos - startPos) if length >= self.maxLength: if not wx.Validator_IsSilent(): wx.Bell() return if( self.allowRaw and textCtrl.GetInsertionPoint() == 0 and chr(key).upper() == "R" ): textCtrl.WriteText("R") return if chr(key) in hexdigits: textCtrl.WriteText(chr(key).upper()) return if not wx.Validator_IsSilent(): wx.Bell() # Returning without calling event.Skip eats the event before it # gets to the text control return
Example #8
Source File: ConfigEditor.py From OpenPLC_Editor with GNU General Public License v3.0 | 5 votes |
def OnVariablesFilterKeyDown(self, event): if self.VariablesFilterFirstCharacter: keycode = event.GetKeyCode() if keycode not in [wx.WXK_RETURN, wx.WXK_NUMPAD_ENTER]: self.VariablesFilterFirstCharacter = False if keycode not in NAVIGATION_KEYS: self.VariablesFilter.SetValue("") if keycode not in [wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE, wx.WXK_BACK]: event.Skip() else: event.Skip()
Example #9
Source File: ConfigEditor.py From OpenPLC_Editor with GNU General Public License v3.0 | 5 votes |
def OnNodesFilterKeyDown(self, event): if self.NodesFilterFirstCharacter: keycode = event.GetKeyCode() if keycode not in [wx.WXK_RETURN, wx.WXK_NUMPAD_ENTER]: self.NodesFilterFirstCharacter = False if keycode not in NAVIGATION_KEYS: self.NodesFilter.SetValue("") if keycode not in [wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE, wx.WXK_BACK]: event.Skip() else: event.Skip()
Example #10
Source File: ConfigEditor.py From OpenPLC_Editor with GNU General Public License v3.0 | 5 votes |
def OnProcessVariablesGridKeyDown(self, event): keycode = event.GetKeyCode() col = self.ProcessVariablesGrid.GetGridCursorCol() row = self.ProcessVariablesGrid.GetGridCursorRow() colname = self.ProcessVariablesTable.GetColLabelValue(col, False) if keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE) and \ (colname.startswith("Read from") or colname.startswith("Write to")): self.ProcessVariablesTable.SetValue(row, col, "") self.SaveProcessVariables() wx.CallAfter(self.ProcessVariablesTable.ResetView, self.ProcessVariablesGrid) else: event.Skip()
Example #11
Source File: IDEFrame.py From OpenPLC_Editor with GNU General Public License v3.0 | 5 votes |
def OnDeleteMenu(self, event): window = self.FindFocus() if window == self.ProjectTree or window is None: selected = self.ProjectTree.GetSelection() if selected is not None and selected.IsOk(): function = self.DeleteFunctions.get(self.ProjectTree.GetPyData(selected)["type"], None) if function is not None: function(self, selected) self.CloseTabsWithoutModel() self._Refresh(TITLE, EDITORTOOLBAR, FILEMENU, EDITMENU, PROJECTTREE, POUINSTANCEVARIABLESPANEL, LIBRARYTREE) elif isinstance(window, (Viewer, TextViewer)): event = wx.KeyEvent(wx.EVT_CHAR._getEvtType()) event.m_keyCode = wx.WXK_DELETE window.ProcessEvent(event)
Example #12
Source File: frame_overview.py From bookhub with MIT License | 5 votes |
def OnKeyDown(self, event): objs = self.myOlv.GetSelectedObjects() key = event.GetKeyCode() if wx.WXK_DELETE == key: self.DoDelete(objs) elif 3 == key: # wx.WXK_CONTROL_C self.DoCopyFileid(objs)
Example #13
Source File: CellEditor.py From bookhub with MIT License | 5 votes |
def __init__(self, acceptableChars="0123456789+-"): wx.PyValidator.__init__(self) self.Bind(wx.EVT_CHAR, self._OnChar) self.acceptableChars = acceptableChars self.acceptableCodes = [ord(x) for x in self.acceptableChars] stdEditKeys = [wx.WXK_RETURN, wx.WXK_NUMPAD_ENTER, wx.WXK_ESCAPE, wx.WXK_CANCEL, wx.WXK_TAB, wx.WXK_BACK, wx.WXK_DELETE, wx.WXK_HOME, wx.WXK_END, wx.WXK_LEFT, wx.WXK_RIGHT] self.acceptableCodes.extend(stdEditKeys)
Example #14
Source File: CodeFileEditor.py From OpenPLC_Editor with GNU General Public License v3.0 | 4 votes |
def OnKeyPressed(self, event): if self.CallTipActive(): self.CallTipCancel() key = event.GetKeyCode() current_pos = self.GetCurrentPos() selected = self.GetSelection() text_selected = selected[0] != selected[1] # Test if caret is before Windows like new line text = self.GetText() if current_pos < len(text) and ord(text[current_pos]) == 13: newline_size = 2 else: newline_size = 1 # Disable to type any character in section header lines if self.GetLineState(self.LineFromPosition(current_pos)) and \ not text_selected and \ key not in NAVIGATION_KEYS + [wx.WXK_RETURN, wx.WXK_NUMPAD_ENTER]: return # Disable to delete line between code and header lines elif (self.GetCurLine()[0].strip() != "" and not text_selected and (key == wx.WXK_BACK and self.GetLineState(self.LineFromPosition(max(0, current_pos - 1))) or key in [wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE] and self.GetLineState(self.LineFromPosition(min(len(text), current_pos + newline_size))))): return elif key == 32 and event.ControlDown(): # Tips if event.ShiftDown(): pass # Code completion else: self.AutoCompSetIgnoreCase(False) # so this needs to match keywords = self.KEYWORDS + [var["Name"] for var in self.Controler.GetVariables()] keywords.sort() self.AutoCompShow(0, " ".join(keywords)) else: event.Skip()
Example #15
Source File: LDViewer.py From OpenPLC_Editor with GNU General Public License v3.0 | 4 votes |
def OnChar(self, event): if self.GetDrawingMode() == FREEDRAWING_MODE: Viewer.OnChar(self, event) else: xpos, ypos = self.GetScrollPos(wx.HORIZONTAL), self.GetScrollPos(wx.VERTICAL) xmax = self.GetScrollRange(wx.HORIZONTAL) - self.GetScrollThumb(wx.HORIZONTAL) ymax = self.GetScrollRange(wx.VERTICAL) - self.GetScrollThumb(wx.VERTICAL) keycode = event.GetKeyCode() if keycode == wx.WXK_DELETE and self.SelectedElement: if self.IsBlock(self.SelectedElement): self.SelectedElement.Delete() elif self.IsWire(self.SelectedElement): self.DeleteWire(self.SelectedElement) elif isinstance(self.SelectedElement, Graphic_Group): all_wires = True for element in self.SelectedElement.GetElements(): all_wires &= self.IsWire(element) if all_wires: self.DeleteWire(self.SelectedElement) else: self.SelectedElement.Delete() self.RefreshBuffer() self.RefreshScrollBars() self.Refresh(False) elif keycode == wx.WXK_LEFT: if event.ControlDown() and event.ShiftDown(): self.Scroll(0, ypos) elif event.ControlDown(): self.Scroll(max(0, xpos - 1), ypos) elif keycode == wx.WXK_RIGHT: if event.ControlDown() and event.ShiftDown(): self.Scroll(xmax, ypos) elif event.ControlDown(): self.Scroll(min(xpos + 1, xmax), ypos) elif keycode == wx.WXK_UP: if event.ControlDown() and event.ShiftDown(): self.Scroll(xpos, 0) elif event.ControlDown(): self.Scroll(xpos, max(0, ypos - 1)) elif keycode == wx.WXK_DOWN: if event.ControlDown() and event.ShiftDown(): self.Scroll(xpos, ymax) elif event.ControlDown(): self.Scroll(xpos, min(ypos + 1, ymax)) else: event.Skip() # ------------------------------------------------------------------------------- # Model adding functions from Drop Target # -------------------------------------------------------------------------------
Example #16
Source File: ObjectListView.py From bookhub with MIT License | 4 votes |
def _HandleTypingEvent(self, evt): """ """ if self.GetItemCount() == 0 or self.GetColumnCount() == 0: return False if evt.GetModifiers() != 0 and evt.GetModifiers() != wx.MOD_SHIFT: return False if evt.GetKeyCode() > wx.WXK_START: return False if evt.GetKeyCode() in (wx.WXK_BACK, wx.WXK_DELETE): self.searchPrefix = u"" return True # On which column are we going to compare values? If we should search on the # sorted column, and there is a sorted column and it is searchable, we use that # one, otherwise we fallback to the primary column if self.typingSearchesSortColumn and self.GetSortColumn() and self.GetSortColumn().isSearchable: searchColumn = self.GetSortColumn() else: searchColumn = self.GetPrimaryColumn() # On Linux, GetUnicodeKey() always returns 0 -- on my 2.8.7.1 (gtk2-unicode) if evt.GetUnicodeKey() == 0: uniChar = chr(evt.GetKeyCode()) else: uniChar = unichr(evt.GetUnicodeKey()) if uniChar not in string.printable: return False # On Linux, evt.GetTimestamp() isn't reliable so use time.time() instead timeNow = time.time() if (timeNow - self.whenLastTypingEvent) > self.SEARCH_KEYSTROKE_DELAY: self.searchPrefix = uniChar else: self.searchPrefix += uniChar self.whenLastTypingEvent = timeNow #self.__rows = 0 self._FindByTyping(searchColumn, self.searchPrefix) #print "Considered %d rows in %2f secs" % (self.__rows, time.time() - timeNow) return True