Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Python Briar Wrapper
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
External wiki
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
Python Briar Wrapper
Commits
30513d8a
Commit
30513d8a
authored
5 years ago
by
Nico
Browse files
Options
Downloads
Patches
Plain Diff
Rework application.py to make it more clean
parent
73436621
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/briar-gtk.in
+1
-1
1 addition, 1 deletion
src/briar-gtk.in
src/briar/gtk/application.py
+30
-19
30 additions, 19 deletions
src/briar/gtk/application.py
src/briar/gtk/define.py
+4
-0
4 additions, 0 deletions
src/briar/gtk/define.py
with
35 additions
and
20 deletions
src/briar-gtk.in
+
1
−
1
View file @
30513d8a
...
...
@@ -50,7 +50,7 @@ def prepare():
def start_application():
from briar.gtk.application import Application
sys.exit(Application(
"@VERSION@"
).run(sys.argv))
sys.exit(Application().run(sys.argv))
if __name__ == '__main__':
prepare()
...
...
This diff is collapsed.
Click to expand it.
src/briar/gtk/application.py
+
30
−
19
View file @
30513d8a
...
...
@@ -10,45 +10,56 @@ from gi.repository import Gdk, Gio, GLib, Gtk
from
briar.api.api
import
Api
from
briar.gtk.define
import
APPLICATION_ID
,
APPLICATION_NAME
from
briar.gtk.define
import
BRIAR_HEADLESS_JAR
from
briar.gtk.window
import
Window
class
Application
(
Gtk
.
Application
):
def
__init__
(
self
,
version
):
GLib
.
set_application_name
(
"
Briar
"
)
GLib
.
set_prgname
(
"
Briar
"
)
super
().
__init__
(
application_id
=
'
app.briar.gtk
'
)
self
.
window
=
None
self
.
_set_version
(
version
)
def
__init__
(
self
):
Application
.
_set_application_name
()
super
().
__init__
(
application_id
=
APPLICATION_ID
)
# pylint: disable=arguments-differ
def
do_startup
(
self
):
Gtk
.
Application
.
do_startup
(
self
)
Application
.
_setup_styling
()
self
.
_setup_api
()
# pylint: disable=arguments-differ
def
do_activate
(
self
):
self
.
_setup_window
()
# pylint: disable=arguments-differ
def
quit
(
self
):
self
.
api
.
stop
()
self
.
window
.
hide
()
Gio
.
Application
.
quit
(
self
)
@staticmethod
def
_set_application_name
():
GLib
.
set_application_name
(
APPLICATION_NAME
)
GLib
.
set_prgname
(
APPLICATION_NAME
)
@staticmethod
def
_setup_styling
():
css_provider_file
=
Gio
.
File
.
new_for_uri
(
"
resource:///app/briar/gtk/ui/application.css
"
)
css_provider
=
Gtk
.
CssProvider
()
css_provider
.
load_from_file
(
css_provider_file
)
screen
=
Gdk
.
Screen
.
get_default
()
style_context
=
Gtk
.
StyleContext
()
style_context
.
add_provider_for_screen
(
screen
,
css_provider
,
Gtk
.
STYLE_PROVIDER_PRIORITY_USER
)
self
.
api
=
Api
(
'
/app/briar/briar-headless.jar
'
)
def
_setup_api
(
self
):
self
.
api
=
Api
(
BRIAR_HEADLESS_JAR
)
# pylint: disable=a
rguments-differ
def
do_activate
(
self
):
if
self
.
window
is
None
:
# pylint: disable=a
ccess-member-before-definition
def
_setup_window
(
self
):
if
not
hasattr
(
self
,
"
window
"
)
or
self
.
window
is
None
:
self
.
window
=
Window
()
self
.
window
.
show
()
self
.
window
.
present
()
# pylint: disable=arguments-differ
def
quit
(
self
):
self
.
api
.
stop
()
self
.
window
.
hide
()
Gio
.
Application
.
quit
(
self
)
def
_set_version
(
self
,
version
):
self
.
_version
=
version
This diff is collapsed.
Click to expand it.
src/briar/gtk/define.py
+
4
−
0
View file @
30513d8a
...
...
@@ -8,4 +8,8 @@
from
gi.repository
import
Gio
APPLICATION_ID
=
"
app.briar.gtk
"
APPLICATION_NAME
=
"
Briar
"
BRIAR_HEADLESS_JAR
=
"
/app/briar/briar-headless.jar
"
App
=
Gio
.
Application
.
get_default
# pylint: disable=invalid-name
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