本文整理汇总了Python中wx.WXK_DELETE属性的典型用法代码示例。如果您正苦于以下问题:Python wx.WXK_DELETE属性的具体用法?Python wx.WXK_DELETE怎么用?Python wx.WXK_DELETE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类wx
的用法示例。
在下文中一共展示了wx.WXK_DELETE属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: OnChar
# 需要导入模块: import wx [as 别名]
# 或者: from wx import WXK_DELETE [as 别名]
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
示例2: OnChar
# 需要导入模块: import wx [as 别名]
# 或者: from wx import WXK_DELETE [as 别名]
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
示例3: OnKeyDown
# 需要导入模块: import wx [as 别名]
# 或者: from wx import WXK_DELETE [as 别名]
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()
示例4: OnLogKeyDown
# 需要导入模块: import wx [as 别名]
# 或者: from wx import WXK_DELETE [as 别名]
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()
示例5: OnChar
# 需要导入模块: import wx [as 别名]
# 或者: from wx import WXK_DELETE [as 别名]
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
示例6: text_inserted
# 需要导入模块: import wx [as 别名]
# 或者: from wx import WXK_DELETE [as 别名]
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()
示例7: OnChar
# 需要导入模块: import wx [as 别名]
# 或者: from wx import WXK_DELETE [as 别名]
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
示例8: OnVariablesFilterKeyDown
# 需要导入模块: import wx [as 别名]
# 或者: from wx import WXK_DELETE [as 别名]
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()
示例9: OnNodesFilterKeyDown
# 需要导入模块: import wx [as 别名]
# 或者: from wx import WXK_DELETE [as 别名]
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()
示例10: OnProcessVariablesGridKeyDown
# 需要导入模块: import wx [as 别名]
# 或者: from wx import WXK_DELETE [as 别名]
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()
示例11: OnDeleteMenu
# 需要导入模块: import wx [as 别名]
# 或者: from wx import WXK_DELETE [as 别名]
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)
示例12: OnKeyDown
# 需要导入模块: import wx [as 别名]
# 或者: from wx import WXK_DELETE [as 别名]
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)
示例13: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import WXK_DELETE [as 别名]
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)
示例14: OnKeyPressed
# 需要导入模块: import wx [as 别名]
# 或者: from wx import WXK_DELETE [as 别名]
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()
示例15: OnChar
# 需要导入模块: import wx [as 别名]
# 或者: from wx import WXK_DELETE [as 别名]
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
# -------------------------------------------------------------------------------