diff --git a/direct/src/gui/Button.py b/direct/src/gui/Button.py index 645e34532b..044ed15ca0 100644 --- a/direct/src/gui/Button.py +++ b/direct/src/gui/Button.py @@ -1,5 +1,6 @@ from ShowBaseGlobal import * from DirectObject import * +from GuiGlobals import * import GuiManager import GuiLabel import GuiButton @@ -8,7 +9,7 @@ guiMgr = GuiManager.GuiManager.getPtr(base.win, base.mak.node(), base.renderGui. class Button(DirectObject): - def __init__(self, name, label=None, font=interfaceFont): + def __init__(self, name, label=None, font=getDefaultFont()): self.name = name # if no label given, use the button name if (label == None): diff --git a/direct/src/gui/ForceAcknowledge.py b/direct/src/gui/ForceAcknowledge.py index 8f54878fb5..c533032194 100644 --- a/direct/src/gui/ForceAcknowledge.py +++ b/direct/src/gui/ForceAcknowledge.py @@ -93,3 +93,10 @@ class ForceAcknowledge(StateData.StateData): def __handleOk(self): self.doneStatus = "ok" messenger.send(self.doneEvent) + + + + + + + diff --git a/direct/src/gui/GuiGlobals.py b/direct/src/gui/GuiGlobals.py new file mode 100644 index 0000000000..5633a1d5c7 --- /dev/null +++ b/direct/src/gui/GuiGlobals.py @@ -0,0 +1,12 @@ +# GuiGlobals.py : global info for the gui package + +from ShowBaseGlobal import * + +font = loader.loadModelNode("models/fonts/ttf-comic") + +def getDefaultFont(): + return font + +def setDefaultFont(newFont): + global font + font = newFont diff --git a/direct/src/gui/OnscreenText.py b/direct/src/gui/OnscreenText.py index 20dee6e96d..58009083b9 100644 --- a/direct/src/gui/OnscreenText.py +++ b/direct/src/gui/OnscreenText.py @@ -1,13 +1,13 @@ """OnscreenText module: contains the OnscreenText class""" from PandaObject import * +from GuiGlobals import * class OnscreenText(PandaObject, NodePath): - Font = loader.loadModelOnce("phase_3/models/fonts/ttf-comic").node() - - def __init__(self, string, x=0.0, y=0.0): - """__init__(self, string, float=0.0, float=0.0) + def __init__(self, string, x=0.0, y=0.0, font=getDefaultFont()): + """__init__(self, string, float=0.0, float=0.0, + font=GuiGlobals.getDefaultFont()) Make a text node from string, put it into the 2d sg and place it at x, y in screen space """ @@ -24,7 +24,7 @@ class OnscreenText(PandaObject, NodePath): textNode.setCardAsMargin(0.1, 0.1, 0.1, 0.1) # textNode.setFrameColor(0.0, 0.0, 0.0, 1.0) # textNode.setFrameAsMargin(0.15, 0.15, 0.15, 0.15) - textNode.setFont(OnscreenText.Font) + textNode.setFont(font) textNode.setText(string) textNode.clearCardBorder() textNode.clearFrame() diff --git a/direct/src/gui/ScrollingLabel.py b/direct/src/gui/ScrollingLabel.py index 5837b66b78..cc40d20018 100644 --- a/direct/src/gui/ScrollingLabel.py +++ b/direct/src/gui/ScrollingLabel.py @@ -1,4 +1,5 @@ from ShowBaseGlobal import * +from GuiGlobals import * import PandaObject import Frame import GuiFrame @@ -11,7 +12,7 @@ import Sign class ScrollingLabel(PandaObject.PandaObject): # special methods - def __init__(self, name, itemList, font=interfaceFont): + def __init__(self, name, itemList, font=getDefaultFont()): self.name = name self.eventName = self.name diff --git a/direct/src/gui/Sign.py b/direct/src/gui/Sign.py index e4a9cbab45..b82be742fb 100644 --- a/direct/src/gui/Sign.py +++ b/direct/src/gui/Sign.py @@ -1,5 +1,6 @@ from ShowBaseGlobal import * from DirectObject import * +from GuiGlobals import * import GuiSign import GuiManager import GuiLabel @@ -8,7 +9,7 @@ guiMgr = GuiManager.GuiManager.getPtr(base.win, base.mak.node(), base.renderGui. class Sign(DirectObject): - def __init__(self, name, label=None, font=interfaceFont): + def __init__(self, name, label=None, font=getDefaultFont()): self.name = name # label in this case means GuiLabel if not label: diff --git a/direct/src/showbase/ShowBaseGlobal.py b/direct/src/showbase/ShowBaseGlobal.py index aea6e51a1a..8642fd7419 100644 --- a/direct/src/showbase/ShowBaseGlobal.py +++ b/direct/src/showbase/ShowBaseGlobal.py @@ -18,7 +18,3 @@ __builtin__.taskMgr = base.taskMgr __builtin__.eventMgr = base.eventMgr __builtin__.messenger = base.messenger __builtin__.config = base.config - -# Pointer to interface font -import ToontownGlobals -__builtin__.interfaceFont = ToontownGlobals.getInterfaceFont()