Commit 1e3a1d7c authored by Zhang, Tong's avatar Zhang, Tong
Browse files

Merge branch 'master' into 'master'

Master

See merge request !8
parents aab00e27 e05ec953
......@@ -20,6 +20,8 @@ from PyQt5.QtCore import pyqtSlot
from PyQt5.QtGui import QColor
from PyQt5.QtWidgets import QMainWindow
from PyQt5.QtWidgets import QMessageBox
from PyQt5 import QtWidgets
from PyQt5.QtWidgets import QDialog, QApplication
from phantasy import MachinePortal
from phantasy_ui import BaseAppForm
......@@ -182,6 +184,26 @@ class MyAppWindow(BaseAppForm, Ui_MainWindow):
params_x = dict(zip(TWISS_KEYS_X, vals_x))
params_y = dict(zip(TWISS_KEYS_Y, vals_y))
#Fill table widget with constant values
#table is coded as one column even though two exist in QTDesigner GUI
#Only accepts String type (Table View widget could fix this)
self.tableWidget.setItem(0,0,QtWidgets.QTableWidgetItem(str(s.xcen)))#x_c
self.tableWidget.setItem(0,1,QtWidgets.QTableWidgetItem(str(s.ycen)))#y_c
self.tableWidget.setItem(0,2,QtWidgets.QTableWidgetItem(str(s.xpcen)))#a_c
self.tableWidget.setItem(0,3,QtWidgets.QTableWidgetItem(str(s.ypcen)))#b_c
self.tableWidget.setItem(0,4,QtWidgets.QTableWidgetItem(str(s.xrms)))#xm
self.tableWidget.setItem(0,5,QtWidgets.QTableWidgetItem(str(s.yrms)))#ym
self.tableWidget.setItem(0,6,QtWidgets.QTableWidgetItem(str(s.xprms)))#am
self.tableWidget.setItem(0,7,QtWidgets.QTableWidgetItem(str(s.yprms)))#bm
self.tableWidget.setItem(0,8,QtWidgets.QTableWidgetItem(str(s.xemittance)))#eps_x
self.tableWidget.setItem(0,9,QtWidgets.QTableWidgetItem(str(s.yemittance)))#eps_y
self.tableWidget.setItem(0,10,QtWidgets.QTableWidgetItem(str(s.xtwiss_alpha)))#x-alpha
self.tableWidget.setItem(0,11,QtWidgets.QTableWidgetItem(str(s.ytwiss_alpha)))#y-alpha
self.tableWidget.setItem(0,12,QtWidgets.QTableWidgetItem(str(s.xtwiss_beta)))#x-beta
self.tableWidget.setItem(0,13,QtWidgets.QTableWidgetItem(str(s.ytwiss_beta)))#y-beta
self.tableWidget.setItem(0,14,QtWidgets.QTableWidgetItem(str((s.xtwiss_alpha**2 + 1) / s.xtwiss_beta)))#x-gamma
self.tableWidget.setItem(0,15,QtWidgets.QTableWidgetItem(str((s.ytwiss_alpha**2 + 1) / s.ytwiss_beta))) #y-gamma
self._plot_ellipse(self.x_ellipse_plot,
params_x,
color='b',
......
......@@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'ui_app.ui'
#
# Created by: PyQt5 UI code generator 5.14.1
# Created by: PyQt5 UI code generator 5.11.3
#
# WARNING! All changes made in this file will be lost!
......@@ -12,10 +12,11 @@ from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(1341, 687)
MainWindow.resize(1653, 650)
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")
......@@ -176,9 +177,34 @@ class Ui_MainWindow(object):
self.horizontalLayout_3.addWidget(self.envelope_plot)
self.tabWidget.addTab(self.tab_2, "")
self.gridLayout.addWidget(self.tabWidget, 0, 0, 1, 1)
self.tableWidget = QtWidgets.QTableWidget(self.centralwidget)
self.tableWidget.setObjectName("tableWidget")
self.tableWidget.setColumnCount(2)
self.tableWidget.setRowCount(8)
item = QtWidgets.QTableWidgetItem()
self.tableWidget.setVerticalHeaderItem(0, item)
item = QtWidgets.QTableWidgetItem()
self.tableWidget.setVerticalHeaderItem(1, item)
item = QtWidgets.QTableWidgetItem()
self.tableWidget.setVerticalHeaderItem(2, item)
item = QtWidgets.QTableWidgetItem()
self.tableWidget.setVerticalHeaderItem(3, item)
item = QtWidgets.QTableWidgetItem()
self.tableWidget.setVerticalHeaderItem(4, item)
item = QtWidgets.QTableWidgetItem()
self.tableWidget.setVerticalHeaderItem(5, item)
item = QtWidgets.QTableWidgetItem()
self.tableWidget.setVerticalHeaderItem(6, item)
item = QtWidgets.QTableWidgetItem()
self.tableWidget.setVerticalHeaderItem(7, item)
item = QtWidgets.QTableWidgetItem()
self.tableWidget.setHorizontalHeaderItem(0, item)
item = QtWidgets.QTableWidgetItem()
self.tableWidget.setHorizontalHeaderItem(1, item)
self.gridLayout.addWidget(self.tableWidget, 0, 1, 1, 1)
MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QtWidgets.QMenuBar(MainWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 1341, 30))
self.menubar.setGeometry(QtCore.QRect(0, 0, 1653, 24))
self.menubar.setObjectName("menubar")
self.menu_File = QtWidgets.QMenu(self.menubar)
self.menu_File.setObjectName("menu_File")
......@@ -221,13 +247,35 @@ class Ui_MainWindow(object):
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.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.tabWidget.setTabText(
self.tabWidget.indexOf(self.tab_2),
_translate("MainWindow", "Beam Envelope"))
item = self.tableWidget.verticalHeaderItem(0)
item.setText(_translate("MainWindow", "x(y)_c [mm]"))
item = self.tableWidget.verticalHeaderItem(1)
item.setText(_translate("MainWindow", "a(b)_c [mm]"))
item = self.tableWidget.verticalHeaderItem(2)
item.setText(_translate("MainWindow", "x(y)m [mm]"))
item = self.tableWidget.verticalHeaderItem(3)
item.setText(_translate("MainWindow", "a(b)m [mm]"))
item = self.tableWidget.verticalHeaderItem(4)
item.setText(_translate("MainWindow", "eps_x(y)"))
item = self.tableWidget.verticalHeaderItem(5)
item.setText(_translate("MainWindow", "alpha_x(y)"))
item = self.tableWidget.verticalHeaderItem(6)
item.setText(_translate("MainWindow", "beta_x(y)"))
item = self.tableWidget.verticalHeaderItem(7)
item.setText(_translate("MainWindow", "gamma_x(y)"))
item = self.tableWidget.horizontalHeaderItem(0)
item.setText(_translate("MainWindow", "X"))
item = self.tableWidget.horizontalHeaderItem(1)
item.setText(_translate("MainWindow", "Y"))
self.menu_File.setTitle(_translate("MainWindow", "&File"))
self.menu_Help.setTitle(_translate("MainWindow", "&Help"))
self.action_About.setText(_translate("MainWindow", "&About"))
......
......@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>1341</width>
<height>687</height>
<width>1653</width>
<height>650</height>
</rect>
</property>
<property name="windowTitle">
......@@ -256,6 +256,60 @@
</widget>
</widget>
</item>
<item row="0" column="1">
<widget class="QTableWidget" name="tableWidget">
<row>
<property name="text">
<string>x(y)_c [mm]</string>
</property>
</row>
<row>
<property name="text">
<string>a(b)_c [mm]</string>
</property>
</row>
<row>
<property name="text">
<string>x(y)m [mm]</string>
</property>
</row>
<row>
<property name="text">
<string>a(b)m [mm]</string>
</property>
</row>
<row>
<property name="text">
<string>eps_x(y)</string>
</property>
</row>
<row>
<property name="text">
<string>alpha_x(y)</string>
</property>
</row>
<row>
<property name="text">
<string>beta_x(y)</string>
</property>
</row>
<row>
<property name="text">
<string>gamma_x(y)</string>
</property>
</row>
<column>
<property name="text">
<string>X</string>
</property>
</column>
<column>
<property name="text">
<string>Y</string>
</property>
</column>
</widget>
</item>
</layout>
</widget>
<widget class="QMenuBar" name="menubar">
......@@ -263,8 +317,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>1341</width>
<height>30</height>
<width>1653</width>
<height>24</height>
</rect>
</property>
<widget class="QMenu" name="menu_File">
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment