當前位置: 首頁>>代碼示例>>Python>>正文


Python wx.WXK_DELETE屬性代碼示例

本文整理匯總了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 
開發者ID:LudovicRousseau,項目名稱:pyscard,代碼行數:19,代碼來源:APDUHexValidator.py

示例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 
開發者ID:EventGhost,項目名稱:EventGhost,代碼行數:19,代碼來源:DigitOnlyValidator.py

示例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() 
開發者ID:thiagoralves,項目名稱:OpenPLC_Editor,代碼行數:19,代碼來源:CustomEditableListBox.py

示例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() 
開發者ID:Erriez,項目名稱:R421A08-rs485-8ch-relay-board,代碼行數:21,代碼來源:relay_modbus_gui.py

示例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 
開發者ID:JavaCardOS,項目名稱:pyResMan,代碼行數:17,代碼來源:Util.py

示例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() 
開發者ID:kenorb-contrib,項目名稱:BitTorrent,代碼行數:13,代碼來源:__init__.py

示例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 
開發者ID:EventGhost,項目名稱:EventGhost,代碼行數:35,代碼來源:__init__.py

示例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() 
開發者ID:thiagoralves,項目名稱:OpenPLC_Editor,代碼行數:16,代碼來源:ConfigEditor.py

示例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() 
開發者ID:thiagoralves,項目名稱:OpenPLC_Editor,代碼行數:16,代碼來源:ConfigEditor.py

示例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() 
開發者ID:thiagoralves,項目名稱:OpenPLC_Editor,代碼行數:14,代碼來源:ConfigEditor.py

示例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) 
開發者ID:thiagoralves,項目名稱:OpenPLC_Editor,代碼行數:17,代碼來源:IDEFrame.py

示例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) 
開發者ID:JackonYang,項目名稱:bookhub,代碼行數:9,代碼來源:frame_overview.py

示例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) 
開發者ID:JackonYang,項目名稱:bookhub,代碼行數:11,代碼來源:CellEditor.py

示例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() 
開發者ID:thiagoralves,項目名稱:OpenPLC_Editor,代碼行數:45,代碼來源:CodeFileEditor.py

示例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
    # ------------------------------------------------------------------------------- 
開發者ID:thiagoralves,項目名稱:OpenPLC_Editor,代碼行數:52,代碼來源:LDViewer.py


注:本文中的wx.WXK_DELETE屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。