Example #1
0
    def event_simple_cb(widget, event, data):
        """ general event callback function """
        if data == "para":
            (cmd1, cmd2) = akkupara_dialog()
            if not cmd1:
                return

            cfg.COMMAND_ABORT = False  #reset

            helper.akkumatik_command(cmd1, "Übertragen")
            cfg.FLOG.write("Sending Command %s \"Übertragen\"\n" % cmd1)

            if cmd2:
                time.sleep(0.6)  #else threads may get out of order somehow
                helper.akkumatik_command(cmd2, "Start")
                cfg.FLOG.write("Sending Command %s \"Start\"\n" % cmd2)
        elif data == "chart":
            ra_gnuplot.gnuplot()
            #ra_matplot.matplot()
        elif data == "recycle":
            cfg.FILE_BLOCK = True  #stop reading in files (read_line)
            cfg.FSER.close()
            #truncates old file
            cfg.FSER = helper.open_file(cfg.TMP_DIR + '/serial-akkumatik.dat',
                                        'w+b')
            cfg.FLOG.write("%s opened (new or create binary)" % \
                    cfg.TMP_DIR + '/serial-akkumatik.dat\n')
            cfg.FILE_BLOCK = False
            message_dialog(cfg.GTK_WINDOW,
                           "Alte serielle Daten wurden geloescht.")
            return

        elif data == "quit":
            gtk.main_quit()
Example #2
0
    def event_simple_cb(widget, event, data):
        """ general event callback function """
        if data == "para":
            (cmd1, cmd2) = akkupara_dialog()
            if not cmd1:
                return

            cfg.COMMAND_ABORT = False  # reset

            helper.akkumatik_command(cmd1, "Übertragen")
            cfg.FLOG.write('Sending Command %s "Übertragen"\n' % cmd1)

            if cmd2:
                time.sleep(0.6)  # else threads may get out of order somehow
                helper.akkumatik_command(cmd2, "Start")
                cfg.FLOG.write('Sending Command %s "Start"\n' % cmd2)
        elif data == "chart":
            ra_gnuplot.gnuplot()
            # ra_matplot.matplot()
        elif data == "recycle":
            cfg.FILE_BLOCK = True  # stop reading in files (read_line)
            cfg.FSER.close()
            # truncates old file
            cfg.FSER = helper.open_file(cfg.TMP_DIR + "/serial-akkumatik.dat", "w+b")
            cfg.FLOG.write("%s opened (new or create binary)" % cfg.TMP_DIR + "/serial-akkumatik.dat\n")
            cfg.FILE_BLOCK = False
            message_dialog(cfg.GTK_WINDOW, "Alte serielle Daten wurden geloescht.")
            return

        elif data == "quit":
            gtk.main_quit()
Example #3
0
    def event_start_stop_cb(widget, event, data):
        """ callback function - eventboxes containing START/STOP pics """

        if not cfg.START_STOP.get_sensitive():
            return

        #True later on generate_output_strs() again
        cfg.START_STOP.set_sensitive(False)

        #not running -> send start
        if cfg.PHASE == 0:
            if cfg.GEWAEHLTER_AUSGANG == 1:
                cfg.COMMAND_ABORT = False  #reset
                helper.akkumatik_command("44", "Start")
                cfg.FLOG.write("Sending Command 44\n")
            else:
                cfg.COMMAND_ABORT = False  #reset
                helper.akkumatik_command("48", "Start")
                cfg.FLOG.write("Sending Command 48\n")
        else:  #running -> send stop
            if cfg.GEWAEHLTER_AUSGANG == 1:
                cfg.COMMAND_ABORT = False  #reset
                helper.akkumatik_command("41", "Stop")
                cfg.FLOG.write("Sending Command 41\n")
            else:
                cfg.COMMAND_ABORT = False  #reset
                helper.akkumatik_command("42", "Stop")
                cfg.FLOG.write("Sending Command 42\n")
Example #4
0
    def event_start_stop_cb(widget, event, data):
        """ callback function - eventboxes containing START/STOP pics """

        if not cfg.START_STOP.get_sensitive():
            return

        # True later on generate_output_strs() again
        cfg.START_STOP.set_sensitive(False)

        # not running -> send start
        if cfg.PHASE == 0:
            if cfg.GEWAEHLTER_AUSGANG == 1:
                cfg.COMMAND_ABORT = False  # reset
                helper.akkumatik_command("44", "Start")
                cfg.FLOG.write("Sending Command 44\n")
            else:
                cfg.COMMAND_ABORT = False  # reset
                helper.akkumatik_command("48", "Start")
                cfg.FLOG.write("Sending Command 48\n")
        else:  # running -> send stop
            if cfg.GEWAEHLTER_AUSGANG == 1:
                cfg.COMMAND_ABORT = False  # reset
                helper.akkumatik_command("41", "Stop")
                cfg.FLOG.write("Sending Command 41\n")
            else:
                cfg.COMMAND_ABORT = False  # reset
                helper.akkumatik_command("42", "Stop")
                cfg.FLOG.write("Sending Command 42\n")