Example #1
0
 def __init__(self, title, parent=None):
     super(ReduceSliders, self).__init__(title, parent)
     self.sl = gpi.BasicCWFCSliders()
     self.sl.valueChanged.connect(self.valueChanged)
     # at least one button
     self.button_names = ['C/W', 'B/E', 'Slice', 'Pass']
     self.buttons = []
     cnt = 0
     wdgLayout = QtGui.QGridLayout()
     for name in self.button_names:
         newbutton = QtGui.QPushButton(name)
         newbutton.setCheckable(True)
         newbutton.setAutoExclusive(True)
         self.buttons.append(newbutton)
         newbutton.clicked.connect(self.findValue)
         newbutton.clicked.connect(self.valueChanged)
         wdgLayout.addWidget(newbutton, 0, cnt, 1, 1)
         cnt += 1
     # layout
     wdgLayout.addWidget(self.sl, 1, 0, 1, 4)
     wdgLayout.setVerticalSpacing(0)
     wdgLayout.setSpacing(0)
     self.setLayout(wdgLayout)
     # default
     self.set_min(1)
     self._selection = 3  # pass is default
     self.buttons[self._selection].setChecked(True)
     self.sl.set_allvisible(False)
Example #2
0
    def __init__(self, title, parent=None):
        super(OrderButtons, self).__init__(title, parent)

        # at least one button
        wdgLayout = QtGui.QGridLayout()
        self.wdg = GPITabBar()
        self.wdg.addTab('0')
        self.wdg.setMovable(True)
        self.wdg.currentChanged.connect(self.valueChanged.emit)
        # layout
        wdgLayout.addWidget(self.wdg)
        self.setLayout(wdgLayout)
    def __init__(self, title, parent=None):
        super(ConfigSeqWidgets, self).__init__(title, parent)
        self.button_names_list = [
            'Off', 'SincRfPulse', 'HardRfPulse', 'TrapGradPulse',
            'TriangleGradPulse'
        ]
        self.clicked_button_name, self.clicked_button_index = '', 0
        self.buttons_list, self.string_box_list = [], []

        # Labels for StringBoxes to configure Events
        self.sinc_rf_labels = [
            'Name', 'Observe', 'ADCs', 'Apodization', 'Bandwidth', 'Axis',
            'FlipAngle', 'Frequency', 'HardwareMode', 'InitialDelay',
            'InitialPhase', 'Refocusing', 'Symmetry', 'Vector', ' Zeros'
        ]
        self.hard_rf_labels = [
            'Name', 'Observe', 'ADCs', 'Channel', 'Duration', 'FlipAngle',
            'Frequency', 'HardwareMode', 'InitialDelay', 'InitialPhase',
            'Refocusing', 'Symmetry', 'Vector'
        ]
        self.trap_grad_labels = [
            'Name', 'Observe', 'ADCs', 'Area', 'Asymmetric', 'Axis',
            'Duration', 'EddyConvLength', 'EddyCurrents', 'FlatTopArea',
            'FlatTopTime', 'Frequency', 'HardwareMode', 'Hide', 'InitialDelay',
            'InitialPhase', 'MaxAmpl', 'NLG_field', 'PhaseLock', 'SlewRate'
        ]
        self.triangle_grad_labels = [
            'Name', 'Observe', 'ADCs', 'Amplitude', 'Axis', 'Duration',
            'EddyConvLength', 'EddyCurrents', 'HardwareMode', 'Hide',
            'InitialDelay', 'InitialPhase', 'MaxAmpl', 'NLG_field',
            'PhaseLock', 'TriangleType', 'Vector'
        ]

        # Variable to denote the maximum number of StringBoxes to be added; obviously depends on the Event which has the
        # maximum number of configuration parameters_params
        self.num_string_boxes = max(len(self.hard_rf_labels),
                                    len(self.trap_grad_labels))

        # First index is None because the first button is 'Off'. Look into event_def['event_values'] in get_val()
        self.labels = [
            None, self.sinc_rf_labels, self.hard_rf_labels,
            self.trap_grad_labels, self.triangle_grad_labels
        ]

        self.wdg_layout = QtGui.QGridLayout()
        self.add_event_pushbuttons()
        self.add_config_stringboxes()

        self.setLayout(self.wdg_layout)
        self.buttons_list[0].setChecked(True)
Example #4
0
    def __init__(self, title, parent=None):
        super(AddBlockWidgets, self).__init__(title, parent)
        self.button_names_list = [
            'Off', 'Delay', 'SincRF', 'BlockRF', 'G', 'GyPre', 'ArbGrad', 'ADC'
        ]
        self.clicked_button_name, self.clicked_button_index = '', 0
        self.buttons_list, self.string_box_list = [], []

        # Labels for StringBoxes to configure Events
        self.delay_labels = ['Unique Event name', 'Delay (s)']
        self.sinc_rf_labels = [
            'Unique Event name', 'Maximum Gradient (mT/m)',
            'Maximum Slew (T/m/s)', 'Flip Angle (deg)', 'Duration (s)',
            'Frequency Offset', 'Phase Offset', 'Time Bw Product',
            'Apodization', 'Slice Thickness (m)'
        ]
        self.block_rf_labels = [
            'Unique Event name', 'Maximum Gradient (mT/m)',
            'Maximum Slew (T/m/s)', 'Flip Angle (deg)', 'Duration (s)',
            'Frequency Offset', 'Phase Offset', 'Time Bw Product', 'Bandwidth',
            'Slice Thickness (m)'
        ]
        self.trap_labels = [
            'Unique Event name', 'Channel', 'Maximum Gradient (mT/m)',
            'Maximum Slew (T/m/s)', 'Duration (s)', 'Area', 'Flat Time (s)',
            'Flat Area', 'Amplitude (Hz)', 'Rise Time (s)'
        ]
        self.gy_pre_labels = ['Unique Event name', 'Duration (s)', 'Area']
        self.arb_grad_labels = [
            'Unique Event name', 'Channel', 'Maximum Gradient (mT/m)',
            'Maximum Slew (T/m/s)'
        ]
        self.adc_labels = [
            'Unique Event name', 'Number of samples', 'Dwell (s)',
            'Duration (s)', 'Delay (s)', 'Frequency Offset', 'Phase Offset'
        ]
        # Placeholders for StringBoxes to configure Events
        self.delay_placeholders = ['event_unique_name', 'delay']
        self.sinc_rf_placeholders = [
            'event_unique_name', 'max_grad', 'max_slew', 'flip_angle',
            'duration', 'freq_offset', 'phase_offset', 'time_bw_prod',
            'apodization', 'slice_thickness'
        ]
        self.block_rf_placeholders = [
            'event_unique_name', 'max_grad', 'max_slew', 'flip_angle',
            'duration', 'freq_offset', 'phase_offset', 'time_bw_prod',
            'bandwidth', 'slice_thickness'
        ]
        self.trap_placeholders = [
            'event_unique_name', 'channel', 'max_grad', 'max_slew', 'duration',
            'area', 'flat_time', 'flat_area', 'amplitude', 'rise_time'
        ]
        self.gy_pre_placeholders = ['event_unique_name', 'duration', 'area']
        self.arb_grad_placeholders = [
            'event_unique_name', 'channel', 'max_grad', 'max_slew'
        ]
        self.adc_placeholders = [
            'event_unique_name', 'num_samples', 'dwell', 'duration', 'delay',
            'freq_offset', 'phase_offset'
        ]

        # Variable to denote the maximum number of StringBoxes to be added; obviously depends on the Event which has the
        # maximum number of configuration parameters
        self.num_string_boxes = max(len(self.delay_labels),
                                    len(self.sinc_rf_labels),
                                    len(self.block_rf_labels),
                                    len(self.trap_labels),
                                    len(self.gy_pre_labels),
                                    len(self.arb_grad_labels),
                                    len(self.adc_labels))

        # First index is None because the first button is 'Off'. Look into event_def['event_values'] in get_val()
        self.labels = [
            None, self.delay_labels, self.sinc_rf_labels, self.block_rf_labels,
            self.trap_labels, self.gy_pre_labels, self.arb_grad_labels,
            self.adc_labels
        ]
        self.placeholders = [
            None, self.delay_placeholders, self.sinc_rf_placeholders,
            self.block_rf_placeholders, self.trap_placeholders,
            self.gy_pre_placeholders, self.arb_grad_placeholders,
            self.adc_placeholders
        ]

        self.wdg_layout = QtGui.QGridLayout()
        self.add_event_pushbuttons()
        self.add_config_stringboxes()
        self.add_include_in_loop_pushbutton()
        self.add_include_gz_pushbutton()
        self.add_file_browser()

        self.setLayout(self.wdg_layout)
        self.buttons_list[0].setChecked(True)
Example #5
0
    def __init__(self, title, parent=None):
        super(OpenGLWindow, self).__init__(title, parent)

        f = QtOpenGL.QGLFormat()
        f.setAccum(True)
        f.setDoubleBuffer(True)
        f.setRgba(True)
        f.setDepth(True)
        f.setAlpha(True)
        self.glWidget = GPIGLWidget(f)

        self.glWidgetArea = QtGui.QScrollArea()
        self.glWidgetArea.setWidget(self.glWidget)
        self.glWidgetArea.setWidgetResizable(True)
        self.glWidgetArea.setHorizontalScrollBarPolicy(
            QtCore.Qt.ScrollBarAlwaysOff)
        self.glWidgetArea.setVerticalScrollBarPolicy(
            QtCore.Qt.ScrollBarAlwaysOff)
        self.glWidgetArea.setSizePolicy(QtGui.QSizePolicy.Ignored,
                                        QtGui.QSizePolicy.Ignored)
        self.glWidgetArea.setMinimumSize(50, 50)

        # self.pixmapLabelArea = QtGui.QScrollArea()
        # self.pixmapLabelArea.setWidget(self.pixmapLabel)
        # self.pixmapLabelArea.setSizePolicy(QtGui.QSizePolicy.Ignored,
        #        QtGui.QSizePolicy.Ignored)
        # self.pixmapLabelArea.setMinimumSize(50, 50)

        xSlider = self.createSlider(self.glWidget.xRotationChanged,
                                    self.glWidget.setXRotation)
        ySlider = self.createSlider(self.glWidget.yRotationChanged,
                                    self.glWidget.setYRotation)
        zSlider = self.createSlider(self.glWidget.zRotationChanged,
                                    self.glWidget.setZRotation)

        glBlend = self.createCheckOption('PolySmooth', self.glWidget.setBlend)
        polyFill = self.createCheckOption(
            'Poly-Fill/Line/Point', self.glWidget.setPolyFill, tristate=True)

        # antialiasing requires the accumulation buffer
        enableaccum = True
        if not self.glWidget.format().accum():
            enableaccum = False
        antialiasing = self.createCheckOption(
            'AntiAliasing', self.glWidget.setAntiAliasing, initstate=0, enabled=enableaccum)

        hardwareRender = QtGui.QLabel()
        hardwareRender.setFrameStyle(2)
        if self.glWidget.format().directRendering():
            hardwareRender.setText('Rendering: Hardware')
        else:
            hardwareRender.setText('Rendering: Software')

        #testOption = self.createCheckOption(
        #    'Test Option', self.glWidget.setTest, tristate=False)

        # self.createActions()
        # self.createMenus()
        centralLayout = QtGui.QGridLayout()
        centralLayout.addWidget(self.glWidgetArea, 2, 0, 4, 4)
        # centralLayout.setColumnStretch(0,3)
        centralLayout.setRowStretch(2, 2)
        # centralLayout.addWidget(self.pixmapLabelArea, 0, 1)
        #centralLayout.addWidget(xSlider, 2, 0, 1, 2)
        #centralLayout.addWidget(ySlider, 3, 0, 1, 2)
        #centralLayout.addWidget(zSlider, 4, 0, 1, 2)
        centralLayout.addWidget(polyFill, 1, 0, 1, 1)
        centralLayout.addWidget(glBlend, 1, 1, 1, 1)
        centralLayout.addWidget(antialiasing, 1, 2, 1, 1)
        centralLayout.addWidget(hardwareRender, 0, 0, 1, 1)
        #centralLayout.addWidget(testOption, 0, 2, 1, 1)

        self.setLayout(centralLayout)

        xSlider.setValue(15 * 16)
        ySlider.setValue(345 * 16)
        zSlider.setValue(0 * 16)

        # self.setWindowTitle("Grabber")
        self.resize(400, 300)
Example #6
0
    def __init__(self, title, parent=None):
        super(MatplotDisplay, self).__init__(title, parent)

        # gpi interface
        self._collapsables = []
        self._subplotSettings = {}
        #self._subplotPosition = {'right': 0.9, 'bottom': 0.12, 'top': 0.9, 'wspace': 0.2, 'hspace': 0.2, 'left': 0.125}
        self._subplotPosition = {
            'right': 0.913,
            'bottom': 0.119,
            'top': 0.912,
            'wspace': 0.2,
            'hspace': 0.2,
            'left': 0.111
        }
        #self._subplot_keepers = ['yscale', 'xscale'] # linear, log
        self._subplot_keepers = []
        self._lineSettings = []
        self._line_keepers = [
            'linewidth', 'linestyle', 'label', 'marker', 'markeredgecolor',
            'markerfacecolor', 'markersize', 'color', 'alpha'
        ]

        # since drawing is slow, don't do it as often, use the timer as a
        # debouncer
        self._on_draw_cnt = 0
        self._updatetimer = QtCore.QTimer()
        self._updatetimer.setSingleShot(True)
        self._updatetimer.timeout.connect(self._on_draw)
        self._updatetimer.setInterval(10)

        # plot specific UI side panel
        #  -sets options for plot window so this needs to be run first
        vbox = QtGui.QVBoxLayout()
        vbox.setContentsMargins(0, 0, 0, 0)  # no spaces around this item
        vbox.setSpacing(0)

        # AUTOSCALE
        self._autoscale_btn = gpi.widgets.BasicPushButton(self)
        self._autoscale_btn.set_toggle(True)
        self._autoscale_btn.set_button_title('autoscale')
        self._autoscale_btn.valueChanged.connect(self.on_draw)
        self._collapsables.append(self._autoscale_btn)

        # GRID
        self._grid_btn = gpi.widgets.BasicPushButton(self)
        self._grid_btn.set_toggle(True)
        self._grid_btn.set_button_title('grid')
        self._grid_btn.valueChanged.connect(self.on_draw)
        self._collapsables.append(self._grid_btn)

        # X/Y LIMITS
        lims = QtGui.QGridLayout()
        self._xl = gpi.widgets.BasicDoubleSpinBox(self)
        self._xh = gpi.widgets.BasicDoubleSpinBox(self)
        self._yl = gpi.widgets.BasicDoubleSpinBox(self)
        self._yh = gpi.widgets.BasicDoubleSpinBox(self)
        self._xl.valueChanged.connect(self.on_draw)
        self._xh.valueChanged.connect(self.on_draw)
        self._yl.valueChanged.connect(self.on_draw)
        self._yh.valueChanged.connect(self.on_draw)
        self._xl.set_immediate(True)
        self._xh.set_immediate(True)
        self._yl.set_immediate(True)
        self._yh.set_immediate(True)
        self._xl.set_label('max')
        self._xh.set_label('min')
        self._xl.set_decimals(7)
        self._xh.set_decimals(7)
        self._yl.set_decimals(7)
        self._yh.set_decimals(7)
        self._xlab = QtGui.QLabel('x limits')
        self._ylab = QtGui.QLabel('y limits')
        #self._maxlab = QtGui.QLabel('max')
        #self._minlab = QtGui.QLabel('min')
        #lims.addWidget(self._maxlab,1,0,1,1)
        #lims.addWidget(self._minlab,2,0,1,1)
        lims.addWidget(self._xlab,
                       0,
                       1,
                       1,
                       1,
                       alignment=QtCore.Qt.AlignHCenter)
        lims.addWidget(self._xh, 1, 1, 1, 1, alignment=QtCore.Qt.AlignHCenter)
        lims.addWidget(self._xl, 2, 1, 1, 1, alignment=QtCore.Qt.AlignHCenter)
        lims.addWidget(self._ylab,
                       0,
                       2,
                       1,
                       1,
                       alignment=QtCore.Qt.AlignHCenter)
        lims.addWidget(self._yh, 1, 2, 1, 1, alignment=QtCore.Qt.AlignHCenter)
        lims.addWidget(self._yl, 2, 2, 1, 1, alignment=QtCore.Qt.AlignHCenter)
        self._collapsables.append(self._xlab)
        self._collapsables.append(self._ylab)
        self._collapsables.append(self._xl)
        self._collapsables.append(self._xh)
        self._collapsables.append(self._yl)
        self._collapsables.append(self._yh)
        #self._collapsables.append(self._minlab)
        #self._collapsables.append(self._maxlab)

        # TICK MARKS
        ticks = QtGui.QGridLayout()
        self._x_numticks = gpi.widgets.BasicSpinBox(self)
        self._x_numticks.valueChanged.connect(self.on_draw)
        self._y_numticks = gpi.widgets.BasicSpinBox(self)
        self._y_numticks.valueChanged.connect(self.on_draw)
        self._x_ticks = QtGui.QLineEdit()
        self._y_ticks = QtGui.QLineEdit()
        self._x_ticks.textChanged.connect(
            lambda txt: self.check_validticks(self._x_ticks))
        self._y_ticks.textChanged.connect(
            lambda txt: self.check_validticks(self._y_ticks))
        self._x_ticks.setPlaceholderText('comma separated list of x labels')
        self._y_ticks.setPlaceholderText('comma separated list of y labels')
        self._x_ticks.returnPressed.connect(self.on_draw)
        self._y_ticks.returnPressed.connect(self.on_draw)
        self._x_numticks.set_immediate(True)
        self._y_numticks.set_immediate(True)
        self._x_numticks.set_min(2)
        self._y_numticks.set_min(2)
        self._x_numticks.set_max(100)
        self._y_numticks.set_max(100)
        self._x_numticks.set_val(5)
        self._y_numticks.set_val(5)
        self._x_numticks.set_label('x ticks')
        self._y_numticks.set_label('y ticks')
        ticks.addWidget(self._x_numticks, 0, 0, 1, 1)
        ticks.addWidget(self._y_numticks, 1, 0, 1, 1)
        ticks.addWidget(self._x_ticks, 0, 1, 1, 1)
        ticks.addWidget(self._y_ticks, 1, 1, 1, 1)
        self._collapsables.append(self._x_numticks)
        self._collapsables.append(self._y_numticks)
        self._collapsables.append(self._x_ticks)
        self._collapsables.append(self._y_ticks)

        # TITLE, XLABEL, YLABEL
        plotlabels = QtGui.QHBoxLayout()
        self._plot_title = QtGui.QLineEdit()
        self._plot_xlab = QtGui.QLineEdit()
        self._plot_ylab = QtGui.QLineEdit()
        self._plot_title.setPlaceholderText('title')
        self._plot_xlab.setPlaceholderText('x label')
        self._plot_ylab.setPlaceholderText('y label')
        self._plot_title.returnPressed.connect(self.on_draw)
        self._plot_xlab.returnPressed.connect(self.on_draw)
        self._plot_ylab.returnPressed.connect(self.on_draw)
        plotlabels.addWidget(self._plot_title)
        plotlabels.addWidget(self._plot_xlab)
        plotlabels.addWidget(self._plot_ylab)
        self._collapsables.append(self._plot_title)
        self._collapsables.append(self._plot_xlab)
        self._collapsables.append(self._plot_ylab)

        # XSCALE, YSCALE
        self._xscale_btn = gpi.widgets.BasicPushButton(self)
        self._xscale_btn.set_toggle(True)
        self._xscale_btn.set_button_title('log(x)')
        self._xscale_btn.valueChanged.connect(self.on_draw)
        self._collapsables.append(self._xscale_btn)
        self._yscale_btn = gpi.widgets.BasicPushButton(self)
        self._yscale_btn.set_toggle(True)
        self._yscale_btn.set_button_title('log(y)')
        self._yscale_btn.valueChanged.connect(self.on_draw)
        self._collapsables.append(self._yscale_btn)

        scale_options_layout = QtGui.QHBoxLayout()
        scale_options_layout.addWidget(self._xscale_btn)
        scale_options_layout.addWidget(self._yscale_btn)

        # LEGEND
        self._legend_btn = gpi.widgets.BasicPushButton(self)
        self._legend_btn.set_toggle(True)
        self._legend_btn.set_button_title('legend')
        self._legend_btn.valueChanged.connect(self.on_draw)
        self._collapsables.append(self._legend_btn)

        # HOLD
        self._hold_btn = gpi.widgets.BasicPushButton(self)
        self._hold_btn.set_toggle(True)
        self._hold_btn.set_button_title('hold')
        #self._hold_btn.valueChanged.connect(self.on_draw)
        self._collapsables.append(self._hold_btn)

        # MOVE AXES TO ORIGIN
        # self._origin_axes_btn = gpi.widgets.BasicPushButton(self)
        # self._origin_axes_btn.set_toggle(True)
        # self._origin_axes_btn.set_button_title("axes at (0,0)")
        # self._collapsables.append(self._origin_axes_btn)

        # RESET
        self._reset_btn = gpi.widgets.BasicPushButton(self)
        self._reset_btn.set_toggle(False)
        self._reset_btn.set_button_title('reset')
        self._reset_btn.valueChanged.connect(self._init_parms_)
        self._collapsables.append(self._reset_btn)

        # X=0, Y=0
        self._xeq0_btn = gpi.widgets.BasicPushButton(self)
        self._xeq0_btn.set_toggle(True)
        self._xeq0_btn.set_button_title('x=0')
        self._xeq0_btn.set_val(True)
        self._xeq0_btn.valueChanged.connect(self.on_draw)
        self._collapsables.append(self._xeq0_btn)
        self._yeq0_btn = gpi.widgets.BasicPushButton(self)
        self._yeq0_btn.set_toggle(True)
        self._yeq0_btn.set_button_title('y=0')
        self._yeq0_btn.set_val(True)
        self._yeq0_btn.valueChanged.connect(self.on_draw)
        self._collapsables.append(self._yeq0_btn)

        # LINE OPTIONS
        self._lino_btn = gpi.widgets.BasicPushButton(self)
        self._lino_btn.set_toggle(False)
        self._lino_btn.set_button_title('line options')
        self._lino_btn.valueChanged.connect(self.lineOptionsDialog)
        self._collapsables.append(self._lino_btn)

        # SUBPLOT SPACING OPTIONS
        self._subplotso_btn = gpi.widgets.BasicPushButton(self)
        self._subplotso_btn.set_toggle(False)
        self._subplotso_btn.set_button_title('spacing options')
        self._subplotso_btn.valueChanged.connect(self.subplotSpacingOptions)
        self._collapsables.append(self._subplotso_btn)
        self.adj_window = None

        plot_options_layout = QtGui.QHBoxLayout()
        plot_options_layout.addWidget(self._subplotso_btn)
        plot_options_layout.addWidget(self._lino_btn)

        grid_legend_lyt = QtGui.QHBoxLayout()
        grid_legend_lyt.addWidget(self._legend_btn)
        grid_legend_lyt.addWidget(self._grid_btn)

        autoscale_scale_lyt = QtGui.QHBoxLayout()
        autoscale_scale_lyt.addWidget(self._autoscale_btn)
        autoscale_scale_lyt.addWidget(self._xscale_btn)
        autoscale_scale_lyt.addWidget(self._yscale_btn)
        autoscale_scale_lyt.addWidget(self._xeq0_btn)
        autoscale_scale_lyt.addWidget(self._yeq0_btn)

        # HLINES
        self._hline1 = QtGui.QFrame()
        self._hline1.setFrameStyle(QtGui.QFrame.HLine | QtGui.QFrame.Sunken)
        self._hline1.setSizePolicy(QtGui.QSizePolicy.Minimum,
                                   QtGui.QSizePolicy.Minimum)
        self._collapsables.append(self._hline1)

        self._hline2 = QtGui.QFrame()
        self._hline2.setFrameStyle(QtGui.QFrame.HLine | QtGui.QFrame.Sunken)
        self._hline2.setSizePolicy(QtGui.QSizePolicy.Minimum,
                                   QtGui.QSizePolicy.Minimum)
        self._collapsables.append(self._hline2)

        self._hline3 = QtGui.QFrame()
        self._hline3.setFrameStyle(QtGui.QFrame.HLine | QtGui.QFrame.Sunken)
        self._hline3.setSizePolicy(QtGui.QSizePolicy.Minimum,
                                   QtGui.QSizePolicy.Minimum)
        self._collapsables.append(self._hline3)

        spc = 10
        self._spacer1 = QtGui.QSpacerItem(1, spc, QtGui.QSizePolicy.Expanding,
                                          QtGui.QSizePolicy.Expanding)
        self._spacer2 = QtGui.QSpacerItem(1, spc, QtGui.QSizePolicy.Expanding,
                                          QtGui.QSizePolicy.Expanding)
        self._spacer3 = QtGui.QSpacerItem(1, spc, QtGui.QSizePolicy.Expanding,
                                          QtGui.QSizePolicy.Expanding)
        self._spacer4 = QtGui.QSpacerItem(1, spc, QtGui.QSizePolicy.Expanding,
                                          QtGui.QSizePolicy.Expanding)
        self._spacer5 = QtGui.QSpacerItem(1, spc, QtGui.QSizePolicy.Expanding,
                                          QtGui.QSizePolicy.Expanding)
        self._spacer6 = QtGui.QSpacerItem(1, spc, QtGui.QSizePolicy.Expanding,
                                          QtGui.QSizePolicy.Expanding)
        self._collapsables.append(self._spacer1)
        self._collapsables.append(self._spacer2)
        self._collapsables.append(self._spacer3)
        self._collapsables.append(self._spacer4)
        self._collapsables.append(self._spacer5)
        self._collapsables.append(self._spacer6)

        # panel layout
        vbox.addLayout(plotlabels)

        vbox.addSpacerItem(self._spacer1)
        vbox.addWidget(self._hline1)
        vbox.addSpacerItem(self._spacer2)

        vbox.addLayout(lims)
        #vbox.addLayout(scale_options_layout)
        #vbox.addWidget(self._autoscale_btn)
        vbox.addLayout(autoscale_scale_lyt)

        vbox.addSpacerItem(self._spacer3)
        vbox.addWidget(self._hline2)
        vbox.addSpacerItem(self._spacer4)

        vbox.addLayout(ticks)
        #vbox.addWidget(self._legend_btn)
        vbox.addLayout(grid_legend_lyt)
        vbox.addLayout(plot_options_layout)
        #vbox.addWidget(self._lino_btn)
        #vbox.addWidget(self._subplotso_btn)

        vbox.addSpacerItem(self._spacer5)
        vbox.addWidget(self._hline3)
        vbox.addSpacerItem(self._spacer6)

        vbox.addWidget(self._hold_btn)
        # vbox.addWidget(self._origin_axes_btn)

        vbox.insertStretch(-1, 1)
        vbox.addWidget(self._reset_btn)

        # plot window
        self._data = None
        self._plotwindow = self.create_main_frame()

        # put side panel and plot window together
        hbox = QtGui.QHBoxLayout()
        hbox.addLayout(vbox)
        hbox.addLayout(self._plotwindow)
        hbox.setStretch(0, 0)
        hbox.setStretch(1, 11)
        self.setLayout(hbox)

        #self._on_draw() # draw once to get initial settings
        #self.copySubplotSettings()

        # Don't hide side-panel options by default
        self.set_collapsed(False)
        self.set_grid(True)
        self.set_autoscale(True)

        # DEFAULTS
        self._init_parms_()
Example #7
0
    def __init__(self, node):
        super(NodeAPI, self).__init__()

        #self.setToolTip("Double Click to Show/Hide each Widget")
        self.node = node

        self.label = ''
        self._detailLabel = ''
        self._docText = None
        self.parmList = []  # deprecated, since dicts have direct name lookup
        self.parmDict = {}  # mirror parmList for now
        self.parmSettings = {}  # for buffering wdg parms before copying to a PROCESS
        self.shdmDict = {} # for storing base addresses

        # grid for module widgets
        self.layout = QtGui.QGridLayout()

        # this must exist before user-widgets are added so that they can get
        # node label updates
        self.wdglabel = QtGui.QLineEdit(self.label)

        # allow logger to be used in initUI()
        self.log = manager.getLogger(node.getModuleName())

        try:
            self._initUI_ret = self.initUI()
        except:
            log.error('initUI() failed. '+str(node.item.fullpath)+'\n'+str(traceback.format_exc()))
            self._initUI_ret = -1  # error

        # make a label box with the unique id
        labelGroup = HidableGroupBox("Node Label")
        labelLayout = QtGui.QGridLayout()
        self.wdglabel.textChanged.connect(self.setLabel)
        labelLayout.addWidget(self.wdglabel, 0, 1)
        labelGroup.setLayout(labelLayout)
        self.layout.addWidget(labelGroup, len(self.parmList) + 1, 0)
        labelGroup.set_collapsed(True)
        labelGroup.setToolTip("Displays the Label on the Canvas (Double Click)")

        # make an about box with the unique id
        self.aboutGroup = HidableGroupBox("About")
        aboutLayout = QtGui.QGridLayout()
        self.about_button = QtGui.QPushButton("Open Node &Documentation")
        self.about_button.clicked.connect(self.openNodeDocumentation)
        aboutLayout.addWidget(self.about_button, 0, 1)
        self.aboutGroup.setLayout(aboutLayout)
        self.layout.addWidget(self.aboutGroup, len(self.parmList) + 2, 0)
        self.aboutGroup.set_collapsed(True)
        self.aboutGroup.setToolTip("Node Documentation (docstring + autodocs, Double Click)")

        # window (just a QTextEdit) that will show documentation text
        self.doc_text_win = QtGui.QTextEdit()
        self.doc_text_win.setPlainText(self.generateHelpText())
        self.doc_text_win.setReadOnly(True)
        doc_text_font = QtGui.QFont("Monospace", 14)
        self.doc_text_win.setFont(doc_text_font)
        self.doc_text_win.setLineWrapMode(QtGui.QTextEdit.NoWrap)
        self.doc_text_win.setWindowTitle(node.getModuleName() + " Documentation")

        hbox = QtGui.QHBoxLayout()
        self._statusbar_sys = QtGui.QLabel('')
        self._statusbar_usr = QtGui.QLabel('')
        hbox.addWidget(self._statusbar_sys)
        hbox.addWidget(self._statusbar_usr, 0, (QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter))

        # window resize grip
        self._grip = QtGui.QSizeGrip(self)
        hbox.addWidget(self._grip)

        self.layout.addLayout(hbox, len(self.parmList) + 3, 0)
        self.layout.setRowStretch(len(self.parmList) + 3, 0)

        # uid display
        # uid   = QtGui.QLabel("uid: "+str(self.node.getID()))
        # uid.setTextInteractionFlags(QtCore.Qt.TextSelectableByMouse)
        # self.layout.addWidget(uid,len(self.parmList)+2,0)

        # instantiate the layout
        self.setLayout(self.layout)

        # run through all widget titles since each widget parent is now set.
        for parm in self.parmList:
            parm.setDispTitle()

        # instantiate the layout
        # self.setGeometry(50, 50, 300, 40)

        self.setTitle(node.getModuleName())

        self._starttime = 0
        self._startline = 0