Use GetKeyCode() instead of KeyCode()

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41077 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn 2006-09-08 20:09:27 +00:00
parent 2f72b58ae6
commit a3cee65ed4
15 changed files with 22 additions and 19 deletions

View File

@ -105,7 +105,7 @@ class TestPanel(wx.Panel):
self.ie.Navigate(url) self.ie.Navigate(url)
def OnLocationKey(self, evt): def OnLocationKey(self, evt):
if evt.KeyCode() == wx.WXK_RETURN: if evt.GetKeyCode() == wx.WXK_RETURN:
URL = self.location.GetValue() URL = self.location.GetValue()
self.location.Append(URL) self.location.Append(URL)
self.ie.Navigate(URL) self.ie.Navigate(URL)

View File

@ -20,7 +20,7 @@ class NewEnterHandlingGrid(gridlib.Grid):
def OnKeyDown(self, evt): def OnKeyDown(self, evt):
if evt.KeyCode() != wx.WXK_RETURN: if evt.GetKeyCode() != wx.WXK_RETURN:
evt.Skip() evt.Skip()
return return

View File

@ -185,7 +185,7 @@ class PythonSTC(stc.StyledTextCtrl):
def OnKeyPressed(self, event): def OnKeyPressed(self, event):
if self.CallTipActive(): if self.CallTipActive():
self.CallTipCancel() self.CallTipCancel()
key = event.KeyCode() key = event.GetKeyCode()
if key == 32 and event.ControlDown(): if key == 32 and event.ControlDown():
pos = self.GetCurrentPos() pos = self.GetCurrentPos()

View File

@ -34,7 +34,7 @@ class MyValidator(wx.PyValidator):
def OnChar(self, event): def OnChar(self, event):
key = event.KeyCode() key = event.GetKeyCode()
if key < wx.WXK_SPACE or key == wx.WXK_DELETE or key > 255: if key < wx.WXK_SPACE or key == wx.WXK_DELETE or key > 255:
event.Skip() event.Skip()

View File

@ -347,14 +347,14 @@ class GenButton(wx.PyControl):
def OnKeyDown(self, event): def OnKeyDown(self, event):
if self.hasFocus and event.KeyCode() == ord(" "): if self.hasFocus and event.GetKeyCode() == ord(" "):
self.up = False self.up = False
self.Refresh() self.Refresh()
event.Skip() event.Skip()
def OnKeyUp(self, event): def OnKeyUp(self, event):
if self.hasFocus and event.KeyCode() == ord(" "): if self.hasFocus and event.GetKeyCode() == ord(" "):
self.up = True self.up = True
self.Notify() self.Notify()
self.Refresh() self.Refresh()
@ -551,7 +551,7 @@ class __ToggleMixin:
event.Skip() event.Skip()
def OnKeyUp(self, event): def OnKeyUp(self, event):
if self.hasFocus and event.KeyCode() == ord(" "): if self.hasFocus and event.GetKeyCode() == ord(" "):
self.up = not self.up self.up = not self.up
self.Notify() self.Notify()
self.Refresh() self.Refresh()

View File

@ -771,7 +771,7 @@ class Calendar( wx.PyControl ):
event.Skip() event.Skip()
return return
key_code = event.KeyCode() key_code = event.GetKeyCode()
if key_code == wx.WXK_TAB: if key_code == wx.WXK_TAB:
forward = not event.ShiftDown() forward = not event.ShiftDown()

View File

@ -942,7 +942,7 @@ class Editor(wx.ScrolledWindow):
self.AdjustScrollbars() self.AdjustScrollbars()
def OnChar(self, event): def OnChar(self, event):
key = event.KeyCode() key = event.GetKeyCode()
filters = [self.AltKey, filters = [self.AltKey,
self.MoveSpecialControlKey, self.MoveSpecialControlKey,
self.ControlKey, self.ControlKey,

View File

@ -109,7 +109,7 @@ class IntValidator( wx.PyValidator ):
selected. Leading zeros are removed if introduced by selection, selected. Leading zeros are removed if introduced by selection,
and are prevented from being inserted. and are prevented from being inserted.
""" """
key = event.KeyCode() key = event.GetKeyCode()
ctrl = event.GetEventObject() ctrl = event.GetEventObject()

View File

@ -404,9 +404,9 @@ class FileEditor(Editor):
def _key(self, evt): def _key(self, evt):
if evt.KeyCode() == wx.WXK_RETURN: if evt.GetKeyCode() == wx.WXK_RETURN:
self.EndEdit(True) self.EndEdit(True)
elif evt.KeyCode() == wx.WXK_ESCAPE: elif evt.GetKeyCode() == wx.WXK_ESCAPE:
self.EndEdit(False) self.EndEdit(False)
else: else:
evt.Skip() evt.Skip()

View File

@ -216,7 +216,7 @@ class PyShellWindow(stc.StyledTextCtrl, InteractiveInterpreter):
def OnKey(self, evt): def OnKey(self, evt):
key = evt.KeyCode() key = evt.GetKeyCode()
if key == wx.WXK_RETURN: if key == wx.WXK_RETURN:
pos = self.GetCurrentPos() pos = self.GetCurrentPos()
lastPos = self.GetTextLength() lastPos = self.GetTextLength()

View File

@ -109,7 +109,7 @@ class PyShellInput(wx.Panel):
def OnChar(self, event): def OnChar(self, event):
"""called on CHARevent. executes input on newline""" """called on CHARevent. executes input on newline"""
# print "On Char:", event.__dict__.keys() # print "On Char:", event.__dict__.keys()
if event.KeyCode() !=wx.WXK_RETURN: if event.GetKeyCode() !=wx.WXK_RETURN:
# not of our business # not of our business
event.Skip() event.Skip()
return return

View File

@ -318,7 +318,7 @@ class wxVTKRenderWindow(wxVTKRenderWindowBase):
def OnChar(self, event): def OnChar(self, event):
key = event.KeyCode() key = event.GetKeyCode()
if (key == ord('r')) or (key == ord('R')): if (key == ord('r')) or (key == ord('R')):
self.Reset() self.Reset()
elif (key == ord('w')) or (key == ord('W')): elif (key == ord('w')) or (key == ord('W')):

View File

@ -12,6 +12,9 @@ __cvsid__ = "$Id$"
__revision__ = "$Revision$"[11:-2] __revision__ = "$Revision$"[11:-2]
import wx import wx
import os
print "PID:", os.getpid()
raw_input("...")
class App(wx.App): class App(wx.App):
"""PyShell standalone application.""" """PyShell standalone application."""

View File

@ -643,7 +643,7 @@ class Editor:
Only receives an event if OnKeyDown calls event.Skip() for the Only receives an event if OnKeyDown calls event.Skip() for the
corresponding event.""" corresponding event."""
key = event.KeyCode() key = event.GetKeyCode()
if key in self.autoCompleteKeys: if key in self.autoCompleteKeys:
# Usually the dot (period) key activates auto completion. # Usually the dot (period) key activates auto completion.
if self.window.AutoCompActive(): if self.window.AutoCompActive():
@ -671,7 +671,7 @@ class Editor:
def OnKeyDown(self, event): def OnKeyDown(self, event):
"""Key down event handler.""" """Key down event handler."""
key = event.KeyCode() key = event.GetKeyCode()
# If the auto-complete window is up let it do its thing. # If the auto-complete window is up let it do its thing.
if self.window.AutoCompActive(): if self.window.AutoCompActive():
event.Skip() event.Skip()

View File

@ -417,7 +417,7 @@ Platform: %s""" % \
# commands/responses. # commands/responses.
if not self.CanEdit(): if not self.CanEdit():
return return
key = event.KeyCode() key = event.GetKeyCode()
currpos = self.GetCurrentPos() currpos = self.GetCurrentPos()
stoppos = self.promptPosEnd stoppos = self.promptPosEnd
# Return (Enter) needs to be ignored in this handler. # Return (Enter) needs to be ignored in this handler.
@ -452,7 +452,7 @@ Platform: %s""" % \
def OnKeyDown(self, event): def OnKeyDown(self, event):
"""Key down event handler.""" """Key down event handler."""
key = event.KeyCode() key = event.GetKeyCode()
# If the auto-complete window is up let it do its thing. # If the auto-complete window is up let it do its thing.
if self.AutoCompActive(): if self.AutoCompActive():
event.Skip() event.Skip()