Skip to content

Commit

Permalink
[feat] Add monochrome plots and allow chainging units of volume and c…
Browse files Browse the repository at this point in the history
…oncentration
  • Loading branch information
Kastakin committed Aug 10, 2023
1 parent b980e12 commit b1d3db0
Show file tree
Hide file tree
Showing 3 changed files with 356 additions and 108 deletions.
118 changes: 99 additions & 19 deletions src/main/python/pyes/ui/PyES_pyqtgraphPlotExport.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
QCheckBox,
QComboBox,
QFormLayout,
QFrame,
QGridLayout,
QHBoxLayout,
QHeaderView,
Expand All @@ -60,13 +61,14 @@
QVBoxLayout,
QWidget,
)
from ui.widgets import ColorButton


class Ui_PlotWindow(object):
def setupUi(self, PlotWindow):
if not PlotWindow.objectName():
PlotWindow.setObjectName("PlotWindow")
PlotWindow.resize(800, 600)
PlotWindow.resize(945, 704)
PlotWindow.setMinimumSize(QSize(800, 600))
self.centralwidget = QWidget(PlotWindow)
self.centralwidget.setObjectName("centralwidget")
Expand All @@ -83,22 +85,64 @@ def setupUi(self, PlotWindow):
self.verticalLayout = QVBoxLayout(self.widget)
self.verticalLayout.setSpacing(2)
self.verticalLayout.setObjectName("verticalLayout")
self.verticalLayout.setContentsMargins(2, 2, 2, 2)
self.verticalLayout.setContentsMargins(2, 0, 2, 2)
self.widget_2 = QWidget(self.widget)
self.widget_2.setObjectName("widget_2")
self.gridLayout = QGridLayout(self.widget_2)
self.gridLayout.setSpacing(2)
self.gridLayout.setObjectName("gridLayout")
self.gridLayout.setContentsMargins(0, 0, 0, 0)
self.deselect_all = QPushButton(self.widget_2)
self.deselect_all.setObjectName("deselect_all")
self.c_unit = QComboBox(self.widget_2)
self.c_unit.addItem("")
self.c_unit.addItem("")
self.c_unit.addItem("")
self.c_unit.setObjectName("c_unit")

self.gridLayout.addWidget(self.c_unit, 9, 1, 1, 1)

self.line = QFrame(self.widget_2)
self.line.setObjectName("line")
self.line.setFrameShape(QFrame.HLine)
self.line.setFrameShadow(QFrame.Sunken)

self.gridLayout.addWidget(self.deselect_all, 3, 1, 1, 1)
self.gridLayout.addWidget(self.line, 4, 0, 1, 2)

self.regions_check = QCheckBox(self.widget_2)
self.regions_check.setObjectName("regions_check")

self.gridLayout.addWidget(self.regions_check, 1, 0, 1, 2)
self.gridLayout.addWidget(self.regions_check, 7, 0, 1, 2)

self.errors_check = QCheckBox(self.widget_2)
self.errors_check.setObjectName("errors_check")

self.gridLayout.addWidget(self.errors_check, 8, 0, 1, 2)

self.v_unit_label = QLabel(self.widget_2)
self.v_unit_label.setObjectName("v_unit_label")

self.gridLayout.addWidget(self.v_unit_label, 10, 0, 1, 1)

self.plot_options_label = QLabel(self.widget_2)
self.plot_options_label.setObjectName("plot_options_label")

self.gridLayout.addWidget(self.plot_options_label, 5, 0, 1, 2)

self.v_unit = QComboBox(self.widget_2)
self.v_unit.addItem("")
self.v_unit.addItem("")
self.v_unit.setObjectName("v_unit")

self.gridLayout.addWidget(self.v_unit, 10, 1, 1, 1)

self.deselect_all = QPushButton(self.widget_2)
self.deselect_all.setObjectName("deselect_all")

self.gridLayout.addWidget(self.deselect_all, 1, 0, 1, 1)

self.select_all = QPushButton(self.widget_2)
self.select_all.setObjectName("select_all")

self.gridLayout.addWidget(self.select_all, 1, 1, 1, 1)

self.tabWidget_2 = QTabWidget(self.widget_2)
self.tabWidget_2.setObjectName("tabWidget_2")
Expand Down Expand Up @@ -147,17 +191,22 @@ def setupUi(self, PlotWindow):
self.filter = QPushButton(self.widget_2)
self.filter.setObjectName("filter")

self.gridLayout.addWidget(self.filter, 4, 0, 1, 2)
self.gridLayout.addWidget(self.filter, 3, 0, 1, 2)

self.select_all = QPushButton(self.widget_2)
self.select_all.setObjectName("select_all")
self.c_unit_label = QLabel(self.widget_2)
self.c_unit_label.setObjectName("c_unit_label")

self.gridLayout.addWidget(self.select_all, 3, 0, 1, 1)
self.gridLayout.addWidget(self.c_unit_label, 9, 0, 1, 1)

self.errors_check = QCheckBox(self.widget_2)
self.errors_check.setObjectName("errors_check")
self.monochrome_check = QCheckBox(self.widget_2)
self.monochrome_check.setObjectName("monochrome_check")

self.gridLayout.addWidget(self.monochrome_check, 6, 0, 1, 1)

self.monochrome_color = ColorButton(self.widget_2)
self.monochrome_color.setObjectName("monochrome_color")

self.gridLayout.addWidget(self.errors_check, 2, 0, 1, 2)
self.gridLayout.addWidget(self.monochrome_color, 6, 1, 1, 1)

self.verticalLayout.addWidget(self.widget_2)

Expand Down Expand Up @@ -236,6 +285,7 @@ def setupUi(self, PlotWindow):

self.horizontalLayout.addLayout(self.verticalLayout_4)

self.horizontalLayout.setStretch(1, 1)
PlotWindow.setCentralWidget(self.centralwidget)

self.retranslateUi(PlotWindow)
Expand All @@ -256,12 +306,41 @@ def retranslateUi(self, PlotWindow):
PlotWindow.setWindowTitle(
QCoreApplication.translate("PlotWindow", "Export Plot", None)
)
self.deselect_all.setText(
QCoreApplication.translate("PlotWindow", "Deselect All", None)
self.c_unit.setItemText(
0, QCoreApplication.translate("PlotWindow", "mol/l", None)
)
self.c_unit.setItemText(
1, QCoreApplication.translate("PlotWindow", "mmol/l", None)
)
self.c_unit.setItemText(
2, QCoreApplication.translate("PlotWindow", "\u03bcmol/l", None)
)

self.regions_check.setText(
QCoreApplication.translate("PlotWindow", "Solids as regions", None)
)
self.errors_check.setText(
QCoreApplication.translate("PlotWindow", "Plot error bars", None)
)
self.v_unit_label.setText(
QCoreApplication.translate("PlotWindow", "Volume Units", None)
)
self.plot_options_label.setText(
QCoreApplication.translate(
"PlotWindow",
'<html><head/><body><p><span style=" font-weight:700;">Plot Options</span></p></body></html>',
None,
)
)
self.v_unit.setItemText(0, QCoreApplication.translate("PlotWindow", "l", None))
self.v_unit.setItemText(1, QCoreApplication.translate("PlotWindow", "ml", None))

self.deselect_all.setText(
QCoreApplication.translate("PlotWindow", "Deselect All", None)
)
self.select_all.setText(
QCoreApplication.translate("PlotWindow", "Select All", None)
)
self.tabWidget_2.setTabText(
self.tabWidget_2.indexOf(self.species),
QCoreApplication.translate("PlotWindow", "Species", None),
Expand All @@ -271,12 +350,13 @@ def retranslateUi(self, PlotWindow):
QCoreApplication.translate("PlotWindow", "Solids", None),
)
self.filter.setText(QCoreApplication.translate("PlotWindow", "Filter", None))
self.select_all.setText(
QCoreApplication.translate("PlotWindow", "Select All", None)
self.c_unit_label.setText(
QCoreApplication.translate("PlotWindow", "Concentration Units", None)
)
self.errors_check.setText(
QCoreApplication.translate("PlotWindow", "Plot error bars", None)
self.monochrome_check.setText(
QCoreApplication.translate("PlotWindow", "Monochrome", None)
)
self.monochrome_color.setText("")
self.tabWidget.setTabText(
self.tabWidget.indexOf(self.conc_tab),
QCoreApplication.translate("PlotWindow", "Concentrations", None),
Expand Down
110 changes: 95 additions & 15 deletions src/main/python/pyes/ui/PyES_pyqtgraphPlotExport.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>600</height>
<width>945</width>
<height>704</height>
</rect>
</property>
<property name="minimumSize">
Expand All @@ -20,7 +20,7 @@
<string>Export Plot</string>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0">
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,1">
<property name="leftMargin">
<number>2</number>
</property>
Expand Down Expand Up @@ -49,7 +49,7 @@
<number>2</number>
</property>
<property name="topMargin">
<number>2</number>
<number>0</number>
</property>
<property name="rightMargin">
<number>2</number>
Expand All @@ -75,17 +75,85 @@
<property name="spacing">
<number>2</number>
</property>
<item row="3" column="1">
<item row="9" column="1">
<widget class="QComboBox" name="c_unit">
<item>
<property name="text">
<string>mol/l</string>
</property>
</item>
<item>
<property name="text">
<string>mmol/l</string>
</property>
</item>
<item>
<property name="text">
<string>μmol/l</string>
</property>
</item>
</widget>
</item>
<item row="4" column="0" colspan="2">
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="7" column="0" colspan="2">
<widget class="QCheckBox" name="regions_check">
<property name="text">
<string>Solids as regions</string>
</property>
</widget>
</item>
<item row="8" column="0" colspan="2">
<widget class="QCheckBox" name="errors_check">
<property name="text">
<string>Plot error bars</string>
</property>
</widget>
</item>
<item row="10" column="0">
<widget class="QLabel" name="v_unit_label">
<property name="text">
<string>Volume Units</string>
</property>
</widget>
</item>
<item row="5" column="0" colspan="2">
<widget class="QLabel" name="plot_options_label">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:700;&quot;&gt;Plot Options&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="10" column="1">
<widget class="QComboBox" name="v_unit">
<item>
<property name="text">
<string>l</string>
</property>
</item>
<item>
<property name="text">
<string>ml</string>
</property>
</item>
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="deselect_all">
<property name="text">
<string>Deselect All</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QCheckBox" name="regions_check">
<item row="1" column="1">
<widget class="QPushButton" name="select_all">
<property name="text">
<string>Solids as regions</string>
<string>Select All</string>
</property>
</widget>
</item>
Expand Down Expand Up @@ -157,24 +225,31 @@
</widget>
</widget>
</item>
<item row="4" column="0" colspan="2">
<item row="3" column="0" colspan="2">
<widget class="QPushButton" name="filter">
<property name="text">
<string>Filter</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QPushButton" name="select_all">
<item row="9" column="0">
<widget class="QLabel" name="c_unit_label">
<property name="text">
<string>Select All</string>
<string>Concentration Units</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QCheckBox" name="errors_check">
<item row="6" column="0">
<widget class="QCheckBox" name="monochrome_check">
<property name="text">
<string>Plot error bars</string>
<string>Monochrome</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="ColorButton" name="monochrome_color">
<property name="text">
<string/>
</property>
</widget>
</item>
Expand Down Expand Up @@ -308,6 +383,11 @@
<header>pyqtgraph</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ColorButton</class>
<extends>QPushButton</extends>
<header>ui.widgets</header>
</customwidget>
</customwidgets>
<resources/>
<connections>
Expand Down
Loading

0 comments on commit b1d3db0

Please sign in to comment.