-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDlgAddUser.py
133 lines (91 loc) · 4.91 KB
/
DlgAddUser.py
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# -*- coding: utf-8 -*-
import wx
from User_profil import User_profil
[TXT_NAME, TXT_NICKAME, TXT_AGE, TXT_SIZE, TXT_WEIGHT, TXT_FCMIN, TXT_FCMAX,
TXT_FTP] = range(8)
class DlgAddUser(wx.Dialog):
def __init__(self, parent, ID):
wx.Dialog.__init__(self, parent, ID, ("Add a new user"), style = wx.RESIZE_BORDER|wx.CAPTION)
self.user = User_profil()
self._returnAction = wx.ID_CANCEL
lblName = wx.StaticText(self, wx.ID_ANY, ("User name"), style=wx.ALIGN_LEFT)
self._txtName = wx.TextCtrl(self, TXT_NAME, value=self.user.name)
lblNickname = wx.StaticText(self, wx.ID_ANY, ("User nickname"), style=wx.ALIGN_LEFT)
self._txtNickname = wx.TextCtrl(self, TXT_NICKAME, value=self.user.nickname)
lblAge = wx.StaticText(self, wx.ID_ANY, ("User age"), style=wx.ALIGN_LEFT)
self._txtAge = wx.TextCtrl(self, TXT_AGE, value=self.user.nickname)
lblSize = wx.StaticText(self, wx.ID_ANY, ("User Size"), style=wx.ALIGN_LEFT)
self._txtSize = wx.TextCtrl(self, TXT_SIZE, value=self.user.nickname)
lblWeight = wx.StaticText(self, wx.ID_ANY, ("User Weight"), style=wx.ALIGN_LEFT)
self._txtWeight = wx.TextCtrl(self, TXT_WEIGHT, value=self.user.nickname)
lblFCMin = wx.StaticText(self, wx.ID_ANY, ("FC Minimal"), style=wx.ALIGN_LEFT)
self._txtFCMin = wx.TextCtrl(self, TXT_FCMIN, value=self.user.nickname)
lblFCMax = wx.StaticText(self, wx.ID_ANY, ("FC Maximal"), style=wx.ALIGN_LEFT)
self._txtFCMax = wx.TextCtrl(self, TXT_FCMAX, value=self.user.nickname)
lblFTP = wx.StaticText(self, wx.ID_ANY, ("FTP"), style=wx.ALIGN_LEFT)
self._txtFTP = wx.TextCtrl(self, TXT_FTP, value=self.user.nickname)
self.Bind(wx.EVT_TEXT, self._onTxtName, id=TXT_NAME)
self.Bind(wx.EVT_TEXT, self._onTxtNickName, id=TXT_NICKAME)
self.Bind(wx.EVT_TEXT, self._onTxtAge, id=TXT_AGE)
self.Bind(wx.EVT_TEXT, self._onTxtSize, id=TXT_SIZE)
self.Bind(wx.EVT_TEXT, self._onTxtWeight, id=TXT_WEIGHT)
self.Bind(wx.EVT_TEXT, self._onTxtFCMin, id=TXT_FCMIN)
self.Bind(wx.EVT_TEXT, self._onTxtFCMax, id=TXT_FCMAX)
self.Bind(wx.EVT_TEXT, self._onTxtFTP, id=TXT_FTP)
btnOk = wx.Button(self, wx.OK, ('&OK'))
btnOk.SetDefault()
btnCancel = wx.Button(self, wx.CANCEL, ('&Cancel'))
self.Bind(wx.EVT_BUTTON, self._onCmdOk, id=wx.OK)
self.Bind(wx.EVT_BUTTON, self._onCmdCancel, id=wx.CANCEL)
szr1 = wx.GridSizer(cols = 2, rows=8, hgap=5, vgap=5)
szr1.AddMany([
(lblName, 0, wx.ALIGN_LEFT),
(self._txtName, 0, wx.ALIGN_LEFT),
(lblNickname, 0, wx.ALIGN_LEFT),
(self._txtNickname, 0, wx.ALIGN_LEFT),
(lblAge, 0, wx.ALIGN_LEFT),
(self._txtAge, 0, wx.ALIGN_LEFT),
(lblSize, 0, wx.ALIGN_LEFT),
(self._txtSize, 0, wx.ALIGN_LEFT),
(lblWeight, 0, wx.ALIGN_LEFT),
(self._txtWeight, 0, wx.ALIGN_LEFT),
(lblFCMin, 0, wx.ALIGN_LEFT),
(self._txtFCMin, 0, wx.ALIGN_LEFT),
(lblFCMax, 0, wx.ALIGN_LEFT),
(self._txtFCMax, 0, wx.ALIGN_LEFT),
(lblFTP, 0, wx.ALIGN_LEFT),
(self._txtFTP, 0, wx.ALIGN_LEFT),
])
szr2 = wx.BoxSizer(wx.HORIZONTAL)
szr2.Add(btnOk, 0, wx.ALL, 5)
szr2.Add(btnCancel, 0, wx.ALL, 5)
szr3 = wx.BoxSizer(wx.VERTICAL)
szr3.Add(szr1, 0, wx.GROW|wx.ALL, 10)
szr3.Add(szr2, 0, wx.GROW|wx.ALL, 10)
self.SetSizer(szr3)
self.SetAutoLayout(True)
szr3.Fit(self)
def _onTxtName(self, event):
self.user.name = event.GetString().strip()
def _onTxtNickName(self, event):
self.user.nickname = event.GetString().strip()
def _onTxtAge(self, event):
self.user.age = int(event.GetString().strip())
def _onTxtSize(self, event):
self.user.size = int(event.GetString().strip())
def _onTxtWeight(self, event):
self.user.weight = float(event.GetString().strip())
def _onTxtFCMin(self, event):
self.user.FCMin = int(event.GetString().strip())
def _onTxtFCMax(self, event):
self.user.FCMax = int(event.GetString().strip())
def _onTxtFTP(self, event):
self.user.FTP = int(event.GetString().strip())
def _onCmdOk(self, event):
self._returnAction = wx.ID_OK
self.Close()
def _onCmdCancel(self, event):
self._returnAction = wx.ID_CANCEL
self.Close()
def getReturnAction(self):
return self._returnAction