Salome HOME
IMP: Verima / New Plugin: Added a plugin for meshers quality testing (work done at...
[modules/smesh.git] / src / Tools / Verima / Gui / monEditor.py
1 from PyQt4.QtCore import *
2 from PyQt4.QtGui import *
3 from PyQt4.QtSql import *
4
5
6 class TableEditor(QDialog):
7
8      def __init__(self, table,parent):
9          QDialog.__init__(self)
10          self.setModal(False)
11          self.model= QSqlTableModel()
12          self.table=table
13          self.model.setTable(table.nom);
14          self.model.setEditStrategy(QSqlTableModel.OnManualSubmit)
15          self.model.select()
16          self.view = QTableView(self)
17          self.view.setModel(self.model)
18          
19
20          quitButton=QPushButton("Quit")
21          buttonBox=QDialogButtonBox(Qt.Vertical)
22          buttonBox.addButton(quitButton, QDialogButtonBox.RejectRole);
23          self.connect(quitButton, SIGNAL("clicked()"), self, SLOT("close()"))
24
25          mainLayout = QHBoxLayout(self)
26          mainLayout.addWidget(self.view)
27          mainLayout.addWidget(buttonBox)
28          self.setLayout(mainLayout)
29
30          self.setWindowTitle("Table des " + table.nom)
31          self.setSizePolicy(QSizePolicy.Expanding,QSizePolicy.Expanding)
32          self.view.setSizePolicy(QSizePolicy.Expanding,QSizePolicy.Expanding)
33          self.view.resizeColumnsToContents()
34          self.view.adjustSize()
35          self.adjustSize()
36          self.connect(self.view,SIGNAL("pressed(QModelIndex*)"),self.donneLigne)
37          self.connect(self.view,SIGNAL("itemPressed(QTableWidgetItem*)"),self.donneLigne)
38          self.connect(self.view,SIGNAL("clicked(QModelIndex*)"),self.donneLigne)
39          self.connect(self.view,SIGNAL("clicked()"),self.donneLigne)
40          self.connect(self.view,SIGNAL("pressed()"),self.donneLigne)
41
42      def donneLigne(self):
43          print "jjjjjjjjjjjjjjjj"
44
45      def setTitle(self):
46          fields=self.table.getFields()
47          index=0
48          for f in fields:
49            self.model.setHeaderData(index,Qt.Horizontal,fields)
50            index=index+1
51
52
53
54
55 #void TableEditor::submit()
56 #{
57 #     model->database().transaction();
58 #     if (model->submitAll()) {
59 #         model->database().commit();
60 #     } else {
61 #         model->database().rollback();
62 #         QMessageBox::warning(this, tr("Cached Table"),
63 #                              tr("The database reported an error: %1")
64 #                              .arg(model->lastError().text()));
65 #     }
66 #}
67 #     submitButton = new QPushButton(tr("Submit"));
68 #     submitButton->setDefault(true);
69 #     revertButton = new QPushButton(tr("&Revert"));
70 #     buttonBox->addButton(submitButton, QDialogButtonBox::ActionRole);
71 #     buttonBox->addButton(revertButton, QDialogButtonBox::ActionRole);
72 #     connect(submitButton, SIGNAL(clicked()), this, SLOT(submit()));
73 #     connect(revertButton, SIGNAL(clicked()), model, SLOT(revertAll()));
74 #     quitButton = new QPushButton(tr("Quit"));