def __init__(self, parent, appdata): super(SessionInfos, self).__init__(parent) self.appdata = appdata self.setWindowTitle( 'Information for the session' ) self.setFixedSize(250, 300) self.buttonBox = QDialogButtonBox( self ) self.buttonBox.setOrientation( Qt.Horizontal ) self.buttonBox.setStandardButtons( QDialogButtonBox.Cancel|QDialogButtonBox.Ok ) labelcombo = QLabel( 'Breathing Zone:' ) self.breathzone = QComboBox() self.breathzone.addItem( '', '' ) self.breathzone.addItem( 'Abdominal', 1 ) self.breathzone.addItem( 'Thoracic', 2 ) self.breathzone.move(10, 10) labelnote = QLabel( 'Note:' ) self.note = QTextEdit() layout = QVBoxLayout() layout.addWidget( self.create_SessionType_Group() ) layout.addWidget( labelcombo ) layout.addWidget( self.breathzone ) layout.addWidget( labelnote ) layout.addWidget( self.note ) layout.addWidget( self.buttonBox ) self.setLayout( layout ) self.buttonBox.accepted.connect( self.accept ) self.buttonBox.rejected.connect( self.reject )
def __init__(self, parent, widgetclass, toolbar = None): super(myDockableWidget, self).__init__(parent) self.toolbar = toolbar layout = QVBoxLayout() self.widget = widgetclass() layout.addWidget(self.widget) self.setLayout(layout)
def __init__(self, parent): super(MakeNicerWidget, self).__init__(parent) self.data = np.array([]) # array which holds data # Time domain plot self.tdWidget = DockablePlotWidget(self, CurveWidget) self.tdWidget.calcFun.addFun('fs', lambda x: x, lambda x: x) self.tdWidget.calcFun.addFun('µm', lambda x: x * fsDelay * 1e3, lambda x: x / fsDelay * 1e-3) self.tdWidget.calcFun.addFun('mm', lambda x: x * fsDelay, lambda x: x / fsDelay) tdPlot = self.tdWidget.get_plot() self.tdSignal = SignalFT(self, plot=tdPlot) self.tdFit = SignalFT(self, plot=tdPlot, col='r') # Frequency domain plot self.fdWidget = DockablePlotWidget(self, CurveWidget) self.fdWidget.calcFun.addFun('PHz', lambda x: x, lambda x: x) self.fdWidget.calcFun.addFun('THz', lambda x: x * 1e3, lambda x: x * 1e-3) self.fdWidget.calcFun.addFun('µm', lambda x: c0 / x * 1e-9, lambda x: c0 / x * 1e-9) self.fdWidget.calcFun.addFun('eV', lambda x: x, lambda x: x) fdplot = self.fdWidget.get_plot() self.fdSignal = SignalFT(self, plot=fdplot) self.fdFit = SignalFT(self, plot=fdplot, col='r') self.smoothNum = QSpinBox() # gives number of smoothin points self.smoothNum.setMinimum(1) self.smoothNum.setSingleStep(2) # Put things together in layouts buttonLayout = QGridLayout() plotLayout = QVBoxLayout() layout = QHBoxLayout() plotLayout.addWidget(self.tdWidget) plotLayout.addWidget(self.fdWidget) buttonLayout.addWidget(QLabel('Fitting function'), 0, 0) buttonLayout.addWidget( QLineEdit("lambda x,A,f,phi: np.sin(2*np.pi*f*x+phi)"), 1, 0, 1, 2) buttonLayout.addWidget(QLabel('Smooth'), 2, 0) buttonLayout.addWidget(self.smoothNum, 2, 1) buttonLayout.setRowStretch(3, 20) layout.addLayout(buttonLayout) layout.addLayout(plotLayout) self.setLayout(layout) # connect signals self.updateTdPlot.connect(self.tdSignal.updatePlot) self.updateTdFitPlot.connect(self.tdFit.updatePlot) self.updateFdPlot.connect(lambda data: self.fdSignal.updatePlot( self.fdSignal.computeFFT(data))) self.updateFdFitPlot.connect( lambda data: self.fdFit.updatePlot(self.fdFit.computeFFT(data))) self.smoothNum.valueChanged.connect(self.smoothData) self.setData()
def __init__(self, wintitle): super(Window, self).__init__() self.default_tool = None self.plots = [] self.itemlist = PlotItemList(None) self.contrast = ContrastAdjustment(None) self.xcsw = XCrossSection(None) self.ycsw = YCrossSection(None) self.manager = PlotManager(self) self.toolbar = QToolBar(_("Tools"), self) self.manager.add_toolbar(self.toolbar, "default") self.toolbar.setMovable(True) self.toolbar.setFloatable(True) self.addToolBar(Qt.TopToolBarArea, self.toolbar) frame = QFrame(self) self.setCentralWidget(frame) self.layout = QGridLayout() layout = QVBoxLayout(frame) frame.setLayout(layout) layout.addLayout(self.layout) self.frame = frame self.setWindowTitle(wintitle) self.setWindowIcon(get_icon('guiqwt.svg'))
def setup_widget_layout(self): vlayout = QVBoxLayout(self) vlayout.addWidget(self.toolbar) vlayout.addLayout(self.plot_layout) self.setLayout(vlayout) if self.edit: self.button_layout = QHBoxLayout() self.install_button_layout() vlayout.addLayout(self.button_layout)
def __init__(self, parent=None, op=None): QWidget.__init__(self, parent) self.widget_layout = QVBoxLayout() self.minimumHeight = 200 # FIXME: hab noch nie verstanden warum das net einfach einfach ist... self.setLayout(self.widget_layout) self._op = None self._widgets = [] self._par_names = []
def setup_widget(self): self.plot = ImagePlot(self) self.image = make.xyimage(self.x, self.y, self.data, colormap='jet') self.plot.add_item(self.image) self.plot.set_antialiasing(True) vlayout = QVBoxLayout() vlayout.addWidget(self.plot) self.setLayout(vlayout)
def __init__(self, parent=None, tdms_file=None, group_label="Data group", channel_labels=["X channel", "Y channel", "Z channel", "Z2 channel", ]): """ Params ====== twin_z : bool Allow to select two Z (data) channels group_label : str: Label text for group combo box channel_labels : list of str Label texts for channel combo boxes """ QWidget.__init__(self, parent) self.widget_layout = QVBoxLayout() self.group_widgets = [] self.channel_widgets = [] for i, label_text in enumerate([group_label] + channel_labels): label = QLabel(label_text) channel_widget = QComboBox() channel_widget.addItem(label_text) channel_widget.setMinimumWidth(250) channel_widget.setDisabled(True) group_widget = QComboBox() group_widget.addItem(label_text) group_widget.setMinimumWidth(250) group_widget.setDisabled(True) layout = QHBoxLayout() layout.addWidget(label) layout.addWidget(group_widget) if i != 0: layout.addWidget(channel_widget) self.widget_layout.addLayout(layout) if i == 0: self.group_combo = group_widget self.group_combo.currentIndexChanged.connect(self.change_sub_channels) else: self.group_widgets.append(group_widget) self.channel_widgets.append(channel_widget) group_widget.currentIndexChanged.connect(self._populate_channels) self.setLayout(self.widget_layout) self.tdms_file = tdms_file
def setTabs(self, spec=[]): self.removeTabs() self.spec = spec if spec != []: self.sp = [ SpectrometerPanel(self, spec=n, count=c) for n in self.spec for c in range(len(n.frequency)) ] else: self.sp = [SpectrometerPanel(self)] # Spectrometer tabs for sp in self.sp: vBoxlayout = QVBoxLayout() vBoxlayout.addWidget(sp) tab = QWidget() tab.setLayout(vBoxlayout) self.addTab(tab, sp.name) # Summary tab tab = QWidget() vBoxlayout = QVBoxLayout() self.summary = SummaryPanel(self) vBoxlayout.addWidget(self.summary) tab.setLayout(vBoxlayout) self.addTab(tab, 'Summary') # Math tab tab = QWidget() vBoxlayout = QVBoxLayout() self.math = MathPanel(self) vBoxlayout.addWidget(self.math) tab.setLayout(vBoxlayout) self.addTab(tab, 'Math') # Retrieval tab tab = QWidget() vBoxlayout = QVBoxLayout() self.retrieval = RetrievalPanel(self) vBoxlayout.addWidget(self.retrieval) tab.setLayout(vBoxlayout) self.addTab(tab, 'Retrieval')
def setup_widget(self): self.plot = CurvePlot(self) self.data_cut = make.curve(self.xdata, self.ydata) self.data_fit = make.curve(self.xfit, self.yfit) self.plot.add_item(self.data_cut) self.plot.add_item(self.data_fit) vlayout = QVBoxLayout() vlayout.addWidget(self.plot) self.setLayout(vlayout)
def create_SessionType_Group( self ): groupBox = QGroupBox(' Session Type' ) vbox = QVBoxLayout() self.sessiontypes = [] types = [['Unconscious', 0], ['Mindfull', 1]] for t in types: self.sessiontypes.append( QRadioButton( t[0] ) ) vbox.addWidget( self.sessiontypes[-1] ) self.sessiontypes[0].setChecked(True) vbox.addStretch(1) groupBox.setLayout(vbox) return groupBox
def setTabs(self, spec=[], axisLimits=[0, 40, 0, 400]): self.removeTabs() self.spec = spec self.sp=[SpectrometerPanel(self,spec=n,axisLimits=axisLimits)\ for n in self.spec] if self.spec else [SpectrometerPanel(self)] for sp in self.sp: vBoxlayout = QVBoxLayout() vBoxlayout.addWidget(sp) tab = QWidget() tab.setLayout(vBoxlayout) self.addTab(tab, sp.name)
def setup_widget(self): toolbar = self.toolbar toolbar.setOrientation(Qt.Horizontal) layout = QVBoxLayout() if self.xsection_pos == "top": layout.addSpacerItem(self.spacer) layout.addWidget(toolbar) layout.addWidget(self.cs_plot) if self.xsection_pos == "bottom": layout.addSpacerItem(self.spacer) layout.setContentsMargins(0, 0, 0, 0) self.setLayout(layout)
def __init__(self, parent): QWidget.__init__(self, parent) font = QFont(get_family(MONOSPACE), 10, QFont.Normal) info_icon = QLabel() icon = get_std_icon('MessageBoxInformation').pixmap(24, 24) info_icon.setPixmap(icon) info_icon.setFixedWidth(32) info_icon.setAlignment(Qt.AlignTop) self.desc_label = QLabel() self.desc_label.setWordWrap(True) self.desc_label.setAlignment(Qt.AlignTop) self.desc_label.setFont(font) group_desc = QGroupBox(_("Description"), self) layout = QHBoxLayout() layout.addWidget(info_icon) layout.addWidget(self.desc_label) group_desc.setLayout(layout) self.editor = CodeEditor(self) self.editor.setup_editor(linenumbers=True, font=font) self.editor.setReadOnly(True) group_code = QGroupBox(_("Source code"), self) layout = QVBoxLayout() layout.addWidget(self.editor) group_code.setLayout(layout) self.run_button = QPushButton(get_icon("apply.png"), _("Run this script"), self) self.quit_button = QPushButton(get_icon("exit.png"), _("Quit"), self) hlayout = QHBoxLayout() hlayout.addWidget(self.run_button) hlayout.addStretch() hlayout.addWidget(self.quit_button) vlayout = QVBoxLayout() vlayout.addWidget(group_desc) vlayout.addWidget(group_code) vlayout.addLayout(hlayout) self.setLayout(vlayout)
def __init__(self, parent): super(FileUi, self).__init__(Qt.Vertical, parent) layoutWidget = QWidget() layout = QVBoxLayout() layoutWidget.setLayout(layout) self.comment = QPlainTextEdit() self.fileName = None self.saveTxtCheck = QCheckBox('Save Txt') self.saveHdfCheck = QCheckBox('Save HDF5') self.saveTxtBtn = QPushButton('Save Txt') self.saveHdfBtn = QPushButton('Save HDF5') ############# # stream group streamGroup = QGroupBox('Stream data to file:') streamGroup.setFlat(True) streamGroupLayout = QHBoxLayout() streamGroupLayout.addWidget(self.saveTxtCheck) streamGroupLayout.addWidget(self.saveHdfCheck) streamGroup.setLayout(streamGroupLayout) ############## # save static file saveGroup = QGroupBox('Save now to file:') saveGroup.setFlat(True) saveGroupLayout = QHBoxLayout() saveGroupLayout.addWidget(self.saveTxtBtn) saveGroupLayout.addWidget(self.saveHdfBtn) saveGroup.setLayout(saveGroupLayout) ############## # put layout together layout.addWidget(QLabel('Comment:')) layout.addWidget(self.comment) layout.addWidget(streamGroup) layout.addWidget(saveGroup) self.addWidget(layoutWidget) ############## # connnect stuff for functionality self.saveTxtCheck.stateChanged.connect(self.__makeFileName) self.saveHdfCheck.stateChanged.connect(self.__makeFileName) ############## # thread for streaming data to file #self.updateCurrPos.connect(self.__updateCurrPos) self.stream_thread = QThread() # create the QThread self.stream_thread.start() self.stream_worker = GenericWorker(self.__streamFile) self.stream_worker.moveToThread(self.stream_thread)
def __init__(self, parent, plotwidgetclass, toolbar=None): super(DockablePlotWidget, self).__init__(parent) self.toolbar = toolbar self.layout = QVBoxLayout() self.plotwidget = plotwidgetclass() self.layout.addWidget(self.plotwidget) self.calcFun = XAxeCalc(self) self.layout.addWidget(self.calcFun) self.setLayout(self.layout) if toolbar is None: self.setupNoTB() else: self.setup()
def setTabs(self, spec_names): self.sp = [ SpectrometerPanel(self.parent, name=name) for name in spec_names ] for sp in self.sp: vBoxlayout = QVBoxLayout() vBoxlayout.addWidget(sp) tab = QWidget() tab.setLayout(vBoxlayout) self.addTab(tab, sp.name) sp.curves['Antenna'][0].setPen(QPen(Qt.black, 1)) sp.curves['Antenna'][1].setPen(QPen(Qt.red, 1))
def __init__(self, label, klass, wordwrap=False, **kwargs): QGroupBox.__init__(self, label) self.klass = klass self.dataset = klass(**kwargs) self.layout = QVBoxLayout() if self.dataset.get_comment(): label = QLabel(self.dataset.get_comment()) label.setWordWrap(wordwrap) self.layout.addWidget(label) self.grid_layout = QGridLayout() self.layout.addLayout(self.grid_layout) self.setLayout(self.layout) self.edit = self.get_edit_layout()
def __init__(self, parent=None, **kwargs): QDialog.__init__(self) layout = QVBoxLayout() self.tdms_widget = TdmsChannelSelectWidget(parent=self, **kwargs) layout.addWidget(self.tdms_widget) # OK and Cancel buttons buttons = QDialogButtonBox( QDialogButtonBox.Ok | QDialogButtonBox.Cancel, QtCore.Qt.Horizontal, self) buttons.accepted.connect(self.accept) buttons.rejected.connect(self.reject) layout.addWidget(buttons) self.setLayout(layout)
def __init__(self, item, parent_layout): super(ChoiceWidget, self).__init__(item, parent_layout) self._first_call = True self.is_radio = item.get_prop_value("display", "radio") self.store = self.item.get_prop("display", "store", None) if self.is_radio: self.group = QGroupBox() self.group.setToolTip(item.get_help()) self.vbox = QVBoxLayout() self.group.setLayout(self.vbox) self._buttons = [] else: self.combobox = self.group = QComboBox() self.combobox.setToolTip(item.get_help()) self.combobox.currentIndexChanged.connect(self.index_changed)
def setTabs(self, spec=[]): self.removeTabs() self.spec = spec if spec != []: self.sp = [ SpectrometerPanel(self, spec=n, count=c) for n in self.spec for c in range(len(n.frequency)) ] else: self.sp = [SpectrometerPanel(self)] for sp in self.sp: vBoxlayout = QVBoxLayout() vBoxlayout.addWidget(sp) tab = QWidget() tab.setLayout(vBoxlayout) self.addTab(tab, sp.name) tab = QWidget() vBoxlayout = QVBoxLayout() self.summary = SummaryPanel(self, tabs=self.sp) vBoxlayout.addWidget(self.summary) tab.setLayout(vBoxlayout) self.addTab(tab, 'Summary')
def __init__(self, parent, options=None): QWidget.__init__(self, parent=parent) if options is None: options = {} self.imagewidget = ImageWidget(self, **options) self.imagewidget.register_all_image_tools() hlayout = QHBoxLayout() self.add_buttons_to_layout(hlayout) vlayout = QVBoxLayout() vlayout.addWidget(self.imagewidget) vlayout.addLayout(hlayout) self.setLayout(vlayout)
def create_autofit_group(self): auto_button = QPushButton(get_icon('apply.png'), _("Run"), self) auto_button.clicked.connect(self.autofit) autoprm_button = QPushButton(get_icon('settings.png'), _("Settings"), self) autoprm_button.clicked.connect(self.edit_parameters) xrange_button = QPushButton(get_icon('xrange.png'), _("Bounds"), self) xrange_button.setCheckable(True) xrange_button.toggled.connect(self.toggle_xrange) auto_layout = QVBoxLayout() auto_layout.addWidget(auto_button) auto_layout.addWidget(autoprm_button) auto_layout.addWidget(xrange_button) self.button_list += [auto_button, autoprm_button, xrange_button] return create_groupbox(self, _("Automatic fit"), layout=auto_layout)
def setup_widget(self, title): #---Create the plot widget: self.plot = CurvePlot(self) self.curve_item = make.curve([], [], color='b') self.plot.add_item(self.curve_item) self.plot.set_antialiasing(True) #--- button = QPushButton("Test filter: %s" % title) button.clicked.connect(self.process_data) vlayout = QVBoxLayout() vlayout.addWidget(self.plot) vlayout.addWidget(button) self.setLayout(vlayout) self.update_curve()
def setup_widget_layout(self): self.fit_layout = QHBoxLayout() self.params_layout = QGridLayout() params_group = create_groupbox(self, _("Fit parameters"), layout=self.params_layout) if self.auto_fit_enabled: auto_group = self.create_autofit_group() self.fit_layout.addWidget(auto_group) self.fit_layout.addWidget(params_group) self.plot_layout.addLayout(self.fit_layout, 1, 0) vlayout = QVBoxLayout(self) vlayout.addWidget(self.toolbar) vlayout.addLayout(self.plot_layout) self.setLayout(vlayout)
def __init__(self, parent=None): QWidget.__init__(self, parent) self.widget_layout = QVBoxLayout() title_layout = QHBoxLayout() title_layout.addStretch() style = "<span style=\'color: #444444\'><b>%s</b></span>" title = QLabel(style % "Operations") title_layout.addWidget(title) title_layout.addStretch() self.widget_layout.addLayout(title_layout) # Create ListWidget and add 10 items to move around. self.list_widget = QListWidget() # self.list_widget.setDragDropMode(QAbstractItemView.InternalMove) self.list_widget.setSelectionMode(QAbstractItemView.ExtendedSelection) self.list_widget.setSortingEnabled(False) self.list_widget.currentItemChanged.connect(self._populate_settings_update) self.widget_layout.addWidget(self.list_widget) otitle_layout = QHBoxLayout() otitle_layout.addStretch() otitle = QLabel(style % "Operation settings") otitle_layout.addWidget(otitle) otitle_layout.addStretch() self.widget_layout.addLayout(otitle_layout) self.operations_combo = QComboBox() self.operations_combo.currentIndexChanged.connect(self._populate_settings_add) self.widget_layout.addWidget(self.operations_combo) self.operation_settings = GenericOperationWidget() self.widget_layout.addWidget(self.operation_settings) self.toolbar = QToolBar() self.toolbar.addAction(get_icon('apply.png'), "Apply/Replace", self._change_operation) self.toolbar.addAction(get_icon('editors/edit_add.png'), "Add after", self._add_operation) self.toolbar.addAction(get_icon('trash.png'), "Remove", self._remove_operation) self.widget_layout.addWidget(self.toolbar) self.setLayout(self.widget_layout)
def __init__(self, instance, icon='', parent=None, apply=None, wordwrap=True, size=None): QDialog.__init__(self, parent) self.wordwrap = wordwrap self.apply_func = apply self.layout = QVBoxLayout() if instance.get_comment(): label = QLabel(instance.get_comment()) label.setWordWrap(wordwrap) self.layout.addWidget(label) self.instance = instance self.edit_layout = [] self.setup_instance(instance) if apply is not None: apply_button = QDialogButtonBox.Apply else: apply_button = QDialogButtonBox.NoButton bbox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel | apply_button) self.bbox = bbox bbox.accepted.connect(self.accept) bbox.rejected.connect(self.reject) bbox.clicked.connect(self.button_clicked) self.layout.addWidget(bbox) self.setLayout(self.layout) if parent is None: if not isinstance(icon, QIcon): icon = get_icon(icon, default="guidata.svg") self.setWindowIcon(icon) self.setModal(True) self.setWindowTitle(instance.get_title()) if size is not None: if isinstance(size, QSize): self.resize(size) else: self.resize(*size)
def setup_widget(self): self.plot = ImagePlot(self) self.image = make.xyimage(self.x, self.y, self.data, colormap='jet') self.plot.add_item(self.image) self.plot.set_antialiasing(True) #--- levels ? for i in range(8): x = self.level_xy[i][0] y = self.level_xy[i][1] self.levels.append(make.curve(x, y, color="w")) self.plot.add_item(self.levels[-1]) #---------------------- vlayout = QVBoxLayout() vlayout.addWidget(self.plot) self.setLayout(vlayout) self.plot.adjustSize()
def setup_widget(self, title): #---Create the plot widget: curvewidget = CurveWidget(self) curvewidget.register_all_curve_tools() self.curve_item = make.curve([], [], color='b') curvewidget.plot.add_item(self.curve_item) curvewidget.plot.set_antialiasing(True) #--- button = QPushButton("Test filter: %s" % title) self.connect(button, SIGNAL('clicked()'), self.process_data) vlayout = QVBoxLayout() vlayout.addWidget(curvewidget) vlayout.addWidget(button) self.setLayout(vlayout) self.update_curve()
def __init__(self, parent=None): super(ContrastAdjustment, self).__init__(parent) self.local_manager = None # local manager for the histogram plot self.manager = None # manager for the associated image plot # Storing min/max markers for each active image self.min_markers = {} self.max_markers = {} # Select point tools self.min_select_tool = None self.max_select_tool = None style = "<span style=\'color: #444444\'><b>%s</b></span>" layout, _label = get_image_layout(self.PANEL_ICON, style % self.PANEL_TITLE, alignment=Qt.AlignCenter) layout.setAlignment(Qt.AlignCenter) vlayout = QVBoxLayout() vlayout.addLayout(layout) self.local_manager = PlotManager(self) self.histogram = LevelsHistogram(parent) vlayout.addWidget(self.histogram) self.local_manager.add_plot(self.histogram) hlayout = QHBoxLayout() self.setLayout(hlayout) hlayout.addLayout(vlayout) self.toolbar = toolbar = QToolBar(self) toolbar.setOrientation(Qt.Vertical) # toolbar.setToolButtonStyle(Qt.ToolButtonTextBesideIcon) hlayout.addWidget(toolbar) # Add standard plot-related tools to the local manager lman = self.local_manager lman.add_tool(SelectTool) lman.add_tool(BasePlotMenuTool, "item") lman.add_tool(BasePlotMenuTool, "axes") lman.add_tool(BasePlotMenuTool, "grid") lman.add_tool(AntiAliasingTool) lman.get_default_tool().activate() self.outliers_param = EliminateOutliersParam(self.PANEL_TITLE)