Move shticker book buttons up a bit so stats button can fit + add a frame to the left if we add another button.

This commit is contained in:
John 2015-08-29 19:05:44 +03:00
parent 0936ef9c71
commit f6e77208bb

View file

@ -21,8 +21,7 @@ class ShtikerBook(DirectFrame, StateData.StateData):
self.pages = [] self.pages = []
self.pageTabs = [] self.pageTabs = []
self.currPageTabIndex = None self.currPageTabIndex = None
self.pageTabFrame = DirectFrame(parent=self, relief=None, pos=(0.93, 1, 0.575), scale=1.25) self.pageTabFrames = [self.createPageTabFrame(x) for x in (-0.93, 0.93)]
self.pageTabFrame.hide()
self.currPageIndex = None self.currPageIndex = None
self.entered = 0 self.entered = 0
self.safeMode = 0 self.safeMode = 0
@ -48,6 +47,11 @@ class ShtikerBook(DirectFrame, StateData.StateData):
TTLocalizer.EventsPageName, TTLocalizer.EventsPageName,
TTLocalizer.StatPageTitle] TTLocalizer.StatPageTitle]
def createPageTabFrame(self, x):
frame = DirectFrame(parent=self, relief=None, pos=(x, 0, 0.66), scale=1.25)
frame.hide()
return frame
def setSafeMode(self, setting): def setSafeMode(self, setting):
self.safeMode = setting self.safeMode = setting
@ -76,7 +80,8 @@ class ShtikerBook(DirectFrame, StateData.StateData):
self.accept('shtiker-page-done', self.__pageDone) self.accept('shtiker-page-done', self.__pageDone)
self.accept(ToontownGlobals.StickerBookHotkey, self.__close) self.accept(ToontownGlobals.StickerBookHotkey, self.__close)
self.accept(ToontownGlobals.OptionsPageHotkey, self.__close) self.accept(ToontownGlobals.OptionsPageHotkey, self.__close)
self.pageTabFrame.show() for tab in self.pageTabFrames:
tab.show()
self.pages[self.currPageIndex].enter() self.pages[self.currPageIndex].enter()
def exit(self): def exit(self):
@ -106,7 +111,8 @@ class ShtikerBook(DirectFrame, StateData.StateData):
self.hide() self.hide()
self.hideButton() self.hideButton()
cleanupDialog('globalDialog') cleanupDialog('globalDialog')
self.pageTabFrame.hide() for tab in self.pageTabFrames:
tab.hide()
self.ignore('shtiker-page-done') self.ignore('shtiker-page-done')
self.ignore(ToontownGlobals.StickerBookHotkey) self.ignore(ToontownGlobals.StickerBookHotkey)
self.ignore(ToontownGlobals.OptionsPageHotkey) self.ignore(ToontownGlobals.OptionsPageHotkey)
@ -178,7 +184,7 @@ class ShtikerBook(DirectFrame, StateData.StateData):
if base.config.GetBool('want-qa-regression', 0): if base.config.GetBool('want-qa-regression', 0):
self.notify.info('QA-REGRESSION: SHTICKERBOOK: Browse tabs %s' % page.pageName) self.notify.info('QA-REGRESSION: SHTICKERBOOK: Browse tabs %s' % page.pageName)
yOffset = 0.07 * pageIndex yOffset = 0.07 * (pageIndex % 16)
iconGeom = None iconGeom = None
iconImage = None iconImage = None
iconScale = 1 iconScale = 1
@ -257,13 +263,14 @@ class ShtikerBook(DirectFrame, StateData.StateData):
iconModels.detachNode() iconModels.detachNode()
if pageName == TTLocalizer.OptionsPageTitle: if pageName == TTLocalizer.OptionsPageTitle:
pageName = TTLocalizer.OptionsTabTitle pageName = TTLocalizer.OptionsTabTitle
pageTab = DirectButton(parent=self.pageTabFrame, relief=DGG.RAISED, frameSize=(-0.575, rightSide = pageIndex < 16
pageTab = DirectButton(parent=self.pageTabFrames[rightSide], relief=DGG.RAISED, frameSize=(-0.575,
0.575, 0.575,
-0.575, -0.575,
0.575), borderWidth=(0.05, 0.05), text=('', 0.575), borderWidth=(0.05, 0.05), text=('',
'', '',
pageName, pageName,
''), text_align=TextNode.ALeft, text_pos=(1, -0.2), text_scale=TTLocalizer.SBpageTab, text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1), image=iconImage, image_scale=iconScale, geom=iconGeom, geom_scale=iconScale, geom_color=iconColor, pos=(0, 0, -yOffset), scale=0.06, command=buttonPressedCommand, extraArgs=extraArgs) ''), text_align=TextNode.ALeft, text_pos=(1 if rightSide else -4, -0.2), text_scale=TTLocalizer.SBpageTab, text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1), image=iconImage, image_scale=iconScale, geom=iconGeom, geom_scale=iconScale, geom_color=iconColor, pos=(0, 0, -yOffset), scale=0.06, command=buttonPressedCommand, extraArgs=extraArgs)
self.pageTabs.insert(pageIndex, pageTab) self.pageTabs.insert(pageIndex, pageTab)
return return