IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

PyQt Python Discussion :

Comment effectuer des actions sur des onglets ajoutés dynamiquement et ayant le même contenu ?


Sujet :

PyQt Python

  1. #1
    Membre confirmé
    Femme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Mars 2013
    Messages
    61
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur développement logiciels

    Informations forums :
    Inscription : Mars 2013
    Messages : 61
    Par défaut Comment effectuer des actions sur des onglets ajoutés dynamiquement et ayant le même contenu ?
    J'ai ajouté mes tabs dynamiquement comme ceci :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    def add_new_tab(self,index,text):
     
        self.new_tab = InterfaceTemplateDialog()
        self.tabs.addTab(self.new_tab,text)
        self.tabs.setTabText(index,text)
    Ma classe InterfaceTemplateDialog qui définit le contenu des tabs :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    class InterfaceTemplateDialog(QtGui.QDialog, FORM_CLASS):
     
    def __init__(self,parent=None):
        """Constructor."""
        super(InterfaceTemplateDialog, self).__init__(parent)
     
        self.setupUi(self)
     
     
        self.run_tranus_btn = self.findChild(QtGui.QPushButton,'run_tranus_btn')
        self.spin_box = self.findChild(QtGui.QSpinBox,'spinBox')
     
        #imploc checkboxes 
        self.checkBox_22 = self.findChild(QtGui.QCheckBox,'checkBox_22') ....etc
    C'est vrai que je peux connaitre le tab qui est sélectionné en utilisant la méthode
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    self.tabs.currentIndex()
    mais ce que je veux connaitre c'est si jamais j'appuie sur un bouton je pourrais savoir dans quel tab l'action a été réalisée (tab 1 ou 2 ou ...).

  2. #2
    Expert confirmé

    Homme Profil pro
    Inscrit en
    Octobre 2008
    Messages
    4 308
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Belgique

    Informations forums :
    Inscription : Octobre 2008
    Messages : 4 308
    Par défaut
    Salut,

    mais ce que je veux connaitre c'est si jamais j'appuie sur un bouton je pourrais savoir dans quel tab l'action a été réalisée (tab 1 ou 2 ou ...).
    Heu, quelle action ?


    Par contre ton code est surprenant, Les onglets sont de simples QWidgets or tu les fait hériter de QDialog, pourquoi diable !?

    Et aussi de FORM_CLASS qui, me dit mon petit doigt, est un widget que tu as créé avec Designer. Si c'est bien le cas supprime ce QDialog.

    Tu n'as, non plus, aucun besoin de rechercher tes widgets avec findChild si tu connais leur nom.

    Pour t'en convaincre ajoute un print juste après le setupUi, comme ceci:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
     
        self.setupUi(self)
        print(self.run_tranus_btn.text(), self.spinBox.value())

  3. #3
    Membre confirmé
    Femme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Mars 2013
    Messages
    61
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur développement logiciels

    Informations forums :
    Inscription : Mars 2013
    Messages : 61
    Par défaut
    Bonjour,

    Merci pour votre réponse. Juste pour ajouter le contexte, je suis en train de développer un plugin Python sur QGIS.
    C'est vrai que je n'ai pas besoin de chercher les widgets par findchild ( ton print marche correctement ) mais ce n'est pas mon problème pour l'instant.
    FORM CLASS est un widget que j'ai créé avec QT Creator.
    Quand j'ai enlevé QDialog, j'ai eu cette erreur :
    TypeError: object.__init__() takes no parameters 
    Traceback (most recent call last):
      File "C:/Users/emna/.qgis2/python/plugins\OptionsTRANUS\options_tranus_dialog.py", line 112, in launch_options_TRANUS
        dialog.show()
      File "C:/Users/emna/.qgis2/python/plugins\OptionsTRANUS\launch_tranus_dialog.py", line 54, in show
        self.put_tabs()
      File "C:/Users/emna/.qgis2/python/plugins\OptionsTRANUS\launch_tranus_dialog.py", line 41, in put_tabs
        self.add_new_tab(index,title)
      File "C:/Users/emna/.qgis2/python/plugins\OptionsTRANUS\launch_tranus_dialog.py", line 48, in add_new_tab
        self.new_tab = InterfaceTemplateDialog()
      File "C:/Users/emna/.qgis2/python/plugins\OptionsTRANUS\interface_template.py", line 15, in __init__
        super(InterfaceTemplateDialog, self).__init__(parent)
    TypeError: object.__init__() takes no parameters
    
    Le résultat de ton print est :
    (u'Run TRANUS', 0)
    (u'Run TRANUS', 0)
    (u'Run TRANUS', 0)
    J'ai 3 tabs pour cet exemple, si jamais je clique sur le bouton Run TRANUS ou j’incrémente le spinbox comment je peux connaitre sur quel tab ( tab 1 ou tab 2 ou tab 3) l'action a été réalisée.

  4. #4
    Expert confirmé

    Homme Profil pro
    Inscrit en
    Octobre 2008
    Messages
    4 308
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Belgique

    Informations forums :
    Inscription : Octobre 2008
    Messages : 4 308
    Par défaut
    Supprime le parent de cette ligne là:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
        super(InterfaceTemplateDialog, self).__init__(parent)
    Pour ton problème, soit tu mets un bouton dans chaque onglet, soit tu implémentes un signal sur chacun des widgets et tu maintiens une liste des dernières actions effectuées.

    La première solution me paraît plus simple.

  5. #5
    Membre confirmé
    Femme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Mars 2013
    Messages
    61
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur développement logiciels

    Informations forums :
    Inscription : Mars 2013
    Messages : 61
    Par défaut
    Je l'ai supprimé mais ça affiche aussi un problème : AttributeError: 'InterfaceTemplateDialog' object has no attribute 'setObjectName

    Effectivement, j'ai mis un bouton dans chaque onglet (le même bouton). Quand je clique sur le bouton et que ça réalise une action, je ne sais pas de quel tab j'ai cliqué. Mon problème est de relier les références des tabs avec les actions sur chaque tab. J'essaie d'ajouter un attribut index dans la classe IntefaceTemplateDialog. Je suis en train de voir.

  6. #6
    Expert confirmé

    Homme Profil pro
    Inscrit en
    Octobre 2008
    Messages
    4 308
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Belgique

    Informations forums :
    Inscription : Octobre 2008
    Messages : 4 308
    Par défaut
    Je ne comprend pas très bien pourquoi tu parles de QtCreator, je sais qu'on peut y implémenter le support de Python (il doit y avoir un tuto à ce sujet sur ce site) mais pour les widgets des onglets je pense que tu as utilisé le Designer (éventuellement instancié à partir de QtCreator).

    Quoiqu'il en soit il est possible qu'au lieu de créer un QWidget tu n'aies fais qu'une Forme. Ce qui ne convient pas, les onglets doivent être des widgets.

    Ça marchait précédemment parce que tu camouflais ta Form derrière un QDialog.

    Tu peux copier ici le contenu du fichier ui ?

  7. #7
    Membre confirmé
    Femme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Mars 2013
    Messages
    61
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur développement logiciels

    Informations forums :
    Inscription : Mars 2013
    Messages : 61
    Par défaut Fichier .ui
    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
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    from PyQt4 import QtCore, QtGui
     
    try:
        _fromUtf8 = QtCore.QString.fromUtf8
    except AttributeError:
        def _fromUtf8(s):
            return s
     
    try:
        _encoding = QtGui.QApplication.UnicodeUTF8
        def _translate(context, text, disambig):
            return QtGui.QApplication.translate(context, text, disambig, _encoding)
    except AttributeError:
        def _translate(context, text, disambig):
            return QtGui.QApplication.translate(context, text, disambig)
     
    class Ui_tab(object):
        def setupUi(self, tab):
            tab.setObjectName(_fromUtf8("tab"))
            tab.resize(688, 1112)
            self.verticalLayout = QtGui.QVBoxLayout(tab)
            self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
            self.gridLayout = QtGui.QGridLayout()
            self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
            self.spinBox = QtGui.QSpinBox(tab)
            self.spinBox.setObjectName(_fromUtf8("spinBox"))
            self.gridLayout.addWidget(self.spinBox, 0, 3, 1, 1)
            self.run_tranus_btn = QtGui.QPushButton(tab)
            self.run_tranus_btn.setObjectName(_fromUtf8("run_tranus_btn"))
            self.gridLayout.addWidget(self.run_tranus_btn, 0, 2, 1, 1)
            self.label = QtGui.QLabel(tab)
            self.label.setObjectName(_fromUtf8("label"))
            self.gridLayout.addWidget(self.label, 0, 0, 1, 1)
            spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
            self.gridLayout.addItem(spacerItem, 0, 1, 1, 1)
            self.verticalLayout.addLayout(self.gridLayout)
            self.gridLayout_3 = QtGui.QGridLayout()
            self.gridLayout_3.setObjectName(_fromUtf8("gridLayout_3"))
            self.label_27 = QtGui.QLabel(tab)
            self.label_27.setObjectName(_fromUtf8("label_27"))
            self.gridLayout_3.addWidget(self.label_27, 1, 0, 1, 1)
            spacerItem1 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
            self.gridLayout_3.addItem(spacerItem1, 1, 1, 1, 1)
            self.label_28 = QtGui.QLabel(tab)
            font = QtGui.QFont()
            font.setPointSize(10)
            font.setBold(True)
            font.setWeight(75)
            self.label_28.setFont(font)
            self.label_28.setObjectName(_fromUtf8("label_28"))
            self.gridLayout_3.addWidget(self.label_28, 0, 0, 1, 1)
            self.checkBox_22 = QtGui.QCheckBox(tab)
            self.checkBox_22.setText(_fromUtf8(""))
            self.checkBox_22.setObjectName(_fromUtf8("checkBox_22"))
            self.gridLayout_3.addWidget(self.checkBox_22, 1, 5, 1, 1)
            self.label_29 = QtGui.QLabel(tab)
            self.label_29.setObjectName(_fromUtf8("label_29"))
            self.gridLayout_3.addWidget(self.label_29, 7, 0, 1, 1)
            self.checkBox_29 = QtGui.QCheckBox(tab)
            self.checkBox_29.setText(_fromUtf8(""))
            self.checkBox_29.setObjectName(_fromUtf8("checkBox_29"))
            self.gridLayout_3.addWidget(self.checkBox_29, 5, 5, 1, 1)
            spacerItem2 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
            self.gridLayout_3.addItem(spacerItem2, 1, 6, 1, 1)
            self.checkBox_25 = QtGui.QCheckBox(tab)
            self.checkBox_25.setText(_fromUtf8(""))
            self.checkBox_25.setObjectName(_fromUtf8("checkBox_25"))
            self.gridLayout_3.addWidget(self.checkBox_25, 4, 5, 1, 1)
            self.label_31 = QtGui.QLabel(tab)
            self.label_31.setObjectName(_fromUtf8("label_31"))
            self.gridLayout_3.addWidget(self.label_31, 8, 0, 1, 1)
            self.checkBox_20 = QtGui.QCheckBox(tab)
            self.checkBox_20.setText(_fromUtf8(""))
            self.checkBox_20.setObjectName(_fromUtf8("checkBox_20"))
            self.gridLayout_3.addWidget(self.checkBox_20, 8, 5, 1, 1)
            self.label_26 = QtGui.QLabel(tab)
            self.label_26.setObjectName(_fromUtf8("label_26"))
            self.gridLayout_3.addWidget(self.label_26, 5, 0, 1, 1)
            self.checkBox_27 = QtGui.QCheckBox(tab)
            self.checkBox_27.setText(_fromUtf8(""))
            self.checkBox_27.setObjectName(_fromUtf8("checkBox_27"))
            self.gridLayout_3.addWidget(self.checkBox_27, 2, 5, 1, 1)
            self.label_24 = QtGui.QLabel(tab)
            self.label_24.setObjectName(_fromUtf8("label_24"))
            self.gridLayout_3.addWidget(self.label_24, 3, 0, 1, 1)
            self.checkBox_28 = QtGui.QCheckBox(tab)
            self.checkBox_28.setText(_fromUtf8(""))
            self.checkBox_28.setObjectName(_fromUtf8("checkBox_28"))
            self.gridLayout_3.addWidget(self.checkBox_28, 7, 5, 1, 1)
            self.checkBox_23 = QtGui.QCheckBox(tab)
            self.checkBox_23.setText(_fromUtf8(""))
            self.checkBox_23.setObjectName(_fromUtf8("checkBox_23"))
            self.gridLayout_3.addWidget(self.checkBox_23, 3, 5, 1, 1)
            self.label_34 = QtGui.QLabel(tab)
            self.label_34.setObjectName(_fromUtf8("label_34"))
            self.gridLayout_3.addWidget(self.label_34, 6, 0, 1, 1)
            self.label_25 = QtGui.QLabel(tab)
            self.label_25.setObjectName(_fromUtf8("label_25"))
            self.gridLayout_3.addWidget(self.label_25, 4, 0, 1, 1)
            self.label_30 = QtGui.QLabel(tab)
            self.label_30.setObjectName(_fromUtf8("label_30"))
            self.gridLayout_3.addWidget(self.label_30, 2, 0, 1, 1)
            self.checkBox_30 = QtGui.QCheckBox(tab)
            self.checkBox_30.setText(_fromUtf8(""))
            self.checkBox_30.setObjectName(_fromUtf8("checkBox_30"))
            self.gridLayout_3.addWidget(self.checkBox_30, 6, 5, 1, 1)
            self.verticalLayout.addLayout(self.gridLayout_3)
            self.gridLayout_8 = QtGui.QGridLayout()
            self.gridLayout_8.setObjectName(_fromUtf8("gridLayout_8"))
            self.label_69 = QtGui.QLabel(tab)
            self.label_69.setObjectName(_fromUtf8("label_69"))
            self.gridLayout_8.addWidget(self.label_69, 8, 0, 1, 1)
            self.checkBox_62 = QtGui.QCheckBox(tab)
            self.checkBox_62.setText(_fromUtf8(""))
            self.checkBox_62.setObjectName(_fromUtf8("checkBox_62"))
            self.gridLayout_8.addWidget(self.checkBox_62, 10, 5, 1, 1)
            self.label_70 = QtGui.QLabel(tab)
            self.label_70.setObjectName(_fromUtf8("label_70"))
            self.gridLayout_8.addWidget(self.label_70, 3, 0, 1, 1)
            self.label_71 = QtGui.QLabel(tab)
            self.label_71.setObjectName(_fromUtf8("label_71"))
            self.gridLayout_8.addWidget(self.label_71, 4, 0, 1, 1)
            self.label_72 = QtGui.QLabel(tab)
            self.label_72.setObjectName(_fromUtf8("label_72"))
            self.gridLayout_8.addWidget(self.label_72, 5, 0, 1, 1)
            spacerItem3 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
            self.gridLayout_8.addItem(spacerItem3, 1, 1, 1, 1)
            self.checkBox_63 = QtGui.QCheckBox(tab)
            self.checkBox_63.setText(_fromUtf8(""))
            self.checkBox_63.setObjectName(_fromUtf8("checkBox_63"))
            self.gridLayout_8.addWidget(self.checkBox_63, 11, 5, 1, 1)
            self.checkBox_64 = QtGui.QCheckBox(tab)
            self.checkBox_64.setText(_fromUtf8(""))
            self.checkBox_64.setObjectName(_fromUtf8("checkBox_64"))
            self.gridLayout_8.addWidget(self.checkBox_64, 1, 5, 1, 1)
            self.label_73 = QtGui.QLabel(tab)
            self.label_73.setObjectName(_fromUtf8("label_73"))
            self.gridLayout_8.addWidget(self.label_73, 1, 0, 1, 1)
            self.checkBox_65 = QtGui.QCheckBox(tab)
            self.checkBox_65.setText(_fromUtf8(""))
            self.checkBox_65.setObjectName(_fromUtf8("checkBox_65"))
            self.gridLayout_8.addWidget(self.checkBox_65, 3, 5, 1, 1)
            self.checkBox_66 = QtGui.QCheckBox(tab)
            self.checkBox_66.setText(_fromUtf8(""))
            self.checkBox_66.setObjectName(_fromUtf8("checkBox_66"))
            self.gridLayout_8.addWidget(self.checkBox_66, 7, 5, 1, 1)
            self.checkBox_67 = QtGui.QCheckBox(tab)
            self.checkBox_67.setText(_fromUtf8(""))
            self.checkBox_67.setObjectName(_fromUtf8("checkBox_67"))
            self.gridLayout_8.addWidget(self.checkBox_67, 4, 5, 1, 1)
            self.label_75 = QtGui.QLabel(tab)
            self.label_75.setObjectName(_fromUtf8("label_75"))
            self.gridLayout_8.addWidget(self.label_75, 9, 0, 1, 1)
            self.label_76 = QtGui.QLabel(tab)
            self.label_76.setObjectName(_fromUtf8("label_76"))
            self.gridLayout_8.addWidget(self.label_76, 2, 0, 1, 1)
            self.checkBox_68 = QtGui.QCheckBox(tab)
            self.checkBox_68.setText(_fromUtf8(""))
            self.checkBox_68.setObjectName(_fromUtf8("checkBox_68"))
            self.gridLayout_8.addWidget(self.checkBox_68, 8, 5, 1, 1)
            self.checkBox_69 = QtGui.QCheckBox(tab)
            self.checkBox_69.setText(_fromUtf8(""))
            self.checkBox_69.setObjectName(_fromUtf8("checkBox_69"))
            self.gridLayout_8.addWidget(self.checkBox_69, 2, 5, 1, 1)
            self.label_77 = QtGui.QLabel(tab)
            self.label_77.setObjectName(_fromUtf8("label_77"))
            self.gridLayout_8.addWidget(self.label_77, 10, 0, 1, 1)
            self.checkBox_70 = QtGui.QCheckBox(tab)
            self.checkBox_70.setText(_fromUtf8(""))
            self.checkBox_70.setObjectName(_fromUtf8("checkBox_70"))
            self.gridLayout_8.addWidget(self.checkBox_70, 9, 5, 1, 1)
            self.label_78 = QtGui.QLabel(tab)
            self.label_78.setObjectName(_fromUtf8("label_78"))
            self.gridLayout_8.addWidget(self.label_78, 11, 0, 1, 1)
            self.checkBox_71 = QtGui.QCheckBox(tab)
            self.checkBox_71.setText(_fromUtf8(""))
            self.checkBox_71.setObjectName(_fromUtf8("checkBox_71"))
            self.gridLayout_8.addWidget(self.checkBox_71, 5, 5, 1, 1)
            self.label_79 = QtGui.QLabel(tab)
            self.label_79.setObjectName(_fromUtf8("label_79"))
            self.gridLayout_8.addWidget(self.label_79, 7, 0, 1, 1)
            self.checkBox_72 = QtGui.QCheckBox(tab)
            self.checkBox_72.setText(_fromUtf8(""))
            self.checkBox_72.setObjectName(_fromUtf8("checkBox_72"))
            self.gridLayout_8.addWidget(self.checkBox_72, 6, 5, 1, 1)
            self.label_80 = QtGui.QLabel(tab)
            self.label_80.setObjectName(_fromUtf8("label_80"))
            self.gridLayout_8.addWidget(self.label_80, 6, 0, 1, 1)
            spacerItem4 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
            self.gridLayout_8.addItem(spacerItem4, 1, 6, 1, 1)
            self.label_74 = QtGui.QLabel(tab)
            font = QtGui.QFont()
            font.setPointSize(10)
            font.setBold(True)
            font.setWeight(75)
            self.label_74.setFont(font)
            self.label_74.setObjectName(_fromUtf8("label_74"))
            self.gridLayout_8.addWidget(self.label_74, 0, 0, 1, 1)
            self.verticalLayout.addLayout(self.gridLayout_8)
            self.gridLayout_5 = QtGui.QGridLayout()
            self.gridLayout_5.setObjectName(_fromUtf8("gridLayout_5"))
            self.label_6 = QtGui.QLabel(tab)
            self.label_6.setObjectName(_fromUtf8("label_6"))
            self.gridLayout_5.addWidget(self.label_6, 14, 0, 1, 1)
            self.label_54 = QtGui.QLabel(tab)
            font = QtGui.QFont()
            font.setPointSize(10)
            font.setBold(True)
            font.setWeight(75)
            self.label_54.setFont(font)
            self.label_54.setObjectName(_fromUtf8("label_54"))
            self.gridLayout_5.addWidget(self.label_54, 0, 0, 1, 1)
            self.label_46 = QtGui.QLabel(tab)
            self.label_46.setObjectName(_fromUtf8("label_46"))
            self.gridLayout_5.addWidget(self.label_46, 8, 0, 1, 1)
            self.checkBox_41 = QtGui.QCheckBox(tab)
            self.checkBox_41.setText(_fromUtf8(""))
            self.checkBox_41.setObjectName(_fromUtf8("checkBox_41"))
            self.gridLayout_5.addWidget(self.checkBox_41, 10, 5, 1, 1)
            self.label_47 = QtGui.QLabel(tab)
            self.label_47.setObjectName(_fromUtf8("label_47"))
            self.gridLayout_5.addWidget(self.label_47, 3, 0, 1, 1)
            self.label_48 = QtGui.QLabel(tab)
            self.label_48.setObjectName(_fromUtf8("label_48"))
            self.gridLayout_5.addWidget(self.label_48, 4, 0, 1, 1)
            self.label_49 = QtGui.QLabel(tab)
            self.label_49.setObjectName(_fromUtf8("label_49"))
            self.gridLayout_5.addWidget(self.label_49, 5, 0, 1, 1)
            spacerItem5 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
            self.gridLayout_5.addItem(spacerItem5, 1, 1, 1, 1)
            self.checkBox_42 = QtGui.QCheckBox(tab)
            self.checkBox_42.setText(_fromUtf8(""))
            self.checkBox_42.setObjectName(_fromUtf8("checkBox_42"))
            self.gridLayout_5.addWidget(self.checkBox_42, 1, 5, 1, 1)
            spacerItem6 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
            self.gridLayout_5.addItem(spacerItem6, 1, 6, 1, 1)
            self.checkBox_43 = QtGui.QCheckBox(tab)
            self.checkBox_43.setText(_fromUtf8(""))
            self.checkBox_43.setObjectName(_fromUtf8("checkBox_43"))
            self.gridLayout_5.addWidget(self.checkBox_43, 2, 5, 1, 1)
            self.label_50 = QtGui.QLabel(tab)
            self.label_50.setObjectName(_fromUtf8("label_50"))
            self.gridLayout_5.addWidget(self.label_50, 10, 0, 1, 1)
            self.checkBox_44 = QtGui.QCheckBox(tab)
            self.checkBox_44.setText(_fromUtf8(""))
            self.checkBox_44.setObjectName(_fromUtf8("checkBox_44"))
            self.gridLayout_5.addWidget(self.checkBox_44, 9, 5, 1, 1)
            self.checkBox_45 = QtGui.QCheckBox(tab)
            self.checkBox_45.setText(_fromUtf8(""))
            self.checkBox_45.setObjectName(_fromUtf8("checkBox_45"))
            self.gridLayout_5.addWidget(self.checkBox_45, 5, 5, 1, 1)
            self.label_51 = QtGui.QLabel(tab)
            self.label_51.setObjectName(_fromUtf8("label_51"))
            self.gridLayout_5.addWidget(self.label_51, 7, 0, 1, 1)
            self.checkBox_46 = QtGui.QCheckBox(tab)
            self.checkBox_46.setText(_fromUtf8(""))
            self.checkBox_46.setObjectName(_fromUtf8("checkBox_46"))
            self.gridLayout_5.addWidget(self.checkBox_46, 6, 5, 1, 1)
            self.label_52 = QtGui.QLabel(tab)
            self.label_52.setObjectName(_fromUtf8("label_52"))
            self.gridLayout_5.addWidget(self.label_52, 6, 0, 1, 1)
            self.label_53 = QtGui.QLabel(tab)
            self.label_53.setObjectName(_fromUtf8("label_53"))
            self.gridLayout_5.addWidget(self.label_53, 1, 0, 1, 1)
            self.checkBox_47 = QtGui.QCheckBox(tab)
            self.checkBox_47.setText(_fromUtf8(""))
            self.checkBox_47.setObjectName(_fromUtf8("checkBox_47"))
            self.gridLayout_5.addWidget(self.checkBox_47, 3, 5, 1, 1)
            self.checkBox_48 = QtGui.QCheckBox(tab)
            self.checkBox_48.setText(_fromUtf8(""))
            self.checkBox_48.setObjectName(_fromUtf8("checkBox_48"))
            self.gridLayout_5.addWidget(self.checkBox_48, 7, 5, 1, 1)
            self.checkBox_49 = QtGui.QCheckBox(tab)
            self.checkBox_49.setText(_fromUtf8(""))
            self.checkBox_49.setObjectName(_fromUtf8("checkBox_49"))
            self.gridLayout_5.addWidget(self.checkBox_49, 4, 5, 1, 1)
            self.label_55 = QtGui.QLabel(tab)
            self.label_55.setObjectName(_fromUtf8("label_55"))
            self.gridLayout_5.addWidget(self.label_55, 9, 0, 1, 1)
            self.label_56 = QtGui.QLabel(tab)
            self.label_56.setObjectName(_fromUtf8("label_56"))
            self.gridLayout_5.addWidget(self.label_56, 2, 0, 1, 1)
            self.checkBox_50 = QtGui.QCheckBox(tab)
            self.checkBox_50.setText(_fromUtf8(""))
            self.checkBox_50.setObjectName(_fromUtf8("checkBox_50"))
            self.gridLayout_5.addWidget(self.checkBox_50, 8, 5, 1, 1)
            self.label_3 = QtGui.QLabel(tab)
            self.label_3.setObjectName(_fromUtf8("label_3"))
            self.gridLayout_5.addWidget(self.label_3, 11, 0, 1, 1)
            self.checkBox_4 = QtGui.QCheckBox(tab)
            self.checkBox_4.setText(_fromUtf8(""))
            self.checkBox_4.setObjectName(_fromUtf8("checkBox_4"))
            self.gridLayout_5.addWidget(self.checkBox_4, 14, 5, 1, 1)
            self.checkBox = QtGui.QCheckBox(tab)
            self.checkBox.setText(_fromUtf8(""))
            self.checkBox.setObjectName(_fromUtf8("checkBox"))
            self.gridLayout_5.addWidget(self.checkBox, 11, 5, 1, 1)
            self.label_5 = QtGui.QLabel(tab)
            self.label_5.setObjectName(_fromUtf8("label_5"))
            self.gridLayout_5.addWidget(self.label_5, 13, 0, 1, 1)
            self.checkBox_2 = QtGui.QCheckBox(tab)
            self.checkBox_2.setText(_fromUtf8(""))
            self.checkBox_2.setObjectName(_fromUtf8("checkBox_2"))
            self.gridLayout_5.addWidget(self.checkBox_2, 12, 5, 1, 1)
            self.label_4 = QtGui.QLabel(tab)
            self.label_4.setObjectName(_fromUtf8("label_4"))
            self.gridLayout_5.addWidget(self.label_4, 12, 0, 1, 1)
            self.checkBox_3 = QtGui.QCheckBox(tab)
            self.checkBox_3.setText(_fromUtf8(""))
            self.checkBox_3.setObjectName(_fromUtf8("checkBox_3"))
            self.gridLayout_5.addWidget(self.checkBox_3, 13, 5, 1, 1)
            self.label_7 = QtGui.QLabel(tab)
            self.label_7.setObjectName(_fromUtf8("label_7"))
            self.gridLayout_5.addWidget(self.label_7, 15, 0, 1, 1)
            self.checkBox_5 = QtGui.QCheckBox(tab)
            self.checkBox_5.setText(_fromUtf8(""))
            self.checkBox_5.setObjectName(_fromUtf8("checkBox_5"))
            self.gridLayout_5.addWidget(self.checkBox_5, 15, 5, 1, 1)
            self.verticalLayout.addLayout(self.gridLayout_5)
            self.horizontalLayout = QtGui.QHBoxLayout()
            self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
            self.generate_btn = QtGui.QPushButton(tab)
            self.generate_btn.setObjectName(_fromUtf8("generate_btn"))
            self.horizontalLayout.addWidget(self.generate_btn)
            spacerItem7 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
            self.horizontalLayout.addItem(spacerItem7)
            spacerItem8 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
            self.horizontalLayout.addItem(spacerItem8)
            self.check_all_btn = QtGui.QPushButton(tab)
            self.check_all_btn.setObjectName(_fromUtf8("check_all_btn"))
            self.horizontalLayout.addWidget(self.check_all_btn)
            spacerItem9 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
            self.horizontalLayout.addItem(spacerItem9)
            self.verticalLayout.addLayout(self.horizontalLayout)
            self.console = QtGui.QTextBrowser(tab)
            self.console.setObjectName(_fromUtf8("console"))
            self.verticalLayout.addWidget(self.console)
     
            self.retranslateUi(tab)
            QtCore.QMetaObject.connectSlotsByName(tab)
     
        def retranslateUi(self, tab):
            tab.setWindowTitle(_translate("tab", "Options TRANUS", None))
            self.run_tranus_btn.setText(_translate("tab", "Run TRANUS", None))
            self.label.setText(_translate("tab", "Run TRANUS to generate the basic files needed for the other operations TRANUS", None))
            self.label_27.setText(_translate("tab", "Run", None))
            self.label_28.setText(_translate("tab", "Imploc", None))
            self.label_29.setText(_translate("tab", "Consumption coefficients by sector", None))
            self.label_31.setText(_translate("tab", "Total consumption by sector and zone", None))
            self.label_26.setText(_translate("tab", "Total production by year/policy", None))
            self.label_24.setText(_translate("tab", "All information, comma-delimited", None))
            self.label_34.setText(_translate("tab", "Internal information by sector and zone", None))
            self.label_25.setText(_translate("tab", "Total production by sector and zone", None))
            self.label_30.setText(_translate("tab", "All information by sector and zone", None))
            self.label_69.setText(_translate("tab", "Link Route & category profile", None))
            self.label_70.setText(_translate("tab", "Cordons (only with IMPTRA.DAT)", None))
            self.label_71.setText(_translate("tab", "Filter links by Demand/Capacity range", None))
            self.label_72.setText(_translate("tab", "Table of indicators", None))
            self.label_73.setText(_translate("tab", "Run", None))
            self.label_75.setText(_translate("tab", "Transit Routes profiles", None))
            self.label_76.setText(_translate("tab", "Report all links", None))
            self.label_77.setText(_translate("tab", "Route profile in comma delimited format", None))
            self.label_78.setText(_translate("tab", "Report specified link types", None))
            self.label_79.setText(_translate("tab", "Report specified links", None))
            self.label_80.setText(_translate("tab", "Indicators in comma delimited format ", None))
            self.label_74.setText(_translate("tab", "Imptra", None))
            self.label_6.setText(_translate("tab", "Exogenous trips by transport category", None))
            self.label_54.setText(_translate("tab", "Mats", None))
            self.label_46.setText(_translate("tab", "Total trips (sum of categories)", None))
            self.label_47.setText(_translate("tab", "Disut. by mode and transport category", None))
            self.label_48.setText(_translate("tab", "Disut. by socio-economic sector", None))
            self.label_49.setText(_translate("tab", "Trips by mode", None))
            self.label_50.setText(_translate("tab", "Flows by socio-economic sector", None))
            self.label_51.setText(_translate("tab", "Trips by mode and transport category", None))
            self.label_52.setText(_translate("tab", "Trips by transport category ", None))
            self.label_53.setText(_translate("tab", "Run", None))
            self.label_55.setText(_translate("tab", "Frequency distribution of trips by mode", None))
            self.label_56.setText(_translate("tab", "Disut. by transport category", None))
            self.label_3.setText(_translate("tab", "Flow by transport category", None))
            self.label_5.setText(_translate("tab", "Costs by socio-economic sector", None))
            self.label_4.setText(_translate("tab", "Costs by transport category", None))
            self.label_7.setText(_translate("tab", "Exogenous trips by category and mode", None))
            self.generate_btn.setText(_translate("tab", "Generate", None))
            self.check_all_btn.setText(_translate("tab", "Check all", None))

  8. #8
    Expert confirmé

    Homme Profil pro
    Inscrit en
    Octobre 2008
    Messages
    4 308
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Belgique

    Informations forums :
    Inscription : Octobre 2008
    Messages : 4 308
    Par défaut
    Ce n'est pas un fichier ui ça et en plus cette classe ne s'appelle pas InterfaceTemplateDialog.

    Dans ce post tu faisais état d'un FORM_CLASS, _ = uic.loadUiType(os.path.join(os.path.dirname(__file__), 'launch_interface.ui'))</br>

    Si c'est vraiment le code des onglets alors, comme j'ai dis, ton onglet n'hérite pas de QWidget et, en plus, tu n'aurais pas dût avoir l'erreur précédente avec le parent.

  9. #9
    Membre confirmé
    Femme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Mars 2013
    Messages
    61
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur développement logiciels

    Informations forums :
    Inscription : Mars 2013
    Messages : 61
    Par défaut
    Salut,

    En fait, j'ai généré le fichier .py à partir du fichier .ui en utilisant la commande pyuic.
    Code xml : 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
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
    423
    424
    425
    426
    427
    428
    429
    430
    431
    432
    433
    434
    435
    436
    437
    438
    439
    440
    441
    442
    443
    444
    445
    446
    447
    448
    449
    450
    451
    452
    453
    454
    455
    456
    457
    458
    459
    460
    461
    462
    463
    464
    465
    466
    467
    468
    469
    470
    471
    472
    473
    474
    475
    476
    477
    478
    479
    480
    481
    482
    483
    484
    485
    486
    487
    488
    489
    490
    491
    492
    493
    494
    495
    496
    497
    498
    499
    500
    501
    502
    503
    504
    505
    506
    507
    508
    509
    510
    511
    512
    513
    514
    515
    516
    517
    518
    519
    520
    521
    522
    523
    524
    525
    526
    527
    528
    529
    530
    531
    532
    533
    534
    535
    536
    537
    538
    539
    540
    541
    542
    543
    544
    545
    546
    547
    548
    549
    550
    551
    552
    553
    554
    555
    556
    557
    558
    559
    560
    561
    562
    563
    564
    565
    566
    567
    568
    569
    570
    571
    572
    573
    574
    575
    576
    577
    578
    579
    580
    581
    582
    583
    584
    585
    586
    587
    588
    589
    590
    591
    592
    593
    594
    595
    596
    597
    598
    599
    600
    601
    602
    603
    604
    605
    606
    607
    608
    609
    610
    611
    612
    613
    614
    615
    616
    617
    618
    619
    620
    621
    622
    623
    624
    625
    626
    627
    628
    629
    630
    631
    632
    633
    634
    635
    636
    637
    638
    639
    640
    641
    642
    643
    644
    645
    646
    647
    648
    649
    650
    651
    652
    653
    654
    655
    656
    657
    658
    659
    660
    661
    662
    663
    664
    665
    666
    667
    668
    669
    670
    671
    672
    673
    674
    675
    676
    677
    678
    679
    680
    681
    682
    683
    684
    685
    686
    687
    688
    689
    690
    691
    692
    693
    694
    695
    696
    697
    698
    699
    700
    701
    702
    703
    704
    705
    706
    707
    708
    709
    710
    711
    712
    713
    714
    715
    716
    717
    718
    719
    720
    721
    722
    723
    <?xml version="1.0" encoding="UTF-8"?>
    <ui version="4.0">
     <class>tab</class>
     <widget class="QDialog" name="tab">
      <property name="geometry">
       <rect>
        <x>0</x>
        <y>0</y>
        <width>688</width>
        <height>1112</height>
       </rect>
      </property>
      <property name="windowTitle">
       <string>Options TRANUS</string>
      </property>
      <layout class="QVBoxLayout" name="verticalLayout">
       <item>
        <layout class="QGridLayout" name="gridLayout">
         <item row="0" column="3">
          <widget class="QSpinBox" name="spinBox"/>
         </item>
         <item row="0" column="2">
          <widget class="QPushButton" name="run_tranus_btn">
           <property name="text">
            <string>Run TRANUS</string>
           </property>
          </widget>
         </item>
         <item row="0" column="0">
          <widget class="QLabel" name="label">
           <property name="text">
            <string>Run TRANUS to generate the basic files needed for the other operations TRANUS</string>
           </property>
          </widget>
         </item>
         <item row="0" column="1">
          <spacer name="horizontalSpacer_3">
           <property name="orientation">
            <enum>Qt::Horizontal</enum>
           </property>
           <property name="sizeHint" stdset="0">
            <size>
             <width>40</width>
             <height>20</height>
            </size>
           </property>
          </spacer>
         </item>
        </layout>
       </item>
       <item>
        <layout class="QGridLayout" name="gridLayout_3">
         <item row="1" column="0">
          <widget class="QLabel" name="label_27">
           <property name="text">
            <string>Run</string>
           </property>
          </widget>
         </item>
         <item row="1" column="1">
          <spacer name="horizontalSpacer_14">
           <property name="orientation">
            <enum>Qt::Horizontal</enum>
           </property>
           <property name="sizeHint" stdset="0">
            <size>
             <width>40</width>
             <height>20</height>
            </size>
           </property>
          </spacer>
         </item>
         <item row="0" column="0">
          <widget class="QLabel" name="label_28">
           <property name="font">
            <font>
             <pointsize>10</pointsize>
             <weight>75</weight>
             <bold>true</bold>
            </font>
           </property>
           <property name="text">
            <string>Imploc</string>
           </property>
          </widget>
         </item>
         <item row="1" column="5">
          <widget class="QCheckBox" name="checkBox_22">
           <property name="text">
            <string/>
           </property>
          </widget>
         </item>
         <item row="7" column="0">
          <widget class="QLabel" name="label_29">
           <property name="text">
            <string>Consumption coefficients by sector</string>
           </property>
          </widget>
         </item>
         <item row="5" column="5">
          <widget class="QCheckBox" name="checkBox_29">
           <property name="text">
            <string/>
           </property>
          </widget>
         </item>
         <item row="1" column="6">
          <spacer name="horizontalSpacer_15">
           <property name="orientation">
            <enum>Qt::Horizontal</enum>
           </property>
           <property name="sizeHint" stdset="0">
            <size>
             <width>40</width>
             <height>20</height>
            </size>
           </property>
          </spacer>
         </item>
         <item row="4" column="5">
          <widget class="QCheckBox" name="checkBox_25">
           <property name="text">
            <string/>
           </property>
          </widget>
         </item>
         <item row="8" column="0">
          <widget class="QLabel" name="label_31">
           <property name="text">
            <string>Total consumption by sector and zone</string>
           </property>
          </widget>
         </item>
         <item row="8" column="5">
          <widget class="QCheckBox" name="checkBox_20">
           <property name="text">
            <string/>
           </property>
          </widget>
         </item>
         <item row="5" column="0">
          <widget class="QLabel" name="label_26">
           <property name="text">
            <string>Total production by year/policy</string>
           </property>
          </widget>
         </item>
         <item row="2" column="5">
          <widget class="QCheckBox" name="checkBox_27">
           <property name="text">
            <string/>
           </property>
          </widget>
         </item>
         <item row="3" column="0">
          <widget class="QLabel" name="label_24">
           <property name="text">
            <string>All information, comma-delimited</string>
           </property>
          </widget>
         </item>
         <item row="7" column="5">
          <widget class="QCheckBox" name="checkBox_28">
           <property name="text">
            <string/>
           </property>
          </widget>
         </item>
         <item row="3" column="5">
          <widget class="QCheckBox" name="checkBox_23">
           <property name="text">
            <string/>
           </property>
          </widget>
         </item>
         <item row="6" column="0">
          <widget class="QLabel" name="label_34">
           <property name="text">
            <string>Internal information by sector and zone</string>
           </property>
          </widget>
         </item>
         <item row="4" column="0">
          <widget class="QLabel" name="label_25">
           <property name="text">
            <string>Total production by sector and zone</string>
           </property>
          </widget>
         </item>
         <item row="2" column="0">
          <widget class="QLabel" name="label_30">
           <property name="text">
            <string>All information by sector and zone</string>
           </property>
          </widget>
         </item>
         <item row="6" column="5">
          <widget class="QCheckBox" name="checkBox_30">
           <property name="text">
            <string/>
           </property>
          </widget>
         </item>
        </layout>
       </item>
       <item>
        <layout class="QGridLayout" name="gridLayout_8">
         <item row="8" column="0">
          <widget class="QLabel" name="label_69">
           <property name="text">
            <string>Link Route &amp; category profile</string>
           </property>
          </widget>
         </item>
         <item row="10" column="5">
          <widget class="QCheckBox" name="checkBox_62">
           <property name="text">
            <string/>
           </property>
          </widget>
         </item>
         <item row="3" column="0">
          <widget class="QLabel" name="label_70">
           <property name="text">
            <string>Cordons (only with IMPTRA.DAT)</string>
           </property>
          </widget>
         </item>
         <item row="4" column="0">
          <widget class="QLabel" name="label_71">
           <property name="text">
            <string>Filter links by Demand/Capacity range</string>
           </property>
          </widget>
         </item>
         <item row="5" column="0">
          <widget class="QLabel" name="label_72">
           <property name="text">
            <string>Table of indicators</string>
           </property>
          </widget>
         </item>
         <item row="1" column="1">
          <spacer name="horizontalSpacer_22">
           <property name="orientation">
            <enum>Qt::Horizontal</enum>
           </property>
           <property name="sizeHint" stdset="0">
            <size>
             <width>40</width>
             <height>20</height>
            </size>
           </property>
          </spacer>
         </item>
         <item row="11" column="5">
          <widget class="QCheckBox" name="checkBox_63">
           <property name="text">
            <string/>
           </property>
          </widget>
         </item>
         <item row="1" column="5">
          <widget class="QCheckBox" name="checkBox_64">
           <property name="text">
            <string/>
           </property>
          </widget>
         </item>
         <item row="1" column="0">
          <widget class="QLabel" name="label_73">
           <property name="text">
            <string>Run</string>
           </property>
          </widget>
         </item>
         <item row="3" column="5">
          <widget class="QCheckBox" name="checkBox_65">
           <property name="text">
            <string/>
           </property>
          </widget>
         </item>
         <item row="7" column="5">
          <widget class="QCheckBox" name="checkBox_66">
           <property name="text">
            <string/>
           </property>
          </widget>
         </item>
         <item row="4" column="5">
          <widget class="QCheckBox" name="checkBox_67">
           <property name="text">
            <string/>
           </property>
          </widget>
         </item>
         <item row="9" column="0">
          <widget class="QLabel" name="label_75">
           <property name="text">
            <string>Transit Routes profiles</string>
           </property>
          </widget>
         </item>
         <item row="2" column="0">
          <widget class="QLabel" name="label_76">
           <property name="text">
            <string>Report all links</string>
           </property>
          </widget>
         </item>
         <item row="8" column="5">
          <widget class="QCheckBox" name="checkBox_68">
           <property name="text">
            <string/>
           </property>
          </widget>
         </item>
         <item row="2" column="5">
          <widget class="QCheckBox" name="checkBox_69">
           <property name="text">
            <string/>
           </property>
          </widget>
         </item>
         <item row="10" column="0">
          <widget class="QLabel" name="label_77">
           <property name="text">
            <string>Route profile in comma delimited format</string>
           </property>
          </widget>
         </item>
         <item row="9" column="5">
          <widget class="QCheckBox" name="checkBox_70">
           <property name="text">
            <string/>
           </property>
          </widget>
         </item>
         <item row="11" column="0">
          <widget class="QLabel" name="label_78">
           <property name="text">
            <string>Report specified link types</string>
           </property>
          </widget>
         </item>
         <item row="5" column="5">
          <widget class="QCheckBox" name="checkBox_71">
           <property name="text">
            <string/>
           </property>
          </widget>
         </item>
         <item row="7" column="0">
          <widget class="QLabel" name="label_79">
           <property name="text">
            <string>Report specified links</string>
           </property>
          </widget>
         </item>
         <item row="6" column="5">
          <widget class="QCheckBox" name="checkBox_72">
           <property name="text">
            <string/>
           </property>
          </widget>
         </item>
         <item row="6" column="0">
          <widget class="QLabel" name="label_80">
           <property name="text">
            <string>Indicators in comma delimited format </string>
           </property>
          </widget>
         </item>
         <item row="1" column="6">
          <spacer name="horizontalSpacer_23">
           <property name="orientation">
            <enum>Qt::Horizontal</enum>
           </property>
           <property name="sizeHint" stdset="0">
            <size>
             <width>40</width>
             <height>20</height>
            </size>
           </property>
          </spacer>
         </item>
         <item row="0" column="0">
          <widget class="QLabel" name="label_74">
           <property name="font">
            <font>
             <pointsize>10</pointsize>
             <weight>75</weight>
             <bold>true</bold>
            </font>
           </property>
           <property name="text">
            <string>Imptra</string>
           </property>
          </widget>
         </item>
        </layout>
       </item>
       <item>
        <layout class="QGridLayout" name="gridLayout_5">
         <item row="14" column="0">
          <widget class="QLabel" name="label_6">
           <property name="text">
            <string>Exogenous trips by transport category</string>
           </property>
          </widget>
         </item>
         <item row="0" column="0">
          <widget class="QLabel" name="label_54">
           <property name="font">
            <font>
             <pointsize>10</pointsize>
             <weight>75</weight>
             <bold>true</bold>
            </font>
           </property>
           <property name="text">
            <string>Mats</string>
           </property>
          </widget>
         </item>
         <item row="8" column="0">
          <widget class="QLabel" name="label_46">
           <property name="text">
            <string>Total trips (sum of categories)</string>
           </property>
          </widget>
         </item>
         <item row="10" column="5">
          <widget class="QCheckBox" name="checkBox_41">
           <property name="text">
            <string/>
           </property>
          </widget>
         </item>
         <item row="3" column="0">
          <widget class="QLabel" name="label_47">
           <property name="text">
            <string>Disut. by mode and transport category</string>
           </property>
          </widget>
         </item>
         <item row="4" column="0">
          <widget class="QLabel" name="label_48">
           <property name="text">
            <string>Disut. by socio-economic sector</string>
           </property>
          </widget>
         </item>
         <item row="5" column="0">
          <widget class="QLabel" name="label_49">
           <property name="text">
            <string>Trips by mode</string>
           </property>
          </widget>
         </item>
         <item row="1" column="1">
          <spacer name="horizontalSpacer_18">
           <property name="orientation">
            <enum>Qt::Horizontal</enum>
           </property>
           <property name="sizeHint" stdset="0">
            <size>
             <width>40</width>
             <height>20</height>
            </size>
           </property>
          </spacer>
         </item>
         <item row="1" column="5">
          <widget class="QCheckBox" name="checkBox_42">
           <property name="text">
            <string/>
           </property>
          </widget>
         </item>
         <item row="1" column="6">
          <spacer name="horizontalSpacer_19">
           <property name="orientation">
            <enum>Qt::Horizontal</enum>
           </property>
           <property name="sizeHint" stdset="0">
            <size>
             <width>40</width>
             <height>20</height>
            </size>
           </property>
          </spacer>
         </item>
         <item row="2" column="5">
          <widget class="QCheckBox" name="checkBox_43">
           <property name="text">
            <string/>
           </property>
          </widget>
         </item>
         <item row="10" column="0">
          <widget class="QLabel" name="label_50">
           <property name="text">
            <string>Flows by socio-economic sector</string>
           </property>
          </widget>
         </item>
         <item row="9" column="5">
          <widget class="QCheckBox" name="checkBox_44">
           <property name="text">
            <string/>
           </property>
          </widget>
         </item>
         <item row="5" column="5">
          <widget class="QCheckBox" name="checkBox_45">
           <property name="text">
            <string/>
           </property>
          </widget>
         </item>
         <item row="7" column="0">
          <widget class="QLabel" name="label_51">
           <property name="text">
            <string>Trips by mode and transport category</string>
           </property>
          </widget>
         </item>
         <item row="6" column="5">
          <widget class="QCheckBox" name="checkBox_46">
           <property name="text">
            <string/>
           </property>
          </widget>
         </item>
         <item row="6" column="0">
          <widget class="QLabel" name="label_52">
           <property name="text">
            <string>Trips by transport category </string>
           </property>
          </widget>
         </item>
         <item row="1" column="0">
          <widget class="QLabel" name="label_53">
           <property name="text">
            <string>Run</string>
           </property>
          </widget>
         </item>
         <item row="3" column="5">
          <widget class="QCheckBox" name="checkBox_47">
           <property name="text">
            <string/>
           </property>
          </widget>
         </item>
         <item row="7" column="5">
          <widget class="QCheckBox" name="checkBox_48">
           <property name="text">
            <string/>
           </property>
          </widget>
         </item>
         <item row="4" column="5">
          <widget class="QCheckBox" name="checkBox_49">
           <property name="text">
            <string/>
           </property>
          </widget>
         </item>
         <item row="9" column="0">
          <widget class="QLabel" name="label_55">
           <property name="text">
            <string>Frequency distribution of trips by mode</string>
           </property>
          </widget>
         </item>
         <item row="2" column="0">
          <widget class="QLabel" name="label_56">
           <property name="text">
            <string>Disut. by transport category</string>
           </property>
          </widget>
         </item>
         <item row="8" column="5">
          <widget class="QCheckBox" name="checkBox_50">
           <property name="text">
            <string/>
           </property>
          </widget>
         </item>
         <item row="11" column="0">
          <widget class="QLabel" name="label_3">
           <property name="text">
            <string>Flow by transport category</string>
           </property>
          </widget>
         </item>
         <item row="14" column="5">
          <widget class="QCheckBox" name="checkBox_4">
           <property name="text">
            <string/>
           </property>
          </widget>
         </item>
         <item row="11" column="5">
          <widget class="QCheckBox" name="checkBox">
           <property name="text">
            <string/>
           </property>
          </widget>
         </item>
         <item row="13" column="0">
          <widget class="QLabel" name="label_5">
           <property name="text">
            <string>Costs by socio-economic sector</string>
           </property>
          </widget>
         </item>
         <item row="12" column="5">
          <widget class="QCheckBox" name="checkBox_2">
           <property name="text">
            <string/>
           </property>
          </widget>
         </item>
         <item row="12" column="0">
          <widget class="QLabel" name="label_4">
           <property name="text">
            <string>Costs by transport category</string>
           </property>
          </widget>
         </item>
         <item row="13" column="5">
          <widget class="QCheckBox" name="checkBox_3">
           <property name="text">
            <string/>
           </property>
          </widget>
         </item>
         <item row="15" column="0">
          <widget class="QLabel" name="label_7">
           <property name="text">
            <string>Exogenous trips by category and mode</string>
           </property>
          </widget>
         </item>
         <item row="15" column="5">
          <widget class="QCheckBox" name="checkBox_5">
           <property name="text">
            <string/>
           </property>
          </widget>
         </item>
        </layout>
       </item>
       <item>
        <layout class="QHBoxLayout" name="horizontalLayout">
         <item>
          <widget class="QPushButton" name="generate_btn">
           <property name="text">
            <string>Generate</string>
           </property>
          </widget>
         </item>
         <item>
          <spacer name="horizontalSpacer_4">
           <property name="orientation">
            <enum>Qt::Horizontal</enum>
           </property>
           <property name="sizeHint" stdset="0">
            <size>
             <width>40</width>
             <height>20</height>
            </size>
           </property>
          </spacer>
         </item>
         <item>
          <spacer name="horizontalSpacer">
           <property name="orientation">
            <enum>Qt::Horizontal</enum>
           </property>
           <property name="sizeHint" stdset="0">
            <size>
             <width>40</width>
             <height>20</height>
            </size>
           </property>
          </spacer>
         </item>
         <item>
          <widget class="QPushButton" name="check_all_btn">
           <property name="text">
            <string>Check all</string>
           </property>
          </widget>
         </item>
         <item>
          <spacer name="horizontalSpacer_2">
           <property name="orientation">
            <enum>Qt::Horizontal</enum>
           </property>
           <property name="sizeHint" stdset="0">
            <size>
             <width>40</width>
             <height>20</height>
            </size>
           </property>
          </spacer>
         </item>
        </layout>
       </item>
       <item>
        <widget class="QTextBrowser" name="console"/>
       </item>
      </layout>
     </widget>
     <resources/>
     <connections/>
    </ui>

  10. #10
    Expert confirmé

    Homme Profil pro
    Inscrit en
    Octobre 2008
    Messages
    4 308
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Belgique

    Informations forums :
    Inscription : Octobre 2008
    Messages : 4 308
    Par défaut
    J'ai modifié la définition du widget.

    Je met les deux en attachement.

    Pour créer tes onglets:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
     
    from tab import Ui_tab
     
        ...
     
        def add_new_tab(self, index, text):
            widget = QtGui.QWidget(self)
            tab = Ui_tab(widget)
            self.tabs.addTab(tab, text)
    Et pour savoir dans quel onglet on a cliqué il faudra utiliser self.tabs.currentIndex()

    (J'ai compressé le ui sinon il est refusé)
    Fichiers attachés Fichiers attachés

  11. #11
    Membre confirmé
    Femme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Mars 2013
    Messages
    61
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur développement logiciels

    Informations forums :
    Inscription : Mars 2013
    Messages : 61
    Par défaut
    Salut,

    J'ai apporté vos modifications proposées, cependant, j'ai eu ce petit problème :
    An error has occurred while executing Python code:

    TypeError: object() takes no parameters
    Traceback (most recent call last):
    File "C:/Users/emna/.qgis2/python/plugins\OptionsTRANUS\Options_TRANUS.py", line 193, in run
    self.dlg.show()
    File "C:/Users/emna/.qgis2/python/plugins\OptionsTRANUS\options_tranus_dialog.py", line 94, in show
    self.launch_options_TRANUS()
    File "C:/Users/emna/.qgis2/python/plugins\OptionsTRANUS\options_tranus_dialog.py", line 112, in launch_options_TRANUS
    dialog.show()
    File "C:/Users/emna/.qgis2/python/plugins\OptionsTRANUS\launch_tranus_dialog.py", line 64, in show
    self.put_tabs()
    File "C:/Users/emna/.qgis2/python/plugins\OptionsTRANUS\launch_tranus_dialog.py", line 46, in put_tabs
    self.add_new_tab(index,title)
    File "C:/Users/emna/.qgis2/python/plugins\OptionsTRANUS\launch_tranus_dialog.py", line 53, in add_new_tab
    tab = Ui_tab(widget)
    TypeError: object() takes no parameters

  12. #12
    Expert confirmé

    Homme Profil pro
    Inscrit en
    Octobre 2008
    Messages
    4 308
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Belgique

    Informations forums :
    Inscription : Octobre 2008
    Messages : 4 308
    Par défaut
    Oui, c'est l'habitude des méthodes __init__() .....

    change simplement la création des onglets
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
     
        def add_new_tab(self, index, text):
            widget = QtGui.QWidget(self)
            tab = Ui_tab()
            tab.setupUi(widget)
            self.tabs.addTab(widget, text)

Discussions similaires

  1. Gérer des événements sur des actions du navigateur
    Par Anonyme5571 dans le forum Général JavaScript
    Réponses: 3
    Dernier message: 16/01/2015, 11h57
  2. Réponses: 8
    Dernier message: 04/10/2013, 08h43
  3. Comment ajouter des séries dans des graphes sur des feuilles variables
    Par Molomarcopolo dans le forum Macros et VBA Excel
    Réponses: 1
    Dernier message: 06/07/2012, 16h26
  4. Trigger pour mettre des droits sur des procedures et des vues
    Par briino dans le forum Développement
    Réponses: 3
    Dernier message: 23/09/2009, 09h44
  5. Réponses: 6
    Dernier message: 18/04/2005, 21h12

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo