Python wx.WXK_NUMPAD_DELETE Examples

The following are 5 code examples of wx.WXK_NUMPAD_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: ConfigEditor.py    From OpenPLC_Editor with GNU General Public License v3.0 5 votes vote down vote up
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 #2
Source File: ConfigEditor.py    From OpenPLC_Editor with GNU General Public License v3.0 5 votes vote down vote up
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 #3
Source File: ConfigEditor.py    From OpenPLC_Editor with GNU General Public License v3.0 5 votes vote down vote up
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 #4
Source File: CustomGrid.py    From OpenPLC_Editor with GNU General Public License v3.0 5 votes vote down vote up
def OnKeyDown(self, event):
        key_handled = False
        keycode = event.GetKeyCode()
        if keycode == wx.WXK_TAB:
            row = self.GetGridCursorRow()
            col = self.GetGridCursorCol()
            if event.ShiftDown():
                if row < 0 or col == 0:
                    self.Navigate(wx.NavigationKeyEvent.IsBackward)
                    key_handled = True
            elif row < 0 or col == self.Table.GetNumberCols() - 1:
                self.Navigate(wx.NavigationKeyEvent.IsForward)
                key_handled = True
        elif keycode in (wx.WXK_ADD, wx.WXK_NUMPAD_ADD) and self.Editable:
            self.AddRow()
            key_handled = True
        elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE) and self.Editable:
            self.DeleteRow()
            key_handled = True
        elif keycode == wx.WXK_UP and event.ShiftDown() and self.Editable:
            self.MoveRow(self.GetGridCursorRow(), -1)
            key_handled = True
        elif keycode == wx.WXK_DOWN and event.ShiftDown() and self.Editable:
            self.MoveRow(self.GetGridCursorRow(), 1)
            key_handled = True
        if not key_handled:
            event.Skip() 
Example #5
Source File: CodeFileEditor.py    From OpenPLC_Editor with GNU General Public License v3.0 4 votes vote down vote up
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()