From 8c15fdb40547d415b0bca83c49aff2c3076d32dc Mon Sep 17 00:00:00 2001 From: totaam Date: Thu, 5 Oct 2023 14:59:47 +0700 Subject: [PATCH] #3964 oops: forgot to add the configure scripts --- .gitignore | 1 + xpra/gtk/configure/features.py | 42 +++++++++++++++++++ xpra/gtk/configure/gstreamer.py | 40 ++++++++++++++++++ xpra/gtk/configure/main.py | 72 +++++++++++++++++++++++++++++++++ 4 files changed, 155 insertions(+) create mode 100644 xpra/gtk/configure/features.py create mode 100644 xpra/gtk/configure/gstreamer.py create mode 100644 xpra/gtk/configure/main.py diff --git a/.gitignore b/.gitignore index 3fd1645a43..b56b7092e0 100644 --- a/.gitignore +++ b/.gitignore @@ -124,6 +124,7 @@ tests/unittests/test-file* /xpra/gtk/*.c /xpra/gtk/dialogs/*.c /xpra/gtk/examples/*.c +/xpra/gtk/configure/*.c /xpra/gtk/bindings/*.c /xpra/gstreamer/*.c /xpra/keyboard/*.c diff --git a/xpra/gtk/configure/features.py b/xpra/gtk/configure/features.py new file mode 100644 index 0000000000..0c34df1c1f --- /dev/null +++ b/xpra/gtk/configure/features.py @@ -0,0 +1,42 @@ +# This file is part of Xpra. +# Copyright (C) 2018-2023 Antoine Martin +# Xpra is released under the terms of the GNU GPL v2, or, at your option, any +# later version. See the file COPYING for details. + +import gi + +from xpra.gtk.dialogs.base_gui_window import BaseGUIWindow +from xpra.gtk.widget import label +from xpra.log import Logger + +gi.require_version('Gtk', '3.0') +from gi.repository import Gtk + +log = Logger("util") + + +class ConfigureGUI(BaseGUIWindow): + + def __init__(self, parent:Gtk.Window|None=None): + super().__init__( + "Configure Xpra's Features", + "features.png", + wm_class=("xpra-configure-features-gui", "Xpra Configure Features GUI"), + default_size=(640, 300), + header_bar=(True, False), + parent=parent, + ) + + def populate(self): + self.add_widget(label("Configure Xpra Features", font="sans 20")) + self.add_widget(label("This dialog allows you to turn on or off whole subsystems", font="sans 14")) + + + +def main() -> int: + from xpra.gtk.configure.main import run_gui + return run_gui(ConfigureGUI) + +if __name__ == "__main__": + import sys + sys.exit(main()) diff --git a/xpra/gtk/configure/gstreamer.py b/xpra/gtk/configure/gstreamer.py new file mode 100644 index 0000000000..dd358cc013 --- /dev/null +++ b/xpra/gtk/configure/gstreamer.py @@ -0,0 +1,40 @@ +# This file is part of Xpra. +# Copyright (C) 2018-2023 Antoine Martin +# Xpra is released under the terms of the GNU GPL v2, or, at your option, any +# later version. See the file COPYING for details. + +import gi + +from xpra.gtk.dialogs.base_gui_window import BaseGUIWindow +from xpra.gtk.widget import label +from xpra.log import Logger + +gi.require_version('Gtk', '3.0') +from gi.repository import Gtk + +log = Logger("gstreamer", "util") + + +class ConfigureGUI(BaseGUIWindow): + + def __init__(self, parent:Gtk.Window|None=None): + super().__init__( + "Configure Xpra's GStreamer Codecs", + "gstreamer.png", + wm_class=("xpra-configure-gstreamer-gui", "Xpra Configure GStreamer GUI"), + default_size=(640, 300), + header_bar=(True, False), + parent=parent, + ) + + def populate(self): + self.add_widget(label("Configure Xpra GStreamer Codecs", font="sans 20")) + + +def main() -> int: + from xpra.gtk.configure.main import run_gui + return run_gui(ConfigureGUI) + +if __name__ == "__main__": + import sys + sys.exit(main()) diff --git a/xpra/gtk/configure/main.py b/xpra/gtk/configure/main.py new file mode 100644 index 0000000000..08849818b0 --- /dev/null +++ b/xpra/gtk/configure/main.py @@ -0,0 +1,72 @@ +# This file is part of Xpra. +# Copyright (C) 2018-2023 Antoine Martin +# Xpra is released under the terms of the GNU GPL v2, or, at your option, any +# later version. See the file COPYING for details. + +from importlib import import_module +import gi + +from xpra.gtk.dialogs.base_gui_window import BaseGUIWindow +from xpra.gtk.widget import label +from xpra.log import Logger + +gi.require_version('Gtk', '3.0') +from gi.repository import Gtk + +log = Logger("util") + + +class ConfigureGUI(BaseGUIWindow): + + def __init__(self): + super().__init__( + "Configure Xpra", + "toolbox.png", + wm_class=("xpra-configure-gui", "Xpra Configure GUI"), + default_size=(480, 300), + header_bar=(True, False), + ) + self.dialogs : dict[str,BaseGUIWindow] = {} + + def populate(self): + self.vbox.add(label("Configure Xpra", font="sans 20")) + self.vbox.add(label("Tune your xpra configuration:", font="sans 14")) + self.sub("Features", "features.png","Enable or disable feature groups", "features") + self.sub("Picture compression", "encoding.png","Encodings, speed and quality", "encodings") + self.sub("GStreamer", "gstreamer.png","Configure the GStreamer codecs", "gstreamer") + + def sub(self, title="", icon_name="browse.png", tooltip="", configure:str="") -> None: + def callback(btn): + dialog = self.dialogs.get(configure) + if dialog is None: + mod = import_module(f"xpra.gtk.configure.{configure}") + dialog = mod.ConfigureGUI(self) + self.dialogs[configure] = dialog + dialog.show() + self.ib(title, icon_name, tooltip, callback=callback) + + +def run_gui(gui_class=ConfigureGUI) -> int: + # pylint: disable=import-outside-toplevel + from xpra.platform import program_context + from xpra.log import enable_color + from xpra.platform.gui import init, ready + from xpra.gtk.signals import register_os_signals + with program_context("xpra-configure-gui", "Xpra Configure GUI"): + enable_color() + init() + gui = gui_class() + register_os_signals(gui.app_signal) + ready() + gui.show() + Gtk.main() + log("do_main() gui.exit_code=%i", gui.exit_code) + return 0 + +def main() -> int: + return run_gui(ConfigureGUI) + + +if __name__ == "__main__": + import sys + sys.exit(main())