예제 #1
0
    def __init__(self, mgr):
        super(ExecWindow, self).__init__()

        self.mgr = mgr

        self.outputViews = {}

        self.label = QtGui.QLabel()
        self.combobox = QtGui.QComboBox()
        self.combobox.SizeAdjustPolicy = \
            QtGui.QComboBox.AdjustToContents

        button_layout = QtGui.QHBoxLayout()
        self.refresher = QtGui.QPushButton('Refresh')
        self.refresher.clicked.connect(self.refresh)
        self.outviewer = QtGui.QPushButton('Show Output')
        self.outviewer.clicked.connect(self.outview)
        self.killer = QtGui.QPushButton('Kill')
        self.killer.clicked.connect(self.kill_task)
        button_layout.addWidget(self.refresher)
        button_layout.addWidget(self.outviewer)
        button_layout.addWidget(self.killer)
        button_layout.addStretch()

        layout = QtGui.QVBoxLayout()
        layout.addWidget(self.label)
        layout.addWidget(self.combobox)
        layout.addLayout(button_layout)
        self.setLayout(layout)
        self.setWindowTitle("Execution list")
        self.refresh()
예제 #2
0
    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
예제 #3
0
    def __init__(self, task_id, task):
        super(ExecOutput, self).__init__()
        self.task = task
        self.setWindowTitle("NeXpy: Output: (%i)" % task_id)

        labelHost = QtGui.QLabel()
        labelHost.setText("hostname: " + task.ssh.host)
        self.editor = QtGui.QTextEdit(self)
        self.editor.setFixedWidth(750)
        self.editor.setFixedHeight(500)
        self.refresher = QtGui.QPushButton('Refresh')
        self.refresher.clicked.connect(self.refresh)
        layout = QtGui.QVBoxLayout()
        layout.addWidget(labelHost)
        layout.addWidget(self.editor)
        layout.addWidget(self.refresher)
        self.setLayout(layout)
예제 #4
0
    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())
예제 #5
0
    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)
예제 #6
0
    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')