def ssh_box(self): pyro_layout = QtGui.QHBoxLayout() user_label = QtGui.QLabel('Remote user:'******'USER')) self.user_box.setMinimumWidth(100) port_label = QtGui.QLabel('Local port:') self.port_box = QtGui.QLineEdit('8801') self.port_box.setMinimumWidth(100) self.ssh_start_button = QtGui.QPushButton("Start SSH") self.ssh_stop_button = QtGui.QPushButton("Stop SSH") if self.globus.ssh_session is not None: self.ssh_start_button.setEnabled(False) self.ssh_stop_button.setEnabled(True) else: self.ssh_start_button.setEnabled(True) self.ssh_stop_button.setEnabled(False) self.ssh_start_button.clicked.connect(self.ssh_start) self.ssh_stop_button.clicked.connect(self.ssh_stop) pyro_layout.addStretch() pyro_layout.addWidget(user_label) pyro_layout.addWidget(self.user_box) pyro_layout.addWidget(port_label) pyro_layout.addWidget(self.port_box) pyro_layout.addWidget(self.ssh_start_button) pyro_layout.addWidget(self.ssh_stop_button) pyro_layout.addStretch() return pyro_layout
def add_parameter_rows(self, f): row = self.parameter_grid.rowCount() name = self.expanded_name(f.name) f.rows = [] f.label_box = QtGui.QLabel(name) self.parameter_grid.addWidget(f.label_box, row, 0) for p in f.parameters: p.parameter_index = row p.parameter_box = QtGui.QLabel(str(p.parameter_index)) p.value_box = QtGui.QLineEdit() p.value_box.setAlignment(QtCore.Qt.AlignRight) p.error_box = QtGui.QLabel() p.min_box = QtGui.QLineEdit('-inf') p.min_box.setAlignment(QtCore.Qt.AlignRight) p.max_box = QtGui.QLineEdit('inf') p.max_box.setAlignment(QtCore.Qt.AlignRight) p.fixed_box = QtGui.QCheckBox() # p.bound_box = QtGui.QLineEdit() self.parameter_grid.addWidget(p.parameter_box, row, 1, alignment=QtCore.Qt.AlignHCenter) self.parameter_grid.addWidget(QtGui.QLabel(p.name), row, 2) self.parameter_grid.addWidget(p.value_box, row, 3) self.parameter_grid.addWidget(p.error_box, row, 4) self.parameter_grid.addWidget(p.min_box, row, 5) self.parameter_grid.addWidget(p.max_box, row, 6) self.parameter_grid.addWidget(p.fixed_box, row, 7, alignment=QtCore.Qt.AlignHCenter) # self.parameter_grid.addWidget(p.bound_box, row, 8) f.rows.append(row) row += 1 self.parameter_grid.setRowStretch(self.parameter_grid.rowCount(), 10)
def __init__(self, parent=None): super(ImportDialog, self).__init__(parent) self.file_type = None layout = QtGui.QVBoxLayout() layout.addLayout(self.filebox()) title_layout = QtGui.QHBoxLayout() title_label = QtGui.QLabel('Title') self.title_box = QtGui.QLineEdit() title_layout.addWidget(title_label) title_layout.addWidget(self.title_box) layout.addLayout(title_layout) energy_layout = QtGui.QHBoxLayout() energy_label = QtGui.QLabel('Incident Energy') self.energy_box = QtGui.QLineEdit() self.energy_box.setFixedWidth(150) energy_layout.addWidget(energy_label) energy_layout.addWidget(self.energy_box) energy_layout.addStretch() layout.addLayout(energy_layout) step_layout = QtGui.QHBoxLayout() Q_label = QtGui.QLabel('dQ') self.Q_box = QtGui.QLineEdit() self.Q_box.setFixedWidth(75) E_label = QtGui.QLabel('dE') self.E_box = QtGui.QLineEdit() self.E_box.setFixedWidth(75) self.convert_box = QtGui.QCheckBox('Convert to S(Q,E)') self.convert_box.setChecked(False) step_layout.addWidget(self.convert_box) step_layout.addStretch() step_layout.addWidget(Q_label) step_layout.addWidget(self.Q_box) step_layout.addWidget(E_label) step_layout.addWidget(self.E_box) step_layout.addStretch() layout.addLayout(step_layout) layout.addWidget(self.close_buttons()) self.setLayout(layout) self.setWindowTitle("Import " + str(filetype))
def scanbox(self): '''create widgets for specifying scan range to import''' scanminlabel = QtGui.QLabel("Min. Scan") self.scanmin = QtGui.QLineEdit() self.scanmin.setFixedWidth(100) self.scanmin.setAlignment(QtCore.Qt.AlignRight) scanmaxlabel = QtGui.QLabel("Max. Scan") self.scanmax = QtGui.QLineEdit() self.scanmax.setFixedWidth(100) self.scanmax.setAlignment(QtCore.Qt.AlignRight) scanbox = QtGui.QHBoxLayout() scanbox.addWidget(scanminlabel) scanbox.addWidget(self.scanmin) scanbox.addWidget(scanmaxlabel) scanbox.addWidget(self.scanmax) return scanbox
def make_rangebox(self): rangebox = QtGui.QWidget() layout = QtGui.QHBoxLayout() rangeminlabel = QtGui.QLabel("Min. index") self.rangemin = QtGui.QLineEdit() self.rangemin.setFixedWidth(150) self.rangemin.setAlignment(QtCore.Qt.AlignRight) rangemaxlabel = QtGui.QLabel("Max. index") self.rangemax = QtGui.QLineEdit() self.rangemax.setFixedWidth(150) self.rangemax.setAlignment(QtCore.Qt.AlignRight) layout.addWidget(rangeminlabel) layout.addWidget(self.rangemin) layout.addStretch() layout.addWidget(rangemaxlabel) layout.addWidget(self.rangemax) rangebox.setLayout(layout) rangebox.setVisible(False) return rangebox
def make_filterbox(self): filterbox = QtGui.QWidget() layout = QtGui.QGridLayout() layout.setSpacing(10) prefix_label = QtGui.QLabel('File Prefix') self.prefix_box = QtGui.QLineEdit() self.prefix_box.editingFinished.connect(self.set_range) suffix_label = QtGui.QLabel('File Suffix') self.suffix_box = QtGui.QLineEdit('') self.suffix_box.editingFinished.connect(self.get_prefixes) extension_label = QtGui.QLabel('File Extension') self.extension_box = QtGui.QLineEdit() self.extension_box.editingFinished.connect(self.set_extension) layout.addWidget(prefix_label, 0, 0) layout.addWidget(self.prefix_box, 0, 1) layout.addWidget(suffix_label, 0, 2) layout.addWidget(self.suffix_box, 0, 3) layout.addWidget(extension_label, 0, 4) layout.addWidget(self.extension_box, 0, 5) self.prefix_combo = QtGui.QComboBox() self.prefix_combo.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents) self.prefix_combo.activated.connect(self.choose_prefix) self.extension_combo = QtGui.QComboBox() self.extension_combo.setSizeAdjustPolicy( QtGui.QComboBox.AdjustToContents) self.extension_combo.activated.connect(self.choose_extension) layout.addWidget(self.prefix_combo, 1, 1, alignment=QtCore.Qt.AlignHCenter) layout.addWidget(self.extension_combo, 1, 5, alignment=QtCore.Qt.AlignHCenter) filterbox.setLayout(layout) filterbox.setVisible(False) return filterbox
def __init__(self, parent=None): super(ImportDialog, self).__init__(parent) skippedbox = QtGui.QHBoxLayout() skippedlabel = QtGui.QLabel("No. of skipped rows") self.skiprows = QtGui.QLineEdit() self.skiprows.setText('0') self.skiprows.setFixedWidth(20) skippedbox.addWidget(skippedlabel) skippedbox.addWidget(self.skiprows) layout = QtGui.QVBoxLayout() layout.addLayout(self.filebox()) layout.addLayout(skippedbox) layout.addWidget(self.buttonbox()) self.setLayout(layout) self.setWindowTitle("Import " + str(filetype))
def __init__(self, file_name=None, parent=None): from nexpy.gui.consoleapp import _mainwindow self.window = _mainwindow.editors QtGui.QWidget.__init__(self, parent=self.window.tabs) self.file_name = file_name from consoleapp import _nexpy_dir self.default_directory = os.path.join(_nexpy_dir, 'scripts') layout = QtGui.QVBoxLayout() self.text_layout = QtGui.QHBoxLayout() self.number_box = QtGui.QLabel('1') self.number_box.setFont(QtGui.QFont('Courier')) self.number_box.setAlignment(QtCore.Qt.AlignTop | QtCore.Qt.AlignRight) self.number_box.setStyleSheet("QLabel {padding: 1px 0}") self.text_box = NXPlainTextEdit(self) self.text_layout.addWidget(self.number_box) self.text_layout.addWidget(self.text_box) layout.addLayout(self.text_layout) run_button = QtGui.QPushButton('Run Script') run_button.clicked.connect(self.run_script) run_button.setAutoDefault(False) self.argument_box = QtGui.QLineEdit() self.argument_box.setMinimumWidth(200) save_button = QtGui.QPushButton('Save') save_button.clicked.connect(self.save_script) save_as_button = QtGui.QPushButton('Save as...') save_as_button.clicked.connect(self.save_script_as) self.delete_button = QtGui.QPushButton('Delete') self.delete_button.clicked.connect(self.delete_script) close_button = QtGui.QPushButton('Close Tab') close_button.clicked.connect(self.close) button_layout = QtGui.QHBoxLayout() button_layout.addWidget(run_button) button_layout.addWidget(self.argument_box) button_layout.addStretch() button_layout.addWidget(save_button) button_layout.addWidget(save_as_button) button_layout.addWidget(self.delete_button) button_layout.addWidget(close_button) layout.addLayout(button_layout) self.setLayout(layout) if self.file_name: with open(self.file_name, 'r') as f: text = f.read() self.text_box.setPlainText(text) self.window.tabs.addTab(self, os.path.basename(self.file_name)) self.update_line_numbers(self.text_box.count) else: self.delete_button.setVisible(False) self.window.tabs.addTab(self, 'Untitled %s' % (self.window.tabs.count()+1)) self.index = self.window.tabs.indexOf(self) self.window.tabs.adjustSize() self.window.tabs.setCurrentWidget(self) self.hl = Highlighter(self.text_box.document())
def __init__(self, entry, parent=None): super(FitDialog, self).__init__(parent) self.setMinimumWidth(850) self.data = self.initialize_data(entry.data) from nexpy.gui.consoleapp import _tree self.tree = _tree from nexpy.gui.plotview import plotview self.plotview = plotview self.functions = [] self.parameters = [] self.first_time = True self.fitted = False self.fit = None self.initialize_functions() function_layout = QtGui.QHBoxLayout() self.functioncombo = QtGui.QComboBox() for name in sorted(self.function_module.keys()): self.functioncombo.addItem(name) self.functioncombo.setSizeAdjustPolicy( QtGui.QComboBox.AdjustToContents) self.functioncombo.setMinimumWidth(100) add_button = QtGui.QPushButton("Add Function") add_button.clicked.connect(self.add_function) function_layout.addWidget(self.functioncombo) function_layout.addWidget(add_button) function_layout.addStretch() self.header_font = QtGui.QFont() self.header_font.setBold(True) self.parameter_layout = self.initialize_parameter_grid() self.remove_layout = QtGui.QHBoxLayout() remove_button = QtGui.QPushButton("Remove Function") remove_button.clicked.connect(self.remove_function) self.removecombo = QtGui.QComboBox() self.removecombo.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents) self.removecombo.setMinimumWidth(100) self.remove_layout.addWidget(remove_button) self.remove_layout.addWidget(self.removecombo) self.remove_layout.addStretch() self.plot_layout = QtGui.QHBoxLayout() plot_data_button = QtGui.QPushButton('Plot Data') plot_data_button.clicked.connect(self.plot_data) plot_function_button = QtGui.QPushButton('Plot Function') plot_function_button.clicked.connect(self.plot_model) self.plotcombo = QtGui.QComboBox() self.plotcombo.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents) self.plotcombo.setMinimumWidth(100) plot_label = QtGui.QLabel('X-axis:') self.plot_minbox = QtGui.QLineEdit(str(self.plotview.xtab.axis.min)) self.plot_minbox.setAlignment(QtCore.Qt.AlignRight) plot_tolabel = QtGui.QLabel(' to ') self.plot_maxbox = QtGui.QLineEdit(str(self.plotview.xtab.axis.max)) self.plot_maxbox.setAlignment(QtCore.Qt.AlignRight) self.plot_checkbox = QtGui.QCheckBox('Use Data Points') self.plot_layout.addWidget(plot_data_button) self.plot_layout.addWidget(plot_function_button) self.plot_layout.addWidget(self.plotcombo) self.plot_layout.addWidget(plot_label) self.plot_layout.addWidget(self.plot_minbox) self.plot_layout.addWidget(plot_tolabel) self.plot_layout.addWidget(self.plot_maxbox) self.plot_layout.addWidget(self.plot_checkbox) self.plot_layout.addStretch() self.action_layout = QtGui.QHBoxLayout() fit_button = QtGui.QPushButton("Fit") fit_button.clicked.connect(self.fit_data) self.fit_label = QtGui.QLabel() if self.data.nxerrors: self.fit_checkbox = QtGui.QCheckBox('Use Errors') self.fit_checkbox.setCheckState(QtCore.Qt.Checked) else: self.fit_checkbox = QtGui.QCheckBox('Use Poisson Errors') self.fit_checkbox.setCheckState(QtCore.Qt.Unchecked) self.fit_checkbox.stateChanged.connect(self.define_errors) self.report_button = QtGui.QPushButton("Show Fit Report") self.report_button.clicked.connect(self.report_fit) self.save_button = QtGui.QPushButton("Save Parameters") self.save_button.clicked.connect(self.save_fit) self.restore_button = QtGui.QPushButton("Restore Parameters") self.restore_button.clicked.connect(self.restore_parameters) self.action_layout.addWidget(fit_button) self.action_layout.addWidget(self.fit_label) self.action_layout.addStretch() self.action_layout.addWidget(self.fit_checkbox) self.action_layout.addWidget(self.save_button) self.layout = QtGui.QVBoxLayout() self.layout.addLayout(function_layout) self.layout.addWidget(self.close_buttons()) self.setLayout(self.layout) self.setWindowTitle("Fit NeXus Data") self.load_entry(entry)
def __init__(self, parent=None): super(MapDialog, self).__init__(parent) self.select_entry() dets_list = {} self.dets = self.entry['instrument/fluorescence'] self.signal_combo = self.select_box(self.dets, default='sdd3') self.axes = self.entry['sample/positioner'] self.axis1_combo = self.select_box(self.axes, default='hex_xp') self.axis2_combo = self.select_box(self.axes, default='hex_yp') roi_peak_layout = QtGui.QHBoxLayout() roi_peak_layout.addWidget(QtGui.QLabel('ROI Peak')) self.roi_peak = QtGui.QSlider(Qt.Horizontal) self.pLabel = QtGui.QLineEdit() self.pLabel.setText('800') self.pLabel.setSizePolicy(QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum)) self.pLabel.setAlignment(Qt.AlignRight) self.roi_peak.setMinimum(0) self.roi_peak.setMaximum(256) self.roi_peak.setValue(80) self.roi_peak.setTickPosition(QtGui.QSlider.TicksBelow) self.roi_peak.setTickInterval(1) roi_peak_layout.addWidget(self.roi_peak) self.roi_peak.valueChanged.connect(self.setRoi) self.pLabel.returnPressed.connect(self.setRoi2) self.pUnits = QtGui.QLabel('eV') roi_peak_layout.addWidget(self.pLabel) roi_peak_layout.addWidget(self.pUnits) roi_width_layout = QtGui.QHBoxLayout() roi_width_layout.addWidget(QtGui.QLabel('ROI Width')) self.roi_width = QtGui.QSlider(Qt.Horizontal) self.wLabel = QtGui.QLineEdit() self.wLabel.setText('200') self.wLabel.setSizePolicy(QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum)) self.wLabel.setAlignment(Qt.AlignRight) self.roi_width.setMinimum(2) self.roi_width.setMaximum(100) self.roi_width.setValue(20) self.roi_width.setTickPosition(QtGui.QSlider.TicksBelow) self.roi_peak.setTickInterval(1) roi_width_layout.addWidget(self.roi_width) self.roi_width.valueChanged.connect(self.setRoi) self.wLabel.returnPressed.connect(self.setRoi2) self.signal_combo.activated.connect(self.setRoi) self.axis1_combo.activated.connect(self.setRoi) self.axis2_combo.activated.connect(self.setRoi) self.entry_box.activated.connect(self.setRoi) self.wUnits = QtGui.QLabel('eV') roi_width_layout.addWidget(self.wLabel) roi_width_layout.addWidget(self.wUnits) lab_sig_layout = QtGui.QHBoxLayout() self.lab_sig = self.labels('Detector :', align='left') lab_sig_layout.addLayout(self.lab_sig) lab_sig_layout.addWidget(self.signal_combo) lab_sig_layout.addStretch() lab_axis1_layout = QtGui.QHBoxLayout() self.lab_axis1 = self.labels('X-Axis :', align='left') lab_axis1_layout.addLayout(self.lab_axis1) lab_axis1_layout.addWidget(self.axis1_combo) lab_axis1_layout.addStretch() lab_axis2_layout = QtGui.QHBoxLayout() self.lab_axis2 = self.labels('Y-Axis :', align='left') lab_axis2_layout.addLayout(self.lab_axis2) lab_axis2_layout.addWidget(self.axis2_combo) lab_axis2_layout.addStretch() self.set_layout(self.entry_layout, lab_sig_layout, lab_axis1_layout, lab_axis2_layout, roi_peak_layout, roi_width_layout, self.close_buttons()) self.set_title('Convert to 2D map')
def __init__(self, parent=None): super(MultiXasDialog, self).__init__(parent) layout = QtGui.QVBoxLayout() self.h_line = QHLine() self.h_line2 = QHLine() self.h_line3 = QHLine() self.select_root(text='Select File :') self.select_entry_num(text='First Entry :') self.select_entry_num(text='Last Entry :', other='True') self.select_abs() self.select_sdd() self.roi_peak_slider() self.roi_width_slider() self.pb_ploteems = QtGui.QPushButton() self.pb_ploteems.setObjectName("plot eems") self.pb_ploteems.setText("Plot EEMS") self.pb_getsumplot = QtGui.QPushButton() self.pb_getsumplot.setObjectName("summary plot") self.pb_getsumplot.setText("Summary Plot") self.pb_get_averaged = QtGui.QPushButton() self.pb_get_averaged.setObjectName("interpolated plots") self.pb_get_averaged.setText("Interpolated Plots") self.pb_get_single_averaged = QtGui.QPushButton() self.pb_get_single_averaged.setObjectName("single interpolated plot") self.pb_get_single_averaged.setText("Single Interpolated Plot") self.pb_get_normalized = QtGui.QPushButton() self.pb_get_normalized.setObjectName("normalized data") self.pb_get_normalized.setText("Normalized Data") self.bin_interval = QtGui.QLineEdit("0.1") self.bin_interval.setObjectName("Bin Interval") self.bad_scans = QtGui.QLineEdit() self.bad_scans.setObjectName("Bad Scans") layout.addLayout(self.root_layout) layout.addLayout(self.select_sdd()) layout.addLayout(self.select_eem_entry()) layout.addWidget(self.pb_ploteems) layout.addWidget(self.h_line) layout.addLayout(self.entry_num_layout) layout.addLayout(self.other_entry_num_layout) layout.addLayout(self.roi_peak_slider()) layout.addLayout(self.roi_width_slider()) layout.addLayout(self.select_abs()) layout.addWidget(self.pb_getsumplot) layout.addWidget(self.h_line2) bin_interval_layout = QtGui.QHBoxLayout() bin_interval_layout.addWidget(QtGui.QLabel('Bin Interval (eV) : ')) bin_interval_layout.addWidget(self.bin_interval) layout.addLayout(bin_interval_layout) bad_scan_layout = QtGui.QHBoxLayout() bad_scan_layout.addWidget(QtGui.QLabel('Bad Scans : ')) bad_scan_layout.addWidget(self.bad_scans) layout.addLayout(bad_scan_layout) layout.addWidget(self.pb_get_averaged) layout.addWidget(self.h_line3) layout.addLayout(self.select_normalization()) layout.addWidget(self.pb_get_normalized) # layout.addWidget(self.close_buttons()) self.setLayout(layout) self.pb_ploteems.clicked.connect(self.plot_eems) self.pb_getsumplot.clicked.connect(self.plot_sum) self.pb_get_averaged.clicked.connect(self.plot_averaged_data) self.pb_get_normalized.clicked.connect(self.plot_normalized_data) self.root_box.currentIndexChanged.connect(self.refresh_entry) self.set_title('Multi XAS')