def getCurrentId(self): try: l = linkbot.CLinkbot('LOCL') QtGui.QMessageBox.information(self, "Serial ID", "Serial ID: " + l.get_serial_id()) except Exception as e: try: # Try using SFP linkbot.config(use_sfp = True) l = linkbot.CLinkbot('LOCL') QtGui.QMessageBox.information(self, "Serial ID", "Serial ID: " + l.get_serial_id()) except Exception as e2: QtGui.QMessageBox.warning( self, "Warning", "Could not get the Linkbot's serial ID. Is the Linkbot plugged " "in?\n\n" + str(e) + str(e2))
def getCurrentId(self): try: l = linkbot.CLinkbot('LOCL') QtGui.QMessageBox.information(self, "Serial ID", "Serial ID: " + l.get_serial_id()) except Exception as e: try: # Try using SFP linkbot.config(use_sfp=True) l = linkbot.CLinkbot('LOCL') QtGui.QMessageBox.information( self, "Serial ID", "Serial ID: " + l.get_serial_id()) except Exception as e2: QtGui.QMessageBox.warning( self, "Warning", "Could not get the Linkbot's serial ID. Is the Linkbot plugged " "in?\n\n" + str(e) + str(e2))
def programCurrentSerialId(self): try: l = linkbot.CLinkbot('LOCL') except: try: linkbot.config(use_sfp=True) l = linkbot.CLinkbot('LOCL') except Exception as e: QtGui.QMessageBox.warning(self, "Error: ", str(e)) return newId = self.ui.serialId_lineEdit.text().upper() if len(newId) != 4: raise Exception("Serial IDs must be 4 characters long.") l._set_serial_id(newId) l.setBuzzerFrequency(440) time.sleep(0.5) l.setBuzzerFrequency(0) self.ui.serialId_lineEdit.selectAll()
#!/usr/bin/env python3 import linkbot3 as linkbot import time import sys from PyQt4 import QtCore, QtGui linkbot.config(use_sfp=True) try: from preassemblytest_mainwindow import Ui_MainWindow except: from linkbot_diagnostics.preassemblytest_mainwindow import Ui_MainWindow try: from test_dialogs.led_dialog import Ui_Dialog_led except: from linkbot_diagnostics.test_dialogs.led_dialog import Ui_Dialog_led try: from test_dialogs.encoder_dialog import Ui_Dialog_encoder except: from linkbot_diagnostics.test_dialogs.encoder_dialog import Ui_Dialog_encoder try: from test_dialogs.button_dialog import Ui_Dialog_button except: from linkbot_diagnostics.test_dialogs.button_dialog import Ui_Dialog_button try: from test_dialogs.accelerometer_dialog import Ui_Dialog_accelerometer
import concurrent from PyQt4 import QtCore, QtGui import time import linkbot3 as linkbot linkbot.config(use_sfp=True, timeout=3) import traceback import threading import math from linkbot_diagnostics.LinkbotDiagnosticGui import LinkbotDiagnostic from linkbot_diagnostics.testlinkbot import TestLinkbot from linkbot_diagnostics import Database import sqlite3 as sql import appdirs import os db_dir = os.path.join(appdirs.user_data_dir(), "linkbot-diagnostics") db_file = os.path.join(db_dir, "database.db") try: _fromUtf8 = QtCore.QString.fromUtf8 except AttributeError: def _fromUtf8(s): return s class LinkbotTest(QtGui.QWidget): completed = QtCore.pyqtSignal() failure = QtCore.pyqtSignal(str) error = QtCore.pyqtSignal(str)
import concurrent from PyQt4 import QtCore, QtGui import time import linkbot3 as linkbot linkbot.config(timeout=3) import traceback import threading import math from linkbot_diagnostics.LinkbotDiagnosticGui import initialize_tables from linkbot_diagnostics.LinkbotDiagnosticGui import LinkbotDiagnostic from linkbot_diagnostics.testlinkbot import TestLinkbot import sqlite3 as sql import appdirs import os db_dir = os.path.join(appdirs.user_data_dir(), "linkbot-diagnostics") db_file = os.path.join(db_dir, "database.db") try: _fromUtf8 = QtCore.QString.fromUtf8 except AttributeError: def _fromUtf8(s): return s class LinkbotTest(QtGui.QWidget): completed = QtCore.pyqtSignal() failure = QtCore.pyqtSignal(str) error = QtCore.pyqtSignal(str)