Exemplo n.º 1
0
 def __init__(self, x, y):
   Plato.__init__(self, x, y, 40, 40)
   #self.x = x
   #self.y = y
   #self.width = 40
   #self.height = 40
   #self.rotation = 0.0
   self.padding = 0.0
   
   self.can_drag = True
   
   self.datapoints = {}
   self.numdatapoints = 1000
   
   self.object   = None
   self.variable = None
   
   # ignore workspace scaling, translation and rotation
   self.lock_scale = False
   self.lock_position = False
   self.lock_rotation = False
   
   self.skip_size = 5
   self.skip_count = self.skip_size
   
   self.min = 0
   self.max = 100
Exemplo n.º 2
0
 def __init__(self, x, y, width = 150.0, height = 150.0):
   Plato.__init__(self, x, y, width, height)
   self.buf = None
   self.color = lambda context : context.set_source_rgb(1.0, 1.0, 1.0)
   self.particle_radius = 10.0
   r = 50
   resolution_x = r
   resolution_y = r
   resolution = resolution_x * resolution_y    
   num_particles = 500
   self.field = glug.VectorField(resolution_x, resolution_y, num_particles)
   #self.field.diffusion = 0.01
   #self.field.viscosity = 0.01
   for particle in self.field.particles():
     (particle.position_x, particle.position_y) = \
       (random.randint(self.left, self.right-self.particle_radius), \
        random.randint(self.top, self.bottom-self.particle_radius))
Exemplo n.º 3
0
 def __init__(self, x, y, width = 30.0, height = 30.0):
   Plato.__init__(self, x, y, width, height)
   
   self.color = lambda context : context.set_source_rgb(1.0, 1.0, 1.0)
   
   self.resolution_x = 20
   self.resolution_y = 20
   self.resolution = self.resolution_x * self.resolution_y
   #self.grid = [[0 for col in range(resolution)] for row in range(resolution)]
   self.grid = [0 for cell in range(self.resolution)]
   self.noise_size = self.resolution * 10
   self.noise = [random.randint(0, 2) for i in range(self.noise_size)]
   self.noise_count = 0
   self.colors = [ lambda context : context.set_source_rgb(0.0, 1.0, 0.0),
                   lambda context : context.set_source_rgb(1.0, 0.0, 0.0), 
                   lambda context : context.set_source_rgb(0.0, 0.0, 1.0) ]
   self.buf = None
Exemplo n.º 4
0
  def __init__(self, text, x = 0.0, y = 0.0):
    Plato.__init__(self, x, y, 0.0, 0.0)

    # zoomin'
    self.lock_zoom = False

    # font properies - derived from css properties
    self.font_family = "Monospace"
    self.font_size = 10

    # selection
    self.selection = (0, 0)

    # other properties
    self.margin = 5.0
    self.border_width = 1.0
    self.border_radius = 10.0 # in the case of rounded borders

    self.color = (0.0, 0.0, 0.0, 1.0)
    self.border_color = (1.0, 0.0, 0.0, 1.0)
    self.background_color = (0.7, 0.7, 1.0, 0.5)
    self.selection_background = 'background="gray"'
    self.selection_foreground = '' # 'color="white"'

    self.__text = text
    self.cursorindex = 0
    self.pixel_width  = 0.0
    self.pixel_height = 0.0

    # create text layout
    self.layout = pango.Layout(TheWorld.pango_context)
    fontDescription = pango.FontDescription(self.font_family + " " + str(self.font_size))
    self.layout.set_font_description(fontDescription)
    self.layout.set_markup('<span>' + text + '</span>')

    # calc text metrics
    self.recalc_text_size()
Exemplo n.º 5
0
  def __init__(self, x, y, w, h):
    Plato.__init__(self, x, y, w, h)

    # set up physics engine
    #print 'creating world'
    self._ode_world = ode.World()
    #self._ode.setGravity( (0,0.1,0) )    
    #self._ode_space = ode.Space(type=1) # hashspace
    self._ode_space = ode.QuadTreeSpace((0,0,0),(1,1,1),4)
    
    # create walls
    #self.ode_floor = ode.GeomPlane(self.ode_space, (0, -1, 0), -TheWorld.unit_range)
    #self.ode_wall_right = ode.GeomPlane(self.ode_space, (-1, 0, 0), -TheWorld.unit_range)
    #self.ode_wall_left = ode.GeomPlane(self.ode_space, (1, 0, 0), -TheWorld.unit_range)
    #self.ode_celing = ode.GeomPlane(self.ode_space, (0, 1, 0), -TheWorld.unit_range)
    
    # contact group for collision detection
    self._ode_contactgroup = ode.JointGroup()
    
    # jointgroup for constraining movement to 2d, all moving objects
    self._ode_2dgroup = ode.JointGroup()
    
    # motor group 
    self._ode_motorgroup = ode.JointGroup()
    
    # jointgroup for fixed objects - e.g. walls, inputs outputs
    self._ode_anchorgroup = ode.JointGroup()

    self._ode_bodies = []
    
    self._remove_list = [] # for operations on bodies not associated with in/outputs
    self._add_list = []
    
    self.__particlecount_by_type = {} 
    
    
    self.collision_lock = False
Exemplo n.º 6
0
 def __init__(self, x, y):
   Plato.__init__(self, x, y, SIZE, SIZE)
Exemplo n.º 7
0
 def __init__(self, x, y):
   Plato.__init__(self, x, y, WIDTH, LENGTH)
   Body.__init__(self)
Exemplo n.º 8
0
 def __init__(self, x, y, w, h):
   Plato.__init__(self, x, y, w, h)
   Body.__init__(self, None) 
Exemplo n.º 9
0
 def __init__(self, x, y, w, h):
   Plato.__init__(self,x, y, w, h)
Exemplo n.º 10
0
  def __init__(self, x, y, w, h):
    Plato.__init__(self, x, y, w, h)

    self.input_buffer = []
    self.output_buffer = []
Exemplo n.º 11
0
  def __init__(self, x, y, w, h):
    Plato.__init__(self,x, y, w, h)

    self.is_toolbox = True