1 | import sys |
---|
2 | import os |
---|
3 | from PyQt4 import QtCore |
---|
4 | from PyQt4 import QtGui |
---|
5 | |
---|
6 | # local |
---|
7 | from UI.InvariantDetailsUI import Dialog |
---|
8 | from InvariantUtils import WIDGETS |
---|
9 | |
---|
10 | class DetailsDialog(Dialog): |
---|
11 | """ |
---|
12 | """ |
---|
13 | def __init__(self, parent): |
---|
14 | Dialog.__init__(self, parent) |
---|
15 | |
---|
16 | self.progressBar.setMinimum(0) |
---|
17 | self.progressBar.setMaximum(100) |
---|
18 | |
---|
19 | self.progressBar_2.setMinimum(0) |
---|
20 | self.progressBar_2.setMaximum(100) |
---|
21 | |
---|
22 | self.progressBar_3.setMinimum(0) |
---|
23 | self.progressBar_3.setMaximum(100) |
---|
24 | |
---|
25 | def setModel(self, model): |
---|
26 | """ |
---|
27 | """ |
---|
28 | self._model = model |
---|
29 | |
---|
30 | def showDialog(self): |
---|
31 | """ |
---|
32 | """ |
---|
33 | # Pull out data from the model |
---|
34 | qstar_total = float(self._model.item(WIDGETS.W_INVARIANT).text()) |
---|
35 | self.lineEdit_3.setText(str(qstar_total)) |
---|
36 | self.lineEdit_4.setText(self._model.item(WIDGETS.W_INVARIANT_ERR).text()) |
---|
37 | |
---|
38 | progress_low_qstar = 0.0 |
---|
39 | progress_high_qstar = 0.0 |
---|
40 | progress_qstar = 100.0 |
---|
41 | |
---|
42 | if self._model.item(WIDGETS.W_ENABLE_LOWQ).text() == "true": |
---|
43 | qlow = float(self._model.item(WIDGETS.D_LOW_QSTAR).text()) |
---|
44 | self.lineEdit.setText(str(qlow)) |
---|
45 | self.lineEdit_2.setText(self._model.item(WIDGETS.D_LOW_QSTAR_ERR).text()) |
---|
46 | progress_low_qstar = (qlow/qstar_total)*100.0 |
---|
47 | |
---|
48 | if self._model.item(WIDGETS.W_ENABLE_HIGHQ).text() == "true": |
---|
49 | qhigh = float(self._model.item(WIDGETS.D_LOW_QSTAR).text()) |
---|
50 | self.lineEdit.setText(str(qhigh)) |
---|
51 | self.lineEdit_2.setText(self._model.item(WIDGETS.D_HIGH_QSTAR_ERR).text()) |
---|
52 | progress_high_qstar = (qhigh/qstar_total)*100.0 |
---|
53 | |
---|
54 | |
---|
55 | progress_qstar -= progress_low_qstar + progress_high_qstar |
---|
56 | |
---|
57 | self.progressBar.setValue(progress_low_qstar) |
---|
58 | self.progressBar_2.setValue(progress_qstar) |
---|
59 | self.progressBar_3.setValue(progress_high_qstar) |
---|
60 | |
---|
61 | self.show() |
---|