def ShowDialog( cls, returnCallback: typing.Optional[typing.Callable[[], None]] = None) -> None: """ Show the dialog to change this setting. :param returnCallback: The return callback will be triggered after the setting dialog is closed. :type returnCallback: typing.Callable[[], None] """ if not isinstance(returnCallback, typing.Callable) and returnCallback is not None: raise Exceptions.IncorrectTypeException(returnCallback, "returnCallback", ("Callable", None)) if not cls.CanShowDialog(): return if cls.Dialog is None: return settingWrapper = UISettingsShared.SettingStandardWrapper( cls) # type: UISettingsShared.SettingStandardWrapper settingDialog = cls.Dialog() # type: UISettings.SettingDialogBase settingDialog.ShowDialog(settingWrapper, returnCallback=returnCallback)
def ShowDialog(cls, simID: str, returnCallback: typing.Callable[[], None] = None) -> None: """ Show the dialog to change this setting. :param simID: The ID of the sim who's setting value the dialog would be changing. :type simID: str :param returnCallback: The return callback will be triggered after the setting dialog is closed. :type returnCallback: typing.Callable[[], None] """ if not isinstance(simID, str): raise Exceptions.IncorrectTypeException(simID, "simID", (str, )) if not isinstance(returnCallback, typing.Callable) and returnCallback is not None: raise Exceptions.IncorrectTypeException(returnCallback, "returnCallback", ("Callable", None)) if not hasattr(cls, "Dialog"): return if cls.Dialog is None: return settingWrapper = UISettingsShared.SettingBranchWrapper( cls, simID) # type: UISettingsShared.SettingBranchWrapper settingDialog = cls.Dialog() # type: UISettings.SettingDialogBase settingDialog.ShowDialog(settingWrapper, returnCallback=returnCallback)
def GetListDialogSettings () -> typing.List[UISettingsShared.SettingStandardWrapper]: return [UISettingsShared.SettingStandardWrapper(setting) for setting in Settings.GetAllSettings()]
def GetListDialogSettingsSystem () -> UISettingsShared.SettingsSystemStandardWrapper: return UISettingsShared.SettingsSystemStandardWrapper(SettingsBase, GetListDialogSettings(), SettingsBase.Save, SettingsBase.Update)
def GetListDialogSettings( branch: str) -> typing.List[UISettingsShared.SettingBranchWrapper]: return [ UISettingsShared.SettingBranchWrapper(setting, branch) for setting in SimSettings.GetAllSettings() ]
def GetListDialogSettingsSystem( branch: str) -> UISettingsShared.SettingsSystemBranchWrapper: return UISettingsShared.SettingsSystemBranchWrapper( SettingsBase, GetListDialogSettings(branch), lambda *args, **kwargs: None, SettingsBase.Update)