forked from aklnk/xaesa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathxaesa_settings.py
89 lines (72 loc) · 2.98 KB
/
xaesa_settings.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# -*- coding: utf-8 -*-
"""
Created on Fri Apr 6 11:20:43 2018
@author: akali
"""
from init import QTVer
if QTVer == 4:
from PyQt4 import QtGui, QtCore
if QTVer == 5:
from PyQt5 import QtWidgets as QtGui
from PyQt5 import QtCore
class xaesa_settings(QtGui.QWidget):
def __init__(self, parent=None):
super(xaesa_settings, self).__init__()
self.rebinSmoothing = 1
self.rebinE1 = 5
self.rebinE1E0 = 0.1
self.rebinE0E3 = 0.02
self.initUI()
def initUI(self):
################# Rebin group ###################################
grpRebin = QtGui.QGroupBox("Rebin parameters")
self.lblRebinSmoothing = QtGui.QLabel("Rebin smoothing factor")
self.edtRebinSmoothing = QtGui.QLineEdit(str(self.rebinSmoothing))
self.lblrebinE1 = QtGui.QLabel("Rebin dE (E < E1)")
self.edtrebinE1 = QtGui.QLineEdit(str(self.rebinE1))
self.lblrebinE1E0 = QtGui.QLabel("Rebin dE (E1 < E < E0+50)")
self.edtrebinE1E0 = QtGui.QLineEdit(str(self.rebinE1E0))
self.lblrebinE0E3 = QtGui.QLabel("Rebin dk (E0+50 < E < E3)")
self.edtrebinE0E3 = QtGui.QLineEdit(str(self.rebinE0E3))
loutRebin = QtGui.QGridLayout()
loutRebin.addWidget(self.lblRebinSmoothing, 0, 0)
loutRebin.addWidget(self.edtRebinSmoothing, 0, 1)
loutRebin.addWidget(self.lblrebinE1, 1, 0)
loutRebin.addWidget(self.edtrebinE1, 1, 1)
loutRebin.addWidget(self.lblrebinE1E0, 2, 0)
loutRebin.addWidget(self.edtrebinE1E0, 2, 1)
loutRebin.addWidget(self.lblrebinE0E3, 3, 0)
loutRebin.addWidget(self.edtrebinE0E3, 3, 1)
grpRebin.setLayout(loutRebin)
################ Apply button ###############
self.btnApply = QtGui.QPushButton("Apply")
self.btnApply.clicked.connect(self.apply)
#################Main Layout ###############
loutMain = QtGui.QGridLayout()
loutMain.addWidget(grpRebin, 0, 0)
loutMain.addWidget(self.btnApply, 1, 0)
self.setLayout(loutMain)
def apply(self):
self.rebinSmoothing = float(self.edtRebinSmoothing.text())
self.rebinE1 = float(self.edtrebinE1.text())
self.rebinE1E0 = float(self.edtrebinE1E0.text())
self.rebinE0E3 = float(self.edtrebinE0E3.text())
#class TestWindow(QtGui.QMainWindow):
# def __init__(self, parent=None):
# super(TestWindow, self).__init__()
#
# self.wid = xaesa_settings(self)
# self.setCentralWidget(self.wid)
#
# self.show()
#
# def closeEvent(self, event):
# super(TestWindow, self).closeEvent(event)
# print('closed')
#
#if __name__ == '__main__':
# app = QtGui.QApplication(argv)
#
# main = TestWindow()
#
# exit(app.exec_())