Commit dce5d6e3 authored by Roman Alifanov's avatar Roman Alifanov

Merge branch 'master' into 'master'

Some changes See merge request !1
parents cd15cdba bc42a32c
.idea .idea
# vscode
.vscode
# .po
*.mo
*.pot
# flatpak
.flatpak
# meson
_build
[Desktop Entry] [Desktop Entry]
Name=eepm play Name=eepm play
Exec=eepm-play-gui Exec=eepm-play-gui %U
Icon=ru.eepm.PlayGUI Icon=ru.eepm.PlayGUI
Comment=Install applications from official sites Comment=Install applications from official sites
Comment[ru]=Установка приложений с официальных сайтов
Terminal=false Terminal=false
Type=Application Type=Application
......
...@@ -6,8 +6,10 @@ project('eepm-play-gui', ...@@ -6,8 +6,10 @@ project('eepm-play-gui',
i18n = import('i18n') i18n = import('i18n')
gnome = import('gnome') gnome = import('gnome')
python = import('python')
pkgdatadir = get_option('prefix') / get_option('datadir') / meson.project_name()
moduledir = pkgdatadir / 'eepm_play_gui'
subdir('data') subdir('data')
subdir('src') subdir('src')
......
...@@ -2,5 +2,6 @@ data/ru.eepm.PlayGUI.desktop.in ...@@ -2,5 +2,6 @@ data/ru.eepm.PlayGUI.desktop.in
data/ru.eepm.PlayGUI.metainfo.xml.in data/ru.eepm.PlayGUI.metainfo.xml.in
data/ru.eepm.PlayGUI.gschema.xml data/ru.eepm.PlayGUI.gschema.xml
src/main.py src/main.py
src/help-overlay.ui
src/window.py src/window.py
src/window.ui src/window.ui
i18n.gettext('eepm-play-gui', preset: 'glib') i18n.gettext(meson.project_name(), preset: 'glib')
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: ru.eepm.PlayGUI\n" "Project-Id-Version: ru.eepm.PlayGUI\n"
"POT-Creation-Date: 2024-10-07 19:12+0300\n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-10-08 12:09+0300\n"
"PO-Revision-Date: 2024-10-07 19:17+0300\n" "PO-Revision-Date: 2024-10-07 19:17+0300\n"
"Last-Translator: \n" "Last-Translator: \n"
"Language-Team: \n" "Language-Team: \n"
...@@ -13,60 +14,77 @@ msgstr "" ...@@ -13,60 +14,77 @@ msgstr ""
"X-Poedit-Basepath: ../src\n" "X-Poedit-Basepath: ../src\n"
"X-Poedit-SearchPath-0: .\n" "X-Poedit-SearchPath-0: .\n"
#: gtk/help-overlay.ui:11 #: data/ru.eepm.PlayGUI.desktop.in:3
msgid "eepm play"
msgstr ""
#: data/ru.eepm.PlayGUI.desktop.in:7
#, fuzzy
msgid "Install applications from official sites"
msgstr "Установить программы"
#: data/ru.eepm.PlayGUI.metainfo.xml.in:7
msgid "No description"
msgstr ""
#: data/ui/help-overlay.ui:11
msgctxt "shortcut window" msgctxt "shortcut window"
msgid "General" msgid "General"
msgstr "" msgstr ""
#: gtk/help-overlay.ui:14 #: data/ui/help-overlay.ui:14
msgctxt "shortcut window" msgctxt "shortcut window"
msgid "Show Shortcuts" msgid "Show Shortcuts"
msgstr "" msgstr ""
#: gtk/help-overlay.ui:20 #: data/ui/help-overlay.ui:20
msgctxt "shortcut window" msgctxt "shortcut window"
msgid "Quit" msgid "Quit"
msgstr "Выйти" msgstr "Выйти"
#: window.py:167 #: data/ui/window.ui:46
msgid "Remove and install applications" msgid "Getting packages list…"
msgstr "Удалить и установить программы" msgstr "Получение списка пакетов…"
#: window.py:168
msgid "Install applications"
msgstr "Установить программы"
#: window.py:169
msgid "Remove applications"
msgstr "Удалить программы"
#: window.py:170 window.ui:100
msgid "Update applications"
msgstr "Обновить программы"
#: window.ui:20 #: data/ui/window.ui:47
msgid "Menu" msgid "It could take a while"
msgstr "" msgstr "Это может занять некоторое время"
#: window.ui:48 #: data/ui/window.ui:79
msgid "All" msgid "All"
msgstr "Все" msgstr "Все"
#: window.ui:49 #: data/ui/window.ui:80
msgid "Installed" msgid "Installed"
msgstr "Установленные" msgstr "Установленные"
#: window.ui:50 #: data/ui/window.ui:81
msgid "Uninstalled" msgid "Uninstalled"
msgstr "Неустановленные" msgstr "Неустановленные"
#: window.ui:51 #: data/ui/window.ui:82
msgid "Changed" msgid "Changed"
msgstr "Изменённые" msgstr "Изменённые"
#: window.ui:122 #: data/ui/window.ui:132 src/window.py:180
msgid "Update applications"
msgstr "Обновить программы"
#: data/ui/window.ui:158
msgid "_About Eepm-play-gui" msgid "_About Eepm-play-gui"
msgstr "О программе" msgstr "_О программе"
#: src/window.py:177
msgid "Remove and install applications"
msgstr "Удалить и установить программы"
#: src/window.py:178
msgid "Install applications"
msgstr "Установить программы"
#: src/window.py:179
msgid "Remove applications"
msgstr "Удалить программы"
#~ msgid "Apply" #~ msgid "Apply"
#~ msgstr "Применить" #~ msgstr "Применить"
...@@ -36,11 +36,6 @@ class EepmPlayGuiApplication(Adw.Application): ...@@ -36,11 +36,6 @@ class EepmPlayGuiApplication(Adw.Application):
self.create_action('quit', lambda *_: self.quit(), ['<primary>q']) self.create_action('quit', lambda *_: self.quit(), ['<primary>q'])
self.create_action('about', self.on_about_action) self.create_action('about', self.on_about_action)
provider = Gtk.CssProvider()
provider.load_from_resource("/ru/eepm/PlayGUI/style.css")
display = Gdk.Display.get_default()
Gtk.StyleContext.add_provider_for_display(display, provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION)
def do_activate(self): def do_activate(self):
"""Called when the application is activated. """Called when the application is activated.
...@@ -54,16 +49,16 @@ class EepmPlayGuiApplication(Adw.Application): ...@@ -54,16 +49,16 @@ class EepmPlayGuiApplication(Adw.Application):
def on_about_action(self, widget, _): def on_about_action(self, widget, _):
"""Callback for the app.about action.""" """Callback for the app.about action."""
about = Adw.AboutWindow(transient_for=self.props.active_window, about = Adw.AboutDialog(application_name='eepm-play-gui',
application_name='eepm-play-gui',
application_icon='ru.eepm.PlayGUI', application_icon='ru.eepm.PlayGUI',
developer_name='Etersoft', developer_name='Etersoft',
version='0.2.0', version='0.2.0',
developers=['Ximper'], developers=['Ximper', "Vladimir Vaskov <rirusha@altlinux.org>"],
artists=['Ximper', "Vladimir Vaskov <rirusha@altlinux.org>"], designers=['Ximper', "Vladimir Vaskov <rirusha@altlinux.org>"],
artists=['Ximper'],
license_type=Gtk.License.AGPL_3_0, license_type=Gtk.License.AGPL_3_0,
copyright='© 2024 Etersoft') copyright='© 2024 Etersoft')
about.present() about.present(self.props.active_window)
def create_action(self, name, callback, shortcuts=None): def create_action(self, name, callback, shortcuts=None):
"""Add an application action. """Add an application action.
......
pkgdatadir = get_option('prefix') / get_option('datadir') / meson.project_name()
moduledir = pkgdatadir / 'eepm_play_gui'
gnome = import('gnome')
gnome.compile_resources('eepm-play-gui',
'eepm-play-gui.gresource.xml',
gresource_bundle: true,
install: true,
install_dir: pkgdatadir,
)
python = import('python')
conf = configuration_data() conf = configuration_data()
conf.set('PYTHON', python.find_installation('python3').full_path()) conf.set('PYTHON', python.find_installation('python3').full_path())
conf.set('VERSION', meson.project_version()) conf.set('VERSION', meson.project_version())
...@@ -26,6 +13,13 @@ configure_file( ...@@ -26,6 +13,13 @@ configure_file(
install_mode: 'r-xr-xr-x' install_mode: 'r-xr-xr-x'
) )
gnome.compile_resources('eepm-play-gui',
'eepm-play-gui.gresource.xml',
gresource_bundle: true,
install: true,
install_dir: pkgdatadir,
)
eepm_play_gui_sources = [ eepm_play_gui_sources = [
'__init__.py', '__init__.py',
'main.py', 'main.py',
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
# #
# SPDX-License-Identifier: AGPL-3.0-or-later # SPDX-License-Identifier: AGPL-3.0-or-later
from gi.repository import Gtk, Adw from gi.repository import Gtk, Adw, GObject
import gettext import gettext
gettext.textdomain('eepm-play-gui') gettext.textdomain('eepm-play-gui')
...@@ -83,10 +83,16 @@ class LogDialog(Adw.Dialog): ...@@ -83,10 +83,16 @@ class LogDialog(Adw.Dialog):
@Gtk.Template(resource_path='/ru/eepm/PlayGUI/window.ui') @Gtk.Template(resource_path='/ru/eepm/PlayGUI/window.ui')
class EepmPlayGuiWindow(Adw.ApplicationWindow): class EepmPlayGuiWindow(Adw.ApplicationWindow):
__gtype_name__ = 'EepmPlayGuiWindow' __gtype_name__ = 'EepmPlayGuiWindow'
is_loading = GObject.Property(type=bool, default=True)
search_entry = Gtk.Template.Child() search_entry = Gtk.Template.Child()
search_bar = Gtk.Template.Child()
search_toggle_button = Gtk.Template.Child()
main_stack = Gtk.Template.Child()
search_dropdown = Gtk.Template.Child() search_dropdown = Gtk.Template.Child()
loading_spinner = Gtk.Template.Child()
choice_listbox = Gtk.Template.Child() choice_listbox = Gtk.Template.Child()
apply_button = Gtk.Template.Child() apply_button = Gtk.Template.Child()
...@@ -97,6 +103,9 @@ class EepmPlayGuiWindow(Adw.ApplicationWindow): ...@@ -97,6 +103,9 @@ class EepmPlayGuiWindow(Adw.ApplicationWindow):
self.apply_button.connect("activated", self.on_apply_clicked) self.apply_button.connect("activated", self.on_apply_clicked)
self.connect("notify::is-loading", self.on_is_loading_changed)
self.search_bar.connect_entry(self.search_entry)
self.search_entry.connect("search-changed", self.on_search_changed) self.search_entry.connect("search-changed", self.on_search_changed)
self.search_dropdown.connect("notify::selected", self.on_filter_changed) self.search_dropdown.connect("notify::selected", self.on_filter_changed)
...@@ -106,13 +115,8 @@ class EepmPlayGuiWindow(Adw.ApplicationWindow): ...@@ -106,13 +115,8 @@ class EepmPlayGuiWindow(Adw.ApplicationWindow):
self.update_ui() self.update_ui()
def show_loading_spinner(self): def on_is_loading_changed (self, obj, _pspec):
self.loading_spinner.set_visible(True) self.main_stack.props.visible_child_name = "loading" if self.props.is_loading else "main"
self.choice_listbox.set_visible(False) # Скрыть группу настроек во время загрузки
def hide_loading_spinner(self):
self.loading_spinner.set_visible(False)
self.choice_listbox.set_visible(True)
def on_applications_loaded(self, applications, error=None): def on_applications_loaded(self, applications, error=None):
if error: if error:
...@@ -124,7 +128,7 @@ class EepmPlayGuiWindow(Adw.ApplicationWindow): ...@@ -124,7 +128,7 @@ class EepmPlayGuiWindow(Adw.ApplicationWindow):
self.installed_apps = None self.installed_apps = None
self.applications = None self.applications = None
self.show_loading_spinner() # Show loading again for installed apps self.props.is_loading = True
self.update_button_status() self.update_button_status()
...@@ -143,7 +147,7 @@ class EepmPlayGuiWindow(Adw.ApplicationWindow): ...@@ -143,7 +147,7 @@ class EepmPlayGuiWindow(Adw.ApplicationWindow):
self.add_application_row(app) self.add_application_row(app)
self.choice_listbox.invalidate_filter() self.choice_listbox.invalidate_filter()
self.hide_loading_spinner() self.props.is_loading = False
def clear_choice_listbox(self): def clear_choice_listbox(self):
self.choice_listbox.remove_all() self.choice_listbox.remove_all()
...@@ -218,7 +222,7 @@ class EepmPlayGuiWindow(Adw.ApplicationWindow): ...@@ -218,7 +222,7 @@ class EepmPlayGuiWindow(Adw.ApplicationWindow):
def on_apply_clicked(self, button): def on_apply_clicked(self, button):
commands = None commands = None
self.show_loading_spinner() # Показать сообщение о загрузке перед выполнением команды self.props.is_loading = True # Показать сообщение о загрузке перед выполнением команды
to_install, to_remove = self.get_install_remove_lists() to_install, to_remove = self.get_install_remove_lists()
commands = self.build_commands(to_install, to_remove) commands = self.build_commands(to_install, to_remove)
......
<?xml version='1.0' encoding='UTF-8'?> <?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Cambalache 0.92.0 -->
<interface domain="eepm-play-gui"> <interface domain="eepm-play-gui">
<!-- interface-name window.ui -->
<requires lib="Adw" version="1.0"/>
<requires lib="gio" version="2.0"/>
<requires lib="gtk" version="4.0"/> <requires lib="gtk" version="4.0"/>
<requires lib="libadwaita" version="1.4"/>
<template class="EepmPlayGuiWindow" parent="AdwApplicationWindow"> <template class="EepmPlayGuiWindow" parent="AdwApplicationWindow">
<property name="content"> <property name="default-height">489</property>
<property name="default-width">300</property>
<property name="width-request">360</property>
<property name="height-request">294</property>
<child>
<object class="AdwToolbarView"> <object class="AdwToolbarView">
<property name="top-bar-style">raised</property> <property name="top-bar-style">raised</property>
<child type="top"> <child type="top">
<object class="AdwHeaderBar" id="header_bar"> <object class="AdwHeaderBar" id="header_bar">
<child type="start">
<object class="GtkToggleButton" id="search_toggle_button">
<property name="sensitive" bind-source="EepmPlayGuiWindow" bind-property="is-loading" bind-flags="sync-create|invert-boolean"/>
<property name="icon-name">system-search-symbolic</property>
</object>
</child>
<child type="end"> <child type="end">
<object class="GtkMenuButton"> <object class="GtkButton">
<property name="icon-name">open-menu-symbolic</property> <property name="icon-name">help-about-symbolic</property>
<property name="menu-model">primary_menu</property> <property name="action-name">app.about</property>
<property name="primary">True</property>
<property name="tooltip-text" translatable="yes">Menu</property>
</object> </object>
</child> </child>
</object> </object>
</child> </child>
<property name="content">
<object class="GtkStack" id="main_stack">
<property name="transition-type">crossfade</property>
<child> <child>
<object class="AdwClamp"> <object class="GtkStackPage">
<property name="margin-bottom">12</property> <property name="name">loading</property>
<property name="margin-end">12</property> <property name="child">
<property name="margin-start">12</property> <object class="AdwStatusPage" id="status_page">
<property name="margin-top">12</property> <property name="paintable">
<property name="maximum-size">420</property> <object class="AdwSpinnerPaintable">
<property name="widget">status_page</property>
</object>
</property>
<property name="title" translatable="yes">Getting packages list…</property>
<property name="description" translatable="yes">It could take a while</property>
</object>
</property>
</object>
</child>
<child> <child>
<object class="GtkStackPage">
<property name="name">main</property>
<property name="child">
<object class="AdwToolbarView">
<property name="content">
<object class="GtkBox"> <object class="GtkBox">
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="spacing">12</property> <child>
<object class="GtkSearchBar" id="search_bar">
<property name="search-mode-enabled" bind-source="search_toggle_button" bind-property="active" bind-flags="sync-create|bidirectional"/>
<property name="key-capture-widget">EepmPlayGuiWindow</property>
<child>
<object class="AdwClamp">
<property name="maximum-size">480</property>
<child> <child>
<object class="GtkBox"> <object class="GtkBox">
<style>
<class name="linked"/>
</style>
<child> <child>
<object class="GtkSearchEntry" id="search_entry"> <object class="GtkSearchEntry" id="search_entry">
<property name="hexpand">True</property> <property name="hexpand">true</property>
</object> </object>
</child> </child>
<child> <child>
...@@ -52,28 +81,28 @@ ...@@ -52,28 +81,28 @@
</items> </items>
</object> </object>
</property> </property>
<property name="width-request">170</property> <property name="halign">end</property>
</object>
</child>
</object> </object>
</child> </child>
<style>
<class name="linked"/>
</style>
</object> </object>
</child> </child>
<child>
<object class="AdwSpinner" id="loading_spinner">
<property name="halign">center</property>
<property name="height-request">48</property>
<property name="valign">center</property>
<property name="visible">False</property>
<property name="width-request">48</property>
</object> </object>
</child> </child>
<child> <child>
<object class="GtkScrolledWindow"> <object class="GtkScrolledWindow">
<property name="vexpand">True</property> <property name="propagate-natural-height">true</property>
<property name="hscrollbar-policy">never</property>
<child>
<object class="AdwClamp">
<property name="margin-bottom">12</property>
<property name="margin-end">12</property>
<property name="margin-start">12</property>
<property name="margin-top">12</property>
<child> <child>
<object class="GtkListBox" id="choice_listbox"> <object class="GtkListBox" id="choice_listbox">
<property name="selection-mode">none</property>
<style> <style>
<class name="boxed-list-separate"/> <class name="boxed-list-separate"/>
</style> </style>
...@@ -84,7 +113,7 @@ ...@@ -84,7 +113,7 @@
</object> </object>
</child> </child>
</object> </object>
</child> </property>
<child type="bottom"> <child type="bottom">
<object class="AdwClamp"> <object class="AdwClamp">
<property name="margin-bottom">12</property> <property name="margin-bottom">12</property>
...@@ -94,9 +123,9 @@ ...@@ -94,9 +123,9 @@
<property name="maximum-size">360</property> <property name="maximum-size">360</property>
<child type="center"> <child type="center">
<object class="GtkListBox"> <object class="GtkListBox">
<property name="selection-mode">none</property>
<child> <child>
<object class="AdwButtonRow" id="apply_button"> <object class="AdwButtonRow" id="apply_button">
<property name="margin-start">1</property>
<property name="title" translatable="yes">Update applications</property> <property name="title" translatable="yes">Update applications</property>
<style> <style>
<class name="suggested-action"/> <class name="suggested-action"/>
...@@ -112,8 +141,12 @@ ...@@ -112,8 +141,12 @@
</child> </child>
</object> </object>
</property> </property>
<property name="default-height">489</property> </object>
<property name="default-width">300</property> </child>
</object>
</property>
</object>
</child>
</template> </template>
<menu id="primary_menu"> <menu id="primary_menu">
<section> <section>
......
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