|
@@ -2,7 +2,7 @@ from PyQt4 import QtGui, QtCore
|
|
|
import logging
|
|
|
|
|
|
import kcgwidget as kcgw
|
|
|
-from backend import board # TODO: remove direct dependency on board
|
|
|
+from backend import board
|
|
|
from groupedelements import Checkboxes, Buttons, Elements
|
|
|
import backendinterface as bif
|
|
|
import storage
|
|
@@ -193,17 +193,19 @@ class ControlWidget(kcgw.KCGWidgets):
|
|
|
self.gridLayout.addWidget(self.pll_ld_led, 6, 1)
|
|
|
|
|
|
# -----------[ Buttons ]--------------
|
|
|
+ self.all_in_one_button = self.createButton(text=tr("Button", "Prepare Board"), connect=self.all_in_one,
|
|
|
+ tooltip=tr("Tooltip", "Start, Calibrate, Synchronize and set Defaults\nCtrl+A"))
|
|
|
+ self.all_in_one_button.setShortcut("Ctrl+A")
|
|
|
+ self.all_in_one_button.setObjectName("all_in_one")
|
|
|
+
|
|
|
self.start_button = self.createButton(text=tr("Button", "Start Board"), connect=bif.bk_start_board)
|
|
|
self.calibrate_button = self.createButton(text=tr("Button", "Calibrate"), connect=bif.bk_calibrate)
|
|
|
self.syncronize_button = self.createButton(text=tr("Button", "Synchronize"), connect=bif.bk_sync_board)
|
|
|
self.set_default_button = self.createButton(text=tr("Button", "Set Defaults"), connect=bif.bk_set_defaults)
|
|
|
self.soft_reset_button = self.createButton(text=tr("Button", "Soft Reset"), connect=bif.bk_soft_reset)
|
|
|
self.off_button = self.createButton(text=tr("Button", "Board Off"), connect=bif.bk_stop_board)
|
|
|
- self.all_in_one_button = self.createButton(text=tr("Button", "Prepare Board"), connect=self.all_in_one,
|
|
|
- tooltip=tr("Tooltip", "Start, Calibrate, Synchronize and set Defaults\nCtrl+A"))
|
|
|
- self.all_in_one_button.setShortcut("Ctrl+A")
|
|
|
- self.all_in_one_button.setObjectName("all_in_one")
|
|
|
self.off_button.setObjectName("off")
|
|
|
+ self.check_status_button = self.createButton(text=tr("Button", "Check Status"), connect=bif._bif_status_readout)
|
|
|
|
|
|
Buttons.addButton("start_board", self.start_button)
|
|
|
Buttons.addButton(["calibrate", "after_start"], self.calibrate_button)
|
|
@@ -221,6 +223,7 @@ class ControlWidget(kcgw.KCGWidgets):
|
|
|
])
|
|
|
|
|
|
# -----------[ Add to grid ]---------------
|
|
|
+ self.gridLayout.addWidget(self.all_in_one_button, 1, 0)
|
|
|
self.gridLayout.addWidget(self.start_button, 3, 0)
|
|
|
self.gridLayout.addWidget(self.calibrate_button, 4, 0)
|
|
|
self.gridLayout.addWidget(self.syncronize_button, 5, 0)
|
|
@@ -228,8 +231,7 @@ class ControlWidget(kcgw.KCGWidgets):
|
|
|
self.gridLayout.addWidget(self.soft_reset_button, 7, 0)
|
|
|
self.gridLayout.addItem(QtGui.QSpacerItem(10, 50), 8, 0)
|
|
|
self.gridLayout.addWidget(self.off_button, 9, 0)
|
|
|
- self.gridLayout.addWidget(self.all_in_one_button, 1, 0)
|
|
|
- self.gridLayout.addWidget(self.createButton(text=tr("Button", "Check Status"), connect=bif._bif_status_readout), 7, 1)
|
|
|
+ self.gridLayout.addWidget(self.check_status_button, 7, 1)
|
|
|
|
|
|
|
|
|
self.layout.addLayout(self.gridLayout)
|
|
@@ -239,6 +241,9 @@ class ControlWidget(kcgw.KCGWidgets):
|
|
|
self.log_area.setReadOnly(True)
|
|
|
self.overlayout.addWidget(self.log_area)
|
|
|
|
|
|
+ self.setTabOrder(self.soft_reset_button, self.check_status_button)
|
|
|
+ self.setTabOrder(self.check_status_button, self.off_button)
|
|
|
+
|
|
|
# ------------------[ Logging ]----------------------
|
|
|
log_handler = LogHandler(self.log_area)
|
|
|
self.logger = logging.getLogger()
|
|
@@ -246,6 +251,8 @@ class ControlWidget(kcgw.KCGWidgets):
|
|
|
self.logger.addHandler(log_handler)
|
|
|
self.logger.setLevel(logging.INFO)
|
|
|
logging.logger = self.logger
|
|
|
+ self.gridLayout.addWidget(self.all_in_one_button, 1, 0)
|
|
|
+
|
|
|
|
|
|
def all_in_one(self):
|
|
|
bif.bk_start_board()
|
|
@@ -254,16 +261,7 @@ class ControlWidget(kcgw.KCGWidgets):
|
|
|
bif.bk_set_defaults()
|
|
|
bif.bk_calibrate(do_the_rest)
|
|
|
|
|
|
- def on_check(self, registers): # TODO: remove dependency on board
|
|
|
- # import random
|
|
|
- # r = [random.random()+0.5 for i in range(4)]
|
|
|
- # ledlist = [self.pipeline_led, self.master_control_led, self.data_check_led, self.pll_ld_led]
|
|
|
- # for i, led in enumerate(ledlist):
|
|
|
- # if int(r[i]) == 1:
|
|
|
- # led.set_on()
|
|
|
- # else:
|
|
|
- # led.set_off()
|
|
|
- # logging.info("Checked: {}".format(str([int(i) for i in r])))
|
|
|
+ def on_check(self, registers):
|
|
|
try:
|
|
|
bits = []
|
|
|
bits += ['{0:032b}'.format(registers[0])]
|