Source code for diplomat.wx_gui.settings_dialog

from typing import Any, Callable, List, Optional
import wx
from diplomat.processing import Config
from diplomat.wx_gui.labeler_lib import SettingWidget, SettingCollection, SettingCollectionWidget






[docs] class SettingsDialog(wx.Dialog):
[docs] def __init__(self, *args, title: str = "Settings", settings: SettingCollection, **kwargs): super().__init__(*args, title=title, style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER, **kwargs) self._parent_layout = wx.BoxSizer(wx.VERTICAL) self._settings = settings self._setting_widget = SettingCollectionWidget(self, title=title, collapsable=False) self._setting_widget.set_setting_collection(settings) self._parent_layout.Add(self._setting_widget, proportion=1, flag=wx.EXPAND | wx.ALL) self._buttons = self.CreateButtonSizer(wx.OK | wx.CANCEL) self._parent_layout.Add(self._buttons, proportion=0, flag=wx.EXPAND | wx.ALL) self.SetSizerAndFit(self._parent_layout)
def get_values(self) -> Config: return self._settings.get_values()