Ejemplo n.º 1
0
    def __init__(self, date=None, radius=16, fill='#f00', stroke='#fff',
                 line_width=1, amountdue=0, payee='', estimated=False,
                 overthreshold=False, status=0, multi=0, tooltip='',
                 **kwargs):
        graphics.Sprite.__init__(self, **kwargs)

        if date:
            self.date = date
        else:
            self.date = datetime.date.today()

        self.radius = radius
        self.fill = fill
        self.stroke = stroke
        self.line_width = line_width

        self.amountdue = amountdue
        self.payee = payee
        self.estimated = estimated
        self.overthreshold = overthreshold
        self.status = status
        self.multi = multi
        self.tooltip = tooltip

        self.bullet_color = None

        self.rectangle = graphics.Rectangle(1, 1, 5,
                                           stroke='#fff',
                                           interactive=True)
        self.rectangle.connect("on-mouse-over", self.on_mouse_over)
        self.rectangle.connect("on-mouse-out", self.on_mouse_out)
        self.rectangle.connect("on-click", self.on_click)
        self.rectangle.mouse_cursor = gtk.gdk.ARROW
        self.rectangle.opacity = 0
        self.add_child(self.rectangle)

        self.payee_label = graphics.Label(self.payee, color='#fff')
        self.payee_label.x = 14
        self.add_child(self.payee_label)

        self.amount_label = graphics.Label(self.float_to_currency(
                                               self.amountdue),
                                           color='#fff')
        self.amount_label.x = 4
        self.amount_label.y = 14
        self.add_child(self.amount_label)

        self.connect("on-render", self.on_render)
Ejemplo n.º 2
0
    def plot(self, keys, data):
        self.data = data

        bars = dict([(bar.key, bar.normalized) for bar in self.bars])

        max_val = float(max(data or [0]))

        new_bars, new_labels = [], []
        for key, value in zip(keys, data):
            if max_val:
                normalized = value / max_val
            else:
                normalized = 0
            bar = Bar(key, locale.format(self.value_format, value), normalized,
                      self.label_color)
            bar.interactive = self.graph_interactive

            if key in bars:
                bar.normalized = bars[key]
                self.tweener.add_tween(bar, normalized=normalized)
            new_bars.append(bar)

            label = graphics.Label(key, size=8, alignment=pango.ALIGN_RIGHT)
            new_labels.append(label)

        self.plot_area.remove_child(*self.bars)
        self.remove_child(*self.labels)

        self.bars, self.labels = new_bars, new_labels
        self.add_child(*self.labels)
        self.plot_area.add_child(*self.bars)

        self.show()
        self.redraw()
Ejemplo n.º 3
0
    def __init__(self, key, value, normalized, label_color):
        graphics.Sprite.__init__(self, cache_as_bitmap=True)
        self.key, self.value, self.normalized = key, value, normalized

        self.height = 0
        self.width = 20
        self.interactive = True
        self.fill = None

        self.label = graphics.Label(value, size=8, color=label_color)
        self.label_background = graphics.Rectangle(self.label.width + 4, self.label.height + 4, 4, visible=False)
        self.add_child(self.label_background)
        self.add_child(self.label)
        self.connect("on-render", self.on_render)
Ejemplo n.º 4
0
    def __init__(self, app, channel: audio.Channel, y_off=0):
        self.app = app
        self.channel = channel
        self.channel.update()
        self.color = channel.color
        y_off *= self.SPACING
        self.y = y_off
        self.scroll_y = 0

        # DIVS
        self.channel_view = graphics.Canvas(app,
                                            0.7,
                                            0.2,
                                            0.1,
                                            0.0 + y_off,
                                            bg=self.BG,
                                            border_width=1,
                                            border_color=self.color,
                                            xoffset=-1,
                                            yoffset=0 + self.y,
                                            hoffset=-2)
        self.presets = graphics.Div(app,
                                    0.1,
                                    0.2,
                                    0.0,
                                    0.0 + y_off,
                                    bg=self.BG,
                                    border_width=1,
                                    border_color=self.color)
        self.buttons = graphics.Div(app,
                                    0.2,
                                    0.2,
                                    0.8,
                                    0.0 + y_off,
                                    bg=self.BG,
                                    border_width=1,
                                    border_color=self.color)

        # PRESETS
        #self.compression_label = graphics.Label(app, '', y=0.01 + y_off, fg=self.FG_1, bg=self.BG)
        #self.compression_label.define_pre_label('COMP ')
        self.mono_label = graphics.Label(app,
                                         '',
                                         y=0.01 + y_off,
                                         fg=self.FG_1,
                                         bg=self.BG,
                                         fontscale=1.0)
        self.track_count_label = graphics.Label(app,
                                                '',
                                                y=0.06 + y_off,
                                                fg=self.FG_1,
                                                bg=self.BG)

        # TRACK NAME
        self.track_name_label = graphics.Label(app,
                                               '',
                                               x=0.1,
                                               y=0.002 + y_off,
                                               fontscale=1.3,
                                               fg=self.FG_2,
                                               bg=self.BG)

        # TIME
        self.elapsed_label = graphics.Label(app,
                                            '',
                                            x=0.12,
                                            y=0.16 + y_off,
                                            yoffset=-10,
                                            fontscale=0.9,
                                            fg=self.FG_2,
                                            bg=self.BG)
        self.total_label = graphics.Label(app,
                                          '',
                                          x=0.7,
                                          y=0.16 + y_off,
                                          yoffset=-10,
                                          fontscale=0.9,
                                          fg=self.FG_2,
                                          bg=self.BG)

        # NEXT PREV
        self.prev_label = graphics.Label(app,
                                         '',
                                         x=0.13,
                                         y=0.067 + y_off,
                                         fontscale=1,
                                         fg=self.FG_1,
                                         bg=self.BG)
        self.prev_label.define_pre_label('Prev: ')
        self.next_label = graphics.Label(app,
                                         '',
                                         x=0.45,
                                         y=0.067 + y_off,
                                         fontscale=1,
                                         fg=self.FG_1,
                                         bg=self.BG)
        self.next_label.define_pre_label('Next: ')

        # BAR
        self.timebar = graphics.ProgressBar(app,
                                            self.channel_view,
                                            x=0.18,
                                            y=0.8,
                                            w=0.65,
                                            h=0.1,
                                            xoffset=10,
                                            yoffset=-5,
                                            fill_color=self.color,
                                            border_color=self.color)

        # CHANNEL
        self.channel_label = graphics.RightAlignLabel(app,
                                                      self.channel.name,
                                                      x=0.817,
                                                      y=0.005 + y_off,
                                                      fontscale=1.5,
                                                      fg=self.color,
                                                      bg=self.BG)

        # PAUSED
        self.paused_label = graphics.Label(app,
                                           '',
                                           x=0.7,
                                           y=0.065 + y_off,
                                           fontscale=1.3,
                                           fg='white',
                                           bg=self.BG)

        # BUTTONS
        LINE1Y = 0.03
        LINE2Y = 0.11
        CENTERX = 0.8875
        SIZE = 0.02

        self.pause_button = graphics.Button(app,
                                            SIZE,
                                            SIZE,
                                            CENTERX + 0.0,
                                            LINE1Y + y_off,
                                            img_name=app.IMG + 'play.png',
                                            img_scale=0.9,
                                            background=self.BUTTONBG,
                                            cmd=self.cmd_play)
        self.next_button = graphics.Button(app,
                                           SIZE,
                                           SIZE,
                                           CENTERX + 0.03,
                                           LINE1Y + y_off,
                                           img_name=app.IMG + 'next.png',
                                           background=self.BUTTONBG,
                                           cmd=self.cmd_next)
        self.last_button = graphics.Button(app,
                                           SIZE,
                                           SIZE,
                                           CENTERX + 0.06,
                                           LINE1Y + y_off,
                                           img_name=app.IMG + 'last.png',
                                           background=self.BUTTONBG,
                                           cmd=self.cmd_last)
        self.prev_button = graphics.Button(app,
                                           SIZE,
                                           SIZE,
                                           CENTERX - 0.03,
                                           LINE1Y + y_off,
                                           img_name=app.IMG + 'prev.png',
                                           background=self.BUTTONBG,
                                           cmd=self.cmd_back)
        self.first_button = graphics.Button(app,
                                            SIZE,
                                            SIZE,
                                            CENTERX - 0.06,
                                            LINE1Y + y_off,
                                            img_name=app.IMG + 'first.png',
                                            background=self.BUTTONBG,
                                            cmd=self.cmd_first)

        self.stop_button = graphics.Button(app,
                                           SIZE,
                                           SIZE,
                                           CENTERX,
                                           LINE2Y + y_off,
                                           img_name=app.IMG + 'stop.png',
                                           img_scale=0.8,
                                           background=self.BUTTONBG,
                                           cmd=self.cmd_stop)

        self.ch_gain_label = graphics.Label(app,
                                            'CH GAIN',
                                            x=0.9275,
                                            y=0.15 + y_off,
                                            fontscale=0.6,
                                            fg=self.FG_1,
                                            bg=self.BG)
        self.tr_gain_label = graphics.Label(app,
                                            'TR GAIN',
                                            x=0.82,
                                            y=0.15 + y_off,
                                            fontscale=0.6,
                                            fg=self.FG_1,
                                            bg=self.BG)

        self.ch_gain_inc = graphics.Incrementor(app,
                                                min=self.GAIN_MIN,
                                                max=self.GAIN_MAX,
                                                step=self.GAIN_STEP_INC,
                                                x=0.92,
                                                y=0.111 + y_off,
                                                w=5,
                                                yoffset=0,
                                                bg='#000',
                                                fg=self.color,
                                                buttonbg=self.BUTTONBG,
                                                fontscale=1)
        self.tr_gain_inc = graphics.Incrementor(app,
                                                min=self.GAIN_MIN,
                                                max=self.GAIN_MAX,
                                                step=self.GAIN_STEP_INC,
                                                x=0.8125,
                                                y=0.111 + y_off,
                                                w=5,
                                                yoffset=0,
                                                bg='#000',
                                                fg=self.color,
                                                buttonbg=self.BUTTONBG,
                                                fontscale=1)

        self.parts = (
            self.channel_view,
            self.presets,
            self.buttons,
            self.mono_label,
            self.track_count_label,  # Removed gain and comp labels
            self.track_name_label,
            self.elapsed_label,
            self.total_label,
            self.next_label,
            self.prev_label,
            self.channel_label,
            self.paused_label,  # no timebar
            self.pause_button,
            self.next_button,
            self.last_button,
            self.prev_button,
            self.first_button,
            self.stop_button,
            self.ch_gain_label,
            self.tr_gain_label,
            self.ch_gain_inc,
            self.tr_gain_inc)

        app.track(self)
        self.update_labels()
        self.update_times()
        self.ch_gain_inc.set(str(self.channel.gain))
        self.tr_gain_inc.set(str(self.current.gain))
Ejemplo n.º 5
0
    def __init__(self, app, cue_manager):
        self.cm: cues.CueManager = cue_manager
        self.app = app

        self.box = graphics.Div(app,
                                w=0.8,
                                h=0.1,
                                x=0.1,
                                y=0.9,
                                bg=self.BG,
                                border_color=self.BD,
                                border_width=1,
                                yoffset=1,
                                hoffset=2)

        self.prev_label = graphics.Label(app,
                                         x=0.105,
                                         y=0.915,
                                         fg=self.FG_1,
                                         bg=self.BG,
                                         fontscale=0.8)
        self.prev_label.define_pre_label('Last: ')
        self.next_label = graphics.Label(app,
                                         x=0.105,
                                         y=0.955,
                                         fg=self.FG_1,
                                         bg=self.BG,
                                         fontscale=0.8)
        self.next_label.define_pre_label('Next: ')

        self.current_label = graphics.Label(app,
                                            x=0.35,
                                            y=0.905,
                                            yoffset=1,
                                            fg=self.FG_2,
                                            bg=self.BG,
                                            fontscale=1.4)
        #self.current_label.define_pre_label('Now: ')
        self.next_cmd = graphics.Label(app,
                                       x=0.35,
                                       y=0.945,
                                       yoffset=7,
                                       fg=self.FG_3,
                                       bg=self.BG,
                                       fontscale=0.7,
                                       h=0.01,
                                       anchor='n')

        self.prev_button = graphics.Button(app,
                                           w=0.02,
                                           h=0.06,
                                           x=0.065,
                                           y=0.92,
                                           img_name=self.app.IMG + 'first.png',
                                           background=self.BBG_1,
                                           activebackground=self.ABBG_1,
                                           cmd=self.cm.back)
        self.next_button = graphics.Button(app,
                                           w=0.02,
                                           h=0.06,
                                           x=0.915,
                                           y=0.92,
                                           xoffset=-4,
                                           img_name=self.app.IMG + 'last.png',
                                           background=self.BBG_1,
                                           activebackground=self.ABBG_1,
                                           cmd=self.cm.next)

        self.stop_all_button = graphics.Button(app,
                                               w=0.02,
                                               h=0.06,
                                               x=0.029,
                                               y=0.92,
                                               img_name=self.app.IMG +
                                               'stop2.png',
                                               background=self.BBG_2,
                                               activebackground=self.ABBG_2,
                                               cmd=self.cm.m.stop_all,
                                               img_scale=0.98)
        self.go_button = graphics.Button(app,
                                         w=0.02,
                                         h=0.06,
                                         x=0.95,
                                         y=0.92,
                                         xoffset=-4,
                                         img_name=self.app.IMG + 'go.png',
                                         background=self.BBG_2,
                                         activebackground=self.ABBG_2,
                                         cmd=self.cm.do,
                                         img_scale=1.05)

        app.track(self)