コード例 #1
0
 def add_row(self, name, checkbox_name=None):
    current_row = self.layout.rowCount()
    if self.layout.count != 0:
       current_row +=1
    l = QtGui.QLabel(name) # graph width label
    sp = QtGui.QSpinBox()     # graph width spinbox
    sp.setMaximum(max(QtGui.QApplication.desktop().size().width(),
                      QtGui.QApplication.desktop().size().height()))
    self.rows[name] = (l, sp)
    self.layout.addWidget(l,current_row, 0)
    self.layout.addWidget(sp,current_row, 1)
    if checkbox_name is not None:
       l_check = QtGui.QLabel(checkbox_name)
       check = QtGui.QCheckBox()
       self.layout.addWidget(l_check, current_row, 2)
       self.layout.addWidget(check, current_row, 3)
       return l, sp, check
    return l, sp
コード例 #2
0
import pyqtgraph as pg
from pyqtgraph import QtGui
from pyqtgraph import QtCore
import numpy as np
import cdp_gather as cdp
import cdp_gui
import time

## Always start by initializing Qt (only once per application)
app = QtGui.QApplication([])

## Define a top-level widget to hold everything
w = QtGui.QWidget()

cdp_scale_text = QtGui.QLabel('Perc')
cdp_scale_spin = QtGui.QSpinBox().setValue(90)

#Setting background and axis configuration
pg.setConfigOption('background', 'w')
pg.setConfigOption('foreground', 'k')

plot2 = pg.PlotWidget(parent=None)
#Modify widgets
#Procurar funcao de set between lines

cdp_window = cdp_gui.cdp_gui()
cdp_index_text = cdp_window.spin_label
cdp_index_spin = cdp_window.spin
#Trace window
cdp_window.plot_cdp()
#Semblance window
コード例 #3
0
    def __init__(self, **kwargs):
        self.holograms = list()

        super(TimeSeriesCreator, self).__init__(**kwargs)
        self.setModal(True)
        self.setWindowTitle('Create hologram time series')

        # Create reorderable list
        # Example from http://www.walletfox.com/course/qtreorderablelist.php
        self.hologram_table = QtGui.QListWidget(parent=self)
        self.hologram_table.setDragDropMode(
            QtGui.QAbstractItemView.InternalMove)

        self.assembly_progress_bar = QtGui.QProgressBar(parent=self)
        self.assembly_progress_bar.setRange(0, 100)
        self._assembly_update_signal.connect(
            self.assembly_progress_bar.setValue)
        self.assembly_progress_bar.hide()

        # Wavelength widgets as spinboxes
        # wavelength 2 and 3 are hidden with a default of None
        self.wavelength1_widget = QtGui.QSpinBox(parent=self)
        self.wavelength2_widget = QtGui.QSpinBox(parent=self)
        self.wavelength3_widget = QtGui.QSpinBox(parent=self)

        self.wavelength2_widget.hide()
        self.wavelength3_widget.hide()

        for widget in (self.wavelength1_widget, self.wavelength2_widget,
                       self.wavelength3_widget):
            widget.setSuffix(' nm')
            widget.setMinimum(0)  # value of 0  -> not to be counted
            widget.setMaximum(999)

        self.wavelength1_widget.setValue(405)
        self.wavelength1_widget.setMinimum(
            1)  # At least one wavelength must be given

        # Create an exclusive button group in which only one-wavelength or three-wavelengths
        # can be active at one time
        self.one_wavelength_mode_btn = QtGui.QPushButton(
            'Single-wavelength time-series', self)
        self.one_wavelength_mode_btn.setCheckable(True)
        self.one_wavelength_mode_btn.setChecked(True)
        self.three_wavelength_mode_btn = QtGui.QPushButton(
            'Three-wavelength time-series', self)
        self.three_wavelength_mode_btn.setCheckable(True)
        self.three_wavelength_mode_btn.setChecked(False)

        self.wavelength_btns = QtGui.QButtonGroup(parent=self)
        self.wavelength_btns.addButton(self.one_wavelength_mode_btn, id=1)
        self.wavelength_btns.addButton(self.three_wavelength_mode_btn, id=3)
        self.wavelength_btns.setExclusive(True)
        self.wavelength_btns.buttonClicked[int].connect(
            self.set_wavelength_mode)

        file_search_btn = QtGui.QPushButton('Add hologram', self)
        file_search_btn.clicked.connect(self.add_hologram_file)

        clear_btn = QtGui.QPushButton('Clear holograms', self)
        clear_btn.clicked.connect(self.clear)

        accept_btn = QtGui.QPushButton('Create', self)
        accept_btn.clicked.connect(self.accept)

        reject_btn = QtGui.QPushButton('Cancel', self)
        reject_btn.clicked.connect(self.reject)
        reject_btn.setDefault(True)

        hologram_btns = QtGui.QHBoxLayout()
        hologram_btns.addWidget(file_search_btn)
        hologram_btns.addWidget(clear_btn)

        wavelength_mode_layout = QtGui.QHBoxLayout()
        wavelength_mode_layout.addWidget(self.one_wavelength_mode_btn)
        wavelength_mode_layout.addWidget(self.three_wavelength_mode_btn)

        wavelength_layout = QtGui.QHBoxLayout()
        wlabel = QtGui.QLabel('Wavelength(s):')
        wlabel.setAlignment(QtCore.Qt.AlignCenter)
        wavelength_layout.addWidget(wlabel)
        wavelength_layout.addWidget(self.wavelength1_widget)
        wavelength_layout.addWidget(self.wavelength2_widget)
        wavelength_layout.addWidget(self.wavelength3_widget)

        btns = QtGui.QHBoxLayout()
        btns.addWidget(accept_btn)
        btns.addWidget(reject_btn)

        explanation = QtGui.QLabel(
            'Add holograms and order them by drag-and-drop')
        explanation.setAlignment(QtCore.Qt.AlignCenter)

        layout = QtGui.QVBoxLayout()
        layout.addWidget(explanation)
        layout.addLayout(hologram_btns)
        layout.addWidget(self.hologram_table)
        layout.addLayout(wavelength_mode_layout)
        layout.addLayout(wavelength_layout)
        layout.addWidget(self.assembly_progress_bar)
        layout.addLayout(btns)
        self.setLayout(layout)