Note that there are some explanatory texts on larger screens.

plurals
  1. POEvent signal is emmitted twice every time
    text
    copied!<p>I am working on GUI appplication. From main window I open new popup window Dialog=myDialog() (so both are now open). If i press button on that new popup window, and catch signal with this code:</p> <pre><code>class Ui_DialogCalibration(object): def setupUi(self, DialogCalibration): DialogCalibration.setObjectName(_fromUtf8("DialogCalibration")) DialogCalibration.resize(888, 378) self.widget = QtGui.QWidget(DialogCalibration) self.widget.setGeometry(QtCore.QRect(10, 150, 641, 144)) self.widget.setObjectName(_fromUtf8("widget")) self.horizontalLayout_5 = QtGui.QHBoxLayout(self.widget) self.horizontalLayout_5.setMargin(0) self.horizontalLayout_5.setObjectName(_fromUtf8("horizontalLayout_5")) self.radioButtonManual = QtGui.QRadioButton(self.widget) self.radioButtonManual.setObjectName(_fromUtf8("radioButtonManual")) self.horizontalLayout_5.addWidget(self.radioButtonManual) self.verticalLayout = QtGui.QVBoxLayout() self.verticalLayout.setObjectName(_fromUtf8("verticalLayout")) self.horizontalLayout_4 = QtGui.QHBoxLayout() self.horizontalLayout_4.setObjectName(_fromUtf8("horizontalLayout_4")) self.verticalLayout_4 = QtGui.QVBoxLayout() self.verticalLayout_4.setObjectName(_fromUtf8("verticalLayout_4")) self.pushButtonDesnoX = QtGui.QPushButton(self.widget) self.pushButtonDesnoX.setObjectName(_fromUtf8("pushButtonDesnoX")) self.verticalLayout_4.addWidget(self.pushButtonDesnoX) self.lineEdit = QtGui.QLineEdit(self.widget) self.lineEdit.setText(_fromUtf8("")) self.lineEdit.setObjectName(_fromUtf8("lineEdit")) self.verticalLayout_4.addWidget(self.lineEdit) self.pushButtonLijevoX = QtGui.QPushButton(self.widget) self.pushButtonLijevoX.setObjectName(_fromUtf8("pushButtonLijevoX")) self.verticalLayout_4.addWidget(self.pushButtonLijevoX) self.horizontalLayout_4.addLayout(self.verticalLayout_4) self.verticalLayout_3 = QtGui.QVBoxLayout() self.verticalLayout_3.setObjectName(_fromUtf8("verticalLayout_3")) self.pushButtonDesnoY = QtGui.QPushButton(self.widget) self.pushButtonDesnoY.setObjectName(_fromUtf8("pushButtonDesnoY")) self.verticalLayout_3.addWidget(self.pushButtonDesnoY) self.lineEdit_2 = QtGui.QLineEdit(self.widget) self.lineEdit_2.setText(_fromUtf8("")) self.lineEdit_2.setObjectName(_fromUtf8("lineEdit_2")) self.verticalLayout_3.addWidget(self.lineEdit_2) self.pushButtonLijevoY = QtGui.QPushButton(self.widget) self.pushButtonLijevoY.setObjectName(_fromUtf8("pushButtonLijevoY")) self.verticalLayout_3.addWidget(self.pushButtonLijevoY) self.horizontalLayout_4.addLayout(self.verticalLayout_3) self.verticalLayout_2 = QtGui.QVBoxLayout() self.verticalLayout_2.setObjectName(_fromUtf8("verticalLayout_2")) self.pushButtonDesnoZ = QtGui.QPushButton(self.widget) self.pushButtonDesnoZ.setObjectName(_fromUtf8("pushButtonDesnoZ")) self.verticalLayout_2.addWidget(self.pushButtonDesnoZ) self.lineEdit_3 = QtGui.QLineEdit(self.widget) self.lineEdit_3.setText(_fromUtf8("")) self.lineEdit_3.setObjectName(_fromUtf8("lineEdit_3")) self.verticalLayout_2.addWidget(self.lineEdit_3) self.pushButtoLijevoZ = QtGui.QPushButton(self.widget) self.pushButtoLijevoZ.setObjectName(_fromUtf8("pushButtoLijevoZ")) self.verticalLayout_2.addWidget(self.pushButtoLijevoZ) self.horizontalLayout_4.addLayout(self.verticalLayout_2) self.verticalLayout.addLayout(self.horizontalLayout_4) self.pushButtonSondaSettings = QtGui.QPushButton(self.widget) self.pushButtonSondaSettings.setObjectName(_fromUtf8("pushButtonSondaSettings")) self.verticalLayout.addWidget(self.pushButtonSondaSettings) self.pushButtonReset = QtGui.QPushButton(self.widget) self.pushButtonReset.setObjectName(_fromUtf8("pushButtonReset")) self.verticalLayout.addWidget(self.pushButtonReset) self.horizontalLayout_5.addLayout(self.verticalLayout) self.verticalLayout_5 = QtGui.QVBoxLayout() self.verticalLayout_5.setObjectName(_fromUtf8("verticalLayout_5")) self.labelPozition = QtGui.QLabel(self.widget) self.labelPozition.setObjectName(_fromUtf8("labelPozition")) self.verticalLayout_5.addWidget(self.labelPozition) self.horizontalLayout = QtGui.QHBoxLayout() self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout")) self.labelpozitionX = QtGui.QLabel(self.widget) self.labelpozitionX.setObjectName(_fromUtf8("labelpozitionX")) self.horizontalLayout.addWidget(self.labelpozitionX) self.lineEditPozitionX = QtGui.QLineEdit(self.widget) self.lineEditPozitionX.setObjectName(_fromUtf8("lineEditPozitionX")) self.horizontalLayout.addWidget(self.lineEditPozitionX) self.verticalLayout_5.addLayout(self.horizontalLayout) self.horizontalLayout_2 = QtGui.QHBoxLayout() self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2")) self.labelPozitionY = QtGui.QLabel(self.widget) self.labelPozitionY.setObjectName(_fromUtf8("labelPozitionY")) self.horizontalLayout_2.addWidget(self.labelPozitionY) self.lineEditPozitionY = QtGui.QLineEdit(self.widget) self.lineEditPozitionY.setObjectName(_fromUtf8("lineEditPozitionY")) self.horizontalLayout_2.addWidget(self.lineEditPozitionY) self.verticalLayout_5.addLayout(self.horizontalLayout_2) self.horizontalLayout_3 = QtGui.QHBoxLayout() self.horizontalLayout_3.setObjectName(_fromUtf8("horizontalLayout_3")) self.labelPozitionZ = QtGui.QLabel(self.widget) self.labelPozitionZ.setObjectName(_fromUtf8("labelPozitionZ")) self.horizontalLayout_3.addWidget(self.labelPozitionZ) self.lineEditPozitionZ = QtGui.QLineEdit(self.widget) self.lineEditPozitionZ.setObjectName(_fromUtf8("lineEditPozitionZ")) self.horizontalLayout_3.addWidget(self.lineEditPozitionZ) self.verticalLayout_5.addLayout(self.horizontalLayout_3) self.horizontalLayout_5.addLayout(self.verticalLayout_5) self.widget1 = QtGui.QWidget(DialogCalibration) self.widget1.setGeometry(QtCore.QRect(20, 40, 631, 91)) self.widget1.setObjectName(_fromUtf8("widget1")) self.verticalLayout_6 = QtGui.QVBoxLayout(self.widget1) self.verticalLayout_6.setMargin(0) self.verticalLayout_6.setObjectName(_fromUtf8("verticalLayout_6")) self.radioButtonAutomatic = QtGui.QRadioButton(self.widget1) self.radioButtonAutomatic.setObjectName(_fromUtf8("radioButtonAutomatic")) self.verticalLayout_6.addWidget(self.radioButtonAutomatic) self.buttonBox = QtGui.QDialogButtonBox(self.widget1) self.buttonBox.setOrientation(QtCore.Qt.Horizontal) self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok) self.buttonBox.setObjectName(_fromUtf8("buttonBox")) self.verticalLayout_6.addWidget(self.buttonBox) self.labelpozitionX.setBuddy(self.lineEditPozitionX) self.labelPozitionY.setBuddy(self.lineEditPozitionY) self.labelPozitionZ.setBuddy(self.lineEditPozitionZ) self.radioButtonManual.toggle() self.buttonBox.setEnabled(False) self.pushButtonDesnoX.setEnabled(False) self.pushButtonDesnoY.setEnabled(False) self.pushButtonDesnoZ.setEnabled(False) self.pushButtonLijevoX.setEnabled(False) self.pushButtonLijevoY.setEnabled(False) self.pushButtoLijevoZ.setEnabled(False) self.pushButtonReset.setEnabled(False) self.lineEdit.setText("1") self.lineEdit_2.setText("1") self.lineEdit_3.setText("1") self.X=None self.Y=None self.Z=None self.retranslateUi(DialogCalibration) QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), DialogCalibration.accept) QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), DialogCalibration.reject) QtCore.QMetaObject.connectSlotsByName(DialogCalibration) class myDialog(QtGui.QDialog,Ui_DialogCalibration): def __init__(self,sonda, parent=None): super(myDialog, self).__init__( parent) self.toupleSonda=sonda self.setupUi(self) def on_pushButtonDesnoX_clicked(self): value=int(self.lineEdit.text()) self.X=self.X+value print self.X def retranslateUi(self, DialogCalibration): DialogCalibration.setWindowTitle(QtGui.QApplication.translate("DialogCalibration", "Calibration", None, QtGui.QApplication.UnicodeUTF8)) self.radioButtonManual.setText(QtGui.QApplication.translate("DialogCalibration", "manual", None, QtGui.QApplication.UnicodeUTF8)) self.pushButtonDesnoX.setText(QtGui.QApplication.translate("DialogCalibration", "Desno X", None, QtGui.QApplication.UnicodeUTF8)) self.pushButtonLijevoX.setText(QtGui.QApplication.translate("DialogCalibration", "Lijevo X", None, QtGui.QApplication.UnicodeUTF8)) self.pushButtonDesnoY.setText(QtGui.QApplication.translate("DialogCalibration", "Naprijed Y", None, QtGui.QApplication.UnicodeUTF8)) self.pushButtonLijevoY.setText(QtGui.QApplication.translate("DialogCalibration", "Nazad Y", None, QtGui.QApplication.UnicodeUTF8)) self.pushButtonDesnoZ.setText(QtGui.QApplication.translate("DialogCalibration", "Gore Z", None, QtGui.QApplication.UnicodeUTF8)) self.pushButtoLijevoZ.setText(QtGui.QApplication.translate("DialogCalibration", "Dolje Z", None, QtGui.QApplication.UnicodeUTF8)) self.pushButtonSondaSettings.setText(QtGui.QApplication.translate("DialogCalibration", "Load", None, QtGui.QApplication.UnicodeUTF8)) self.pushButtonReset.setText(QtGui.QApplication.translate("DialogCalibration", "Reset", None, QtGui.QApplication.UnicodeUTF8)) self.labelPozition.setText(QtGui.QApplication.translate("DialogCalibration", "Current pozition", None, QtGui.QApplication.UnicodeUTF8)) self.labelpozitionX.setText(QtGui.QApplication.translate("DialogCalibration", "X", None, QtGui.QApplication.UnicodeUTF8)) self.labelPozitionY.setText(QtGui.QApplication.translate("DialogCalibration", "Y", None, QtGui.QApplication.UnicodeUTF8)) self.labelPozitionZ.setText(QtGui.QApplication.translate("DialogCalibration", "Z", None, QtGui.QApplication.UnicodeUTF8)) self.radioButtonAutomatic.setText(QtGui.QApplication.translate("DialogCalibration", "automatic", None, QtGui.QApplication.UnicodeUTF8)) </code></pre> <p>I got this oouput</p> <p>1</p> <p>2</p> <p>So, this method has been executed twice. How can i fix this problem? Same happens on every other signal emmitted on popup window</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload