Sfoglia il codice sorgente

added clearText() and appendText()

Dave Schuyler 22 anni fa
parent
commit
e06875f537
1 ha cambiato i file con 7 aggiunte e 10 eliminazioni
  1. 7 10
      direct/src/gui/OnscreenText.py

+ 7 - 10
direct/src/gui/OnscreenText.py

@@ -32,8 +32,7 @@ class OnscreenText(PandaObject, NodePath):
                  parent = None,
                  parent = None,
                  sort = 0,
                  sort = 0,
                  mayChange = 0):
                  mayChange = 0):
-        """__init__(self, ...)
-
+        """
         Make a text node from string, put it into the 2d sg and set it
         Make a text node from string, put it into the 2d sg and set it
         up with all the indicated parameters.
         up with all the indicated parameters.
 
 
@@ -88,7 +87,6 @@ class OnscreenText(PandaObject, NodePath):
           mayChange: pass true if the text or its properties may need
           mayChange: pass true if the text or its properties may need
               to be changed at runtime, false if it is static once
               to be changed at runtime, false if it is static once
               created (which leads to better memory optimization).
               created (which leads to better memory optimization).
-        
         """
         """
         if parent == None:
         if parent == None:
             parent = aspect2d
             parent = aspect2d
@@ -110,7 +108,6 @@ class OnscreenText(PandaObject, NodePath):
             frame = frame or (0, 0, 0, 0)
             frame = frame or (0, 0, 0, 0)
             if align == None:
             if align == None:
                 align = TextNode.ACenter
                 align = TextNode.ACenter
-
         elif style == ScreenTitle:
         elif style == ScreenTitle:
             scale = scale or 0.15
             scale = scale or 0.15
             fg = fg or (1, 0.2, 0.2, 1)
             fg = fg or (1, 0.2, 0.2, 1)
@@ -119,7 +116,6 @@ class OnscreenText(PandaObject, NodePath):
             frame = frame or (0, 0, 0, 0)
             frame = frame or (0, 0, 0, 0)
             if align == None:
             if align == None:
                 align = TextNode.ACenter
                 align = TextNode.ACenter
-
         elif style == ScreenPrompt:
         elif style == ScreenPrompt:
             scale = scale or 0.1
             scale = scale or 0.1
             fg = fg or (1, 1, 0, 1)
             fg = fg or (1, 1, 0, 1)
@@ -128,7 +124,6 @@ class OnscreenText(PandaObject, NodePath):
             frame = frame or (0, 0, 0, 0)
             frame = frame or (0, 0, 0, 0)
             if align == None:
             if align == None:
                 align = TextNode.ACenter
                 align = TextNode.ACenter
-
         elif style == NameConfirm:
         elif style == NameConfirm:
             scale = scale or 0.1
             scale = scale or 0.1
             fg = fg or (0, 1, 0, 1)
             fg = fg or (0, 1, 0, 1)
@@ -137,7 +132,6 @@ class OnscreenText(PandaObject, NodePath):
             frame = frame or (0, 0, 0, 0)
             frame = frame or (0, 0, 0, 0)
             if align == None:
             if align == None:
                 align = TextNode.ACenter
                 align = TextNode.ACenter
-
         elif style == BlackOnWhite:
         elif style == BlackOnWhite:
             scale = scale or 0.1
             scale = scale or 0.1
             fg = fg or (0, 0, 0, 1)
             fg = fg or (0, 0, 0, 1)
@@ -146,7 +140,6 @@ class OnscreenText(PandaObject, NodePath):
             frame = frame or (0, 0, 0, 0)
             frame = frame or (0, 0, 0, 0)
             if align == None:
             if align == None:
                 align = TextNode.ACenter
                 align = TextNode.ACenter
-
         else:
         else:
             raise ValueError
             raise ValueError
 
 
@@ -223,8 +216,6 @@ class OnscreenText(PandaObject, NodePath):
         self.assign(parent.attachNewNode(self.textNode, sort))
         self.assign(parent.attachNewNode(self.textNode, sort))
     
     
     def cleanup(self):
     def cleanup(self):
-        """cleanup(self)
-        """
         self.textNode = None
         self.textNode = None
         if self.isClean == 0:
         if self.isClean == 0:
             self.isClean = 1
             self.isClean = 1
@@ -256,9 +247,15 @@ class OnscreenText(PandaObject, NodePath):
     def getFont(self):
     def getFont(self):
         return self.textNode.getFont()
         return self.textNode.getFont()
 
 
+    def clearText(self):
+        self.textNode.clearText()
+
     def setText(self, text):
     def setText(self, text):
         self.textNode.setText(text)
         self.textNode.setText(text)
 
 
+    def appendText(self, text):
+        self.textNode.appendText(text)
+
     def getText(self):
     def getText(self):
         return self.textNode.getText()
         return self.textNode.getText()