Changeset 759:cf8bdfef70dd


Ignore:
Timestamp:
02/14/16 08:52:26 (9 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
Phase:
public
Message:

The surname and first name are to be entered separately (re #285)

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • locale/en/mlx.po

    r757 r759  
    21432143"One of VATSIM ID or IVAO ID is mandatory."
    21442144
    2145 msgid "register_name"
    2146 msgstr "_Name:"
    2147 
    2148 msgid "register_name_tooltip"
    2149 msgstr "Enter your real name."
     2145msgid "register_name1"
     2146msgstr "First _name:"
     2147
     2148msgid "register_name1_tooltip"
     2149msgstr "Enter your real first name."
     2150
     2151msgid "register_name2"
     2152msgstr "Sur_name:"
     2153
     2154msgid "register_name2_tooltip"
     2155msgstr "Enter your real surname."
     2156
     2157msgid "register_nameorder"
     2158msgstr "western"
    21502159
    21512160msgid "register_year_of_birth"
  • locale/hu/mlx.po

    r757 r759  
    21572157"Vagy VATSIM vagy IVAO azonosítót meg kell adni."
    21582158
    2159 msgid "register_name"
    2160 msgstr "Né_v:"
    2161 
    2162 msgid "register_name_tooltip"
    2163 msgstr "Írd be a valódi nevedet"
     2159msgid "register_name1"
     2160msgstr "_Vezetéknév:"
     2161
     2162msgid "register_name1_tooltip"
     2163msgstr "Írd be a valódi vezetéknevedet"
     2164
     2165msgid "register_name2"
     2166msgstr "Keresz_tnév:"
     2167
     2168msgid "register_name2_tooltip"
     2169msgstr "Írd be a valódi keresztnevedet"
     2170
     2171msgid "register_nameorder"
     2172msgstr "eastern"
    21642173
    21652174msgid "register_year_of_birth"
  • src/mlx/gui/flight.py

    r756 r759  
    1111import mlx.util as util
    1212from mlx.pirep import PIREP
    13 from mlx.i18n import xstr
     13from mlx.i18n import xstr, getLanguage
    1414from mlx.sound import startSound
    1515import mlx.web as web
     
    942942                                  xscale = 0.0, yscale = 0.0)
    943943
    944         table = gtk.Table(11, 3)
     944        table = gtk.Table(12, 3)
    945945        table.set_row_spacings(4)
    946946        table.set_col_spacings(32)
     
    948948        self.setMainWidget(alignment)
    949949
     950        row = 0
     951
    950952        labelAlignment = gtk.Alignment(xalign = 1.0, yalign = 0.5,
    951953                                       xscale = 0.0, yscale = 0.0)
    952         label = gtk.Label(xstr("register_name"))
     954        label = gtk.Label(xstr("register_name1"))
    953955        label.set_use_underline(True)
    954956        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
    963983
    964984        labelAlignment = gtk.Alignment(xalign = 1.0, yalign = 0.5,
     
    967987        label.set_use_underline(True)
    968988        labelAlignment.add(label)
    969         table.attach(labelAlignment, 0, 1, 1, 2)
     989        table.attach(labelAlignment, 0, 1, row, row+1)
    970990
    971991        alignment = gtk.Alignment(xalign = 0.0, yalign = 0.0,
     
    9821002        self._yearOfBirth.connect("value-changed", self._updateButtons)
    9831003        alignment.add(self._yearOfBirth)
    984         table.attach(alignment, 1, 2, 1, 2)
     1004        table.attach(alignment, 1, 2, row, row+1)
    9851005        label.set_mnemonic_widget(self._yearOfBirth)
     1006
     1007        row += 1
    9861008
    9871009        labelAlignment = gtk.Alignment(xalign = 1.0, yalign = 0.5,
     
    9901012        label.set_use_underline(True)
    9911013        labelAlignment.add(label)
    992         table.attach(labelAlignment, 0, 1, 2, 3)
     1014        table.attach(labelAlignment, 0, 1, row, row+1)
    9931015
    9941016        self._emailAddress = gtk.Entry()
    9951017        self._emailAddress.connect("changed", self._updateButtons)
    9961018        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)
    9981020        label.set_mnemonic_widget(self._emailAddress)
    9991021
     
    10011023        self._emailAddressPublic.set_use_underline(True)
    10021024        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
    10041028
    10051029        labelAlignment = gtk.Alignment(xalign = 1.0, yalign = 0.5,
     
    10081032        label.set_use_underline(True)
    10091033        labelAlignment.add(label)
    1010         table.attach(labelAlignment, 0, 1, 3, 4)
     1034        table.attach(labelAlignment, 0, 1, row, row+1)
    10111035
    10121036        alignment = gtk.Alignment(xalign = 0.0, yalign = 0.0,
     
    10171041        self._vatsimID.set_width_chars(7)
    10181042        alignment.add(self._vatsimID)
    1019         table.attach(alignment, 1, 2, 3, 4)
     1043        table.attach(alignment, 1, 2, row, row+1)
    10201044        label.set_mnemonic_widget(self._vatsimID)
     1045
     1046        row += 1
    10211047
    10221048        labelAlignment = gtk.Alignment(xalign = 1.0, yalign = 0.5,
     
    10251051        label.set_use_underline(True)
    10261052        labelAlignment.add(label)
    1027         table.attach(labelAlignment, 0, 1, 4, 5)
     1053        table.attach(labelAlignment, 0, 1, row, row+1)
    10281054
    10291055        alignment = gtk.Alignment(xalign = 0.0, yalign = 0.0,
     
    10341060        self._ivaoID.set_width_chars(7)
    10351061        alignment.add(self._ivaoID)
    1036         table.attach(alignment, 1, 2, 4, 5)
     1062        table.attach(alignment, 1, 2, row, row+1)
    10371063        label.set_mnemonic_widget(self._ivaoID)
     1064
     1065        row += 1
    10381066
    10391067        labelAlignment = gtk.Alignment(xalign = 1.0, yalign = 0.5,
     
    10431071        label.set_use_markup(True)
    10441072        labelAlignment.add(label)
    1045         table.attach(labelAlignment, 0, 1, 5, 6)
     1073        table.attach(labelAlignment, 0, 1, row, row+1)
    10461074
    10471075        self._phoneNumber = gtk.Entry()
    10481076        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)
    10501078        label.set_mnemonic_widget(self._phoneNumber)
     1079
     1080        row += 1
    10511081
    10521082        labelAlignment = gtk.Alignment(xalign = 1.0, yalign = 0.5,
     
    10561086        label.set_use_markup(True)
    10571087        labelAlignment.add(label)
    1058         table.attach(labelAlignment, 0, 1, 6, 7)
     1088        table.attach(labelAlignment, 0, 1, row, row+1)
    10591089
    10601090
    10611091        self._nationality = gtk.Entry()
    10621092        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)
    10641094        label.set_mnemonic_widget(self._nationality)
    10651095
     
    10691099        placeholder.set_child_visible(False)
    10701100        placeholder.hide()
    1071         table.attach(placeholder, 2, 3, 6, 7)
     1101        table.attach(placeholder, 2, 3, row, row+1)
     1102
     1103        row += 1
    10721104
    10731105        labelAlignment = gtk.Alignment(xalign = 1.0, yalign = 0.5,
     
    10761108        label.set_use_underline(True)
    10771109        labelAlignment.add(label)
    1078         table.attach(labelAlignment, 0, 1, 8, 9)
     1110        table.attach(labelAlignment, 0, 1, row, row+1)
    10791111
    10801112        self._password = gtk.Entry()
     
    10821114        self._password.connect("changed", self._updateButtons)
    10831115        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)
    10851117        label.set_mnemonic_widget(self._password)
    10861118
     
    10891121        self._passwordStatus = gtk.Label()
    10901122        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
    10921126
    10931127        labelAlignment = gtk.Alignment(xalign = 1.0, yalign = 0.5,
     
    10961130        label.set_use_underline(True)
    10971131        labelAlignment.add(label)
    1098         table.attach(labelAlignment, 0, 1, 9, 10)
     1132        table.attach(labelAlignment, 0, 1, row, row+1)
    10991133
    11001134        self._password2 = gtk.Entry()
     
    11021136        self._password2.connect("changed", self._updateButtons)
    11031137        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)
    11051139        label.set_mnemonic_widget(self._password2)
    11061140
     
    11091143        self._password2Status = gtk.Label()
    11101144        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
    11121148
    11131149        self._rememberButton = gtk.CheckButton(xstr("remember_password"))
    11141150        self._rememberButton.set_use_underline(True)
    11151151        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)
    11171153
    11181154        cancelButton = \
     
    11281164
    11291165    @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()
    11331174
    11341175    @property
     
    11861227    def _updateButtons(self, widget = None):
    11871228        """Update the sensitive state of the buttons"""
    1188         name = self.name
    1189         nameLength = len(name)
    1190         nameSpacePosition = name.find(" ")
    1191 
    11921229        yearOfBirth = self.yearOfBirth
    11931230
     
    12171254
    12181255        sensitive = \
    1219             nameLength >= 5 and nameSpacePosition != -1 and \
    1220             nameSpacePosition<(nameLength-2) and \
     1256            len(self.name1)>0 and len(self.name2)>0 and \
    12211257            yearOfBirth>=RegisterPage._minYearOfBirth and \
    12221258            yearOfBirth<=RegisterPage._maxYearOfBirth and \
     
    12331269    def _registerClicked(self, button):
    12341270        """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,
    12361291                                            self.emailAddress,
    12371292                                            self.emailAddressPublic,
     
    12401295                                            self.password)
    12411296        print "Registering with data:"
    1242         print "  name:", self.name, registrationData.name
     1297        print "  name:", self.name1, self.name2, registrationData.firstName, registrationData.surName, requestedNameOrder
    12431298        print "  yearOfBirth:", self.yearOfBirth, registrationData.yearOfBirth
    12441299        print "  emailAddress:", self.emailAddress, registrationData.emailAddress
  • src/mlx/rpc.py

    r756 r759  
    127127class Registration(object):
    128128    """Data for registration."""
    129     def __init__(self, name, yearOfBirth, emailAddress, emailAddressPublic,
     129    def __init__(self, surName, firstName, nameOrder,
     130                 yearOfBirth, emailAddress, emailAddressPublic,
    130131                 vatsimID, ivaoID, phoneNumber, nationality, password):
    131132        """Construct the registration data."""
    132         self.name = name
     133        self.surName = surName
     134        self.firstName = firstName
     135        self.nameOrder = nameOrder
    133136        self.yearOfBirth = yearOfBirth
    134137        self.emailAddress = emailAddress
Note: See TracChangeset for help on using the changeset viewer.