|
@@ -8,73 +8,14 @@ and will yield True or False depending on the result of the action performed
|
|
|
import logging
|
|
|
|
|
|
from . import *
|
|
|
-from .utils import *
|
|
|
from .utils import get_board_config
|
|
|
import json
|
|
|
from PyQt4 import QtGui, QtCore
|
|
|
+from ...kcgwidget import PopupDialog
|
|
|
import os
|
|
|
|
|
|
-def tr(_, x):
|
|
|
- """
|
|
|
- Dummy Translation method that does not translate
|
|
|
- :param _: unused
|
|
|
- :param x: the string to "translate"
|
|
|
- :return: x
|
|
|
- """
|
|
|
- return x
|
|
|
|
|
|
|
|
|
-
|
|
|
-class PopupDialog(QtGui.QDialog):
|
|
|
- """
|
|
|
- Simple Class to show a popup dialog.
|
|
|
- """
|
|
|
-
|
|
|
- def __init__(self, text, title=None, parent=None):
|
|
|
- QtGui.QDialog.__init__(self, parent)
|
|
|
- self.text = text
|
|
|
- self.setWindowTitle(title if title else tr("Dialog", "User action required"))
|
|
|
- self.return_value = False
|
|
|
-
|
|
|
- size = QtCore.QSize(200, 200)
|
|
|
- # self.setMaximumSize(size)
|
|
|
- self.setMinimumSize(size)
|
|
|
- box = QtGui.QVBoxLayout()
|
|
|
- self.text_label = QtGui.QLabel(self.text)
|
|
|
- self.text_label.setAlignment(QtCore.Qt.AlignCenter)
|
|
|
- box.addWidget(self.text_label)
|
|
|
- self.okay_btn = QtGui.QPushButton(tr("Button", "Ok"))
|
|
|
- self.okay_btn.setStyleSheet("padding: 15px;")
|
|
|
- self.okay_btn.clicked.connect(self.on_okay)
|
|
|
- box.addWidget(self.okay_btn)
|
|
|
- box.addSpacerItem(QtGui.QSpacerItem(1, 20))
|
|
|
- self.cancel_btn = QtGui.QPushButton(tr("Button", "Cancel"))
|
|
|
- self.cancel_btn.setStyleSheet("padding: 15px;")
|
|
|
- self.cancel_btn.clicked.connect(self.on_cancel)
|
|
|
- box.addWidget(self.cancel_btn)
|
|
|
- self.setLayout(box)
|
|
|
-
|
|
|
- def on_okay(self):
|
|
|
- """
|
|
|
- Handler for the press of the ok button
|
|
|
- """
|
|
|
- self.return_value = True
|
|
|
- self.close()
|
|
|
-
|
|
|
- def on_cancel(self):
|
|
|
- """
|
|
|
- Handler for the press of the cancel button
|
|
|
- :return:
|
|
|
- """
|
|
|
- self.close()
|
|
|
-
|
|
|
- def get_return_value(self):
|
|
|
- """
|
|
|
- Get True if the Window was closed with OK else False
|
|
|
- :return: True if OK else False
|
|
|
- """
|
|
|
- return self.return_value
|
|
|
-
|
|
|
def read_sequence(board_version):
|
|
|
#print("sequence ",board_version)
|
|
|
filename = os.path.join(os.path.dirname(__file__), "sequences", "sequences_" + str(board_version)+".json")
|
|
@@ -99,7 +40,7 @@ def run_sequence(board_id, sequence, progressbar=None):
|
|
|
|
|
|
if entry[2] != "":
|
|
|
# Dialog
|
|
|
- dialog = PopupDialog(tr("Button", "{0} (on board {1})".format(entry[2], board_id)))
|
|
|
+ dialog = PopupDialog("{0} (on board {1})".format(entry[2], board_id))
|
|
|
dialog.exec_()
|
|
|
dialog.deleteLater()
|
|
|
|