Commit 5f4d632b authored by Roman Alifanov's avatar Roman Alifanov

added the --auto flag and other minor improvements

parent ffaee2d4
......@@ -2,8 +2,8 @@ msgid ""
msgstr ""
"Project-Id-Version: ru.eepm.PlayGUI\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-10-13 19:22+0300\n"
"PO-Revision-Date: 2024-10-13 19:23+0300\n"
"POT-Creation-Date: 2024-10-14 21:46+0300\n"
"PO-Revision-Date: 2024-10-14 21:46+0300\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: ru\n"
......@@ -37,11 +37,15 @@ msgstr "выберите нужные флаги"
msgid "Flags"
msgstr "Флаги"
#: widgets/flagsdialog.ui:40
#: widgets/flagsdialog.ui:43
msgid "The user will not be asked any questions"
msgstr "Пользователю не будет задано никаких вопросов"
#: widgets/flagsdialog.ui:51
msgid "It helps to get resources that are unavailable from your network"
msgstr "Помогает получить доступ к ресурсам, которые недоступны в вашей сети"
#: widgets/flagsdialog.ui:48
#: widgets/flagsdialog.ui:59
msgid ""
"Sometimes it helps to get the latest version of the program. (Not "
"recommended)"
......
......@@ -10,10 +10,12 @@
(1,3,"AdwHeaderBar",None,2,None,"top",None,0,None,None),
(1,4,"AdwWindowTitle",None,3,None,None,None,0,None,None),
(1,5,"AdwClamp",None,2,None,None,None,1,None,None),
(1,6,"GtkBox",None,5,None,None,None,0,None,None),
(1,7,"GtkListBox",None,6,None,None,None,0,None,None),
(1,8,"AdwSwitchRow","force_row",7,None,None,None,1,None,None),
(1,9,"AdwSwitchRow","ipfs_row",7,None,None,None,0,None,None)
(1,11,"GtkScrolledWindow",None,5,None,None,None,0,None,None),
(1,12,"GtkBox",None,11,None,None,None,0,None,None),
(1,13,"GtkListBox",None,12,None,None,None,0,None,None),
(1,14,"AdwSwitchRow","auto_row",13,None,None,None,0,None,None),
(1,15,"AdwSwitchRow","ipfs_row",13,None,None,None,1,None,None),
(1,16,"AdwSwitchRow","force_row",13,None,None,None,2,None,None)
</object>
<object_property>
(1,1,"AdwDialog","presentation-mode","bottom-sheet",None,None,None,None,None,None,None,None,None),
......@@ -25,25 +27,30 @@
(1,5,"GtkWidget","margin-end","12",None,None,None,None,None,None,None,None,None),
(1,5,"GtkWidget","margin-start","12",None,None,None,None,None,None,None,None,None),
(1,5,"GtkWidget","margin-top","12",None,None,None,None,None,None,None,None,None),
(1,6,"GtkBox","spacing","12",None,None,None,None,None,None,None,None,None),
(1,6,"GtkOrientable","orientation","vertical",None,None,None,None,None,None,None,None,None),
(1,6,"GtkWidget","vexpand","True",None,None,None,None,None,None,None,None,None),
(1,7,"GtkWidget","height-request","198",None,None,None,None,None,None,None,None,None),
(1,7,"GtkWidget","vexpand","True",None,None,None,None,None,None,None,None,None),
(1,8,"AdwActionRow","subtitle","Sometimes it helps to get the latest version of the program. (Not recommended)",1,None,None,None,None,None,None,None,None),
(1,8,"AdwActionRow","subtitle-lines","3",None,None,None,None,None,None,None,None,None),
(1,8,"AdwPreferencesRow","title","Force",None,None,None,None,None,None,None,None,None),
(1,8,"GtkListBoxRow","selectable","False",None,None,None,None,None,None,None,None,None),
(1,9,"AdwActionRow","subtitle","It helps to get resources that are unavailable from your network",1,None,None,None,None,None,None,None,None),
(1,9,"AdwActionRow","subtitle-lines","3",None,None,None,None,None,None,None,None,None),
(1,9,"AdwPreferencesRow","title","IPFS",None,None,None,None,None,None,None,None,None),
(1,9,"GtkListBoxRow","selectable","False",None,None,None,None,None,None,None,None,None)
(1,11,"GtkScrolledWindow","hscrollbar-policy","never",None,None,None,None,None,None,None,None,None),
(1,11,"GtkScrolledWindow","propagate-natural-height","True",None,None,None,None,None,None,None,None,None),
(1,12,"GtkBox","spacing","12",0,None,None,None,None,None,None,None,None),
(1,12,"GtkOrientable","orientation","vertical",0,None,None,None,None,None,None,None,None),
(1,12,"GtkWidget","vexpand","True",0,None,None,None,None,None,None,None,None),
(1,13,"GtkWidget","vexpand","True",0,None,None,None,None,None,None,None,None),
(1,14,"AdwActionRow","subtitle","The user will not be asked any questions",1,None,None,None,None,None,None,None,None),
(1,14,"AdwActionRow","subtitle-lines","3",0,None,None,None,None,None,None,None,None),
(1,14,"AdwPreferencesRow","title","Auto",0,None,None,None,None,None,None,None,None),
(1,14,"GtkListBoxRow","selectable","False",0,None,None,None,None,None,None,None,None),
(1,15,"AdwActionRow","subtitle","It helps to get resources that are unavailable from your network",1,None,None,None,None,None,None,None,None),
(1,15,"AdwActionRow","subtitle-lines","3",0,None,None,None,None,None,None,None,None),
(1,15,"AdwPreferencesRow","title","IPFS",0,None,None,None,None,None,None,None,None),
(1,15,"GtkListBoxRow","selectable","False",0,None,None,None,None,None,None,None,None),
(1,16,"AdwActionRow","subtitle","Sometimes it helps to get the latest version of the program. (Not recommended)",1,None,None,None,None,None,None,None,None),
(1,16,"AdwActionRow","subtitle-lines","3",0,None,None,None,None,None,None,None,None),
(1,16,"AdwPreferencesRow","title","Force",0,None,None,None,None,None,None,None,None),
(1,16,"GtkListBoxRow","selectable","False",0,None,None,None,None,None,None,None,None)
</object_property>
<object_data>
(1,7,"GtkWidget",1,1,None,None,None,None,None,None),
(1,7,"GtkWidget",2,2,None,1,None,None,None,None)
(1,13,"GtkWidget",1,1,None,None,None,None,None,None),
(1,13,"GtkWidget",2,2,None,1,None,None,None,None)
</object_data>
<object_data_arg>
(1,7,"GtkWidget",2,2,"name","boxed-list-separate")
(1,13,"GtkWidget",2,2,"name","boxed-list-separate")
</object_data_arg>
</cambalache-project>
......@@ -3,6 +3,7 @@ from gi.repository import Gtk, Adw
@Gtk.Template(resource_path='/ru/eepm/PlayGUI/widgets/flagsdialog.ui')
class FlagsDialog(Adw.Dialog):
__gtype_name__ = 'FlagsDialog'
auto_row = Gtk.Template.Child()
ipfs_row = Gtk.Template.Child()
force_row = Gtk.Template.Child()
......@@ -20,3 +21,9 @@ class FlagsDialog(Adw.Dialog):
return "--force"
else:
return ""
def auto(self):
if self.auto_row.get_active():
return "--auto"
else:
return ""
<?xml version='1.0' encoding='UTF-8'?>
<!-- Created with Cambalache 0.92.0 -->
<!-- Created with Cambalache 0.92.1 -->
<interface>
<!-- interface-name preferences.ui -->
<requires lib="gtk" version="4.12"/>
......@@ -26,33 +26,46 @@
<property name="margin-top">12</property>
<property name="maximum-size">500</property>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<property name="vexpand">True</property>
<object class="GtkScrolledWindow">
<property name="hscrollbar-policy">never</property>
<property name="propagate-natural-height">True</property>
<child>
<object class="GtkListBox">
<property name="height-request">198</property>
<object class="GtkBox">
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<property name="vexpand">True</property>
<child>
<object class="AdwSwitchRow" id="ipfs_row">
<property name="selectable">False</property>
<property name="subtitle" translatable="yes">It helps to get resources that are unavailable from your network</property>
<property name="subtitle-lines">3</property>
<property name="title">IPFS</property>
<object class="GtkListBox">
<property name="vexpand">True</property>
<child>
<object class="AdwSwitchRow" id="auto_row">
<property name="selectable">False</property>
<property name="subtitle" translatable="yes">The user will not be asked any questions</property>
<property name="subtitle-lines">3</property>
<property name="title">Auto</property>
</object>
</child>
<child>
<object class="AdwSwitchRow" id="ipfs_row">
<property name="selectable">False</property>
<property name="subtitle" translatable="yes">It helps to get resources that are unavailable from your network</property>
<property name="subtitle-lines">3</property>
<property name="title">IPFS</property>
</object>
</child>
<child>
<object class="AdwSwitchRow" id="force_row">
<property name="selectable">False</property>
<property name="subtitle" translatable="yes">Sometimes it helps to get the latest version of the program. (Not recommended)</property>
<property name="subtitle-lines">3</property>
<property name="title">Force</property>
</object>
</child>
<style>
<class name="boxed-list-separate"/>
</style>
</object>
</child>
<child>
<object class="AdwSwitchRow" id="force_row">
<property name="selectable">False</property>
<property name="subtitle" translatable="yes">Sometimes it helps to get the latest version of the program. (Not recommended)</property>
<property name="subtitle-lines">3</property>
<property name="title">Force</property>
</object>
</child>
<style>
<class name="boxed-list-separate"/>
</style>
</object>
</child>
</object>
......
......@@ -184,7 +184,12 @@ class EepmPlayGuiWindow(Adw.ApplicationWindow):
pkexec_command = f'pkexec sh -c "{full_command}"'
self.logdialog.run(pkexec_command, on_done=self.update_ui)
else:
self.logdialog.run("pkexec epm play --update all", on_done=self.update_ui)
self.logdialog.run(self.apply_flags(
[
self.flagsdialog.auto(),
self.flagsdialog.ipfs()
], "pkexec epm play --update all"
), on_done=self.update_ui)
def get_install_remove_lists(self):
if self.installed_apps and self.checkboxes:
......@@ -197,9 +202,9 @@ class EepmPlayGuiWindow(Adw.ApplicationWindow):
def build_commands(self, to_install, to_remove):
commands = []
if to_install:
commands.append(f"epm play --auto {' '.join(to_install)}")
commands.append(f"epm play {' '.join(to_install)}")
if to_remove:
commands.append(f"epm play --auto --remove {' '.join(to_remove)}")
commands.append(f"epm play --remove {' '.join(to_remove)}")
if not commands:
return None
......@@ -207,9 +212,17 @@ class EepmPlayGuiWindow(Adw.ApplicationWindow):
full_command = " && ".join(commands)
# Apply flags to the command
flags = [self.flagsdialog.force(), self.flagsdialog.ipfs()]
full_command = self.apply_flags(
[
self.flagsdialog.force(),
self.flagsdialog.ipfs(),
self.flagsdialog.auto()
], full_command)
return full_command
def apply_flags(self, flags, full_command):
for flag in flags:
full_command = re.sub(r"\bepm play\b", f"epm play {flag}", full_command)
return full_command
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