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