Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
ximper-unified-theme-switcher
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ximper Linux
ximper-unified-theme-switcher
Commits
fa30b375
Commit
fa30b375
authored
Sep 09, 2024
by
Roman Alifanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
The dialog is now a class
parent
0acb99f7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
27 deletions
+31
-27
main.py
src/main.py
+31
-27
No files found.
src/main.py
View file @
fa30b375
...
@@ -8,6 +8,35 @@ gi.require_version('Adw', '1')
...
@@ -8,6 +8,35 @@ gi.require_version('Adw', '1')
from
gi.repository
import
Gtk
,
Gio
,
Adw
from
gi.repository
import
Gtk
,
Gio
,
Adw
from
.window
import
XimperUnifiedThemeSwitcherGuiGtk4Window
from
.window
import
XimperUnifiedThemeSwitcherGuiGtk4Window
class
ServiceNeededDialog
(
Adw
.
AlertDialog
):
def
__init__
(
self
,
parent_window
):
super
()
.
__init__
()
self
.
parent_window
=
parent_window
self
.
set_heading
(
_
(
"The user service is disabled."
)),
self
.
set_body
(
_
(
"Do you want to enable it?"
))
self
.
add_response
(
"yes"
,
_
(
"Yes"
))
self
.
add_response
(
"no"
,
_
(
"No"
))
self
.
connect
(
"response"
,
self
.
on_response
)
def
present
(
self
):
"""Present the dialog to the user."""
super
()
.
present
(
self
.
parent_window
)
def
on_response
(
self
,
dialog
,
response
):
print
(
f
"response: {response}"
)
if
response
==
"yes"
:
service_enable
(
"ximper-unified-theme-switcher.service"
)
dialog
.
close
()
elif
response
in
(
"no"
,
"close"
):
dialog
.
close
()
self
.
parent_window
.
close
()
class
XimperUnifiedThemeSwitcherGuiGtk4Application
(
Adw
.
Application
):
class
XimperUnifiedThemeSwitcherGuiGtk4Application
(
Adw
.
Application
):
"""The main application singleton class."""
"""The main application singleton class."""
...
@@ -32,33 +61,8 @@ class XimperUnifiedThemeSwitcherGuiGtk4Application(Adw.Application):
...
@@ -32,33 +61,8 @@ class XimperUnifiedThemeSwitcherGuiGtk4Application(Adw.Application):
if
service_status
(
"ximper-unified-theme-switcher.service"
)
==
False
:
if
service_status
(
"ximper-unified-theme-switcher.service"
)
==
False
:
print
(
"service not found"
)
print
(
"service not found"
)
dialog
=
ServiceNeededDialog
(
win
)
# Create the dialog
dialog
.
present
()
dialog
=
Adw
.
AlertDialog
(
heading
=
_
(
"The user service is disabled."
),
body
=
_
(
"Do you want to enable it?"
)
)
# Add buttons for the user to respond
dialog
.
add_response
(
"yes"
,
_
(
"Yes"
))
dialog
.
add_response
(
"no"
,
_
(
"No"
))
# Connect the response handler
dialog
.
connect
(
"response"
,
self
.
srvs_d_on_response
)
# Present the dialog
dialog
.
present
(
win
)
def
srvs_d_on_response
(
self
,
dialog
,
response
):
print
(
f
"response: {response}"
)
if
response
==
"yes"
:
service_enable
(
"ximper-unified-theme-switcher.service"
)
dialog
.
close
()
elif
response
in
(
"no"
,
"close"
):
dialog
.
close
()
self
.
props
.
active_window
.
close
()
def
on_about_action
(
self
,
widget
,
_
):
def
on_about_action
(
self
,
widget
,
_
):
"""Callback for the app.about action."""
"""Callback for the app.about action."""
...
...
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