Commit cb09107a authored by Roman Alifanov's avatar Roman Alifanov

repository structure redesigned

parent de1649a0
......@@ -3,7 +3,7 @@
<gresource prefix="/ru/eepm/PlayGUI">
<file>style.css</file>
<file preprocess="xml-stripblanks">window.ui</file>
<file preprocess="xml-stripblanks">logdialog.ui</file>
<file preprocess="xml-stripblanks">widgets/logdialog.ui</file>
<file preprocess="xml-stripblanks">gtk/help-overlay.ui</file>
</gresource>
</gresources>
......@@ -20,12 +20,22 @@ gnome.compile_resources('eepm-play-gui',
install_dir: pkgdatadir,
)
eepm_play_gui_sources = [
eepm_play_gui_main = [
'__init__.py',
'main.py',
'window.py',
'command_runner.py',
'appsmanager.py',
]
]
eepm_play_gui_widgets = [
'__init__.py',
'widgets/logdialog.py',
'widgets/applicationrow.py',
]
eepm_play_gui_tools = [
'__init__.py',
'tools/command_runner.py',
'tools/appsmanager.py',
]
install_data(eepm_play_gui_sources, install_dir: moduledir)
install_data(eepm_play_gui_main, install_dir: moduledir)
install_data(eepm_play_gui_widgets, install_dir: moduledir / 'widgets')
install_data(eepm_play_gui_tools, install_dir: moduledir / 'tools')
from gi.repository import Adw, Gtk
class ApplicationRow(Adw.ActionRow):
def __init__(self, app, is_installed, on_toggle):
super().__init__(title=app['name'], subtitle=app['dscr'])
self.app = app
self.is_installed = is_installed
self.checkbox = Gtk.CheckButton()
self.checkbox.add_css_class("selection-mode")
self.checkbox.set_active(is_installed)
self.checkbox.connect("toggled", self.on_checkbox_toggled)
self.add_suffix(self.checkbox)
self.on_toggle = on_toggle # Callback for when the checkbox is toggled
def on_checkbox_toggled(self, checkbox):
self.on_toggle(self.app['name'], checkbox.get_active())
self.update_row_css() # Update the row's style when toggled
def is_changed(self):
"""Determine if the checkbox state has changed compared to the installed state."""
return self.checkbox.get_active() != self.is_installed
def update_row_css(self):
"""Update the CSS classes for the row based on the checkbox state."""
for css in ["marked-for-install", "marked-for-removal", "unchanged"]:
self.remove_css_class(css)
# Add the appropriate class based on the current checkbox state
if self.is_changed():
if self.checkbox.get_active():
self.add_css_class("marked-for-install")
print("marked-for-install")
else:
self.add_css_class("marked-for-removal")
print("marked-for-removal")
else:
# self.add_css_class("unchanged")
print("marked-unchanged")
from gi.repository import Gtk, Adw
from ..tools.command_runner import CommandRunner
@Gtk.Template(resource_path='/ru/eepm/PlayGUI/widgets/logdialog.ui')
class LogDialog(Adw.Dialog):
__gtype_name__ = 'LogDialog'
logdialog_textview = Gtk.Template.Child()
def __init__(self, win, **kwargs):
super().__init__(**kwargs)
self.win = win
def run(self, command, on_done):
self.present(self.win)
# Создание и передача функции обратного вызова для обновления UI
runner = CommandRunner(on_done=on_done)
runner.run_command(command, self)
......@@ -20,66 +20,14 @@
from gi.repository import Gtk, Adw, GObject
import gettext
gettext.textdomain('eepm-play-gui')
_ = gettext.gettext
from .appsmanager import ApplicationManager
from .command_runner import CommandRunner
class ApplicationRow(Adw.ActionRow):
def __init__(self, app, is_installed, on_toggle):
super().__init__(title=app['name'], subtitle=app['dscr'])
self.app = app
self.is_installed = is_installed
self.checkbox = Gtk.CheckButton()
self.checkbox.add_css_class("selection-mode")
self.checkbox.set_active(is_installed)
self.checkbox.connect("toggled", self.on_checkbox_toggled)
self.add_suffix(self.checkbox)
self.on_toggle = on_toggle # Callback for when the checkbox is toggled
def on_checkbox_toggled(self, checkbox):
self.on_toggle(self.app['name'], checkbox.get_active())
self.update_row_css() # Update the row's style when toggled
def is_changed(self):
"""Determine if the checkbox state has changed compared to the installed state."""
return self.checkbox.get_active() != self.is_installed
def update_row_css(self):
"""Update the CSS classes for the row based on the checkbox state."""
for css in ["marked-for-install", "marked-for-removal", "unchanged"]:
self.remove_css_class(css)
# Add the appropriate class based on the current checkbox state
if self.is_changed():
if self.checkbox.get_active():
self.add_css_class("marked-for-install")
print("marked-for-install")
else:
self.add_css_class("marked-for-removal")
print("marked-for-removal")
else:
# self.add_css_class("unchanged")
print("marked-unchanged")
@Gtk.Template(resource_path='/ru/eepm/PlayGUI/logdialog.ui')
class LogDialog(Adw.Dialog):
__gtype_name__ = 'LogDialog'
logdialog_textview = Gtk.Template.Child()
from .widgets.applicationrow import ApplicationRow
from .widgets.logdialog import LogDialog
def __init__(self, win, **kwargs):
super().__init__(**kwargs)
self.win = win
def run(self, command, on_done):
self.present(self.win)
# Создание и передача функции обратного вызова для обновления UI
runner = CommandRunner(on_done=on_done)
runner.run_command(command, self)
gettext.textdomain('eepm-play-gui')
_ = gettext.gettext
from .tools.appsmanager import ApplicationManager
@Gtk.Template(resource_path='/ru/eepm/PlayGUI/window.ui')
class EepmPlayGuiWindow(Adw.ApplicationWindow):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment