[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): |
---|
[83eb5208] | 14 | super(DetailsDialog, self).__init__(parent) |
---|
| 15 | |
---|
[60af928] | 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) |
---|
[457d961] | 61 | self.progressBar_3.setValue(progress_high_qstar) |
---|
| 62 | |
---|
| 63 | new_font = 'font-family: -apple-system, "Helvetica Neue", "Ubuntu";' |
---|
| 64 | self.label_3.setStyleSheet(new_font) |
---|
| 65 | self.label_4.setStyleSheet(new_font) |
---|
[28cda69] | 66 | self.label_7.setStyleSheet(new_font) |
---|
[f721030] | 67 | |
---|
| 68 | self.show() |
---|