Skip to content

Commit

Permalink
#3964 oops: forgot to add the configure scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
totaam committed Oct 5, 2023
1 parent da23258 commit 8c15fdb
Show file tree
Hide file tree
Showing 4 changed files with 155 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
42 changes: 42 additions & 0 deletions xpra/gtk/configure/features.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# This file is part of Xpra.
# Copyright (C) 2018-2023 Antoine Martin <[email protected]>
# 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())
40 changes: 40 additions & 0 deletions xpra/gtk/configure/gstreamer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# This file is part of Xpra.
# Copyright (C) 2018-2023 Antoine Martin <[email protected]>
# 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())
72 changes: 72 additions & 0 deletions xpra/gtk/configure/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# This file is part of Xpra.
# Copyright (C) 2018-2023 Antoine Martin <[email protected]>
# 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())

0 comments on commit 8c15fdb

Please sign in to comment.