bonjour,
je débute avec qt, j'ai généré un fichier ui avec qt designer que j'ai convertit en .py avec
Code : Sélectionner tout - Visualiser dans une fenêtre à part
$ pyuic4 monui.ui > monpy.py
le fichier généré écrit explicitement:
WARNING! All changes made in this file will be lost!
dans ce fichier j'ai 2 ligne qui me confronte à un problème:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
QtCore.QObject.connect(self.buttonBox,QtCore.SIGNAL("accepted()"),Dialog.accept)
QtCore.QObject.connect(self.buttonBox,QtCore.SIGNAL("rejected()"),Dialog.reject)
hors dans ce fichier générer j'ai pas d'objet Dialog ni de méthode accept ou reject
comment fait onpour implémenter cet objet sans toucher à ce fichier .

le fichier généré par pyuic4
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# -*- coding: utf-8 -*-
from PyQt4 import QtCore, QtGui
 
class Ui_Dialog(object):
    def setupUi(self, Dialog):
        Dialog.setObjectName("Dialog")
        Dialog.resize(800,600)
        self.tabWidget = QtGui.QTabWidget(Dialog)
        self.tabWidget.setGeometry(QtCore.QRect(0,0,800,600))
        self.tabWidget.setObjectName("tabWidget")
        self.tab = QtGui.QWidget()
        self.tab.setObjectName("tab")
        self.buttonBox = QtGui.QDialogButtonBox(self.tab)
        self.buttonBox.setGeometry(QtCore.QRect(450,540,341,32))
        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
        self.buttonBox.setObjectName("buttonBox")
        self.comboBox = QtGui.QComboBox(self.tab)
        self.comboBox.setGeometry(QtCore.QRect(500,50,250,26))
        self.comboBox.setObjectName("comboBox")
        self.comboBox_2 = QtGui.QComboBox(self.tab)
        self.comboBox_2.setGeometry(QtCore.QRect(50,380,250,26))
        self.comboBox_2.setObjectName("comboBox_2")
        self.comboBox_3 = QtGui.QComboBox(self.tab)
        self.comboBox_3.setGeometry(QtCore.QRect(500,380,250,26))
        self.comboBox_3.setObjectName("comboBox_3")
        self.label1 = QtGui.QLabel(self.tab)
        self.label1.setGeometry(QtCore.QRect(500,20,250,17))
        font = QtGui.QFont()
        font.setPointSize(11)
        font.setWeight(75)
        font.setBold(True)
        self.label1.setFont(font)
        self.label1.setObjectName("label1")
        self.label2 = QtGui.QLabel(self.tab)
        self.label2.setGeometry(QtCore.QRect(50,360,250,17))
        font = QtGui.QFont()
        font.setPointSize(11)
        font.setWeight(75)
        font.setBold(True)
        self.label2.setFont(font)
        self.label2.setObjectName("label2")
        self.label = QtGui.QLabel(self.tab)
        self.label.setGeometry(QtCore.QRect(500,350,250,17))
        font = QtGui.QFont()
        font.setPointSize(11)
        font.setWeight(75)
        font.setBold(True)
        self.label.setFont(font)
        self.label.setObjectName("label")
        self.comboBox_4 = QtGui.QComboBox(self.tab)
        self.comboBox_4.setGeometry(QtCore.QRect(50,250,250,26))
        self.comboBox_4.setObjectName("comboBox_4")
        self.label_2 = QtGui.QLabel(self.tab)
        self.label_2.setGeometry(QtCore.QRect(500,220,250,17))
        font = QtGui.QFont()
        font.setPointSize(11)
        font.setWeight(75)
        font.setBold(True)
        self.label_2.setFont(font)
        self.label_2.setObjectName("label_2")
        self.label2_2 = QtGui.QLabel(self.tab)
        self.label2_2.setGeometry(QtCore.QRect(50,230,250,17))
        font = QtGui.QFont()
        font.setPointSize(11)
        font.setWeight(75)
        font.setBold(True)
        self.label2_2.setFont(font)
        self.label2_2.setObjectName("label2_2")
        self.comboBox_5 = QtGui.QComboBox(self.tab)
        self.comboBox_5.setGeometry(QtCore.QRect(500,250,250,26))
        self.comboBox_5.setObjectName("comboBox_5")
        self.tabWidget.addTab(self.tab,"")
        self.tab_2 = QtGui.QWidget()
        self.tab_2.setObjectName("tab_2")
        self.comboBox_6 = QtGui.QComboBox(self.tab_2)
        self.comboBox_6.setGeometry(QtCore.QRect(20,110,250,26))
        self.comboBox_6.setObjectName("comboBox_6")
        self.label2_3 = QtGui.QLabel(self.tab_2)
        self.label2_3.setGeometry(QtCore.QRect(20,90,250,17))
        font = QtGui.QFont()
        font.setPointSize(11)
        font.setWeight(75)
        font.setBold(True)
        self.label2_3.setFont(font)
        self.label2_3.setObjectName("label2_3")
        self.buttonBox_2 = QtGui.QDialogButtonBox(self.tab_2)
        self.buttonBox_2.setGeometry(QtCore.QRect(450,540,341,32))
        self.buttonBox_2.setOrientation(QtCore.Qt.Horizontal)
        self.buttonBox_2.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
        self.buttonBox_2.setObjectName("buttonBox_2")
        self.TextEdit = QtGui.QPlainTextEdit(self.tab_2)
        self.TextEdit.setGeometry(QtCore.QRect(20,260,771,241))
        self.TextEdit.setObjectName("TextEdit")
        self.label_3 = QtGui.QLabel(self.tab_2)
        self.label_3.setGeometry(QtCore.QRect(20,230,250,17))
        font = QtGui.QFont()
        font.setPointSize(11)
        font.setWeight(75)
        font.setBold(True)
        self.label_3.setFont(font)
        self.label_3.setObjectName("label_3")
        self.tabWidget.addTab(self.tab_2,"")
 
        self.retranslateUi(Dialog)
        self.tabWidget.setCurrentIndex(1)
        QtCore.QObject.connect(self.buttonBox,QtCore.SIGNAL("accepted()"),Dialog.accept)
        QtCore.QObject.connect(self.buttonBox,QtCore.SIGNAL("rejected()"),Dialog.reject)
        QtCore.QMetaObject.connectSlotsByName(Dialog)
 
    def retranslateUi(self, Dialog):
        Dialog.setWindowTitle(QtGui.QApplication.translate("Dialog", "Dialog", None, QtGui.QApplication.UnicodeUTF8))
        self.label1.setText(QtGui.QApplication.translate("Dialog", "Choisir un modèle de document", None, QtGui.QApplication.UnicodeUTF8))
        self.label2.setText(QtGui.QApplication.translate("Dialog", "Choisr un style", None, QtGui.QApplication.UnicodeUTF8))
        self.label.setText(QtGui.QApplication.translate("Dialog", "Choisir une condition", None, QtGui.QApplication.UnicodeUTF8))
        self.label_2.setText(QtGui.QApplication.translate("Dialog", "Choisir une bibliothèque de condition", None, QtGui.QApplication.UnicodeUTF8))
        self.label2_2.setText(QtGui.QApplication.translate("Dialog", "Choisr une bibliothèque de style", None, QtGui.QApplication.UnicodeUTF8))
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), QtGui.QApplication.translate("Dialog", "Générateur", None, QtGui.QApplication.UnicodeUTF8))
        self.label2_3.setText(QtGui.QApplication.translate("Dialog", "Choisr un type de bibliothèque", None, QtGui.QApplication.UnicodeUTF8))
        self.label_3.setText(QtGui.QApplication.translate("Dialog", "Expression à saisir:", None, QtGui.QApplication.UnicodeUTF8))
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), QtGui.QApplication.translate("Dialog", "Éditeur", None, QtGui.QApplication.UnicodeUTF8))
En vous remerciant par avance de votre attention et de votre aide.
merci