dcs_liberation/qt_ui/windows/preferences/QLiberationPreferencesWindow.py
Dan Albert 2a75d14e0e Revert upgrade to pyside6.
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'
```
2021-11-21 17:39:43 -08:00

36 lines
1.1 KiB
Python

from PySide2.QtGui import QIcon, Qt
from PySide2.QtWidgets import QDialog, QVBoxLayout, QPushButton, QHBoxLayout
from qt_ui.windows.preferences.QLiberationPreferences import QLiberationPreferences
class QLiberationPreferencesWindow(QDialog):
def __init__(self):
super(QLiberationPreferencesWindow, self).__init__()
self.setModal(True)
self.setWindowTitle("Preferences")
self.setMinimumSize(300, 200)
self.setWindowIcon(QIcon("./resources/icon.png"))
self.preferences = QLiberationPreferences()
self.apply_button = QPushButton("Apply")
self.apply_button.clicked.connect(lambda: self.apply())
self.initUI()
def initUI(self):
layout = QVBoxLayout()
layout.addWidget(self.preferences)
layout.addStretch()
apply_btn_layout = QHBoxLayout()
apply_btn_layout.addStretch()
apply_btn_layout.addWidget(self.apply_button)
layout.addLayout(apply_btn_layout)
self.setLayout(layout)
def apply(self):
if self.preferences.apply():
print("Closing")
self.close()
else:
print("Not Closing")