mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
This appears to be incompatible with pyinstaller. I get the following when trying to run the executable generated with pyside6: ``` Traceback (most recent call last): File "qt_ui\main.py", line 29, in <module> File "PyInstaller\loader\pyimod03_importers.py", line 476, in exec_module File "qt_ui\windows\QLiberationWindow.py", line 28, in <module> File "PyInstaller\loader\pyimod03_importers.py", line 476, in exec_module File "qt_ui\widgets\map\QLiberationMap.py", line 11, in <module> ImportError: could not import module 'PySide6.QtPrintSupport' ```
73 lines
1.8 KiB
Python
73 lines
1.8 KiB
Python
from PySide2.QtCore import Qt
|
|
from PySide2.QtWidgets import (
|
|
QCheckBox,
|
|
QGridLayout,
|
|
QGroupBox,
|
|
QLabel,
|
|
QVBoxLayout,
|
|
QWidget,
|
|
)
|
|
|
|
from game.plugins import LuaPlugin, LuaPluginManager
|
|
|
|
|
|
class PluginsBox(QGroupBox):
|
|
def __init__(self) -> None:
|
|
super().__init__("Plugins")
|
|
|
|
layout = QGridLayout()
|
|
layout.setAlignment(Qt.AlignTop)
|
|
self.setLayout(layout)
|
|
|
|
for row, plugin in enumerate(LuaPluginManager.plugins()):
|
|
if not plugin.show_in_ui:
|
|
continue
|
|
|
|
layout.addWidget(QLabel(plugin.name), row, 0)
|
|
|
|
checkbox = QCheckBox()
|
|
checkbox.setChecked(plugin.enabled)
|
|
checkbox.toggled.connect(plugin.set_enabled)
|
|
layout.addWidget(checkbox, row, 1)
|
|
|
|
|
|
class PluginsPage(QWidget):
|
|
def __init__(self) -> None:
|
|
super().__init__()
|
|
|
|
layout = QVBoxLayout()
|
|
layout.setAlignment(Qt.AlignTop)
|
|
self.setLayout(layout)
|
|
|
|
layout.addWidget(PluginsBox())
|
|
|
|
|
|
class PluginOptionsBox(QGroupBox):
|
|
def __init__(self, plugin: LuaPlugin) -> None:
|
|
super().__init__(plugin.name)
|
|
|
|
layout = QGridLayout()
|
|
layout.setAlignment(Qt.AlignTop)
|
|
self.setLayout(layout)
|
|
|
|
for row, option in enumerate(plugin.options):
|
|
layout.addWidget(QLabel(option.name), row, 0)
|
|
|
|
checkbox = QCheckBox()
|
|
checkbox.setChecked(option.enabled)
|
|
checkbox.toggled.connect(option.set_enabled)
|
|
layout.addWidget(checkbox, row, 1)
|
|
|
|
|
|
class PluginOptionsPage(QWidget):
|
|
def __init__(self) -> None:
|
|
super().__init__()
|
|
|
|
layout = QVBoxLayout()
|
|
layout.setAlignment(Qt.AlignTop)
|
|
self.setLayout(layout)
|
|
|
|
for plugin in LuaPluginManager.plugins():
|
|
if plugin.options:
|
|
layout.addWidget(PluginOptionsBox(plugin))
|