Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tuneit
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
0
Merge Requests
0
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
tuneit
Commits
c404280a
Commit
c404280a
authored
Mar 09, 2025
by
Roman Alifanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
an attempt to fix random crashes from calling dialogs
(seems to be successful)
parent
f6690070
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
55 additions
and
18 deletions
+55
-18
main.py
src/settings/main.py
+8
-1
setting.py
src/settings/setting/setting.py
+19
-5
deps_alert_dialog.py
src/settings/widgets/deps_alert_dialog.py
+2
-2
service_dialog.py
src/settings/widgets/service_dialog.py
+24
-9
window.py
src/window.py
+2
-1
No files found.
src/settings/main.py
View file @
c404280a
import
time
import
traceback
from
.module
import
Module
from
.page
import
Page
...
...
@@ -47,11 +48,17 @@ def init_settings_stack(stack, listbox, split_view):
f
"{deps_message}
\n
{conflicts_message}"
)
response
=
dialog
.
user_question
(
listbox
.
get_root
())
while
True
:
w
=
listbox
.
get_root
()
if
w
.
get_visible
()
and
w
.
get_mapped
():
response
=
dialog
.
user_question
(
w
)
break
time
.
sleep
(
0.1
)
print
(
f
"RESPONSE: {response}"
)
if
response
==
"skip"
:
break
modules_dict
[
module
.
name
]
=
module
for
section_data
in
module_data
.
get
(
'sections'
,
[]):
...
...
src/settings/setting/setting.py
View file @
c404280a
...
...
@@ -8,7 +8,7 @@ from ..tools.gvariant import convert_by_gvariant
from
..widgets.service_dialog
import
ServiceNotStartedDialog
from
gi.repository
import
GLib
dialog_present
ed
=
False
service_stopp
ed
=
False
class
Setting
:
...
...
@@ -43,6 +43,7 @@ class Setting:
self
.
search_target
=
setting_data
.
get
(
'search_target'
,
None
)
self
.
map
=
setting_data
.
get
(
'map'
)
if
self
.
map
is
None
:
if
self
.
search_target
is
not
None
:
self
.
map
=
SearcherFactory
.
create
(
self
.
search_target
)
.
search
()
...
...
@@ -109,15 +110,28 @@ class Setting:
if
dclient
is
not
None
:
self
.
widget
=
WidgetFactory
.
create_widget
(
self
)
return
self
.
widget
.
create_row
()
if
self
.
widget
else
None
else
:
global
dialog_presented
if
dialog_presented
is
False
:
global
service_stopped
if
service_stopped
is
False
:
from
...main
import
get_main_window
while
True
:
w
=
get_main_window
()
if
w
.
get_visible
()
and
w
.
get_mapped
():
dialog
=
ServiceNotStartedDialog
()
dialog
.
present
(
get_main_window
())
response
=
dialog
.
user_question
(
get_main_window
())
break
time
.
sleep
(
0.1
)
if
response
==
"yes"
:
dialog
.
service_enable_with_restart
()
dialog_presented
=
True
elif
response
in
(
"no"
,
"close"
):
dialog
.
close
()
service_stopped
=
True
return
None
self
.
widget
=
WidgetFactory
.
create_widget
(
self
)
...
...
src/settings/widgets/deps_alert_dialog.py
View file @
c404280a
from
gi.repository
import
G
Object
,
Adw
,
Gtk
from
gi.repository
import
G
Lib
,
Adw
,
Gtk
from
time
import
sleep
@Gtk.Template
(
resource_path
=
'/ru.ximperlinux.TuneIt/settings/widgets/deps_alert_dialog.ui'
)
...
...
@@ -10,7 +10,7 @@ class TuneItDepsAlertDialog(Adw.AlertDialog):
response
=
""
def
user_question
(
self
,
window
):
self
.
present
(
window
)
GLib
.
idle_add
(
self
.
present
,
window
)
def
on_response
(
dialog
,
response
):
self
.
response
=
response
...
...
src/settings/widgets/service_dialog.py
View file @
c404280a
import
os
import
subprocess
import
sys
from
time
import
sleep
from
gi.repository
import
Adw
from
gi.repository
import
GLib
,
Adw
class
ServiceNotStartedDialog
(
Adw
.
AlertDialog
):
response
=
""
def
__init__
(
self
):
super
()
.
__init__
()
...
...
@@ -16,16 +20,22 @@ class ServiceNotStartedDialog(Adw.AlertDialog):
self
.
add_response
(
"yes"
,
_
(
"Yes"
))
self
.
add_response
(
"no"
,
_
(
"No"
))
self
.
connect
(
"response"
,
self
.
on_response
)
def
on_response
(
self
,
dialog
,
response
):
if
response
==
"yes"
:
self
.
service_enable
()
dialog
.
close
()
os
.
execv
(
sys
.
argv
[
0
],
sys
.
argv
)
def
user_question
(
self
,
window
):
GLib
.
idle_add
(
self
.
present
,
window
)
def
on_response
(
dialog
,
response
):
self
.
response
=
response
elif
response
in
(
"no"
,
"close"
):
dialog
.
close
()
self
.
connect
(
'response'
,
on_response
)
while
True
:
if
self
.
response
!=
""
:
return
self
.
response
else
:
sleep
(
0.1
)
continue
def
service_status
(
self
):
try
:
...
...
@@ -52,3 +62,8 @@ class ServiceNotStartedDialog(Adw.AlertDialog):
except
Exception
as
e
:
print
(
f
"An error occurred: {e}"
)
def
service_enable_with_restart
(
self
):
self
.
service_enable
()
self
.
close
()
os
.
execv
(
sys
.
argv
[
0
],
sys
.
argv
)
src/window.py
View file @
c404280a
...
...
@@ -64,5 +64,6 @@ class TuneitWindow(Adw.ApplicationWindow):
def
error
(
self
,
error
):
print
(
error
)
self
.
error_dialog
.
textbuffer
.
set_text
(
str
(
error
))
self
.
error_dialog
.
present
(
self
)
GLib
.
idle_add
(
self
.
error_dialog
.
present
,
self
)
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