Beispiel #1
0
    def __init__(self, window, x, y, params={}):
        PatchElement.__init__(self, window, x, y)

        self.param_list.extend(
            ['x_min', 'x_max', 'y_min', 'y_max', 'style', 'plot_type'])

        # display elements
        self.rect = None
        self.label = None
        self.label_text = None
        self.xyplot = None

        # display bounds
        self.x_min = 0.0
        self.x_max = 6.28
        self.y_min = -1.0
        self.y_max = 1.0

        self.min_interval = 75
        self.last_draw = None

        # create display
        width = self.INIT_WIDTH + self.WIDTH_PAD
        height = self.INIT_HEIGHT + self.LABEL_SPACE + self.HEIGHT_PAD
        self.create_display(width, height)
        self.set_size(width, height)
        self.move(x, y)
        self.update()
Beispiel #2
0
    def configure(self, params):
        if params.get('value') is not None:
            new_text = params.get('value')
            if new_text != self.value:
                self.value = new_text
                self.set_text()

        if params.get('clickchange') is not None:
            self.clickchange = params['clickchange']

        if params.get('default') is not None:
            self.default = params['default']

        newsize = None
        if params.get('style') is not None:
            newstyle = params.get('style')
            if newstyle.get('canvas-size') is not None:
                newsize = newstyle.get('canvas-size')
                params['width'] = newsize[0]
                params['height'] = newsize[1]

        if params.get('border') is not None:
            self.border = params.get('border')

        PatchElement.configure(self, params)
        if newsize: 
            self.set_size(*newsize)

        self.update()
Beispiel #3
0
    def configure(self, params):
        if "plot_type" in params and self.xyplot is None:
            if params["plot_type"] == "scatter":
                self.xyplot = ScatterPlot(self.INIT_WIDTH, self.INIT_HEIGHT)
            elif params["plot_type"] == "scope":
                self.xyplot = ScopePlot(self.INIT_WIDTH, self.INIT_HEIGHT,
                                        MFPApp().samplerate)
                self.xyplot.draw_complete_cb = self.draw_complete_cb
            if self.xyplot:
                self.add_actor(self.xyplot)
                self.xyplot.set_position(3, self.LABEL_SPACE)

        if self.obj_args is None:
            self.label.set_text("%s" % (self.obj_type, ))
        else:
            self.label.set_text("%s %s" % (self.obj_type, self.obj_args))

        x_min = params.get('x_min', self.x_min)
        x_max = params.get('x_max', self.x_max)
        y_min = params.get('y_min', self.y_min)
        y_max = params.get('y_max', self.y_max)

        self.set_bounds(x_min, y_min, x_max, y_max)

        if self.xyplot is not None:
            self.xyplot.configure(params)

        PatchElement.configure(self, params)
Beispiel #4
0
    def __init__(self, window, x, y, params={}):
        PatchElement.__init__(self, window, x, y)

        self.param_list.extend(['x_min', 'x_max', 'y_min', 'y_max',
                                'plot_style', 'plot_type'])

        # display elements
        self.rect = None
        self.label = None
        self.label_text = None
        self.xyplot = None

        # display bounds
        self.x_min = 0.0
        self.x_max = 6.28
        self.y_min = -1.0
        self.y_max = 1.0

        self.min_interval = 75
        self.last_draw = None

        # create display
        width = self.INIT_WIDTH + self.WIDTH_PAD
        height = self.INIT_HEIGHT + self.LABEL_SPACE + self.HEIGHT_PAD
        self.create_display(width, height)
        self.set_size(width, height)
        self.move(x, y)
        self.update()
Beispiel #5
0
    def configure(self, params):
        if "plot_type" in params and self.xyplot is None:
            if params["plot_type"] == "scatter":
                self.xyplot = ScatterPlot(self, self.INIT_WIDTH, self.INIT_HEIGHT)
            elif params["plot_type"] == "scope":
                self.xyplot = ScopePlot(self, self.INIT_WIDTH, self.INIT_HEIGHT, 
                                        MFPApp().samplerate)
                self.xyplot.draw_complete_cb = self.draw_complete_cb
            if self.xyplot:
                self.add_actor(self.xyplot)
                self.xyplot.set_position(3, self.LABEL_SPACE)

        if self.obj_args is None:
            self.label.set_text("%s" % (self.obj_type,))
        else:
            self.label.set_text("%s %s" % (self.obj_type, self.obj_args))

        x_min = params.get('x_min', self.x_min)
        x_max = params.get('x_max', self.x_max)
        y_min = params.get('y_min', self.y_min)
        y_max = params.get('y_max', self.y_max)

        self.set_bounds(x_min, y_min, x_max, y_max)

        if self.xyplot is not None:
            self.xyplot.configure(params)

        PatchElement.configure(self, params)
Beispiel #6
0
 def configure(self, params):
     if params.get('value') is not None:
         new_text = params.get('value')
         if new_text != self.value:
             self.value = new_text
             self.label.set_markup(self.value)
     PatchElement.configure(self, params)
     self.update()
Beispiel #7
0
 def configure(self, params):
     if params.get('value') is not None:
         new_text = params.get('value')
         if new_text != self.value:
             self.value = new_text
             self.label.set_markup(self.value)
     PatchElement.configure(self, params)
     self.update()
Beispiel #8
0
    def __init__(self, window, x, y):
        PatchElement.__init__(self, window, x, y)
        self.value = ''
        self.param_list.append('value')

        # configure label
        self.label = Clutter.Text()
        self.label.set_color(window.color_unselected)
        self.add_actor(self.label)

        self.update_required = True
        self.set_size(12, 12)
        self.move(x, y)
        self.set_reactive(True)
        self.label_changed_cb = self.label.connect('text-changed', self.text_changed_cb)
Beispiel #9
0
    def __init__(self, window, x, y):
        PatchElement.__init__(self, window, x, y)
        self.value = ''
        self.param_list.append('value')

        # configure label
        self.label = Clutter.Text()
        self.label.set_color(window.color_unselected)
        self.add_actor(self.label)

        self.update_required = True
        self.set_size(12, 12)
        self.move(x, y)
        self.set_reactive(True)
        self.label_changed_cb = self.label.connect('text-changed',
                                                   self.text_changed_cb)
Beispiel #10
0
    def command(self, action, data):
        if self.xyplot.command(action, data):
            return True
        elif action == "clear":
            self.xyplot.clear(data)
            return True
        elif action == "bounds":
            self.set_bounds(*data)
            return True
        elif PatchElement.command(self, action, data):
            return True

        return False
Beispiel #11
0
    def command(self, action, data):
        if self.xyplot.command(action, data):
            return True
        elif action == "clear":
            self.xyplot.clear(data)
            return True
        elif action == "bounds":
            self.set_bounds(*data)
            return True
        elif PatchElement.command(self, action, data):
            return True

        return False
Beispiel #12
0
    def __init__(self, window, x, y):
        PatchElement.__init__(self, window, x, y)
        self.value = ''
        self.clickchange = False
        self.default = ''

        self.param_list.extend(['value', 'clickchange', 'default'])

        self.texture = Clutter.CairoTexture.new(12, 12)
        self.texture.connect("draw", self.draw_cb)
        self.add_actor(self.texture)

        self.label = Clutter.Text()
        self.label.set_color(self.get_color('text-color'))
        self.label.set_font_name(self.get_fontspec())
        self.label.set_position(3, 3)
        self.add_actor(self.label)

        self.update_required = True
        self.set_size(12, 12)
        self.move(x, y)
        self.set_reactive(True)
        self.label_changed_cb = self.label.connect('text-changed', self.text_changed_cb)
Beispiel #13
0
 def draw_ports(self):
     if self.selected:
         PatchElement.draw_ports(self)
Beispiel #14
0
    def set_size(self, w, h):
        PatchElement.set_size(self, w, h)

        self.texture.set_size(w, h)
        self.texture.set_surface_size(w, h)
        self.texture.invalidate()
Beispiel #15
0
 def unselect(self, *args):
     PatchElement.unselect(self)
     self.label.set_color(self.get_color('text-color'))
     self.texture.invalidate()
     self.hide_ports()
Beispiel #16
0
 def select(self, *args):
     PatchElement.select(self)
     self.label.set_color(self.stage.color_selected)
     self.draw_ports()
Beispiel #17
0
 def unselect(self, *args):
     PatchElement.unselect(self)
     self.label.set_color(self.stage.color_unselected)
     self.hide_ports()
Beispiel #18
0
 def end_edit(self):
     PatchElement.end_edit(self)
     self.set_text()
Beispiel #19
0
 def select(self, *args):
     PatchElement.select(self)
     self.label.set_color(self.stage.color_selected)
     self.draw_ports()
Beispiel #20
0
 def unselect(self, *args):
     PatchElement.unselect(self)
     self.label.set_color(self.stage.color_unselected)
     self.hide_ports()
Beispiel #21
0
 def set_size(self, width, height):
     PatchElement.set_size(self, width, height)
     self.rect.set_size(width, height)
     if self.xyplot:
         self.xyplot.set_size(width-self.WIDTH_PAD, height-self.LABEL_SPACE-self.WIDTH_PAD)
Beispiel #22
0
 def unselect(self):
     PatchElement.unselect(self)
     self.rect.set_border_color(self.stage.color_unselected)
Beispiel #23
0
    def delete(self):
        for c in self.connections_out + self.connections_in:
            c.delete()

        PatchElement.delete(self)
Beispiel #24
0
 def set_size(self, width, height):
     PatchElement.set_size(self, width, height)
     self.rect.set_size(width, height)
     if self.xyplot:
         self.xyplot.set_size(width - self.WIDTH_PAD,
                              height - self.LABEL_SPACE - self.WIDTH_PAD)
Beispiel #25
0
 def draw_ports(self):
     if self.selected:
         PatchElement.draw_ports(self)
Beispiel #26
0
    def delete(self):
        for c in self.connections_out + self.connections_in:
            c.delete()

        PatchElement.delete(self)
Beispiel #27
0
 def unselect(self):
     PatchElement.unselect(self)
     self.rect.set_border_color(self.stage.color_unselected)