class ScreenMgr(ScreenManager): """Custom ScreenManager providing callbacks for switching screens. """ transition = FadeTransition() def __init__(self, media): super(ScreenMgr, self).__init__() self.overviewScreen = SideBarScreen("Overview", Overview(media)) self.explorerScreen = SideBarScreen("Explorer", Explorer(media)) self.stage = Stage(media) self.stageScreen = SideBarScreen("Stage", self.stage) self.addScreens(self.overviewScreen, self.stageScreen, self.explorerScreen) def addScreens(self, *screens): """Adds the given screens and populates the sidebars respectively. """ for scrn in screens: self.add_widget(scrn) scrn.setupActions((self.setCurrentScreen, s) for s in screens) def setCurrentScreen(self, screen, *args): """Displays the given screen. Uses args in definition to handle the incoming btn instance. """ self.current = screen.name def showMediaObject(self, mediaObj, *args): """Callback for any buttons and a like requesting a mediaObject to be shown on the stage. """ Logger.info("Requested MediaObject {0}".format(mediaObj)) self.setCurrentScreen(self.stageScreen) self.stage.show(mediaObj)
def __init__(self, media): super(ScreenMgr, self).__init__() self.overviewScreen = SideBarScreen("Overview", Overview(media)) self.explorerScreen = SideBarScreen("Explorer", Explorer(media)) self.stage = Stage(media) self.stageScreen = SideBarScreen("Stage", self.stage) self.addScreens(self.overviewScreen, self.stageScreen, self.explorerScreen)