Commit efaae4ce authored by Tong Zhang's avatar Tong Zhang
Browse files

UI: Use tabwidget to hold ellipse and envelop drawings.

parent 9ae4df4e
......@@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'ui_app.ui'
#
# Created by: PyQt5 UI code generator 5.11.3
# Created by: PyQt5 UI code generator 5.14.1
#
# WARNING! All changes made in this file will be lost!
......@@ -12,108 +12,137 @@ from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(1284, 709)
MainWindow.resize(1381, 641)
icon = QtGui.QIcon()
icon.addPixmap(
QtGui.QPixmap(":/icons/default.png"), QtGui.QIcon.Normal,
QtGui.QIcon.Off)
icon.addPixmap(QtGui.QPixmap(":/icons/default.png"),
QtGui.QIcon.Normal, QtGui.QIcon.Off)
MainWindow.setWindowIcon(icon)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.matplotlibbaseWidget = MatplotlibBaseWidget(self.centralwidget)
self.matplotlibbaseWidget.setGeometry(QtCore.QRect(0, 0, 640, 480))
self.gridLayout = QtWidgets.QGridLayout(self.centralwidget)
self.gridLayout.setObjectName("gridLayout")
self.tabWidget = QtWidgets.QTabWidget(self.centralwidget)
self.tabWidget.setObjectName("tabWidget")
self.tab = QtWidgets.QWidget()
self.tab.setObjectName("tab")
self.horizontalLayout_2 = QtWidgets.QHBoxLayout(self.tab)
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
self.x_ellipse_plot = MatplotlibBaseWidget(self.tab)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed,
QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
self.matplotlibbaseWidget.sizePolicy().hasHeightForWidth())
self.matplotlibbaseWidget.setSizePolicy(sizePolicy)
self.x_ellipse_plot.sizePolicy().hasHeightForWidth())
self.x_ellipse_plot.setSizePolicy(sizePolicy)
self.x_ellipse_plot.setFigureTitle("")
font = QtGui.QFont()
font.setFamily("sans-serif")
font.setPointSize(14)
font.setBold(False)
font.setItalic(False)
font.setWeight(50)
self.matplotlibbaseWidget.setFigureXYlabelFont(font)
self.x_ellipse_plot.setFigureXYlabelFont(font)
font = QtGui.QFont()
font.setFamily("sans-serif")
font.setPointSize(16)
font.setBold(False)
font.setItalic(False)
font.setWeight(50)
self.matplotlibbaseWidget.setFigureTitleFont(font)
self.x_ellipse_plot.setFigureTitleFont(font)
font = QtGui.QFont()
font.setFamily("sans-serif")
font.setPointSize(12)
font.setBold(False)
font.setItalic(False)
font.setWeight(50)
self.matplotlibbaseWidget.setFigureXYticksFont(font)
self.matplotlibbaseWidget.setProperty("figureToolbarToggle", False)
self.matplotlibbaseWidget.setObjectName("matplotlibbaseWidget")
self.label = QtWidgets.QLabel(self.centralwidget)
self.label.setGeometry(QtCore.QRect(0, 480, 121, 19))
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed,
QtWidgets.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
self.label.sizePolicy().hasHeightForWidth())
self.label.setSizePolicy(sizePolicy)
self.label.setObjectName("label")
self.quad1_name_cbb = QtWidgets.QComboBox(self.centralwidget)
self.quad1_name_cbb.setGeometry(QtCore.QRect(120, 480, 79, 27))
self.quad1_name_cbb.setObjectName("quad1_name_cbb")
self.label_2 = QtWidgets.QLabel(self.centralwidget)
self.label_2.setGeometry(QtCore.QRect(210, 480, 111, 19))
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed,
QtWidgets.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
self.label_2.sizePolicy().hasHeightForWidth())
self.label_2.setSizePolicy(sizePolicy)
self.label_2.setObjectName("label_2")
self.quad1_grad_dsbox = QtWidgets.QDoubleSpinBox(self.centralwidget)
self.quad1_grad_dsbox.setGeometry(QtCore.QRect(320, 480, 111, 28))
self.quad1_grad_dsbox.setDecimals(3)
self.quad1_grad_dsbox.setObjectName("quad1_grad_dsbox")
self.matplotlibbaseWidget_1 = MatplotlibBaseWidget(self.centralwidget)
self.matplotlibbaseWidget_1.setGeometry(QtCore.QRect(640, 0, 640, 480))
self.x_ellipse_plot.setFigureXYticksFont(font)
self.x_ellipse_plot.setProperty("figureToolbarToggle", False)
self.x_ellipse_plot.setObjectName("x_ellipse_plot")
self.horizontalLayout_2.addWidget(self.x_ellipse_plot)
self.y_ellipse_plot = MatplotlibBaseWidget(self.tab)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed,
QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
self.matplotlibbaseWidget_1.sizePolicy().hasHeightForWidth())
self.matplotlibbaseWidget_1.setSizePolicy(sizePolicy)
self.y_ellipse_plot.sizePolicy().hasHeightForWidth())
self.y_ellipse_plot.setSizePolicy(sizePolicy)
font = QtGui.QFont()
font.setFamily("sans-serif")
font.setPointSize(14)
font.setBold(False)
font.setItalic(False)
font.setWeight(50)
self.matplotlibbaseWidget_1.setFigureXYlabelFont(font)
self.y_ellipse_plot.setFigureXYlabelFont(font)
font = QtGui.QFont()
font.setFamily("sans-serif")
font.setPointSize(16)
font.setBold(False)
font.setItalic(False)
font.setWeight(50)
self.matplotlibbaseWidget_1.setFigureTitleFont(font)
self.y_ellipse_plot.setFigureTitleFont(font)
font = QtGui.QFont()
font.setFamily("sans-serif")
font.setPointSize(12)
font.setBold(False)
font.setItalic(False)
font.setWeight(50)
self.matplotlibbaseWidget_1.setFigureXYticksFont(font)
self.matplotlibbaseWidget_1.setProperty("figureToolbarToggle", False)
self.matplotlibbaseWidget_1.setObjectName("matplotlibbaseWidget_1")
self.y_ellipse_plot.setFigureXYticksFont(font)
self.y_ellipse_plot.setProperty("figureToolbarToggle", False)
self.y_ellipse_plot.setObjectName("y_ellipse_plot")
self.horizontalLayout_2.addWidget(self.y_ellipse_plot)
self.tabWidget.addTab(self.tab, "")
self.tab_2 = QtWidgets.QWidget()
self.tab_2.setObjectName("tab_2")
self.horizontalLayout_3 = QtWidgets.QHBoxLayout(self.tab_2)
self.horizontalLayout_3.setObjectName("horizontalLayout_3")
self.envelope_plot = MatplotlibCurveWidget(self.tab_2)
font = QtGui.QFont()
font.setFamily("sans-serif")
font.setPointSize(14)
font.setBold(False)
font.setItalic(False)
font.setWeight(50)
self.envelope_plot.setFigureXYlabelFont(font)
self.envelope_plot.setProperty("figureLegendToggle", True)
self.envelope_plot.setObjectName("envelope_plot")
self.horizontalLayout_3.addWidget(self.envelope_plot)
self.tabWidget.addTab(self.tab_2, "")
self.gridLayout.addWidget(self.tabWidget, 0, 0, 1, 1)
self.horizontalLayout = QtWidgets.QHBoxLayout()
self.horizontalLayout.setObjectName("horizontalLayout")
self.label = QtWidgets.QLabel(self.centralwidget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed,
QtWidgets.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
self.label.sizePolicy().hasHeightForWidth())
self.label.setSizePolicy(sizePolicy)
self.label.setObjectName("label")
self.horizontalLayout.addWidget(self.label)
self.quad1_name_cbb = QtWidgets.QComboBox(self.centralwidget)
self.quad1_name_cbb.setObjectName("quad1_name_cbb")
self.horizontalLayout.addWidget(self.quad1_name_cbb)
self.label_2 = QtWidgets.QLabel(self.centralwidget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed,
QtWidgets.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
self.label_2.sizePolicy().hasHeightForWidth())
self.label_2.setSizePolicy(sizePolicy)
self.label_2.setObjectName("label_2")
self.horizontalLayout.addWidget(self.label_2)
self.quad1_grad_dsbox = QtWidgets.QDoubleSpinBox(self.centralwidget)
self.quad1_grad_dsbox.setDecimals(3)
self.quad1_grad_dsbox.setObjectName("quad1_grad_dsbox")
self.horizontalLayout.addWidget(self.quad1_grad_dsbox)
self.gridLayout.addLayout(self.horizontalLayout, 1, 0, 1, 1)
MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QtWidgets.QMenuBar(MainWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 1284, 24))
self.menubar.setGeometry(QtCore.QRect(0, 0, 1381, 30))
self.menubar.setObjectName("menubar")
self.menu_File = QtWidgets.QMenu(self.menubar)
self.menu_File.setObjectName("menu_File")
......@@ -137,6 +166,7 @@ class Ui_MainWindow(object):
self.menubar.addAction(self.menu_Help.menuAction())
self.retranslateUi(MainWindow)
self.tabWidget.setCurrentIndex(0)
self.actionAbout_Qt.triggered.connect(MainWindow.onAboutQt)
self.actionE_xit.triggered.connect(MainWindow.close)
self.action_About.triggered.connect(MainWindow.onAbout)
......@@ -145,17 +175,22 @@ class Ui_MainWindow(object):
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
self.matplotlibbaseWidget.setFigureXlabel(
_translate("MainWindow", "X (mm)"))
self.matplotlibbaseWidget.setFigureYlabel(
self.x_ellipse_plot.setFigureXlabel(_translate("MainWindow", "X (mm)"))
self.x_ellipse_plot.setFigureYlabel(
_translate("MainWindow", "X\' (mrad)"))
self.y_ellipse_plot.setFigureXlabel(_translate("MainWindow", "Y (mm)"))
self.y_ellipse_plot.setFigureYlabel(
_translate("MainWindow", "Y\' (mrad)"))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab),
_translate("MainWindow", "Beam Ellipse"))
self.envelope_plot.setFigureXlabel(_translate("MainWindow", "s [m]"))
self.envelope_plot.setFigureYlabel(
_translate("MainWindow", "Envelop [mm]"))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2),
_translate("MainWindow", "Beam Envelope"))
self.label.setText(_translate("MainWindow", "Select quadrupole"))
self.label_2.setText(_translate("MainWindow", "Gradient Setting"))
self.quad1_grad_dsbox.setSuffix(_translate("MainWindow", " T/m"))
self.matplotlibbaseWidget_1.setFigureXlabel(
_translate("MainWindow", "Y (mm)"))
self.matplotlibbaseWidget_1.setFigureYlabel(
_translate("MainWindow", "Y\' (mrad)"))
self.menu_File.setTitle(_translate("MainWindow", "&File"))
self.menu_Help.setTitle(_translate("MainWindow", "&Help"))
self.action_About.setText(_translate("MainWindow", "&About"))
......@@ -168,6 +203,7 @@ class Ui_MainWindow(object):
from mpl4qt.widgets.mplbasewidget import MatplotlibBaseWidget
from mpl4qt.widgets.mplcurvewidget import MatplotlibCurveWidget
from . import resources_rc
if __name__ == "__main__":
......
......@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>1284</width>
<height>709</height>
<width>1381</width>
<height>641</height>
</rect>
</property>
<property name="windowTitle">
......@@ -18,182 +18,197 @@
<normaloff>:/icons/default.png</normaloff>:/icons/default.png</iconset>
</property>
<widget class="QWidget" name="centralwidget">
<widget class="MatplotlibBaseWidget" name="matplotlibbaseWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>640</width>
<height>480</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="figureXlabel">
<string>X (mm)</string>
</property>
<property name="figureYlabel">
<string>X' (mrad)</string>
</property>
<property name="figureXYlabelFont">
<font>
<family>sans-serif</family>
<pointsize>14</pointsize>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
</font>
</property>
<property name="figureTitleFont">
<font>
<family>sans-serif</family>
<pointsize>16</pointsize>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
</font>
</property>
<property name="figureXYticksFont">
<font>
<family>sans-serif</family>
<pointsize>12</pointsize>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
</font>
</property>
<property name="figureToolbarToggle" stdset="0">
<bool>false</bool>
</property>
</widget>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>0</x>
<y>480</y>
<width>121</width>
<height>19</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Select quadrupole</string>
</property>
</widget>
<widget class="QComboBox" name="quad1_name_cbb">
<property name="geometry">
<rect>
<x>120</x>
<y>480</y>
<width>79</width>
<height>27</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>210</x>
<y>480</y>
<width>111</width>
<height>19</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Gradient Setting</string>
</property>
</widget>
<widget class="QDoubleSpinBox" name="quad1_grad_dsbox">
<property name="geometry">
<rect>
<x>320</x>
<y>480</y>
<width>111</width>
<height>28</height>
</rect>
</property>
<property name="suffix">
<string> T/m</string>
</property>
<property name="decimals">
<number>3</number>
</property>
</widget>
<widget class="MatplotlibBaseWidget" name="matplotlibbaseWidget_1">
<property name="geometry">
<rect>
<x>640</x>
<y>0</y>
<width>640</width>
<height>480</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="figureXlabel">
<string>Y (mm)</string>
</property>
<property name="figureYlabel">
<string>Y' (mrad)</string>
</property>
<property name="figureXYlabelFont">
<font>
<family>sans-serif</family>
<pointsize>14</pointsize>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
</font>
</property>
<property name="figureTitleFont">
<font>
<family>sans-serif</family>
<pointsize>16</pointsize>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
</font>
</property>
<property name="figureXYticksFont">
<font>
<family>sans-serif</family>
<pointsize>12</pointsize>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
</font>
</property>
<property name="figureToolbarToggle" stdset="0">
<bool>false</bool>
</property>
</widget>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
<string>Beam Ellipse</string>
</attribute>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="MatplotlibBaseWidget" name="x_ellipse_plot">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="figureXlabel">
<string>X (mm)</string>
</property>
<property name="figureYlabel">
<string>X' (mrad)</string>
</property>
<property name="figureTitle">
<string/>
</property>
<property name="figureXYlabelFont">
<font>
<family>sans-serif</family>
<pointsize>14</pointsize>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
</font>
</property>
<property name="figureTitleFont">
<font>
<family>sans-serif</family>
<pointsize>16</pointsize>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
</font>
</property>
<property name="figureXYticksFont">
<font>
<family>sans-serif</family>
<pointsize>12</pointsize>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
</font>
</property>
<property name="figureToolbarToggle" stdset="0">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="MatplotlibBaseWidget" name="y_ellipse_plot">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="figureXlabel">
<string>Y (mm)</string>
</property>
<property name="figureYlabel">
<string>Y' (mrad)</string>
</property>
<property name="figureXYlabelFont">
<font>
<family>sans-serif</family>
<pointsize>14</pointsize>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
</font>
</property>
<property name="figureTitleFont">
<font>
<family>sans-serif</family>
<pointsize>16</pointsize>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
</font>
</property>
<property name="figureXYticksFont">
<font>
<family>sans-serif</family>
<pointsize>12</pointsize>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
</font>
</property>
<property name="figureToolbarToggle" stdset="0">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_2">
<attribute name="title">
<string>Beam Envelope</string>
</attribute>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="MatplotlibCurveWidget" name="envelope_plot">
<property name="figureXlabel">
<string>s [m]</string>
</property>
<property name="figureYlabel">
<string>Envelop [mm]</string>
</property>
<property name="figureXYlabelFont">
<font>
<family>sans-serif</family>
<pointsize>14</pointsize>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
</font>
</property>
<property name="figureLegendToggle" stdset="0">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Select quadrupole</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="quad1_name_cbb"/>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Gradient Setting</string>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="quad1_grad_dsbox">
<property name="suffix">
<string> T/m</string>
</property>
<property name="decimals">
<number>3</number>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>