示例#1
0
    def init(self, model):
        super().init()
        self.model = model

        # App layout
        with ui.VBox():
            ui.Label(flex=0, text=lambda: model.status)
            ui.Widget(flex=1)
            with ui.HBox(flex=2):
                ui.Widget(flex=1)
                self.canvas = ui.CanvasWidget(flex=0)
                ui.Widget(flex=1)
            ui.Widget(flex=1)

        # Init context to draw to
        self._ctx = self.canvas.node.getContext('2d')
示例#2
0
    def init(self):

        # Select random color
        self.color = random.choice(COLORS)

        # App layout
        with ui.VBox():
            self.people = ui.Label(flex=0)
            ui.Widget(flex=1)
            with ui.HBox(flex=2):
                ui.Widget(flex=1)
                self.canvas = ui.CanvasWidget(flex=0)
                ui.Widget(flex=1)
            ui.Widget(flex=1)

        # Start people-count-updater
        self._update_participants()
示例#3
0
    def init(self):

        # Select random color
        self.color = random.choice(COLORS)

        # App layout
        with ui.VBox():
            self.people = ui.Label(flex=0)
            ui.Widget(flex=1)
            with ui.HBox(flex=2):
                ui.Widget(flex=1)
                self.canvas = ui.CanvasWidget(flex=0)
                ui.Widget(flex=1)
            ui.Widget(flex=1)

        # Connect events
        self.connect(self._this_user_adds_paint, 'canvas.mouse_down')
        relay.connect(self._any_user_adds_paint, 'global_paint:' + self.id)

        # Start people-count-updater
        self._update_participants()
示例#4
0
    def init(self):

        # Select random color
        #rgb = [str(random.randint(0, 200)) for i in range(3)]
        #self.color = 'rgb(%s)' % (', '.join(rgb))
        self.color = random.choice(COLORS)

        # App layout
        with ui.VBox():
            self.people = ui.Label(flex=0)
            ui.Widget(flex=1)
            with ui.HBox(flex=2):
                ui.Widget(flex=1)
                self.canvas = ui.CanvasWidget(flex=0)
                ui.Widget(flex=1)
            ui.Widget(flex=1)

        # Pipe messages send by the relay into this app
        relay.connect(self._push_info, 'new_dot:' + self.id)

        # Start people-count-updater
        self._update_participants()