bauiv1lib.settings.remoteapp
Settings UI functionality related to the remote app.
1# Released under the MIT License. See LICENSE for details. 2# 3"""Settings UI functionality related to the remote app.""" 4 5from __future__ import annotations 6 7import bauiv1 as bui 8 9 10class RemoteAppSettingsWindow(bui.Window): 11 """Window showing info/settings related to the remote app.""" 12 13 def __init__(self) -> None: 14 self._r = 'connectMobileDevicesWindow' 15 width = 700 16 height = 390 17 spacing = 40 18 assert bui.app.classic is not None 19 uiscale = bui.app.ui_v1.uiscale 20 super().__init__( 21 root_widget=bui.containerwidget( 22 size=(width, height), 23 transition='in_right', 24 scale=( 25 1.85 26 if uiscale is bui.UIScale.SMALL 27 else 1.3 28 if uiscale is bui.UIScale.MEDIUM 29 else 1.0 30 ), 31 stack_offset=(-10, 0) 32 if uiscale is bui.UIScale.SMALL 33 else (0, 0), 34 ) 35 ) 36 btn = bui.buttonwidget( 37 parent=self._root_widget, 38 position=(40, height - 67), 39 size=(140, 65), 40 scale=0.8, 41 label=bui.Lstr(resource='backText'), 42 button_type='back', 43 text_scale=1.1, 44 autoselect=True, 45 on_activate_call=self._back, 46 ) 47 bui.containerwidget(edit=self._root_widget, cancel_button=btn) 48 49 bui.textwidget( 50 parent=self._root_widget, 51 position=(width * 0.5, height - 42), 52 size=(0, 0), 53 text=bui.Lstr(resource=self._r + '.titleText'), 54 maxwidth=370, 55 color=bui.app.ui_v1.title_color, 56 scale=0.8, 57 h_align='center', 58 v_align='center', 59 ) 60 61 bui.buttonwidget( 62 edit=btn, 63 button_type='backSmall', 64 size=(60, 60), 65 label=bui.charstr(bui.SpecialChar.BACK), 66 ) 67 68 v = height - 70.0 69 v -= spacing * 1.2 70 bui.textwidget( 71 parent=self._root_widget, 72 position=(15, v - 26), 73 size=(width - 30, 30), 74 maxwidth=width * 0.95, 75 color=(0.7, 0.9, 0.7, 1.0), 76 scale=0.8, 77 text=bui.Lstr( 78 resource=self._r + '.explanationText', 79 subs=[ 80 ('${APP_NAME}', bui.Lstr(resource='titleText')), 81 ('${REMOTE_APP_NAME}', bui.get_remote_app_name()), 82 ], 83 ), 84 max_height=100, 85 h_align='center', 86 v_align='center', 87 ) 88 v -= 90 89 90 # hmm the itms:// version doesnt bounce through safari but is kinda 91 # apple-specific-ish 92 93 # Update: now we just show link to the remote webpage. 94 bui.textwidget( 95 parent=self._root_widget, 96 position=(width * 0.5, v + 5), 97 size=(0, 0), 98 color=(0.7, 0.9, 0.7, 1.0), 99 scale=1.4, 100 text='bombsquadgame.com/remote', 101 maxwidth=width * 0.95, 102 max_height=60, 103 h_align='center', 104 v_align='center', 105 ) 106 v -= 30 107 108 bui.textwidget( 109 parent=self._root_widget, 110 position=(width * 0.5, v - 35), 111 size=(0, 0), 112 color=(0.7, 0.9, 0.7, 0.8), 113 scale=0.65, 114 text=bui.Lstr(resource=self._r + '.bestResultsText'), 115 maxwidth=width * 0.95, 116 max_height=height * 0.19, 117 h_align='center', 118 v_align='center', 119 ) 120 121 bui.checkboxwidget( 122 parent=self._root_widget, 123 position=(width * 0.5 - 150, v - 116), 124 size=(300, 30), 125 maxwidth=300, 126 scale=0.8, 127 value=not bui.app.config.resolve('Enable Remote App'), 128 autoselect=True, 129 text=bui.Lstr(resource='disableRemoteAppConnectionsText'), 130 on_value_change_call=self._on_check_changed, 131 ) 132 133 def _on_check_changed(self, value: bool) -> None: 134 cfg = bui.app.config 135 cfg['Enable Remote App'] = not value 136 cfg.apply_and_commit() 137 138 def _back(self) -> None: 139 from bauiv1lib.settings import controls 140 141 bui.containerwidget(edit=self._root_widget, transition='out_right') 142 assert bui.app.classic is not None 143 bui.app.ui_v1.set_main_menu_window( 144 controls.ControlsSettingsWindow( 145 transition='in_left' 146 ).get_root_widget() 147 )
class
RemoteAppSettingsWindow(bauiv1._uitypes.Window):
11class RemoteAppSettingsWindow(bui.Window): 12 """Window showing info/settings related to the remote app.""" 13 14 def __init__(self) -> None: 15 self._r = 'connectMobileDevicesWindow' 16 width = 700 17 height = 390 18 spacing = 40 19 assert bui.app.classic is not None 20 uiscale = bui.app.ui_v1.uiscale 21 super().__init__( 22 root_widget=bui.containerwidget( 23 size=(width, height), 24 transition='in_right', 25 scale=( 26 1.85 27 if uiscale is bui.UIScale.SMALL 28 else 1.3 29 if uiscale is bui.UIScale.MEDIUM 30 else 1.0 31 ), 32 stack_offset=(-10, 0) 33 if uiscale is bui.UIScale.SMALL 34 else (0, 0), 35 ) 36 ) 37 btn = bui.buttonwidget( 38 parent=self._root_widget, 39 position=(40, height - 67), 40 size=(140, 65), 41 scale=0.8, 42 label=bui.Lstr(resource='backText'), 43 button_type='back', 44 text_scale=1.1, 45 autoselect=True, 46 on_activate_call=self._back, 47 ) 48 bui.containerwidget(edit=self._root_widget, cancel_button=btn) 49 50 bui.textwidget( 51 parent=self._root_widget, 52 position=(width * 0.5, height - 42), 53 size=(0, 0), 54 text=bui.Lstr(resource=self._r + '.titleText'), 55 maxwidth=370, 56 color=bui.app.ui_v1.title_color, 57 scale=0.8, 58 h_align='center', 59 v_align='center', 60 ) 61 62 bui.buttonwidget( 63 edit=btn, 64 button_type='backSmall', 65 size=(60, 60), 66 label=bui.charstr(bui.SpecialChar.BACK), 67 ) 68 69 v = height - 70.0 70 v -= spacing * 1.2 71 bui.textwidget( 72 parent=self._root_widget, 73 position=(15, v - 26), 74 size=(width - 30, 30), 75 maxwidth=width * 0.95, 76 color=(0.7, 0.9, 0.7, 1.0), 77 scale=0.8, 78 text=bui.Lstr( 79 resource=self._r + '.explanationText', 80 subs=[ 81 ('${APP_NAME}', bui.Lstr(resource='titleText')), 82 ('${REMOTE_APP_NAME}', bui.get_remote_app_name()), 83 ], 84 ), 85 max_height=100, 86 h_align='center', 87 v_align='center', 88 ) 89 v -= 90 90 91 # hmm the itms:// version doesnt bounce through safari but is kinda 92 # apple-specific-ish 93 94 # Update: now we just show link to the remote webpage. 95 bui.textwidget( 96 parent=self._root_widget, 97 position=(width * 0.5, v + 5), 98 size=(0, 0), 99 color=(0.7, 0.9, 0.7, 1.0), 100 scale=1.4, 101 text='bombsquadgame.com/remote', 102 maxwidth=width * 0.95, 103 max_height=60, 104 h_align='center', 105 v_align='center', 106 ) 107 v -= 30 108 109 bui.textwidget( 110 parent=self._root_widget, 111 position=(width * 0.5, v - 35), 112 size=(0, 0), 113 color=(0.7, 0.9, 0.7, 0.8), 114 scale=0.65, 115 text=bui.Lstr(resource=self._r + '.bestResultsText'), 116 maxwidth=width * 0.95, 117 max_height=height * 0.19, 118 h_align='center', 119 v_align='center', 120 ) 121 122 bui.checkboxwidget( 123 parent=self._root_widget, 124 position=(width * 0.5 - 150, v - 116), 125 size=(300, 30), 126 maxwidth=300, 127 scale=0.8, 128 value=not bui.app.config.resolve('Enable Remote App'), 129 autoselect=True, 130 text=bui.Lstr(resource='disableRemoteAppConnectionsText'), 131 on_value_change_call=self._on_check_changed, 132 ) 133 134 def _on_check_changed(self, value: bool) -> None: 135 cfg = bui.app.config 136 cfg['Enable Remote App'] = not value 137 cfg.apply_and_commit() 138 139 def _back(self) -> None: 140 from bauiv1lib.settings import controls 141 142 bui.containerwidget(edit=self._root_widget, transition='out_right') 143 assert bui.app.classic is not None 144 bui.app.ui_v1.set_main_menu_window( 145 controls.ControlsSettingsWindow( 146 transition='in_left' 147 ).get_root_widget() 148 )
Window showing info/settings related to the remote app.
Inherited Members
- bauiv1._uitypes.Window
- get_root_widget