Exemplo n.º 1
0
    def button_start_clicked(self):
        self.button_start.setEnabled(False)
        self.button_stop.setEnabled(True)

        self.appliance_name = qt.input_dialog(
                                    "Nome do equipamento", "")
        self.power_plot.setTitle(self.appliance_name)

        self.monitor = subprocess.Popen("./monitor agregate 30",
                            stdout=subprocess.PIPE, shell=True)

        self.status = self.STATUS.COLLECTING
Exemplo n.º 2
0
    def button_tag_clicked(self):
        self.labels = []

        arrow = qt.arrow(angle=-160, tipAngle=60,
                            headLen=40, tailLen=40, tailWidth=20,
                            pen={'color': 'w', 'width': 3})
        self.power_plot.addItem(arrow)

        try:
            for i, prototype in enumerate(self.prototypes):
                arrow.setPos(prototype[0]-0.2, prototype[1]+0.2)
                qt.update_gui()

                current_state = qt.input_dialog("Nome do estado", "")
                self.labels.append(current_state)

                text = qt.text(current_state, anchor=(0.5, 0))
                text.setPos(prototype[0], prototype[1]-0.5)
                self.power_plot.addItem(text)
        except qt.UserCancelError:
            return
        
        self.power_plot.removeItem(arrow)

        self.transitions = []

        l = len(self.prototypes)
        for i in xrange(l):
            for j in xrange(i+1, l):
                self.transitions.append((
                    self.labels[j], self.labels[i], (
                    self.prototypes[i][0] - self.prototypes[j][0],
                    self.prototypes[i][1] - self.prototypes[j][1]
                )))

        self.button_cluster.setEnabled(False)
        self.button_tag.setEnabled(False)
        self.button_save.setEnabled(True)