示例#1
0
 def __init__(self, root_node):
   Thing.__init__(self)
   
   self.root_node = root_node
   
   self.x_offset = 0.0
   self.y_offset = 0.0
   self.width = 1.5
   self.height = 1.5
   
   self.cache_drawing_operations = False
   self.cached_render = None
   self.cached_scale  = TheWorld.scale
示例#2
0
 def __init__(self):
   Thing.__init__(self)
   TextEditor.__init__(self, "> ")
   self.cursorindex = 2
   
   self.x = 0.0
   self.y = 0.0
   self.width = 0.2
   self.height = 0.2
   
   fontDescription = pango.FontDescription("Monospace 10")
   self.layout.set_font_description(fontDescription)
   
   self.lock_scale = False
   self.lock_position = True
   
   self.first = True
示例#3
0
 def __init__(self, label, points = 6.0, font = "Comic Sans MS"):
   Thing.__init__(self)
   
   self.width = 1.0
   self.height = 1.0
   self.pixel_width  = 0.0
   self.pixel_height = 0.0
   self.scale_x = 1.0
   self.scale_y = 1.0
   
   self.size_thing_to_content = True
   self.size_content_to_thing = not self.size_thing_to_content
   
   # pango
   font_description = pango.FontDescription(font + " " + str(points))
   self.layout = TheWorld.text_layout
   self.layout.set_font_description(font_description)
   
   self.label = label    
示例#4
0
  def __init__(self, target):
    Thing.__init__(self)

    self.target = target

    # TODO Need a way of making world objects exempt from scaling, rotation and/or translation transforms
    size = 0.25
    self.width = size
    self.height = size
    
    # set & lock position
    self.x = -1.0 + (ClassEditor.num_editors * (size * 1.5)) + (size / 2.0)
    self.y = -1.0 - (size / 2.0)
    self.can_drag = False
    
    # image
    self.svg = rsvg.Handle('resources/classeditor.svg')    

    ClassEditor.num_editors += 1    
示例#5
0
  def __init__(self, target):
    Thing.__init__(self)

    self.target = target
    
    # set & lock position
    self.x = (random() * 2.0) - 1
    self.y = (random() * 2.0) - 1
    
    self.width  = 0.1
    self.height = 0.1
    self.pixel_width  = 0.0
    self.pixel_height = 0.0
    

    # pango
    self.layout = pango.Layout(TheWorld.pango_context)
    fontDescription = pango.FontDescription("Sans 8")
    self.layout.set_font_description(fontDescription)
    self.text = self.target.__class__.__name__ + "\n" + self.target.code
    
    # calc text metrics
    self.recalc_text_size()
示例#6
0
 def __init__(self):
   Thing.__init__(self)