Changeset 759:cf8bdfef70dd for src/mlx/gui
- Timestamp:
- 02/14/16 08:52:26 (9 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/gui/flight.py
r756 r759 11 11 import mlx.util as util 12 12 from mlx.pirep import PIREP 13 from mlx.i18n import xstr 13 from mlx.i18n import xstr, getLanguage 14 14 from mlx.sound import startSound 15 15 import mlx.web as web … … 942 942 xscale = 0.0, yscale = 0.0) 943 943 944 table = gtk.Table(1 1, 3)944 table = gtk.Table(12, 3) 945 945 table.set_row_spacings(4) 946 946 table.set_col_spacings(32) … … 948 948 self.setMainWidget(alignment) 949 949 950 row = 0 951 950 952 labelAlignment = gtk.Alignment(xalign = 1.0, yalign = 0.5, 951 953 xscale = 0.0, yscale = 0.0) 952 label = gtk.Label(xstr("register_name "))954 label = gtk.Label(xstr("register_name1")) 953 955 label.set_use_underline(True) 954 956 labelAlignment.add(label) 955 table.attach(labelAlignment, 0, 1, 0, 1) 956 957 self._name = gtk.Entry() 958 self._name.connect("changed", self._updateButtons) 959 self._name.set_tooltip_text(xstr("register_name_tooltip")) 960 self._name.set_width_chars(30) 961 table.attach(self._name, 1, 2, 0, 1) 962 label.set_mnemonic_widget(self._name) 957 table.attach(labelAlignment, 0, 1, row, row+1) 958 959 self._name1 = gtk.Entry() 960 self._name1.connect("changed", self._updateButtons) 961 self._name1.set_tooltip_text(xstr("register_name1_tooltip")) 962 self._name1.set_width_chars(15) 963 table.attach(self._name1, 1, 2, row, row+1) 964 label.set_mnemonic_widget(self._name1) 965 966 row += 1 967 968 labelAlignment = gtk.Alignment(xalign = 1.0, yalign = 0.5, 969 xscale = 0.0, yscale = 0.0) 970 label = gtk.Label(xstr("register_name2")) 971 label.set_use_underline(True) 972 labelAlignment.add(label) 973 table.attach(labelAlignment, 0, 1, row, row+1) 974 975 self._name2 = gtk.Entry() 976 self._name2.connect("changed", self._updateButtons) 977 self._name2.set_tooltip_text(xstr("register_name2_tooltip")) 978 self._name2.set_width_chars(15) 979 table.attach(self._name2, 1, 2, row, row+1) 980 label.set_mnemonic_widget(self._name2) 981 982 row += 1 963 983 964 984 labelAlignment = gtk.Alignment(xalign = 1.0, yalign = 0.5, … … 967 987 label.set_use_underline(True) 968 988 labelAlignment.add(label) 969 table.attach(labelAlignment, 0, 1, 1, 2)989 table.attach(labelAlignment, 0, 1, row, row+1) 970 990 971 991 alignment = gtk.Alignment(xalign = 0.0, yalign = 0.0, … … 982 1002 self._yearOfBirth.connect("value-changed", self._updateButtons) 983 1003 alignment.add(self._yearOfBirth) 984 table.attach(alignment, 1, 2, 1, 2)1004 table.attach(alignment, 1, 2, row, row+1) 985 1005 label.set_mnemonic_widget(self._yearOfBirth) 1006 1007 row += 1 986 1008 987 1009 labelAlignment = gtk.Alignment(xalign = 1.0, yalign = 0.5, … … 990 1012 label.set_use_underline(True) 991 1013 labelAlignment.add(label) 992 table.attach(labelAlignment, 0, 1, 2, 3)1014 table.attach(labelAlignment, 0, 1, row, row+1) 993 1015 994 1016 self._emailAddress = gtk.Entry() 995 1017 self._emailAddress.connect("changed", self._updateButtons) 996 1018 self._emailAddress.set_tooltip_text(xstr("register_email_tooltip")) 997 table.attach(self._emailAddress, 1, 2, 2, 3)1019 table.attach(self._emailAddress, 1, 2, row, row+1) 998 1020 label.set_mnemonic_widget(self._emailAddress) 999 1021 … … 1001 1023 self._emailAddressPublic.set_use_underline(True) 1002 1024 self._emailAddressPublic.set_tooltip_text(xstr("register_email_public_tooltip")) 1003 table.attach(self._emailAddressPublic, 2, 3, 2, 3) 1025 table.attach(self._emailAddressPublic, 2, 3, row, row+1) 1026 1027 row += 1 1004 1028 1005 1029 labelAlignment = gtk.Alignment(xalign = 1.0, yalign = 0.5, … … 1008 1032 label.set_use_underline(True) 1009 1033 labelAlignment.add(label) 1010 table.attach(labelAlignment, 0, 1, 3, 4)1034 table.attach(labelAlignment, 0, 1, row, row+1) 1011 1035 1012 1036 alignment = gtk.Alignment(xalign = 0.0, yalign = 0.0, … … 1017 1041 self._vatsimID.set_width_chars(7) 1018 1042 alignment.add(self._vatsimID) 1019 table.attach(alignment, 1, 2, 3, 4)1043 table.attach(alignment, 1, 2, row, row+1) 1020 1044 label.set_mnemonic_widget(self._vatsimID) 1045 1046 row += 1 1021 1047 1022 1048 labelAlignment = gtk.Alignment(xalign = 1.0, yalign = 0.5, … … 1025 1051 label.set_use_underline(True) 1026 1052 labelAlignment.add(label) 1027 table.attach(labelAlignment, 0, 1, 4, 5)1053 table.attach(labelAlignment, 0, 1, row, row+1) 1028 1054 1029 1055 alignment = gtk.Alignment(xalign = 0.0, yalign = 0.0, … … 1034 1060 self._ivaoID.set_width_chars(7) 1035 1061 alignment.add(self._ivaoID) 1036 table.attach(alignment, 1, 2, 4, 5)1062 table.attach(alignment, 1, 2, row, row+1) 1037 1063 label.set_mnemonic_widget(self._ivaoID) 1064 1065 row += 1 1038 1066 1039 1067 labelAlignment = gtk.Alignment(xalign = 1.0, yalign = 0.5, … … 1043 1071 label.set_use_markup(True) 1044 1072 labelAlignment.add(label) 1045 table.attach(labelAlignment, 0, 1, 5, 6)1073 table.attach(labelAlignment, 0, 1, row, row+1) 1046 1074 1047 1075 self._phoneNumber = gtk.Entry() 1048 1076 self._phoneNumber.set_tooltip_text(xstr("register_phone_num_tooltip")) 1049 table.attach(self._phoneNumber, 1, 2, 5, 6)1077 table.attach(self._phoneNumber, 1, 2, row, row+1) 1050 1078 label.set_mnemonic_widget(self._phoneNumber) 1079 1080 row += 1 1051 1081 1052 1082 labelAlignment = gtk.Alignment(xalign = 1.0, yalign = 0.5, … … 1056 1086 label.set_use_markup(True) 1057 1087 labelAlignment.add(label) 1058 table.attach(labelAlignment, 0, 1, 6, 7)1088 table.attach(labelAlignment, 0, 1, row, row+1) 1059 1089 1060 1090 1061 1091 self._nationality = gtk.Entry() 1062 1092 self._nationality.set_tooltip_text(xstr("register_nationality_tooltip")) 1063 table.attach(self._nationality, 1, 2, 6, 7)1093 table.attach(self._nationality, 1, 2, row, row+1) 1064 1094 label.set_mnemonic_widget(self._nationality) 1065 1095 … … 1069 1099 placeholder.set_child_visible(False) 1070 1100 placeholder.hide() 1071 table.attach(placeholder, 2, 3, 6, 7) 1101 table.attach(placeholder, 2, 3, row, row+1) 1102 1103 row += 1 1072 1104 1073 1105 labelAlignment = gtk.Alignment(xalign = 1.0, yalign = 0.5, … … 1076 1108 label.set_use_underline(True) 1077 1109 labelAlignment.add(label) 1078 table.attach(labelAlignment, 0, 1, 8, 9)1110 table.attach(labelAlignment, 0, 1, row, row+1) 1079 1111 1080 1112 self._password = gtk.Entry() … … 1082 1114 self._password.connect("changed", self._updateButtons) 1083 1115 self._password.set_tooltip_text(xstr("register_password_tooltip")) 1084 table.attach(self._password, 1, 2, 8, 9)1116 table.attach(self._password, 1, 2, row, row+1) 1085 1117 label.set_mnemonic_widget(self._password) 1086 1118 … … 1089 1121 self._passwordStatus = gtk.Label() 1090 1122 alignment.add(self._passwordStatus) 1091 table.attach(alignment, 2, 3, 8, 9) 1123 table.attach(alignment, 2, 3, row, row+1) 1124 1125 row += 1 1092 1126 1093 1127 labelAlignment = gtk.Alignment(xalign = 1.0, yalign = 0.5, … … 1096 1130 label.set_use_underline(True) 1097 1131 labelAlignment.add(label) 1098 table.attach(labelAlignment, 0, 1, 9, 10)1132 table.attach(labelAlignment, 0, 1, row, row+1) 1099 1133 1100 1134 self._password2 = gtk.Entry() … … 1102 1136 self._password2.connect("changed", self._updateButtons) 1103 1137 self._password2.set_tooltip_text(xstr("register_password2_tooltip")) 1104 table.attach(self._password2, 1, 2, 9, 10)1138 table.attach(self._password2, 1, 2, row, row+1) 1105 1139 label.set_mnemonic_widget(self._password2) 1106 1140 … … 1109 1143 self._password2Status = gtk.Label() 1110 1144 alignment.add(self._password2Status) 1111 table.attach(alignment, 2, 3, 9, 10) 1145 table.attach(alignment, 2, 3, row, row+1) 1146 1147 row += 1 1112 1148 1113 1149 self._rememberButton = gtk.CheckButton(xstr("remember_password")) 1114 1150 self._rememberButton.set_use_underline(True) 1115 1151 self._rememberButton.set_tooltip_text(xstr("login_remember_tooltip")) 1116 table.attach(self._rememberButton, 1, 2, 10, 11)1152 table.attach(self._rememberButton, 1, 2, row, row+1) 1117 1153 1118 1154 cancelButton = \ … … 1128 1164 1129 1165 @property 1130 def name(self): 1131 """Get the name entered.""" 1132 return self._name.get_text() 1166 def name1(self): 1167 """Get the first name component entered.""" 1168 return self._name1.get_text() 1169 1170 @property 1171 def name2(self): 1172 """Get the second name component entered.""" 1173 return self._name2.get_text() 1133 1174 1134 1175 @property … … 1186 1227 def _updateButtons(self, widget = None): 1187 1228 """Update the sensitive state of the buttons""" 1188 name = self.name1189 nameLength = len(name)1190 nameSpacePosition = name.find(" ")1191 1192 1229 yearOfBirth = self.yearOfBirth 1193 1230 … … 1217 1254 1218 1255 sensitive = \ 1219 nameLength >= 5 and nameSpacePosition != -1 and \ 1220 nameSpacePosition<(nameLength-2) and \ 1256 len(self.name1)>0 and len(self.name2)>0 and \ 1221 1257 yearOfBirth>=RegisterPage._minYearOfBirth and \ 1222 1258 yearOfBirth<=RegisterPage._maxYearOfBirth and \ … … 1233 1269 def _registerClicked(self, button): 1234 1270 """Called when the Register button is clicked.""" 1235 registrationData = web.Registration(self.name, self.yearOfBirth, 1271 nameOrder = xstr("register_nameorder") 1272 1273 if nameOrder=="eastern": 1274 surName = self.name1 1275 firstName = self.name2 1276 else: 1277 surName = self.name2 1278 firstName = self.name1 1279 1280 nationality = self.nationality.lower() 1281 1282 if getLanguage().lower()=="hu" or nationality.find("hung")!=-1 or \ 1283 nationality.find("magyar")!=-1: 1284 requestedNameOrder = "eastern" 1285 else: 1286 requestedNameOrder = "western" 1287 1288 registrationData = web.Registration(surName, firstName, 1289 requestedNameOrder, 1290 self.yearOfBirth, 1236 1291 self.emailAddress, 1237 1292 self.emailAddressPublic, … … 1240 1295 self.password) 1241 1296 print "Registering with data:" 1242 print " name:", self.name , registrationData.name1297 print " name:", self.name1, self.name2, registrationData.firstName, registrationData.surName, requestedNameOrder 1243 1298 print " yearOfBirth:", self.yearOfBirth, registrationData.yearOfBirth 1244 1299 print " emailAddress:", self.emailAddress, registrationData.emailAddress
Note:
See TracChangeset
for help on using the changeset viewer.