Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Briar GTK
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
briar
Briar GTK
Commits
8b0d5907
Commit
8b0d5907
authored
5 years ago
by
Nico
Browse files
Options
Downloads
Patches
Plain Diff
Move about dialog into own widget class
parent
5946bec4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
briar-gtk/briar_gtk/containers/main_window.py
+5
-34
5 additions, 34 deletions
briar-gtk/briar_gtk/containers/main_window.py
briar-gtk/briar_gtk/widgets/about_dialog.py
+59
-0
59 additions, 0 deletions
briar-gtk/briar_gtk/widgets/about_dialog.py
with
64 additions
and
34 deletions
briar-gtk/briar_gtk/containers/main_window.py
+
5
−
34
View file @
8b0d5907
...
@@ -5,23 +5,21 @@
...
@@ -5,23 +5,21 @@
# Initial version based on GNOME Fractal
# Initial version based on GNOME Fractal
# https://gitlab.gnome.org/GNOME/fractal/-/tags/4.2.2
# https://gitlab.gnome.org/GNOME/fractal/-/tags/4.2.2
from
gettext
import
gettext
as
_
from
gi.repository
import
GLib
from
gi.repository
import
GLib
from
briar_wrapper.models.contacts
import
Contacts
from
briar_wrapper.models.contacts
import
Contacts
from
briar_gtk.container
import
Container
from
briar_gtk.container
import
Container
from
briar_gtk.widgets.contact_row
import
ContactRowWidget
from
briar_gtk.containers.private_chat
import
PrivateChatContainer
from
briar_gtk.containers.private_chat
import
PrivateChatContainer
from
briar_gtk.define
import
APP
from
briar_gtk.define
import
APP
from
briar_gtk.widgets.about_dialog
import
AboutDialogWidget
from
briar_gtk.widgets.contact_row
import
ContactRowWidget
class
MainWindowContainer
(
Container
):
class
MainWindowContainer
(
Container
):
CONTAINER_UI
=
"
main_window.ui
"
CONTAINER_UI
=
"
main_window.ui
"
MENU_UI
=
"
main_menu.ui
"
MENU_UI
=
"
main_menu.ui
"
ABOUT_UI
=
"
about_dialog.ui
"
def
__init__
(
self
):
def
__init__
(
self
):
super
().
__init__
()
super
().
__init__
()
...
@@ -64,37 +62,10 @@ class MainWindowContainer(Container):
...
@@ -64,37 +62,10 @@ class MainWindowContainer(Container):
def
chat_entry
(
self
):
def
chat_entry
(
self
):
return
self
.
builder
.
get_object
(
"
chat_entry
"
)
return
self
.
builder
.
get_object
(
"
chat_entry
"
)
# pylint: disable=line-too-long
def
open_about_page
(
self
):
self
.
_add_from_resource
(
self
.
ABOUT_UI
)
about_dialog
=
self
.
builder
.
get_object
(
"
about_dialog
"
)
about_dialog
.
set_transient_for
(
APP
().
window
)
code_use_title
=
_
(
"
Using code by
"
)
code_use_list
=
[
"
GNOME Fractal https://wiki.gnome.org/Apps/Fractal
"
,
"
GNOME Lollypop https://wiki.gnome.org/Apps/Lollypop
"
,
]
about_dialog
.
add_credit_section
(
code_use_title
,
code_use_list
)
briar_functionality_title
=
_
(
"
Briar functionality by
"
)
briar_functionality_list
=
[
"
Briar REST API https://code.briarproject.org/briar/briar/tree/master/briar-headless
"
,
# noqa
"
Briar Python Wrapper https://code.briarproject.org/briar/python-briar-wrapper
"
,
# noqa
]
about_dialog
.
add_credit_section
(
briar_functionality_title
,
briar_functionality_list
)
about_dialog
.
connect
(
"
response
"
,
self
.
_on_about_response
)
about_dialog
.
show
()
@staticmethod
@staticmethod
# pylint: disable=unused-argument
def
open_about_page
():
def
_on_about_response
(
dialog
,
response_id
):
about_dialog
=
AboutDialogWidget
()
dialog
.
destroy
()
about_
dialog
.
show
()
def
open_private_chat
(
self
,
contact_id
):
def
open_private_chat
(
self
,
contact_id
):
contact_name
=
self
.
_get_contact_name
(
contact_id
)
contact_name
=
self
.
_get_contact_name
(
contact_id
)
...
...
This diff is collapsed.
Click to expand it.
briar-gtk/briar_gtk/widgets/about_dialog.py
0 → 100644
+
59
−
0
View file @
8b0d5907
# Copyright (c) 2020 Nico Alt
# SPDX-License-Identifier: AGPL-3.0-only
# License-Filename: LICENSE.md
from
gettext
import
gettext
as
_
from
gi.repository
import
Gtk
from
briar_gtk.define
import
APP
,
RESOURCES_DIR
# pylint: disable=too-few-public-methods
class
AboutDialogWidget
():
ABOUT_UI
=
"
about_dialog.ui
"
def
__init__
(
self
):
self
.
_about_dialog
=
self
.
_load_from_builder
()
self
.
_extend_about_dialog
()
def
show
(
self
):
self
.
_about_dialog
.
show
()
def
_load_from_builder
(
self
):
builder
=
Gtk
.
Builder
()
builder
.
add_from_resource
(
RESOURCES_DIR
+
self
.
ABOUT_UI
)
return
builder
.
get_object
(
"
about_dialog
"
)
def
_extend_about_dialog
(
self
):
self
.
_about_dialog
.
set_transient_for
(
APP
().
window
)
self
.
_add_code_section
()
self
.
_add_briar_section
()
self
.
_about_dialog
.
connect
(
"
response
"
,
self
.
_on_about_response
)
def
_add_code_section
(
self
):
code_use_title
=
_
(
"
Using code by
"
)
code_use_list
=
[
"
GNOME Fractal https://wiki.gnome.org/Apps/Fractal
"
,
"
GNOME Lollypop https://wiki.gnome.org/Apps/Lollypop
"
,
]
self
.
_about_dialog
.
add_credit_section
(
code_use_title
,
code_use_list
)
# pylint: disable=line-too-long
def
_add_briar_section
(
self
):
briar_functionality_title
=
_
(
"
Briar functionality by
"
)
briar_functionality_list
=
[
"
Briar REST API https://code.briarproject.org/briar/briar/tree/master/briar-headless
"
,
# noqa
"
Briar Python Wrapper https://code.briarproject.org/briar/python-briar-wrapper
"
,
# noqa
]
self
.
_about_dialog
.
add_credit_section
(
briar_functionality_title
,
briar_functionality_list
)
@staticmethod
# pylint: disable=unused-argument
def
_on_about_response
(
dialog
,
response_id
):
dialog
.
destroy
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment