до рефакторинга

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import string
import wx
from types import *
class dlgValidTextCtrl(wx.PyValidator):
def __init__(self,flag=None): # ссылка на полис
wx.PyValidator.__init__(self)
self.flag=flag
self.Bind(wx.EVT_CHAR, self.OnChar)
self.store={}
self.KeyPass=[wx.WXK_UP,
wx.WXK_DOWN,
wx.WXK_RIGHT,
wx.WXK_LEFT,
wx.WXK_HOME,
wx.WXK_END,
wx.WXK_BACK,
wx.WXK_DELETE,
wx.WXK_SPACE,
# wx.WXK_RETURN,
wx.WXK_ESCAPE]
return None
def Clone(self):
return dlgValidTextCtrl(self.flag)
def Validate(self, parent):
return True
def TransferToWindow(self):
return self.TransferDataToWindow()
def TransferFromWindow(self):
return self.TransferDataFromWindow()
def TransferDataToWindow(self):
return True
def TransferDataFromWindow(self):
return True
def OnChar(self, event):
WindowCtrl = self.GetWindow()
Value = WindowCtrl.GetValue()
KeyCode = event.GetKeyCode()
small_russian=u"йцукенгшщзхъфывапролджэячсмитьбюё-?*."
big_russian=small_russian.upper()
all_russian=small_russian+big_russian
if unichr(KeyCode) in string.digits:
event.Skip()
return
if unichr(KeyCode) in string.letters:
return
if WindowCtrl.IsEditable():
if unichr(KeyCode) in all_russian:
UniKey=unichr(KeyCode)
if UniKey.isupper!=True:
UniKey=UniKey.upper()
WindowCtrl.WriteText(UniKey)
return
event.Skip()
return