Hi guys,
There are only seldom examples of Applets now. What should I do if I want to make a new Applet in Dashboard to show a new GUI designed by PyQt ?
For example, Here is a new GUI made by me:
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Form(object):
def setupUi(self, Form):
Form.setObjectName("Form")
Form.resize(564, 377)
self.pushButton = QtWidgets.QPushButton(Form)
self.pushButton.setGeometry(QtCore.QRect(240, 180, 93, 28))
self.pushButton.setObjectName("pushButton")
self.retranslateUi(Form)
QtCore.QMetaObject.connectSlotsByName(Form)
def retranslateUi(self, Form):
_translate = QtCore.QCoreApplication.translate
Form.setWindowTitle(_translate("Form", "Form"))
self.pushButton.setText(_translate("Form", "PushButton"))
And here is an initial example of Applet:
from PyQt5 import QtWidgets
from artiq.applets.simple import SimpleApplet
class NumberWidget(QtWidgets.QLCDNumber):
def __init__(self, args):
QtWidgets.QLCDNumber.__init__(self)
self.setDigitCount(args.digit_count)
self.dataset_name = args.dataset
def data_changed(self, data, mods):
try:
n = float(data[self.dataset_name][1])
except (KeyError, ValueError, TypeError):
n = "---"
self.display(n)
def main():
applet = SimpleApplet(NumberWidget)
applet.add_dataset("dataset", "dataset to show")
applet.argparser.add_argument("--digit-count", type=int, default=10,
help="total number of digits to show")
applet.run()
if __name__ == "__main__":
main()
What should I do if I want to make a new Applet and let it show the GUI designed by me?