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