/
settings_dlg.py
35 lines (28 loc) · 1.19 KB
/
settings_dlg.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
"""Logic for the application settings UI"""
import logging
from qtpy.QtWidgets import QDialog
from qtpy.QtCore import Slot, QSettings
from friendlypics2.misc.gui_helpers import load_ui
class SettingsDialog(QDialog):
"""Logic for managing application settings dialog"""
def __init__(self, parent, settings):
super().__init__(parent)
self._settings = settings
self._log = logging.getLogger(__name__)
self.settings = QSettings()
self._load_ui()
def _load_ui(self):
"""Internal helper method that configures the UI for the dialog"""
load_ui("settings_dlg.ui", self)
self.cancel_button.clicked.connect(self.close)
self.save_button.clicked.connect(self._save_clicked)
# TODO: populate the settings tree view
# TODO: make a custom "model" class to render the AppSettings class
self.settings_view.add_item
# Center the about box on the parent window
parent_geom = self.parent().geometry()
self.move(parent_geom.center() - self.rect().center())
@Slot()
def _save_clicked(self):
"""Callback for when the user clicks the save button"""
self._log.debug("Saving")