bauiv1lib.achievements

Provides a popup window to view achievements.

  1# Released under the MIT License. See LICENSE for details.
  2#
  3"""Provides a popup window to view achievements."""
  4
  5from __future__ import annotations
  6
  7from typing import override
  8
  9import bauiv1 as bui
 10
 11
 12class AchievementsWindow(bui.MainWindow):
 13    """Popup window to view achievements."""
 14
 15    def __init__(
 16        self,
 17        transition: str | None = 'in_right',
 18        origin_widget: bui.Widget | None = None,
 19    ):
 20        # pylint: disable=too-many-locals
 21        assert bui.app.classic is not None
 22        uiscale = bui.app.ui_v1.uiscale
 23        self._width = 600 if uiscale is bui.UIScale.SMALL else 450
 24        self._height = (
 25            380
 26            if uiscale is bui.UIScale.SMALL
 27            else 370 if uiscale is bui.UIScale.MEDIUM else 450
 28        )
 29        yoffs = -45 if uiscale is bui.UIScale.SMALL else 0
 30
 31        super().__init__(
 32            root_widget=bui.containerwidget(
 33                size=(self._width, self._height),
 34                toolbar_visibility=(
 35                    'menu_minimal'
 36                    if uiscale is bui.UIScale.SMALL
 37                    else 'menu_full'
 38                ),
 39                scale=(
 40                    2.3
 41                    if uiscale is bui.UIScale.SMALL
 42                    else 1.65 if uiscale is bui.UIScale.MEDIUM else 1.23
 43                ),
 44                stack_offset=(
 45                    (0, 0)
 46                    if uiscale is bui.UIScale.SMALL
 47                    else (0, 0) if uiscale is bui.UIScale.MEDIUM else (0, 0)
 48                ),
 49            ),
 50            transition=transition,
 51            origin_widget=origin_widget,
 52        )
 53
 54        if uiscale is bui.UIScale.SMALL:
 55            bui.containerwidget(
 56                edit=self._root_widget, on_cancel_call=self.main_window_back
 57            )
 58            self._back_button = None
 59        else:
 60            self._back_button = bui.buttonwidget(
 61                parent=self._root_widget,
 62                autoselect=True,
 63                position=(50, self._height - 38 + yoffs),
 64                size=(60, 60),
 65                scale=0.6,
 66                label=bui.charstr(bui.SpecialChar.BACK),
 67                button_type='backSmall',
 68                on_activate_call=self.main_window_back,
 69            )
 70            bui.containerwidget(
 71                edit=self._root_widget, cancel_button=self._back_button
 72            )
 73
 74        achievements = bui.app.classic.ach.achievements
 75        num_complete = len([a for a in achievements if a.complete])
 76
 77        txt_final = bui.Lstr(
 78            resource='accountSettingsWindow.achievementProgressText',
 79            subs=[
 80                ('${COUNT}', str(num_complete)),
 81                ('${TOTAL}', str(len(achievements))),
 82            ],
 83        )
 84        self._title_text = bui.textwidget(
 85            parent=self._root_widget,
 86            position=(
 87                self._width * 0.5,
 88                self._height
 89                - (27 if uiscale is bui.UIScale.SMALL else 20)
 90                + yoffs,
 91            ),
 92            size=(0, 0),
 93            h_align='center',
 94            v_align='center',
 95            scale=0.6,
 96            text=txt_final,
 97            maxwidth=200,
 98            color=bui.app.ui_v1.title_color,
 99        )
100
101        self._scrollwidget = bui.scrollwidget(
102            parent=self._root_widget,
103            size=(
104                self._width - 60,
105                self._height - (150 if uiscale is bui.UIScale.SMALL else 70),
106            ),
107            position=(
108                30,
109                (110 if uiscale is bui.UIScale.SMALL else 30) + yoffs,
110            ),
111            capture_arrows=True,
112            simple_culling_v=10,
113        )
114        bui.widget(edit=self._scrollwidget, autoselect=True)
115        if uiscale is bui.UIScale.SMALL:
116            bui.widget(
117                edit=self._scrollwidget,
118                left_widget=bui.get_special_widget('back_button'),
119            )
120
121        bui.containerwidget(
122            edit=self._root_widget, cancel_button=self._back_button
123        )
124
125        incr = 36
126        sub_width = self._width - 90
127        sub_height = 40 + len(achievements) * incr
128
129        eq_rsrc = 'coopSelectWindow.powerRankingPointsEqualsText'
130        pts_rsrc = 'coopSelectWindow.powerRankingPointsText'
131
132        self._subcontainer = bui.containerwidget(
133            parent=self._scrollwidget,
134            size=(sub_width, sub_height),
135            background=False,
136        )
137
138        total_pts = 0
139        for i, ach in enumerate(achievements):
140            complete = ach.complete
141            bui.textwidget(
142                parent=self._subcontainer,
143                position=(sub_width * 0.08 - 5, sub_height - 20 - incr * i),
144                maxwidth=20,
145                scale=0.5,
146                color=(0.6, 0.6, 0.7) if complete else (0.6, 0.6, 0.7, 0.2),
147                flatness=1.0,
148                shadow=0.0,
149                text=str(i + 1),
150                size=(0, 0),
151                h_align='right',
152                v_align='center',
153            )
154
155            bui.imagewidget(
156                parent=self._subcontainer,
157                position=(
158                    (sub_width * 0.10 + 1, sub_height - 20 - incr * i - 9)
159                    if complete
160                    else (sub_width * 0.10 - 4, sub_height - 20 - incr * i - 14)
161                ),
162                size=(18, 18) if complete else (27, 27),
163                opacity=1.0 if complete else 0.3,
164                color=ach.get_icon_color(complete)[:3],
165                texture=ach.get_icon_ui_texture(complete),
166            )
167            if complete:
168                bui.imagewidget(
169                    parent=self._subcontainer,
170                    position=(
171                        sub_width * 0.10 - 4,
172                        sub_height - 25 - incr * i - 9,
173                    ),
174                    size=(28, 28),
175                    color=(2, 1.4, 0),
176                    texture=bui.gettexture('achievementOutline'),
177                )
178            bui.textwidget(
179                parent=self._subcontainer,
180                position=(sub_width * 0.19, sub_height - 19 - incr * i + 3),
181                maxwidth=sub_width * 0.62,
182                scale=0.6,
183                flatness=1.0,
184                shadow=0.0,
185                color=(1, 1, 1) if complete else (1, 1, 1, 0.2),
186                text=ach.display_name,
187                size=(0, 0),
188                h_align='left',
189                v_align='center',
190            )
191
192            bui.textwidget(
193                parent=self._subcontainer,
194                position=(sub_width * 0.19, sub_height - 19 - incr * i - 10),
195                maxwidth=sub_width * 0.62,
196                scale=0.4,
197                flatness=1.0,
198                shadow=0.0,
199                color=(0.83, 0.8, 0.85) if complete else (0.8, 0.8, 0.8, 0.2),
200                text=(
201                    ach.description_full_complete
202                    if complete
203                    else ach.description_full
204                ),
205                size=(0, 0),
206                h_align='left',
207                v_align='center',
208            )
209
210            pts = ach.power_ranking_value
211            bui.textwidget(
212                parent=self._subcontainer,
213                position=(sub_width * 0.92, sub_height - 20 - incr * i),
214                maxwidth=sub_width * 0.15,
215                color=(0.7, 0.8, 1.0) if complete else (0.9, 0.9, 1.0, 0.3),
216                flatness=1.0,
217                shadow=0.0,
218                scale=0.6,
219                text=bui.Lstr(
220                    resource=pts_rsrc, subs=[('${NUMBER}', str(pts))]
221                ),
222                size=(0, 0),
223                h_align='center',
224                v_align='center',
225            )
226            if complete:
227                total_pts += pts
228
229        bui.textwidget(
230            parent=self._subcontainer,
231            position=(
232                sub_width * 1.0,
233                sub_height - 20 - incr * len(achievements),
234            ),
235            maxwidth=sub_width * 0.5,
236            scale=0.7,
237            color=(0.7, 0.8, 1.0),
238            flatness=1.0,
239            shadow=0.0,
240            text=bui.Lstr(
241                value='${A} ${B}',
242                subs=[
243                    ('${A}', bui.Lstr(resource='coopSelectWindow.totalText')),
244                    (
245                        '${B}',
246                        bui.Lstr(
247                            resource=eq_rsrc,
248                            subs=[('${NUMBER}', str(total_pts))],
249                        ),
250                    ),
251                ],
252            ),
253            size=(0, 0),
254            h_align='right',
255            v_align='center',
256        )
257
258    @override
259    def get_main_window_state(self) -> bui.MainWindowState:
260        # Support recreating our window for back/refresh purposes.
261        cls = type(self)
262        return bui.BasicMainWindowState(
263            create_call=lambda transition, origin_widget: cls(
264                transition=transition, origin_widget=origin_widget
265            )
266        )
class AchievementsWindow(bauiv1._uitypes.MainWindow):
 13class AchievementsWindow(bui.MainWindow):
 14    """Popup window to view achievements."""
 15
 16    def __init__(
 17        self,
 18        transition: str | None = 'in_right',
 19        origin_widget: bui.Widget | None = None,
 20    ):
 21        # pylint: disable=too-many-locals
 22        assert bui.app.classic is not None
 23        uiscale = bui.app.ui_v1.uiscale
 24        self._width = 600 if uiscale is bui.UIScale.SMALL else 450
 25        self._height = (
 26            380
 27            if uiscale is bui.UIScale.SMALL
 28            else 370 if uiscale is bui.UIScale.MEDIUM else 450
 29        )
 30        yoffs = -45 if uiscale is bui.UIScale.SMALL else 0
 31
 32        super().__init__(
 33            root_widget=bui.containerwidget(
 34                size=(self._width, self._height),
 35                toolbar_visibility=(
 36                    'menu_minimal'
 37                    if uiscale is bui.UIScale.SMALL
 38                    else 'menu_full'
 39                ),
 40                scale=(
 41                    2.3
 42                    if uiscale is bui.UIScale.SMALL
 43                    else 1.65 if uiscale is bui.UIScale.MEDIUM else 1.23
 44                ),
 45                stack_offset=(
 46                    (0, 0)
 47                    if uiscale is bui.UIScale.SMALL
 48                    else (0, 0) if uiscale is bui.UIScale.MEDIUM else (0, 0)
 49                ),
 50            ),
 51            transition=transition,
 52            origin_widget=origin_widget,
 53        )
 54
 55        if uiscale is bui.UIScale.SMALL:
 56            bui.containerwidget(
 57                edit=self._root_widget, on_cancel_call=self.main_window_back
 58            )
 59            self._back_button = None
 60        else:
 61            self._back_button = bui.buttonwidget(
 62                parent=self._root_widget,
 63                autoselect=True,
 64                position=(50, self._height - 38 + yoffs),
 65                size=(60, 60),
 66                scale=0.6,
 67                label=bui.charstr(bui.SpecialChar.BACK),
 68                button_type='backSmall',
 69                on_activate_call=self.main_window_back,
 70            )
 71            bui.containerwidget(
 72                edit=self._root_widget, cancel_button=self._back_button
 73            )
 74
 75        achievements = bui.app.classic.ach.achievements
 76        num_complete = len([a for a in achievements if a.complete])
 77
 78        txt_final = bui.Lstr(
 79            resource='accountSettingsWindow.achievementProgressText',
 80            subs=[
 81                ('${COUNT}', str(num_complete)),
 82                ('${TOTAL}', str(len(achievements))),
 83            ],
 84        )
 85        self._title_text = bui.textwidget(
 86            parent=self._root_widget,
 87            position=(
 88                self._width * 0.5,
 89                self._height
 90                - (27 if uiscale is bui.UIScale.SMALL else 20)
 91                + yoffs,
 92            ),
 93            size=(0, 0),
 94            h_align='center',
 95            v_align='center',
 96            scale=0.6,
 97            text=txt_final,
 98            maxwidth=200,
 99            color=bui.app.ui_v1.title_color,
100        )
101
102        self._scrollwidget = bui.scrollwidget(
103            parent=self._root_widget,
104            size=(
105                self._width - 60,
106                self._height - (150 if uiscale is bui.UIScale.SMALL else 70),
107            ),
108            position=(
109                30,
110                (110 if uiscale is bui.UIScale.SMALL else 30) + yoffs,
111            ),
112            capture_arrows=True,
113            simple_culling_v=10,
114        )
115        bui.widget(edit=self._scrollwidget, autoselect=True)
116        if uiscale is bui.UIScale.SMALL:
117            bui.widget(
118                edit=self._scrollwidget,
119                left_widget=bui.get_special_widget('back_button'),
120            )
121
122        bui.containerwidget(
123            edit=self._root_widget, cancel_button=self._back_button
124        )
125
126        incr = 36
127        sub_width = self._width - 90
128        sub_height = 40 + len(achievements) * incr
129
130        eq_rsrc = 'coopSelectWindow.powerRankingPointsEqualsText'
131        pts_rsrc = 'coopSelectWindow.powerRankingPointsText'
132
133        self._subcontainer = bui.containerwidget(
134            parent=self._scrollwidget,
135            size=(sub_width, sub_height),
136            background=False,
137        )
138
139        total_pts = 0
140        for i, ach in enumerate(achievements):
141            complete = ach.complete
142            bui.textwidget(
143                parent=self._subcontainer,
144                position=(sub_width * 0.08 - 5, sub_height - 20 - incr * i),
145                maxwidth=20,
146                scale=0.5,
147                color=(0.6, 0.6, 0.7) if complete else (0.6, 0.6, 0.7, 0.2),
148                flatness=1.0,
149                shadow=0.0,
150                text=str(i + 1),
151                size=(0, 0),
152                h_align='right',
153                v_align='center',
154            )
155
156            bui.imagewidget(
157                parent=self._subcontainer,
158                position=(
159                    (sub_width * 0.10 + 1, sub_height - 20 - incr * i - 9)
160                    if complete
161                    else (sub_width * 0.10 - 4, sub_height - 20 - incr * i - 14)
162                ),
163                size=(18, 18) if complete else (27, 27),
164                opacity=1.0 if complete else 0.3,
165                color=ach.get_icon_color(complete)[:3],
166                texture=ach.get_icon_ui_texture(complete),
167            )
168            if complete:
169                bui.imagewidget(
170                    parent=self._subcontainer,
171                    position=(
172                        sub_width * 0.10 - 4,
173                        sub_height - 25 - incr * i - 9,
174                    ),
175                    size=(28, 28),
176                    color=(2, 1.4, 0),
177                    texture=bui.gettexture('achievementOutline'),
178                )
179            bui.textwidget(
180                parent=self._subcontainer,
181                position=(sub_width * 0.19, sub_height - 19 - incr * i + 3),
182                maxwidth=sub_width * 0.62,
183                scale=0.6,
184                flatness=1.0,
185                shadow=0.0,
186                color=(1, 1, 1) if complete else (1, 1, 1, 0.2),
187                text=ach.display_name,
188                size=(0, 0),
189                h_align='left',
190                v_align='center',
191            )
192
193            bui.textwidget(
194                parent=self._subcontainer,
195                position=(sub_width * 0.19, sub_height - 19 - incr * i - 10),
196                maxwidth=sub_width * 0.62,
197                scale=0.4,
198                flatness=1.0,
199                shadow=0.0,
200                color=(0.83, 0.8, 0.85) if complete else (0.8, 0.8, 0.8, 0.2),
201                text=(
202                    ach.description_full_complete
203                    if complete
204                    else ach.description_full
205                ),
206                size=(0, 0),
207                h_align='left',
208                v_align='center',
209            )
210
211            pts = ach.power_ranking_value
212            bui.textwidget(
213                parent=self._subcontainer,
214                position=(sub_width * 0.92, sub_height - 20 - incr * i),
215                maxwidth=sub_width * 0.15,
216                color=(0.7, 0.8, 1.0) if complete else (0.9, 0.9, 1.0, 0.3),
217                flatness=1.0,
218                shadow=0.0,
219                scale=0.6,
220                text=bui.Lstr(
221                    resource=pts_rsrc, subs=[('${NUMBER}', str(pts))]
222                ),
223                size=(0, 0),
224                h_align='center',
225                v_align='center',
226            )
227            if complete:
228                total_pts += pts
229
230        bui.textwidget(
231            parent=self._subcontainer,
232            position=(
233                sub_width * 1.0,
234                sub_height - 20 - incr * len(achievements),
235            ),
236            maxwidth=sub_width * 0.5,
237            scale=0.7,
238            color=(0.7, 0.8, 1.0),
239            flatness=1.0,
240            shadow=0.0,
241            text=bui.Lstr(
242                value='${A} ${B}',
243                subs=[
244                    ('${A}', bui.Lstr(resource='coopSelectWindow.totalText')),
245                    (
246                        '${B}',
247                        bui.Lstr(
248                            resource=eq_rsrc,
249                            subs=[('${NUMBER}', str(total_pts))],
250                        ),
251                    ),
252                ],
253            ),
254            size=(0, 0),
255            h_align='right',
256            v_align='center',
257        )
258
259    @override
260    def get_main_window_state(self) -> bui.MainWindowState:
261        # Support recreating our window for back/refresh purposes.
262        cls = type(self)
263        return bui.BasicMainWindowState(
264            create_call=lambda transition, origin_widget: cls(
265                transition=transition, origin_widget=origin_widget
266            )
267        )

Popup window to view achievements.

AchievementsWindow( transition: str | None = 'in_right', origin_widget: _bauiv1.Widget | None = None)
 16    def __init__(
 17        self,
 18        transition: str | None = 'in_right',
 19        origin_widget: bui.Widget | None = None,
 20    ):
 21        # pylint: disable=too-many-locals
 22        assert bui.app.classic is not None
 23        uiscale = bui.app.ui_v1.uiscale
 24        self._width = 600 if uiscale is bui.UIScale.SMALL else 450
 25        self._height = (
 26            380
 27            if uiscale is bui.UIScale.SMALL
 28            else 370 if uiscale is bui.UIScale.MEDIUM else 450
 29        )
 30        yoffs = -45 if uiscale is bui.UIScale.SMALL else 0
 31
 32        super().__init__(
 33            root_widget=bui.containerwidget(
 34                size=(self._width, self._height),
 35                toolbar_visibility=(
 36                    'menu_minimal'
 37                    if uiscale is bui.UIScale.SMALL
 38                    else 'menu_full'
 39                ),
 40                scale=(
 41                    2.3
 42                    if uiscale is bui.UIScale.SMALL
 43                    else 1.65 if uiscale is bui.UIScale.MEDIUM else 1.23
 44                ),
 45                stack_offset=(
 46                    (0, 0)
 47                    if uiscale is bui.UIScale.SMALL
 48                    else (0, 0) if uiscale is bui.UIScale.MEDIUM else (0, 0)
 49                ),
 50            ),
 51            transition=transition,
 52            origin_widget=origin_widget,
 53        )
 54
 55        if uiscale is bui.UIScale.SMALL:
 56            bui.containerwidget(
 57                edit=self._root_widget, on_cancel_call=self.main_window_back
 58            )
 59            self._back_button = None
 60        else:
 61            self._back_button = bui.buttonwidget(
 62                parent=self._root_widget,
 63                autoselect=True,
 64                position=(50, self._height - 38 + yoffs),
 65                size=(60, 60),
 66                scale=0.6,
 67                label=bui.charstr(bui.SpecialChar.BACK),
 68                button_type='backSmall',
 69                on_activate_call=self.main_window_back,
 70            )
 71            bui.containerwidget(
 72                edit=self._root_widget, cancel_button=self._back_button
 73            )
 74
 75        achievements = bui.app.classic.ach.achievements
 76        num_complete = len([a for a in achievements if a.complete])
 77
 78        txt_final = bui.Lstr(
 79            resource='accountSettingsWindow.achievementProgressText',
 80            subs=[
 81                ('${COUNT}', str(num_complete)),
 82                ('${TOTAL}', str(len(achievements))),
 83            ],
 84        )
 85        self._title_text = bui.textwidget(
 86            parent=self._root_widget,
 87            position=(
 88                self._width * 0.5,
 89                self._height
 90                - (27 if uiscale is bui.UIScale.SMALL else 20)
 91                + yoffs,
 92            ),
 93            size=(0, 0),
 94            h_align='center',
 95            v_align='center',
 96            scale=0.6,
 97            text=txt_final,
 98            maxwidth=200,
 99            color=bui.app.ui_v1.title_color,
100        )
101
102        self._scrollwidget = bui.scrollwidget(
103            parent=self._root_widget,
104            size=(
105                self._width - 60,
106                self._height - (150 if uiscale is bui.UIScale.SMALL else 70),
107            ),
108            position=(
109                30,
110                (110 if uiscale is bui.UIScale.SMALL else 30) + yoffs,
111            ),
112            capture_arrows=True,
113            simple_culling_v=10,
114        )
115        bui.widget(edit=self._scrollwidget, autoselect=True)
116        if uiscale is bui.UIScale.SMALL:
117            bui.widget(
118                edit=self._scrollwidget,
119                left_widget=bui.get_special_widget('back_button'),
120            )
121
122        bui.containerwidget(
123            edit=self._root_widget, cancel_button=self._back_button
124        )
125
126        incr = 36
127        sub_width = self._width - 90
128        sub_height = 40 + len(achievements) * incr
129
130        eq_rsrc = 'coopSelectWindow.powerRankingPointsEqualsText'
131        pts_rsrc = 'coopSelectWindow.powerRankingPointsText'
132
133        self._subcontainer = bui.containerwidget(
134            parent=self._scrollwidget,
135            size=(sub_width, sub_height),
136            background=False,
137        )
138
139        total_pts = 0
140        for i, ach in enumerate(achievements):
141            complete = ach.complete
142            bui.textwidget(
143                parent=self._subcontainer,
144                position=(sub_width * 0.08 - 5, sub_height - 20 - incr * i),
145                maxwidth=20,
146                scale=0.5,
147                color=(0.6, 0.6, 0.7) if complete else (0.6, 0.6, 0.7, 0.2),
148                flatness=1.0,
149                shadow=0.0,
150                text=str(i + 1),
151                size=(0, 0),
152                h_align='right',
153                v_align='center',
154            )
155
156            bui.imagewidget(
157                parent=self._subcontainer,
158                position=(
159                    (sub_width * 0.10 + 1, sub_height - 20 - incr * i - 9)
160                    if complete
161                    else (sub_width * 0.10 - 4, sub_height - 20 - incr * i - 14)
162                ),
163                size=(18, 18) if complete else (27, 27),
164                opacity=1.0 if complete else 0.3,
165                color=ach.get_icon_color(complete)[:3],
166                texture=ach.get_icon_ui_texture(complete),
167            )
168            if complete:
169                bui.imagewidget(
170                    parent=self._subcontainer,
171                    position=(
172                        sub_width * 0.10 - 4,
173                        sub_height - 25 - incr * i - 9,
174                    ),
175                    size=(28, 28),
176                    color=(2, 1.4, 0),
177                    texture=bui.gettexture('achievementOutline'),
178                )
179            bui.textwidget(
180                parent=self._subcontainer,
181                position=(sub_width * 0.19, sub_height - 19 - incr * i + 3),
182                maxwidth=sub_width * 0.62,
183                scale=0.6,
184                flatness=1.0,
185                shadow=0.0,
186                color=(1, 1, 1) if complete else (1, 1, 1, 0.2),
187                text=ach.display_name,
188                size=(0, 0),
189                h_align='left',
190                v_align='center',
191            )
192
193            bui.textwidget(
194                parent=self._subcontainer,
195                position=(sub_width * 0.19, sub_height - 19 - incr * i - 10),
196                maxwidth=sub_width * 0.62,
197                scale=0.4,
198                flatness=1.0,
199                shadow=0.0,
200                color=(0.83, 0.8, 0.85) if complete else (0.8, 0.8, 0.8, 0.2),
201                text=(
202                    ach.description_full_complete
203                    if complete
204                    else ach.description_full
205                ),
206                size=(0, 0),
207                h_align='left',
208                v_align='center',
209            )
210
211            pts = ach.power_ranking_value
212            bui.textwidget(
213                parent=self._subcontainer,
214                position=(sub_width * 0.92, sub_height - 20 - incr * i),
215                maxwidth=sub_width * 0.15,
216                color=(0.7, 0.8, 1.0) if complete else (0.9, 0.9, 1.0, 0.3),
217                flatness=1.0,
218                shadow=0.0,
219                scale=0.6,
220                text=bui.Lstr(
221                    resource=pts_rsrc, subs=[('${NUMBER}', str(pts))]
222                ),
223                size=(0, 0),
224                h_align='center',
225                v_align='center',
226            )
227            if complete:
228                total_pts += pts
229
230        bui.textwidget(
231            parent=self._subcontainer,
232            position=(
233                sub_width * 1.0,
234                sub_height - 20 - incr * len(achievements),
235            ),
236            maxwidth=sub_width * 0.5,
237            scale=0.7,
238            color=(0.7, 0.8, 1.0),
239            flatness=1.0,
240            shadow=0.0,
241            text=bui.Lstr(
242                value='${A} ${B}',
243                subs=[
244                    ('${A}', bui.Lstr(resource='coopSelectWindow.totalText')),
245                    (
246                        '${B}',
247                        bui.Lstr(
248                            resource=eq_rsrc,
249                            subs=[('${NUMBER}', str(total_pts))],
250                        ),
251                    ),
252                ],
253            ),
254            size=(0, 0),
255            h_align='right',
256            v_align='center',
257        )

Create a MainWindow given a root widget and transition info.

Automatically handles in and out transitions on the provided widget, so there is no need to set transitions when creating it.

@override
def get_main_window_state(self) -> bauiv1.MainWindowState:
259    @override
260    def get_main_window_state(self) -> bui.MainWindowState:
261        # Support recreating our window for back/refresh purposes.
262        cls = type(self)
263        return bui.BasicMainWindowState(
264            create_call=lambda transition, origin_widget: cls(
265                transition=transition, origin_widget=origin_widget
266            )
267        )

Return a WindowState to recreate this window, if supported.

Inherited Members
bauiv1._uitypes.MainWindow
main_window_back_state
main_window_is_top_level
main_window_is_auxiliary
main_window_close
main_window_has_control
main_window_back
main_window_replace
on_main_window_close
bauiv1._uitypes.Window
get_root_widget