ui_app.py 13.9 KB
Newer Older
1
2
3
4
# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file 'ui_app.ui'
#
5
# Created by: PyQt5 UI code generator 5.14.1
6
7
8
9
10
11
12
13
14
#
# WARNING! All changes made in this file will be lost!

from PyQt5 import QtCore, QtGui, QtWidgets


class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
Tong Zhang's avatar
Tong Zhang committed
15
        MainWindow.resize(1337, 692)
16
        icon = QtGui.QIcon()
17
18
        icon.addPixmap(QtGui.QPixmap(":/icons/default.png"),
                       QtGui.QIcon.Normal, QtGui.QIcon.Off)
19
20
21
        MainWindow.setWindowIcon(icon)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
22
23
24
25
26
27
        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")
Tong Zhang's avatar
Tong Zhang committed
28
29
        self.verticalLayout = QtWidgets.QVBoxLayout(self.tab)
        self.verticalLayout.setObjectName("verticalLayout")
Tong Zhang's avatar
Tong Zhang committed
30
        self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
31
        self.horizontalLayout_2.setObjectName("horizontalLayout_2")
Tong Zhang's avatar
Tong Zhang committed
32
33
34
35
36
37
38
39
40
41
42
        self.label_3 = QtWidgets.QLabel(self.tab)
        self.label_3.setObjectName("label_3")
        self.horizontalLayout_2.addWidget(self.label_3)
        self.elemlist_cbb = QtWidgets.QComboBox(self.tab)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred,
                                           QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(1)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.elemlist_cbb.sizePolicy().hasHeightForWidth())
        self.elemlist_cbb.setSizePolicy(sizePolicy)
Tong Zhang's avatar
Tong Zhang committed
43
44
45
        font = QtGui.QFont()
        font.setFamily("Monospace")
        self.elemlist_cbb.setFont(font)
Tong Zhang's avatar
Tong Zhang committed
46
47
        self.elemlist_cbb.setObjectName("elemlist_cbb")
        self.horizontalLayout_2.addWidget(self.elemlist_cbb)
Tong Zhang's avatar
Tong Zhang committed
48
49
50
51
52
53
54
55
56
        self.elem_info_btn = QtWidgets.QToolButton(self.tab)
        icon1 = QtGui.QIcon()
        icon1.addPixmap(QtGui.QPixmap(":/icons/info.png"), QtGui.QIcon.Normal,
                        QtGui.QIcon.Off)
        self.elem_info_btn.setIcon(icon1)
        self.elem_info_btn.setIconSize(QtCore.QSize(30, 30))
        self.elem_info_btn.setAutoRaise(True)
        self.elem_info_btn.setObjectName("elem_info_btn")
        self.horizontalLayout_2.addWidget(self.elem_info_btn)
Tong Zhang's avatar
Tong Zhang committed
57
58
59
60
61
62
63
64
        self.pos_lineEdit = QtWidgets.QLineEdit(self.tab)
        self.pos_lineEdit.setReadOnly(True)
        self.pos_lineEdit.setObjectName("pos_lineEdit")
        self.horizontalLayout_2.addWidget(self.pos_lineEdit)
        self.family_lineEdit = QtWidgets.QLineEdit(self.tab)
        self.family_lineEdit.setReadOnly(True)
        self.family_lineEdit.setObjectName("family_lineEdit")
        self.horizontalLayout_2.addWidget(self.family_lineEdit)
Tong Zhang's avatar
Tong Zhang committed
65
        self.verticalLayout.addLayout(self.horizontalLayout_2)
Tong Zhang's avatar
Tong Zhang committed
66
67
        self.horizontalLayout_4 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_4.setObjectName("horizontalLayout_4")
68
        self.x_ellipse_plot = MatplotlibBaseWidget(self.tab)
Doerr, Kevin's avatar
Doerr, Kevin committed
69
70
71
72
73
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed,
                                           QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
74
75
76
            self.x_ellipse_plot.sizePolicy().hasHeightForWidth())
        self.x_ellipse_plot.setSizePolicy(sizePolicy)
        self.x_ellipse_plot.setFigureTitle("")
Tong Zhang's avatar
Tong Zhang committed
77
78
79
80
81
82
        font = QtGui.QFont()
        font.setFamily("sans-serif")
        font.setPointSize(14)
        font.setBold(False)
        font.setItalic(False)
        font.setWeight(50)
83
        self.x_ellipse_plot.setFigureXYlabelFont(font)
Tong Zhang's avatar
Tong Zhang committed
84
85
86
87
88
89
        font = QtGui.QFont()
        font.setFamily("sans-serif")
        font.setPointSize(16)
        font.setBold(False)
        font.setItalic(False)
        font.setWeight(50)
90
        self.x_ellipse_plot.setFigureTitleFont(font)
Tong Zhang's avatar
Tong Zhang committed
91
92
93
94
95
96
        font = QtGui.QFont()
        font.setFamily("sans-serif")
        font.setPointSize(12)
        font.setBold(False)
        font.setItalic(False)
        font.setWeight(50)
97
98
99
        self.x_ellipse_plot.setFigureXYticksFont(font)
        self.x_ellipse_plot.setProperty("figureToolbarToggle", False)
        self.x_ellipse_plot.setObjectName("x_ellipse_plot")
Tong Zhang's avatar
Tong Zhang committed
100
        self.horizontalLayout_4.addWidget(self.x_ellipse_plot)
101
        self.y_ellipse_plot = MatplotlibBaseWidget(self.tab)
Doerr, Kevin's avatar
Doerr, Kevin committed
102
103
104
105
106
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed,
                                           QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
107
108
            self.y_ellipse_plot.sizePolicy().hasHeightForWidth())
        self.y_ellipse_plot.setSizePolicy(sizePolicy)
Doerr, Kevin's avatar
Doerr, Kevin committed
109
110
111
112
113
114
        font = QtGui.QFont()
        font.setFamily("sans-serif")
        font.setPointSize(14)
        font.setBold(False)
        font.setItalic(False)
        font.setWeight(50)
115
        self.y_ellipse_plot.setFigureXYlabelFont(font)
Doerr, Kevin's avatar
Doerr, Kevin committed
116
117
118
119
120
121
        font = QtGui.QFont()
        font.setFamily("sans-serif")
        font.setPointSize(16)
        font.setBold(False)
        font.setItalic(False)
        font.setWeight(50)
122
        self.y_ellipse_plot.setFigureTitleFont(font)
Doerr, Kevin's avatar
Doerr, Kevin committed
123
124
125
126
127
128
        font = QtGui.QFont()
        font.setFamily("sans-serif")
        font.setPointSize(12)
        font.setBold(False)
        font.setItalic(False)
        font.setWeight(50)
129
130
131
        self.y_ellipse_plot.setFigureXYticksFont(font)
        self.y_ellipse_plot.setProperty("figureToolbarToggle", False)
        self.y_ellipse_plot.setObjectName("y_ellipse_plot")
Tong Zhang's avatar
Tong Zhang committed
132
133
        self.horizontalLayout_4.addWidget(self.y_ellipse_plot)
        self.verticalLayout.addLayout(self.horizontalLayout_4)
134
135
136
137
138
139
        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)
Tong Zhang's avatar
Tong Zhang committed
140
        self.envelope_plot.setFigureAutoScale(True)
141
142
143
144
145
146
147
148
149
150
151
152
        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)
Tong Zhang's avatar
Tong Zhang committed
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
        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)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred,
                                           QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(1)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.quad1_name_cbb.sizePolicy().hasHeightForWidth())
        self.quad1_name_cbb.setSizePolicy(sizePolicy)
        font = QtGui.QFont()
        font.setFamily("Monospace")
        self.quad1_name_cbb.setFont(font)
        self.quad1_name_cbb.setObjectName("quad1_name_cbb")
        self.horizontalLayout.addWidget(self.quad1_name_cbb)
        self.quad_info_btn = QtWidgets.QToolButton(self.centralwidget)
        self.quad_info_btn.setIcon(icon1)
        self.quad_info_btn.setIconSize(QtCore.QSize(30, 30))
        self.quad_info_btn.setAutoRaise(True)
        self.quad_info_btn.setObjectName("quad_info_btn")
        self.horizontalLayout.addWidget(self.quad_info_btn)
        spacerItem = QtWidgets.QSpacerItem(40, 20,
                                           QtWidgets.QSizePolicy.Expanding,
                                           QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout.addItem(spacerItem)
        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.setMinimum(-100.0)
        self.quad1_grad_dsbox.setMaximum(100.0)
        self.quad1_grad_dsbox.setSingleStep(0.1)
        self.quad1_grad_dsbox.setObjectName("quad1_grad_dsbox")
        self.horizontalLayout.addWidget(self.quad1_grad_dsbox)
        self.gridLayout.addLayout(self.horizontalLayout, 1, 0, 1, 1)
206
207
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(MainWindow)
Tong Zhang's avatar
Tong Zhang committed
208
        self.menubar.setGeometry(QtCore.QRect(0, 0, 1337, 30))
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
        self.menubar.setObjectName("menubar")
        self.menu_File = QtWidgets.QMenu(self.menubar)
        self.menu_File.setObjectName("menu_File")
        self.menu_Help = QtWidgets.QMenu(self.menubar)
        self.menu_Help.setObjectName("menu_Help")
        MainWindow.setMenuBar(self.menubar)
        self.action_About = QtWidgets.QAction(MainWindow)
        self.action_About.setObjectName("action_About")
        self.actionAbout_Qt = QtWidgets.QAction(MainWindow)
        self.actionAbout_Qt.setObjectName("actionAbout_Qt")
        self.actionE_xit = QtWidgets.QAction(MainWindow)
        self.actionE_xit.setObjectName("actionE_xit")
        self.actionContents = QtWidgets.QAction(MainWindow)
        self.actionContents.setObjectName("actionContents")
        self.menu_File.addAction(self.actionE_xit)
        self.menu_Help.addAction(self.actionContents)
        self.menu_Help.addSeparator()
        self.menu_Help.addAction(self.action_About)
        self.menu_Help.addAction(self.actionAbout_Qt)
        self.menubar.addAction(self.menu_File.menuAction())
        self.menubar.addAction(self.menu_Help.menuAction())

        self.retranslateUi(MainWindow)
232
        self.tabWidget.setCurrentIndex(0)
233
234
235
236
237
238
239
240
        self.actionAbout_Qt.triggered.connect(MainWindow.onAboutQt)
        self.actionE_xit.triggered.connect(MainWindow.close)
        self.action_About.triggered.connect(MainWindow.onAbout)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)

    def retranslateUi(self, MainWindow):
        _translate = QtCore.QCoreApplication.translate
        MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
Tong Zhang's avatar
Tong Zhang committed
241
        self.label_3.setText(_translate("MainWindow", "Show results after"))
Tong Zhang's avatar
Tong Zhang committed
242
243
244
245
        self.elem_info_btn.setToolTip(
            _translate("MainWindow",
                       "Click to see the details of selected device."))
        self.elem_info_btn.setText(_translate("MainWindow", "info"))
246
247
        self.x_ellipse_plot.setFigureXlabel(_translate("MainWindow", "X (mm)"))
        self.x_ellipse_plot.setFigureYlabel(
Doerr, Kevin's avatar
Doerr, Kevin committed
248
            _translate("MainWindow", "X\' (mrad)"))
249
250
251
252
253
254
255
256
257
258
        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"))
Tong Zhang's avatar
Tong Zhang committed
259
260
261
262
263
264
265
        self.label.setText(_translate("MainWindow", "Select quadrupole"))
        self.quad_info_btn.setToolTip(
            _translate("MainWindow",
                       "Click to see the details of selected device."))
        self.quad_info_btn.setText(_translate("MainWindow", "info"))
        self.label_2.setText(_translate("MainWindow", "Gradient Setting"))
        self.quad1_grad_dsbox.setSuffix(_translate("MainWindow", " T/m"))
266
267
268
269
270
271
272
273
274
275
276
        self.menu_File.setTitle(_translate("MainWindow", "&File"))
        self.menu_Help.setTitle(_translate("MainWindow", "&Help"))
        self.action_About.setText(_translate("MainWindow", "&About"))
        self.action_About.setShortcut(_translate("MainWindow", "Ctrl+A"))
        self.actionAbout_Qt.setText(_translate("MainWindow", "About Qt"))
        self.actionE_xit.setText(_translate("MainWindow", "E&xit"))
        self.actionE_xit.setShortcut(_translate("MainWindow", "Ctrl+W"))
        self.actionContents.setText(_translate("MainWindow", "Contents"))
        self.actionContents.setShortcut(_translate("MainWindow", "F1"))


Tong Zhang's avatar
Tong Zhang committed
277
from mpl4qt.widgets.mplbasewidget import MatplotlibBaseWidget
278
from mpl4qt.widgets.mplcurvewidget import MatplotlibCurveWidget
279
280
281
282
283
284
285
286
287
288
from . import resources_rc

if __name__ == "__main__":
    import sys
    app = QtWidgets.QApplication(sys.argv)
    MainWindow = QtWidgets.QMainWindow()
    ui = Ui_MainWindow()
    ui.setupUi(MainWindow)
    MainWindow.show()
    sys.exit(app.exec_())