Пример #1
0
 def _edit_playlist(self) -> None:
     # pylint: disable=cyclic-import
     from ba.internal import have_pro_options
     from bastd.ui.playlist import editcontroller
     from bastd.ui import purchase
     if not have_pro_options():
         purchase.PurchaseWindow(items=['pro'])
         return
     if self._selected_playlist_name is None:
         return
     if self._selected_playlist_name == '__default__':
         ba.playsound(ba.getsound('error'))
         ba.screenmessage(ba.Lstr(resource=self._r +
                                  '.cantEditDefaultText'))
         return
     self._save_playlist_selection()
     editcontroller.PlaylistEditController(
         existing_playlist_name=self._selected_playlist_name,
         sessiontype=self._sessiontype)
     ba.containerwidget(edit=self._root_widget, transition='out_left')
Пример #2
0
    def _new_playlist(self) -> None:
        # pylint: disable=cyclic-import
        from ba.internal import have_pro_options
        from bastd.ui.playlist import editcontroller
        from bastd.ui import purchase
        if not have_pro_options():
            purchase.PurchaseWindow(items=['pro'])
            return

        # Clamp at our max playlist number.
        if len(ba.app.config[self._config_name_full]) > self._max_playlists:
            ba.screenmessage(
                ba.Lstr(translate=('serverResponses',
                                   'Max number of playlists reached.')),
                color=(1, 0, 0))
            ba.playsound(ba.getsound('error'))
            return

        # In case they cancel so we can return to this state.
        self._save_playlist_selection()

        # Kick off the edit UI.
        editcontroller.PlaylistEditController(sessiontype=self._sessiontype)
        ba.containerwidget(edit=self._root_widget, transition='out_left')