Browse Source

*** empty log message ***

gregw 25 years ago
parent
commit
06256def02

+ 2 - 1
direct/src/gui/Button.py

@@ -1,5 +1,6 @@
 from ShowBaseGlobal import *
 from ShowBaseGlobal import *
 from DirectObject import *
 from DirectObject import *
+from GuiGlobals import *
 import GuiManager
 import GuiManager
 import GuiLabel
 import GuiLabel
 import GuiButton
 import GuiButton
@@ -8,7 +9,7 @@ guiMgr = GuiManager.GuiManager.getPtr(base.win, base.mak.node(), base.renderGui.
 
 
 class Button(DirectObject):
 class Button(DirectObject):
 
 
-    def __init__(self, name, label=None, font=interfaceFont):
+    def __init__(self, name, label=None, font=getDefaultFont()):
         self.name = name
         self.name = name
         # if no label given, use the button name
         # if no label given, use the button name
         if (label == None):
         if (label == None):

+ 7 - 0
direct/src/gui/ForceAcknowledge.py

@@ -93,3 +93,10 @@ class ForceAcknowledge(StateData.StateData):
     def __handleOk(self):
     def __handleOk(self):
 	self.doneStatus = "ok"	
 	self.doneStatus = "ok"	
 	messenger.send(self.doneEvent)
 	messenger.send(self.doneEvent)
+
+
+
+
+
+
+

+ 12 - 0
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

+ 5 - 5
direct/src/gui/OnscreenText.py

@@ -1,13 +1,13 @@
 """OnscreenText module: contains the OnscreenText class"""
 """OnscreenText module: contains the OnscreenText class"""
 
 
 from PandaObject import *
 from PandaObject import *
+from GuiGlobals import *
 
 
 class OnscreenText(PandaObject, NodePath):
 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
         Make a text node from string, put it into the 2d sg and place
         it at x, y in screen space
         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.setCardAsMargin(0.1, 0.1, 0.1, 0.1)
         # textNode.setFrameColor(0.0, 0.0, 0.0, 1.0)
         # textNode.setFrameColor(0.0, 0.0, 0.0, 1.0)
         # textNode.setFrameAsMargin(0.15, 0.15, 0.15, 0.15)
         # textNode.setFrameAsMargin(0.15, 0.15, 0.15, 0.15)
-        textNode.setFont(OnscreenText.Font)
+        textNode.setFont(font)
         textNode.setText(string)
         textNode.setText(string)
         textNode.clearCardBorder()
         textNode.clearCardBorder()
         textNode.clearFrame()
         textNode.clearFrame()

+ 2 - 1
direct/src/gui/ScrollingLabel.py

@@ -1,4 +1,5 @@
 from ShowBaseGlobal import *
 from ShowBaseGlobal import *
+from GuiGlobals import *
 import PandaObject
 import PandaObject
 import Frame
 import Frame
 import GuiFrame
 import GuiFrame
@@ -11,7 +12,7 @@ import Sign
 class ScrollingLabel(PandaObject.PandaObject):
 class ScrollingLabel(PandaObject.PandaObject):
 
 
     # special methods
     # special methods
-    def __init__(self, name, itemList, font=interfaceFont):
+    def __init__(self, name, itemList, font=getDefaultFont()):
 
 
         self.name = name
         self.name = name
         self.eventName = self.name
         self.eventName = self.name

+ 2 - 1
direct/src/gui/Sign.py

@@ -1,5 +1,6 @@
 from ShowBaseGlobal import *
 from ShowBaseGlobal import *
 from DirectObject import *
 from DirectObject import *
+from GuiGlobals import *
 import GuiSign
 import GuiSign
 import GuiManager
 import GuiManager
 import GuiLabel
 import GuiLabel
@@ -8,7 +9,7 @@ guiMgr = GuiManager.GuiManager.getPtr(base.win, base.mak.node(), base.renderGui.
 
 
 class Sign(DirectObject):
 class Sign(DirectObject):
 
 
-    def __init__(self, name, label=None, font=interfaceFont):
+    def __init__(self, name, label=None, font=getDefaultFont()):
         self.name = name
         self.name = name
         # label in this case means GuiLabel
         # label in this case means GuiLabel
         if not label:
         if not label:

+ 0 - 4
direct/src/showbase/ShowBaseGlobal.py

@@ -18,7 +18,3 @@ __builtin__.taskMgr = base.taskMgr
 __builtin__.eventMgr = base.eventMgr
 __builtin__.eventMgr = base.eventMgr
 __builtin__.messenger = base.messenger
 __builtin__.messenger = base.messenger
 __builtin__.config = base.config
 __builtin__.config = base.config
-
-# Pointer to interface font
-import ToontownGlobals
-__builtin__.interfaceFont = ToontownGlobals.getInterfaceFont()