コード例 #1
0
ファイル: GetData.py プロジェクト: rcocetta/kano-profile
 def get_cached_username_and_birthday(self):
     username = get_cached_data("username")
     birthday_day = get_cached_data("birthday_day")
     birthday_month = get_cached_data("birthday_month")
     birthday_year = get_cached_data("birthday_year")
     return {
         "username": username,
         "birthday_day": birthday_day,
         "birthday_month": birthday_month,
         "birthday_year": birthday_year,
     }
コード例 #2
0
    def __init__(self, age):
        DataTemplate.__init__(self)
        box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)

        email = get_cached_data("email")
        secondary_email = get_cached_data("secondary_data")

        self.t_and_cs = TermsAndConditions()
        self.t_and_cs.checkbutton.connect("clicked", self.widgets_full)
        self.t_and_cs.connect("t-and-cs-clicked",
                              self.show_terms_and_conditions)

        marketing_container = self._create_marketing_checkbox()
        marketing_enabled = get_cached_data("marketing_enabled")

        if marketing_enabled is not None:
            self.marketing_checkbutton.set_active(marketing_enabled)
        else:
            self.marketing_checkbutton.set_active(True)

        # If the user is younger than 14, ask for both Guardian and
        # user email, but the guardian email is compulsory
        if age <= 13:
            self.email_entry = LabelledEntry(
                _("Parent's Email (required)"), email
            )
            self.email_entry.connect('key-release-event',
                                     self.widgets_full)

            self.secondary_email_entry = LabelledEntry(
                _("Your Email (optional)"), secondary_email
            )
            self.secondary_email_entry.connect(
                'key-release-event', self.widgets_full
            )

            box.pack_start(self.email_entry, False, False, 5)
            box.pack_start(self.secondary_email_entry, False, False, 5)

        # Otherwise, there is only one compulsory email
        else:
            self.email_entry = LabelledEntry(_("Your Email (required)"), email)
            self.email_entry.connect('key-release-event', self.widgets_full)
            self.secondary_email_entry = None
            box.pack_start(self.email_entry, False, False, 5)

        self.entries = [self.email_entry]

        box.pack_start(self.t_and_cs, False, False, 10)
        box.pack_start(marketing_container, False, False, 0)
        box.set_margin_top(20)

        self.add(box)
コード例 #3
0
ファイル: GetData.py プロジェクト: isabella232/kano-profile
    def __init__(self):
        DataTemplate.__init__(self)

        # Set the birthday to be False by default
        box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)

        # This data contains the saved username and birthday
        data = self.get_cached_username_and_birthday()
        email = get_cached_data('email')

        self._username = LabelledEntry(_("Username"), data['username'])
        self._username.connect('key-release-event', self.validate_username)
        stay_safe = Gtk.Label(_("Stay safe, don't use your real name."))
        stay_safe.get_style_context().add_class('get_data_label')
        stay_safe.set_alignment(0, 0)
        stay_safe.set_margin_left(30)
        stay_safe.set_margin_bottom(10)

        # Do not fill this in
        self._password = LabelledEntry(_("Password"))
        self._password.connect('key-release-event', self.validate_password)

        self.validate_username()

        self.show_password = Gtk.CheckButton.new_with_label(_("Show password"))
        self.show_password.get_style_context().add_class('show_password')
        self.show_password.connect('toggled', self.make_password_entry_visible)
        self.show_password.set_active(True)
        self.show_password.set_margin_left(30)

        self.email_entry = LabelledEntry(_("Email Address"), email)
        self.email_entry.set_placeholder_text('E.g. [email protected]')
        self.email_entry.connect('key-release-event', self.widgets_full)
        self.secondary_email_entry = None

        self.t_and_cs = TermsAndConditions()
        self.t_and_cs.checkbutton.connect('clicked', self.widgets_full)
        self.t_and_cs.connect('t-and-cs-clicked',
                              self.show_terms_and_conditions)

        box.pack_start(self._username, False, False, 5)
        box.pack_start(stay_safe, False, False, 0)
        box.pack_start(self._password, False, False, 5)
        box.pack_start(self.show_password, False, False, 5)
        box.pack_start(self.email_entry, False, False, 5)
        box.pack_start(self.t_and_cs, False, False, 25)

        box.set_margin_top(20)

        self.add(box)
コード例 #4
0
ファイル: GetData.py プロジェクト: KanoComputing/kano-profile
    def __init__(self):
        DataTemplate.__init__(self)

        # Set the birthday to be False by default
        box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)

        # This data contains the saved username and birthday
        data = self.get_cached_username_and_birthday()
        email = get_cached_data('email')

        self._username = LabelledEntry(_("Username"), data['username'])
        self._username.connect('key-release-event', self.validate_username)
        stay_safe = Gtk.Label(_("Stay safe, don't use your real name."))
        stay_safe.get_style_context().add_class('get_data_label')
        stay_safe.set_alignment(0, 0)
        stay_safe.set_margin_left(30)
        stay_safe.set_margin_bottom(10)

        # Do not fill this in
        self._password = LabelledEntry(_("Password"))
        self._password.connect('key-release-event', self.validate_password)

        self.validate_username()

        self.show_password = Gtk.CheckButton.new_with_label(_("Show password"))
        self.show_password.get_style_context().add_class('show_password')
        self.show_password.connect('toggled', self.make_password_entry_visible)
        self.show_password.set_active(True)
        self.show_password.set_margin_left(30)

        self.email_entry = LabelledEntry(_("Email Address"), email)
        self.email_entry.set_placeholder_text('E.g. [email protected]')
        self.email_entry.connect('key-release-event', self.widgets_full)
        self.secondary_email_entry = None

        self.t_and_cs = TermsAndConditions()
        self.t_and_cs.checkbutton.connect('clicked', self.widgets_full)
        self.t_and_cs.connect('t-and-cs-clicked', self.show_terms_and_conditions)

        box.pack_start(self._username, False, False, 5)
        box.pack_start(stay_safe, False, False, 0)
        box.pack_start(self._password, False, False, 5)
        box.pack_start(self.show_password, False, False, 5)
        box.pack_start(self.email_entry, False, False, 5)
        box.pack_start(self.t_and_cs, False, False, 25)

        box.set_margin_top(20)

        self.add(box)
コード例 #5
0
ファイル: GetData.py プロジェクト: isabella232/kano-profile
 def get_cached_username_and_birthday(self):
     username = get_cached_data('username')
     return {
         'username': username,
     }
コード例 #6
0
 def update_birthday_widget_from_cache(self):
     self.bday_widget.set_birthday_data(
         get_cached_data("birthday_year_index"),
         get_cached_data("birthday_month_index"),
         get_cached_data("birthday_day_index")
     )
コード例 #7
0
ファイル: GetData.py プロジェクト: KanoComputing/kano-profile
 def get_cached_username_and_birthday(self):
     username = get_cached_data('username')
     return {
         'username': username,
     }