Skip to content

Commit

Permalink
[enh] Easier plot export
Browse files Browse the repository at this point in the history
  • Loading branch information
Kastakin committed Aug 1, 2023
1 parent 62f8d84 commit 39a887f
Show file tree
Hide file tree
Showing 9 changed files with 644 additions and 114 deletions.
144 changes: 144 additions & 0 deletions src/main/python/pyes/ui/PyES_graphExport.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
# -*- coding: utf-8 -*-

################################################################################
## Form generated from reading UI file 'PyES_graphExport.ui'
##
## Created by: Qt User Interface Compiler version 6.4.3
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
################################################################################

from PySide6.QtCore import (
QCoreApplication,
QDate,
QDateTime,
QLocale,
QMetaObject,
QObject,
QPoint,
QRect,
QSize,
Qt,
QTime,
QUrl,
)
from PySide6.QtGui import (
QBrush,
QColor,
QConicalGradient,
QCursor,
QFont,
QFontDatabase,
QGradient,
QIcon,
QImage,
QKeySequence,
QLinearGradient,
QPainter,
QPalette,
QPixmap,
QRadialGradient,
QTransform,
)
from PySide6.QtWidgets import (
QApplication,
QCheckBox,
QDialog,
QDoubleSpinBox,
QFormLayout,
QFrame,
QLabel,
QPushButton,
QSizePolicy,
QVBoxLayout,
QWidget,
)
from ui.widgets import ColorButton


class Ui_ExportGraphDialog(object):
def setupUi(self, ExportGraphDialog):
if not ExportGraphDialog.objectName():
ExportGraphDialog.setObjectName("ExportGraphDialog")
ExportGraphDialog.resize(311, 149)
ExportGraphDialog.setMinimumSize(QSize(311, 149))
ExportGraphDialog.setMaximumSize(QSize(311, 149))
self.verticalLayout = QVBoxLayout(ExportGraphDialog)
self.verticalLayout.setObjectName("verticalLayout")
self.verticalLayout.setContentsMargins(2, 5, 2, 2)
self.formLayout = QFormLayout()
self.formLayout.setObjectName("formLayout")
self.backgroundLabel = QLabel(ExportGraphDialog)
self.backgroundLabel.setObjectName("backgroundLabel")

self.formLayout.setWidget(2, QFormLayout.LabelRole, self.backgroundLabel)

self.background = ColorButton(ExportGraphDialog)
self.background.setObjectName("background")

self.formLayout.setWidget(2, QFormLayout.FieldRole, self.background)

self.transparent_check = QCheckBox(ExportGraphDialog)
self.transparent_check.setObjectName("transparent_check")

self.formLayout.setWidget(1, QFormLayout.SpanningRole, self.transparent_check)

self.scaleLabel = QLabel(ExportGraphDialog)
self.scaleLabel.setObjectName("scaleLabel")

self.formLayout.setWidget(4, QFormLayout.LabelRole, self.scaleLabel)

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

self.formLayout.setWidget(3, QFormLayout.SpanningRole, self.line)

self.scaleDoubleSpinBox = QDoubleSpinBox(ExportGraphDialog)
self.scaleDoubleSpinBox.setObjectName("scaleDoubleSpinBox")
self.scaleDoubleSpinBox.setMaximum(100.000000000000000)
self.scaleDoubleSpinBox.setSingleStep(0.050000000000000)
self.scaleDoubleSpinBox.setValue(1.000000000000000)

self.formLayout.setWidget(4, QFormLayout.FieldRole, self.scaleDoubleSpinBox)

self.verticalLayout.addLayout(self.formLayout)

self.export_button = QPushButton(ExportGraphDialog)
self.export_button.setObjectName("export_button")
self.export_button.setEnabled(True)
self.export_button.setAutoDefault(False)
self.export_button.setFlat(False)

self.verticalLayout.addWidget(self.export_button)

self.retranslateUi(ExportGraphDialog)

self.export_button.setDefault(False)

QMetaObject.connectSlotsByName(ExportGraphDialog)

# setupUi

def retranslateUi(self, ExportGraphDialog):
ExportGraphDialog.setWindowTitle(
QCoreApplication.translate("ExportGraphDialog", "Export Options", None)
)
self.backgroundLabel.setText(
QCoreApplication.translate("ExportGraphDialog", "Background", None)
)
self.background.setText("")
self.transparent_check.setText(
QCoreApplication.translate(
"ExportGraphDialog", "Transparent Background?", None
)
)
self.scaleLabel.setText(
QCoreApplication.translate("ExportGraphDialog", "Scale", None)
)
self.export_button.setText(
QCoreApplication.translate("ExportGraphDialog", "Export", None)
)

# retranslateUi
123 changes: 123 additions & 0 deletions src/main/python/pyes/ui/PyES_graphExport.ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ExportGraphDialog</class>
<widget class="QDialog" name="ExportGraphDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>311</width>
<height>149</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>311</width>
<height>149</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>311</width>
<height>149</height>
</size>
</property>
<property name="windowTitle">
<string>Export Options</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="leftMargin">
<number>2</number>
</property>
<property name="topMargin">
<number>5</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<number>2</number>
</property>
<item>
<layout class="QFormLayout" name="formLayout">
<item row="2" column="0">
<widget class="QLabel" name="backgroundLabel">
<property name="text">
<string>Background</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="ColorButton" name="background">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QCheckBox" name="transparent_check">
<property name="text">
<string>Transparent Background?</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="scaleLabel">
<property name="text">
<string>Scale</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QDoubleSpinBox" name="scaleDoubleSpinBox">
<property name="maximum">
<double>100.000000000000000</double>
</property>
<property name="singleStep">
<double>0.050000000000000</double>
</property>
<property name="value">
<double>1.000000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QPushButton" name="export_button">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>Export</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
<property name="default">
<bool>false</bool>
</property>
<property name="flat">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>ColorButton</class>
<extends>QPushButton</extends>
<header>ui.widgets</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
84 changes: 71 additions & 13 deletions src/main/python/pyes/ui/PyES_pyqtgraphPlotExport.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,13 @@
QAbstractItemView,
QApplication,
QCheckBox,
QComboBox,
QFormLayout,
QGridLayout,
QHBoxLayout,
QHeaderView,
QLabel,
QLayout,
QMainWindow,
QPushButton,
QSizePolicy,
Expand Down Expand Up @@ -159,8 +163,23 @@ def setupUi(self, PlotWindow):

self.horizontalLayout.addWidget(self.widget)

self.verticalLayout_4 = QVBoxLayout()
self.verticalLayout_4.setSpacing(2)
self.verticalLayout_4.setObjectName("verticalLayout_4")
self.verticalLayout_4.setContentsMargins(0, -1, -1, -1)
self.tabWidget = QTabWidget(self.centralwidget)
self.tabWidget.setObjectName("tabWidget")
self.conc_tab = QWidget()
self.conc_tab.setObjectName("conc_tab")
self.horizontalLayout_2 = QHBoxLayout(self.conc_tab)
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
self.horizontalLayout_2.setContentsMargins(1, 1, 1, 1)
self.conc_graph = PlotWidget(self.conc_tab)
self.conc_graph.setObjectName("conc_graph")

self.horizontalLayout_2.addWidget(self.conc_graph)

self.tabWidget.addTab(self.conc_tab, "")
self.perc_tab = QWidget()
self.perc_tab.setObjectName("perc_tab")
self.verticalLayout_2 = QVBoxLayout(self.perc_tab)
Expand All @@ -173,21 +192,50 @@ def setupUi(self, PlotWindow):

self.verticalLayout_2.setStretch(0, 1)
self.tabWidget.addTab(self.perc_tab, "")
self.conc_tab = QWidget()
self.conc_tab.setObjectName("conc_tab")
self.horizontalLayout_2 = QHBoxLayout(self.conc_tab)
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
self.horizontalLayout_2.setContentsMargins(1, 1, 1, 1)
self.conc_graph = PlotWidget(self.conc_tab)
self.conc_graph.setObjectName("conc_graph")
self.titration_tab = QWidget()
self.titration_tab.setObjectName("titration_tab")
self.verticalLayout_3 = QVBoxLayout(self.titration_tab)
self.verticalLayout_3.setObjectName("verticalLayout_3")
self.verticalLayout_3.setContentsMargins(1, 1, 1, 1)
self.titration_graph = PlotWidget(self.titration_tab)
self.titration_graph.setObjectName("titration_graph")
sizePolicy3 = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)
sizePolicy3.setHorizontalStretch(0)
sizePolicy3.setVerticalStretch(0)
sizePolicy3.setHeightForWidth(
self.titration_graph.sizePolicy().hasHeightForWidth()
)
self.titration_graph.setSizePolicy(sizePolicy3)

self.horizontalLayout_2.addWidget(self.conc_graph)
self.verticalLayout_3.addWidget(self.titration_graph)

self.tabWidget.addTab(self.conc_tab, "")
self.formLayout = QFormLayout()
self.formLayout.setObjectName("formLayout")
self.formLayout.setSizeConstraint(QLayout.SetDefaultConstraint)
self.componentLabel = QLabel(self.titration_tab)
self.componentLabel.setObjectName("componentLabel")

self.formLayout.setWidget(0, QFormLayout.LabelRole, self.componentLabel)

self.componentComboBox = QComboBox(self.titration_tab)
self.componentComboBox.setObjectName("componentComboBox")

self.formLayout.setWidget(0, QFormLayout.FieldRole, self.componentComboBox)

self.verticalLayout_3.addLayout(self.formLayout)

self.verticalLayout_3.setStretch(0, 1)
self.tabWidget.addTab(self.titration_tab, "")

self.verticalLayout_4.addWidget(self.tabWidget)

self.exportButton = QPushButton(self.centralwidget)
self.exportButton.setObjectName("exportButton")

self.horizontalLayout.addWidget(self.tabWidget)
self.verticalLayout_4.addWidget(self.exportButton)

self.horizontalLayout.addLayout(self.verticalLayout_4)

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

self.retranslateUi(PlotWindow)
Expand Down Expand Up @@ -229,13 +277,23 @@ def retranslateUi(self, PlotWindow):
self.errors_check.setText(
QCoreApplication.translate("PlotWindow", "Plot error bars", None)
)
self.tabWidget.setTabText(
self.tabWidget.indexOf(self.conc_tab),
QCoreApplication.translate("PlotWindow", "Concentrations", None),
)
self.tabWidget.setTabText(
self.tabWidget.indexOf(self.perc_tab),
QCoreApplication.translate("PlotWindow", "Percentages", None),
)
self.componentLabel.setText(
QCoreApplication.translate("PlotWindow", "Component:", None)
)
self.tabWidget.setTabText(
self.tabWidget.indexOf(self.conc_tab),
QCoreApplication.translate("PlotWindow", "Concentrations", None),
self.tabWidget.indexOf(self.titration_tab),
QCoreApplication.translate("PlotWindow", "Titration Curve", None),
)
self.exportButton.setText(
QCoreApplication.translate("PlotWindow", "Export Graph", None)
)

# retranslateUi
Loading

0 comments on commit 39a887f

Please sign in to comment.