Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
eepm-play-gui
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
Vladimir Vaskov
eepm-play-gui
Commits
896012d5
Commit
896012d5
authored
Oct 02, 2024
by
Roman Alifanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
log dialog in a separate class
parent
ecdfb77e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
34 deletions
+43
-34
window.py
src/window.py
+43
-34
No files found.
src/window.py
View file @
896012d5
...
...
@@ -23,8 +23,47 @@ from .appsmanager import ApplicationManager
from
.command_runner
import
CommandRunner
class
LogDialog
(
Adw
.
Dialog
):
def
__init__
(
self
,
win
,
**
kwargs
):
super
()
.
__init__
(
**
kwargs
)
self
.
set_title
(
"Лог выполнения"
)
self
.
set_can_close
(
False
)
self
.
set_follows_content_size
(
True
)
self
.
win
=
win
dialog_clamp
=
Adw
.
Clamp
(
margin_bottom
=
12
,
margin_end
=
12
,
margin_top
=
12
,
margin_start
=
12
,
maximum_size
=
500
)
textview
=
Gtk
.
TextView
()
textview
.
set_editable
(
False
)
textbuffer
=
textview
.
get_buffer
()
scrolled_window
=
Gtk
.
ScrolledWindow
(
width_request
=
304
,
height_request
=
259
)
scrolled_window
.
set_child
(
textview
)
scrolled_window
.
set_vexpand
(
True
)
dialog_clamp
.
set_child
(
scrolled_window
)
self
.
set_child
(
dialog_clamp
)
def
run
(
self
,
command
,
on_done
):
self
.
present
(
self
.
win
)
# Создание и передача функции обратного вызова для обновления UI
runner
=
CommandRunner
(
on_done
=
on_done
)
runner
.
run_command
(
command
,
self
)
@Gtk.Template
(
resource_path
=
'/ru/eepm/PlayGUI/window.ui'
)
class
EepmPlayGuiWindow
(
Adw
.
ApplicationWindow
):
class
EepmPlayGuiWindow
(
Adw
.
ApplicationWindow
,
LogDialog
):
__gtype_name__
=
'EepmPlayGuiWindow'
search_entry
=
Gtk
.
Template
.
Child
()
search_dropdown
=
Gtk
.
Template
.
Child
()
...
...
@@ -42,6 +81,8 @@ class EepmPlayGuiWindow(Adw.ApplicationWindow):
self
.
choice_listbox
.
set_filter_func
(
self
.
listbox_filter_func
)
self
.
dialog
=
LogDialog
(
win
=
self
)
self
.
update_ui
()
def
show_loading_spinner
(
self
):
...
...
@@ -137,7 +178,7 @@ class EepmPlayGuiWindow(Adw.ApplicationWindow):
if
commands
:
full_command
=
" && "
.
join
(
commands
)
pkexec_command
=
f
'pkexec sh -c "{full_command}"'
self
.
show_log_dialog
(
pkexec_command
)
self
.
dialog
.
run
(
pkexec_command
,
on_done
=
self
.
update_ui
)
def
get_install_remove_lists
(
self
):
to_install
=
[
app_name
for
app_name
,
checkbox
in
self
.
checkboxes
.
items
()
if
checkbox
.
get_active
()
and
app_name
not
in
self
.
installed_apps
]
...
...
@@ -152,35 +193,3 @@ class EepmPlayGuiWindow(Adw.ApplicationWindow):
commands
.
append
(
f
"epm play --auto --remove {' '.join(to_remove)}"
)
return
commands
def
show_log_dialog
(
self
,
command
):
dialog
=
Adw
.
Dialog
(
title
=
"Лог выполнения"
)
dialog
.
set_follows_content_size
(
True
)
dialog_clamp
=
Adw
.
Clamp
(
margin_bottom
=
12
,
margin_end
=
12
,
margin_top
=
12
,
margin_start
=
12
,
maximum_size
=
500
)
textview
=
Gtk
.
TextView
()
textview
.
set_editable
(
False
)
textbuffer
=
textview
.
get_buffer
()
scrolled_window
=
Gtk
.
ScrolledWindow
(
width_request
=
304
,
height_request
=
259
)
scrolled_window
.
set_child
(
textview
)
scrolled_window
.
set_vexpand
(
True
)
dialog_clamp
.
set_child
(
scrolled_window
)
dialog
.
set_child
(
dialog_clamp
)
dialog
.
present
(
self
)
# Создание и передача функции обратного вызова для обновления UI
runner
=
CommandRunner
(
on_done
=
self
.
update_ui
)
runner
.
run_command
(
command
,
dialog
)
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