Commit 428a77f9 authored by Roman Alifanov's avatar Roman Alifanov

move apply_flags func to flagsdialog

parent 8c1db620
import re
from gi.repository import Gtk, Adw
@Gtk.Template(resource_path='/ru/eepm/PlayGUI/widgets/flagsdialog.ui')
......@@ -10,6 +12,11 @@ class FlagsDialog(Adw.Dialog):
def __init__(self, **kwargs):
super().__init__(**kwargs)
def apply_flags(self, tool, flags, full_command):
for flag in flags:
full_command = re.sub(rf"\b{tool}\b", f"{tool} {flag}", full_command)
return full_command
def ipfs(self):
if self.ipfs_row.get_active():
return "--ipfs"
......
......@@ -225,7 +225,7 @@ class EepmPlayGuiWindow(Adw.ApplicationWindow):
full_command = " && ".join(commands)
# Apply flags to the command
full_command = self.apply_flags(
full_command = self.flagsdialog.apply_flags("epn play",
[
self.flagsdialog.force(),
self.flagsdialog.ipfs(),
......@@ -233,9 +233,3 @@ class EepmPlayGuiWindow(Adw.ApplicationWindow):
], 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