~ubuntu-branches/ubuntu/gutsy/blender/gutsy-security

« back to all changes in this revision

Viewing changes to source/blender/python/api2_2x/doc/Text.py

  • Committer: Bazaar Package Importer
  • Author(s): Florian Ernst
  • Date: 2007-05-17 11:47:59 UTC
  • mfrom: (1.2.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20070517114759-yp4ybrnhp2u7pk66
Tags: 2.44-1
* New upstream release.
* Drop debian/patches/01_64bits_stupidity, not needed anymore: as of this
  version blender is 64 bits safe again. Adjust README.Debian accordingly.

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
This module provides access to B{Text} objects in Blender.
10
10
 
11
11
Example::
12
 
  import Blender
13
 
  from Blender import Text
14
 
  #
15
 
  txt = Text.New("MyText")          # create a new Text object
16
 
  print Text.Get()                  # current list of Texts in Blender
17
 
  txt.write("Appending some ")      # appending text
18
 
  txt.write("text to my\\n")         # '\\n' inserts new-line markers
19
 
  txt.write("text buffer.")
20
 
  print txt.asLines()               # retrieving the buffer as a list of lines
21
 
  Text.unlink(txt)                  # removing a Text object
 
12
        import Blender
 
13
        from Blender import Text
 
14
        #
 
15
        txt = Text.New("MyText")          # create a new Text object
 
16
        print Text.Get()                  # current list of Texts in Blender
 
17
        txt.write("Appending some ")      # appending text
 
18
        txt.write("text to my\\n")         # '\\n' inserts new-line markers
 
19
        txt.write("text buffer.")
 
20
        print txt.asLines()               # retrieving the buffer as a list of lines
 
21
        Text.unlink(txt)                  # removing a Text object
22
22
"""
23
23
 
24
24
def New (name = None, follow_cursor = 0):
25
 
  """
26
 
  Create a new Text object.
27
 
  @type name: string
28
 
  @param name: The Text name.
29
 
  @type follow_cursor: int
30
 
  @param follow_cursor: The text follow flag: if 1, the text display always
31
 
      follows the cursor.
32
 
  @rtype: Blender Text
33
 
  @return: The created Text Data object.
34
 
  """
 
25
        """
 
26
        Create a new Text object.
 
27
        @type name: string
 
28
        @param name: The Text name.
 
29
        @type follow_cursor: int
 
30
        @param follow_cursor: The text follow flag: if 1, the text display always
 
31
                        follows the cursor.
 
32
        @rtype: Blender Text
 
33
        @return: The created Text Data object.
 
34
        """
35
35
 
36
36
def Get (name = None):
37
 
  """
38
 
  Get the Text object(s) from Blender.
39
 
  @type name: string
40
 
  @param name: The name of the Text object.
41
 
  @rtype: Blender Text or a list of Blender Texts
42
 
  @return: It depends on the 'name' parameter:
43
 
      - (name): The Text object with the given name;
44
 
      - ():     A list with all Text objects in the current scene.
45
 
  """
 
37
        """
 
38
        Get the Text object(s) from Blender.
 
39
        @type name: string
 
40
        @param name: The name of the Text object.
 
41
        @rtype: Blender Text or a list of Blender Texts
 
42
        @return: It depends on the 'name' parameter:
 
43
                        - (name): The Text object with the given name;
 
44
                        - ():     A list with all Text objects in the current scene.
 
45
        """
46
46
 
47
47
def Load (filename):
48
 
  """
49
 
  Load a file into a Blender Text object.
50
 
  @type filename: string
51
 
  @param filename:  The name of the file to load.
52
 
  @rtype: Blender Text
53
 
  @return: A Text object with the contents of the loaded file.
54
 
  """
 
48
        """
 
49
        Load a file into a Blender Text object.
 
50
        @type filename: string
 
51
        @param filename:  The name of the file to load.
 
52
        @rtype: Blender Text
 
53
        @return: A Text object with the contents of the loaded file.
 
54
        """
55
55
 
56
56
def unlink(textobj):
57
 
  """
58
 
  Unlink (remove) the given Text object from Blender.
59
 
  @type textobj: Blender Text
60
 
  @param textobj: The Text object to be deleted.
61
 
  """
 
57
        """
 
58
        Unlink (remove) the given Text object from Blender.
 
59
        @type textobj: Blender Text
 
60
        @param textobj: The Text object to be deleted.
 
61
        """
62
62
 
63
63
class Text:
64
 
  """
65
 
  The Text object
66
 
  ===============
67
 
    This object gives access to Texts in Blender.
68
 
  @ivar name: The Text name.
69
 
  @ivar filename: The filename of the file loaded into this Text.
70
 
  @ivar mode: The follow_mode flag: if 1 it is 'on'; if 0, 'off'.
71
 
  @ivar nlines: The number of lines in this Text.
72
 
  """
73
 
 
74
 
  def getName():
75
 
    """
76
 
    Get the name of this Text object.
77
 
    @rtype: string
78
 
    """
79
 
 
80
 
  def setName(name):
81
 
    """
82
 
    Set the name of this Text object.
83
 
    @type name: string
84
 
    @param name: The new name.
85
 
    """
86
 
 
87
 
  def getFilename():
88
 
    """
89
 
    Get the filename of the file loaded into this Text object.
90
 
    @rtype: string
91
 
    """
92
 
 
93
 
  def getNLines():
94
 
    """
95
 
    Get the number of lines in this Text buffer.
96
 
    @rtype: int
97
 
    """
98
 
 
99
 
  def clear():
100
 
    """
101
 
    Clear this Text object: its buffer becomes empty.
102
 
    """
103
 
 
104
 
  def set(attribute, value):
105
 
    """
106
 
    Set this Text's attributes.
107
 
    @type attribute: string
108
 
    @param attribute: The attribute to change:
109
 
        currently, 'follow_cursor' is the only one available.  It can be
110
 
        turned 'on' with value = 1 and 'off' with value = 0.
111
 
    @type value: int
112
 
    @param value: The new attribute value. 
113
 
    """
114
 
 
115
 
  def write(data):
116
 
    """
117
 
    Append a string to this Text buffer.
118
 
    @type data: string
119
 
    @param data:  The string to append to the text buffer.
120
 
    """
121
 
 
122
 
  def asLines():
123
 
    """
124
 
    Retrieve the contents of this Text buffer as a list of strings.
125
 
    @rtype: list of strings
126
 
    @return:  A list of strings, one for each line in the buffer
127
 
    """
 
64
        """
 
65
        The Text object
 
66
        ===============
 
67
                This object gives access to Texts in Blender.
 
68
        @ivar filename: The filename of the file loaded into this Text.
 
69
        @ivar mode: The follow_mode flag: if 1 it is 'on'; if 0, 'off'.
 
70
        @ivar nlines: The number of lines in this Text.
 
71
        """
 
72
 
 
73
        def getName():
 
74
                """
 
75
                Get the name of this Text object.
 
76
                @rtype: string
 
77
                """
 
78
 
 
79
        def setName(name):
 
80
                """
 
81
                Set the name of this Text object.
 
82
                @type name: string
 
83
                @param name: The new name.
 
84
                """
 
85
 
 
86
        def getFilename():
 
87
                """
 
88
                Get the filename of the file loaded into this Text object.
 
89
                @rtype: string
 
90
                """
 
91
 
 
92
        def getNLines():
 
93
                """
 
94
                Get the number of lines in this Text buffer.
 
95
                @rtype: int
 
96
                """
 
97
 
 
98
        def clear():
 
99
                """
 
100
                Clear this Text object: its buffer becomes empty.
 
101
                """
 
102
 
 
103
        def set(attribute, value):
 
104
                """
 
105
                Set this Text's attributes.
 
106
                @type attribute: string
 
107
                @param attribute: The attribute to change:
 
108
                        currently, 'follow_cursor' is the only one available.  It can be
 
109
                        turned 'on' with value = 1 and 'off' with value = 0.
 
110
                @type value: int
 
111
                @param value: The new attribute value. 
 
112
                """
 
113
 
 
114
        def write(data):
 
115
                """
 
116
                Append a string to this Text buffer.
 
117
                @type data: string
 
118
                @param data:  The string to append to the text buffer.
 
119
                """
 
120
 
 
121
        def asLines():
 
122
                """
 
123
                Retrieve the contents of this Text buffer as a list of strings.
 
124
                @rtype: list of strings
 
125
                @return:  A list of strings, one for each line in the buffer
 
126
                """
 
127
 
 
128
import id_generics
 
129
Text.__doc__ += id_generics.attributes
 
 
b'\\ No newline at end of file'