Пример #1
0
    def _update(self) -> None:
        try:
            t_str = str(_ba.get_account_ticket_count())
        except Exception:
            t_str = '?'
        if self._tickets_text is not None:
            ba.textwidget(edit=self._tickets_text,
                          text=ba.Lstr(
                              resource='getTicketsWindow.youHaveShortText',
                              subs=[('${COUNT}',
                                     ba.charstr(ba.SpecialChar.TICKET) + t_str)
                                    ]))

        # Once we've kicked off an upgrade attempt and all transactions go
        # through, we're done.
        if (self._status == 'upgrading'
                and not _ba.have_outstanding_transactions()):
            self._status = 'exiting'
            ba.containerwidget(edit=self._root_widget, transition='out_right')
            edit_profile_window = self._edit_profile_window()
            if edit_profile_window is None:
                print('profile upgrade transition out:'
                      ' original edit window gone')
                return
            ba.playsound(ba.getsound('gunCocking'))
            edit_profile_window.reload_window()
Пример #2
0
    def _on_cancel(self) -> None:

        # Don't allow canceling for several seconds after poking an enter
        # button if it looks like we're waiting on a purchase or entering
        # the tournament.
        if ((ba.time(ba.TimeType.REAL, ba.TimeFormat.MILLISECONDS) -
             self._last_ticket_press_time < 6000) and
            (_ba.have_outstanding_transactions()
             or _ba.get_purchased(self._purchase_name) or self._entering)):
            ba.playsound(ba.getsound('error'))
            return
        self._transition_out()