Updating to ConfigCheckBox

This commit is contained in:
Vishal 2022-11-05 23:47:16 +05:30 committed by GitHub
parent 713540cbb8
commit de086a8a3f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 11 deletions

View File

@ -117,7 +117,7 @@ class PluginWindow(ba.Window):
ba.imagewidget(
parent=self._root_widget,
position=(settings_button_x + 5, self._height - 60),
position=(settings_button_x + 3, self._height - 60),
size=(35, 35),
texture=ba.gettexture('settingsIcon'),
)

View File

@ -7,6 +7,7 @@ from __future__ import annotations
from typing import TYPE_CHECKING
import ba
from bastd.ui.config import ConfigCheckBox
if TYPE_CHECKING:
pass
@ -100,15 +101,14 @@ class PluginSettingsWindow(ba.Window):
)
self._y_position -= 70
self._enable_new_plugins_check_box = ba.checkboxwidget(
self._enable_new_plugins_check_box = ConfigCheckBox(
parent=self._root_widget,
position=(65, self._y_position),
size=(350, 60),
value=ba.app.config['Auto Enable New Plugins'],
text=ba.Lstr(resource='AutoEnableNewPluginsText'),
configkey='Auto Enable New Plugins',
displayname=ba.Lstr(resource='AutoEnableNewPluginsText'),
scale=1.0,
maxwidth=430,
on_value_change_call=self._update_value
maxwidth=430
)
def _enable_all_plugins(self) -> None:
@ -135,11 +135,6 @@ class PluginSettingsWindow(ba.Window):
color=(1.0, 0.5, 0.0),
)
def _update_value(self, val: bool) -> None:
cfg = ba.app.config
cfg['Auto Enable New Plugins'] = val
cfg.apply_and_commit()
def _do_back(self) -> None:
# pylint: disable=cyclic-import
from bastd.ui.settings.plugins import PluginWindow

View File

@ -221,6 +221,8 @@ void AppConfig::SetupEntries() {
// (default to internal keyboard on iircade; not elsewhere)
bool_entries_[BoolID::kAlwaysUseInternalKeyboard] =
BoolEntry("Always Use Internal Keyboard", g_buildconfig.iircade_build());
bool_entries_[BoolID::kAutoEnableNewPlugins] =
BoolEntry("Auto Enable New Plugins", true);
bool_entries_[BoolID::kShowFPS] = BoolEntry("Show FPS", false);
bool_entries_[BoolID::kTVBorder] =
BoolEntry("TV Border", g_platform->IsRunningOnTV());

View File

@ -60,6 +60,7 @@ class AppConfig {
kFullscreen,
kKickIdlePlayers,
kAlwaysUseInternalKeyboard,
kAutoEnableNewPlugins,
kShowFPS,
kTVBorder,
kKeyboardP2Enabled,