Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Briar GTK
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
45
Issues
45
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
briar
Briar GTK
Commits
bbfc2726
Commit
bbfc2726
authored
Mar 23, 2020
by
Nico Alt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify registration container
parent
a47cd11d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
20 deletions
+14
-20
briar-gtk/briar_gtk/containers/registration.py
briar-gtk/briar_gtk/containers/registration.py
+14
-19
briar-gtk/data/ui/registration.ui
briar-gtk/data/ui/registration.ui
+0
-1
No files found.
briar-gtk/briar_gtk/containers/registration.py
View file @
bbfc2726
...
...
@@ -27,7 +27,7 @@ class RegistrationContainer(Container):
self
.
_setup_registration_flow_stack
()
self
.
_setup_registration_flow_headers
()
self
.
_setup_nickname_
keystroke
_listener
()
self
.
_setup_nickname_
enter
_listener
()
def
_setup_registration_flow_stack
(
self
):
self
.
registration_flow_stack
=
self
.
builder
.
get_object
(
self
.
STACK_NAME
)
...
...
@@ -39,15 +39,12 @@ class RegistrationContainer(Container):
registration_flow_headers
.
show_all
()
self
.
_window
.
set_titlebar
(
registration_flow_headers
)
def
_setup_nickname_
keystroke
_listener
(
self
):
def
_setup_nickname_
enter
_listener
(
self
):
nickname_entry
=
self
.
builder
.
get_object
(
"nickname_entry"
)
nickname_entry
.
connect
(
"key-press-event"
,
self
.
_nickname_keystroke
)
nickname_entry
.
connect
(
"activate"
,
self
.
_on_nickname_enter
)
# pylint: disable=unused-argument
def
_nickname_keystroke
(
self
,
widget
,
event
):
if
event
.
hardware_keycode
!=
36
and
event
.
hardware_keycode
!=
104
:
return
def
_on_nickname_enter
(
self
,
event
):
self
.
on_nickname_next_pressed
(
None
)
# pylint: disable=unused-argument
...
...
@@ -68,22 +65,20 @@ class RegistrationContainer(Container):
self
.
registration_flow_stack
.
set_visible_child
(
passwords_page
)
self
.
_focus_password_entry
()
self
.
_setup_passwords_
keystroke
_listener
()
self
.
_setup_passwords_
enter
_listener
()
def
_focus_password_entry
(
self
):
password_entry
=
self
.
builder
.
get_object
(
"password_entry"
)
password_entry
.
grab_focus
()
def
_setup_passwords_
keystroke
_listener
(
self
):
def
_setup_passwords_
enter
_listener
(
self
):
password_confirm_entry
=
self
.
builder
.
get_object
(
"password_confirm_entry"
)
password_confirm_entry
.
connect
(
"
key-press-event"
,
self
.
_passwords_keystroke
)
"
activate"
,
self
.
_on_passwords_enter
)
# pylint: disable=unused-argument
def
_passwords_keystroke
(
self
,
widget
,
event
):
if
event
.
hardware_keycode
!=
36
and
event
.
hardware_keycode
!=
104
:
return
def
_on_passwords_enter
(
self
,
event
):
self
.
on_create_account_pressed
(
None
)
# pylint: disable=unused-argument
...
...
@@ -96,11 +91,11 @@ class RegistrationContainer(Container):
# pylint: disable=unused-argument
def
on_create_account_pressed
(
self
,
button
):
passwords_error_label
=
self
.
builder
.
get_object
(
"passwords_error_label"
)
if
not
self
.
_passwords_match
():
passwords_error_label
.
show
(
)
self
.
_show_error_message
(
_
(
"The passwords do not match"
)
)
return
passwords_error_label
=
self
.
builder
.
get_object
(
"passwords_error_label"
)
passwords_error_label
.
hide
()
self
.
_show_loading_animation
()
self
.
_register
()
...
...
@@ -128,11 +123,11 @@ class RegistrationContainer(Container):
GLib
.
idle_add
(
function
)
def
_registration_failed
(
self
):
self
.
_show_error_message
()
self
.
_show_error_message
(
_
(
"Couldn't register account"
)
)
self
.
_show_passwords_page
()
def
_show_error_message
(
self
):
def
_show_error_message
(
self
,
error_message
):
passwords_error_label
=
self
.
builder
.
get_object
(
"passwords_error_label"
)
passwords_error_label
.
set_label
(
_
(
"Couldn't register account"
)
)
passwords_error_label
.
set_label
(
error_message
)
passwords_error_label
.
show
()
briar-gtk/data/ui/registration.ui
View file @
bbfc2726
...
...
@@ -174,7 +174,6 @@
<property
name=
"can_focus"
>
False
</property>
<property
name=
"no_show_all"
>
True
</property>
<property
name=
"xalign"
>
0
</property>
<property
name=
"label"
translatable=
"yes"
>
The passwords do not match
</property>
<property
name=
"wrap"
>
True
</property>
<property
name=
"wrap_mode"
>
PANGO_WRAP_WORD_CHAR
</property>
<style>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment