Exemplo n.º 1
0
    def __init__(self, data, win_parent=None):
        """
        +------------------+
        | Edit Actor Props |
        +------------------+------+
        |  Name1                  |
        |  Name2                  |
        |  Name3                  |
        |  Name4                  |
        |                         |
        |  Active_Name    main    |
        |  Color          box     |
        |  Line_Width     2       |
        |  Point_Size     2       |
        |  Bar_Scale      2       |
        |  Opacity        0.5     |
        |  Show/Hide              |
        |                         |
        |    Apply   OK   Cancel  |
        +-------------------------+
        """
        QDialog.__init__(self, win_parent)
        self.setWindowTitle('Edit Geometry Properties')

        #default
        self.win_parent = win_parent
        self.out_data = data

        self.keys = sorted(data.keys())
        self.keys = data.keys()
        keys = self.keys
        nrows = len(keys)
        self.active_key = 'main'#keys[0]

        items = keys

        header_labels = ['Groups']
        table_model = Model(items, header_labels, self)
        view = CustomQTableView(self) #Call your custom QTableView here
        view.setModel(table_model)
        if qt_version == 4:
            view.horizontalHeader().setResizeMode(QtGui.QHeaderView.Stretch)

        self.table = view

        actor_obj = data[self.active_key]
        name = actor_obj.name
        line_width = actor_obj.line_width
        point_size = actor_obj.point_size
        bar_scale = actor_obj.bar_scale
        opacity = actor_obj.opacity
        color = actor_obj.color
        show = actor_obj.is_visible
        self.representation = actor_obj.representation

        # table
        header = self.table.horizontalHeader()
        header.setStretchLastSection(True)

        self._default_is_apply = False
        self.name = QLabel("Name:")
        self.name_edit = QLineEdit(str(name))
        self.name_edit.setDisabled(True)

        self.color = QLabel("Color:")
        self.color_edit = QPushButton()
        #self.color_edit.setFlat(True)

        color = self.out_data[self.active_key].color
        qcolor = QtGui.QColor()
        qcolor.setRgb(*color)
        #print('color =%s' % str(color))
        palette = QtGui.QPalette(self.color_edit.palette()) # make a copy of the palette
        #palette.setColor(QtGui.QPalette.Active, QtGui.QPalette.Base, \
                         #qcolor)
        palette.setColor(QtGui.QPalette.Background, QtGui.QColor('blue'))  # ButtonText
        self.color_edit.setPalette(palette)

        self.color_edit.setStyleSheet("QPushButton {"
                                      "background-color: rgb(%s, %s, %s);" % tuple(color) +
                                      #"border:1px solid rgb(255, 170, 255); "
                                      "}")

        self.use_slider = True
        self.is_opacity_edit_active = False
        self.is_opacity_edit_slider_active = False

        self.is_line_width_edit_active = False
        self.is_line_width_edit_slider_active = False

        self.is_point_size_edit_active = False
        self.is_point_size_edit_slider_active = False

        self.is_bar_scale_edit_active = False
        self.is_bar_scale_edit_slider_active = False

        self.opacity = QLabel("Opacity:")
        self.opacity_edit = QDoubleSpinBox(self)
        self.opacity_edit.setRange(0.1, 1.0)
        self.opacity_edit.setDecimals(1)
        self.opacity_edit.setSingleStep(0.1)
        self.opacity_edit.setValue(opacity)
        if self.use_slider:
            self.opacity_slider_edit = QSlider(QtCore.Qt.Horizontal)
            self.opacity_slider_edit.setRange(1, 10)
            self.opacity_slider_edit.setValue(opacity * 10)
            self.opacity_slider_edit.setTickInterval(1)
            self.opacity_slider_edit.setTickPosition(QSlider.TicksBelow)

        self.line_width = QLabel("Line Width:")
        self.line_width_edit = QSpinBox(self)
        self.line_width_edit.setRange(1, 15)
        self.line_width_edit.setSingleStep(1)
        self.line_width_edit.setValue(line_width)
        if self.use_slider:
            self.line_width_slider_edit = QSlider(QtCore.Qt.Horizontal)
            self.line_width_slider_edit.setRange(1, 15)
            self.line_width_slider_edit.setValue(line_width)
            self.line_width_slider_edit.setTickInterval(1)
            self.line_width_slider_edit.setTickPosition(QSlider.TicksBelow)

        if self.representation in ['point', 'surface']:
            self.line_width.setEnabled(False)
            self.line_width_edit.setEnabled(False)
            self.line_width_slider_edit.setEnabled(False)

        self.point_size = QLabel("Point Size:")
        self.point_size_edit = QSpinBox(self)
        self.point_size_edit.setRange(1, 15)
        self.point_size_edit.setSingleStep(1)
        self.point_size_edit.setValue(point_size)
        self.point_size.setVisible(False)
        self.point_size_edit.setVisible(False)
        if self.use_slider:
            self.point_size_slider_edit = QSlider(QtCore.Qt.Horizontal)
            self.point_size_slider_edit.setRange(1, 15)
            self.point_size_slider_edit.setValue(point_size)
            self.point_size_slider_edit.setTickInterval(1)
            self.point_size_slider_edit.setTickPosition(QSlider.TicksBelow)
            self.point_size_slider_edit.setVisible(False)

        if self.representation in ['wire', 'surface']:
            self.point_size.setEnabled(False)
            self.point_size_edit.setEnabled(False)
            if self.use_slider:
                self.point_size_slider_edit.setEnabled(False)

        self.bar_scale = QLabel("Bar Scale:")
        self.bar_scale_edit = QDoubleSpinBox(self)
        #self.bar_scale_edit.setRange(0.01, 1.0)  # was 0.1
        #self.bar_scale_edit.setRange(0.05, 5.0)
        self.bar_scale_edit.setDecimals(1)
        #self.bar_scale_edit.setSingleStep(bar_scale / 10.)
        self.bar_scale_edit.setSingleStep(0.1)
        self.bar_scale_edit.setValue(bar_scale)

        #if self.use_slider:
            #self.bar_scale_slider_edit = QSlider(QtCore.Qt.Horizontal)
            #self.bar_scale_slider_edit.setRange(1, 100)  # 1/0.05 = 100/5.0
            #self.bar_scale_slider_edit.setValue(opacity * 0.05)
            #self.bar_scale_slider_edit.setTickInterval(10)
            #self.bar_scale_slider_edit.setTickPosition(QSlider.TicksBelow)

        if self.representation != 'bar':
            self.bar_scale.setEnabled(False)
            self.bar_scale_edit.setEnabled(False)
            self.bar_scale.setVisible(False)
            self.bar_scale_edit.setVisible(False)
            #self.bar_scale_slider_edit.setVisible(False)
            #self.bar_scale_slider_edit.setEnabled(False)

        # show/hide
        self.checkbox_show = QCheckBox("Show")
        self.checkbox_hide = QCheckBox("Hide")
        self.checkbox_show.setChecked(show)
        self.checkbox_hide.setChecked(not show)

        if name == 'main':
            self.color.setEnabled(False)
            self.color_edit.setEnabled(False)
            self.point_size.setEnabled(False)
            self.point_size_edit.setEnabled(False)
            if self.use_slider:
                self.point_size_slider_edit.setEnabled(False)


        # closing
        # self.apply_button = QPushButton("Apply")
        #if self._default_is_apply:
            #self.apply_button.setDisabled(True)

        # self.ok_button = QPushButton("OK")
        self.cancel_button = QPushButton("Close")

        self.create_layout()
        self.set_connections()
Exemplo n.º 2
0
    def __init__(self, configFile, rowCount, verifyWindowDict, parent=None):
        super(VerifySetpoint,
              self).__init__(parent,
                             Qt.CustomizeWindowHint | Qt.WindowTitleHint)
        self.configFile = configFile
        self.rowCount = rowCount
        self.verifyWindowDict = verifyWindowDict
        self.setWindowTitle('%s: setpoint v.s. readback' %
                            self.configFile.split('/')[-1])
        resolution = QDesktopWidget().screenGeometry()
        #self.setGeometry(resolution.width(), resolution.height() ,250, 150)
        self.setGeometry(resolution.width(), 0, 250, 150)
        self.startUpdate = 1
        self.keys = []

        fd = open(self.configFile)
        lines = fd.readlines()
        #print(lines)
        setpointPVList = []
        readbackPVList = []
        self.allPVList = []
        #thresholdList = []
        rampRatePVList = []
        for line in lines:
            #print(line.split())
            setpointPVList.append(str(line.split()[0]))
            readbackPVList.append(str(line.split()[1]))
            if len(line.split()) > 2:
                #thresholdList.append(str(line.split()[2]))
                rampRatePVList.append(str(line.split()[2]))
        self.allPVList = setpointPVList + readbackPVList + rampRatePVList
        self.pvListColumn = 3
        #print(setpointPVList)
        #print(readbackPVList)
        #print(self.allPVList)
        #print(thresholdList)
        #print(rampRatePVList)

        layout = QGridLayout(self)
        self.label = QLabel()
        if self.rowCount > len(readbackPVList):
            self.label.setText(
                "%d PVs in the original snapshot, but only %d pairs of setpoint &\
readback PVs in this table because some setpoint PVs don't have readbacks\n\nPlease click the \
button below to update data\n" % (self.rowCount, len(readbackPVList)))
        else:
            self.label.setText(
                "%d pairs of setpoint & readback PVs in this table\n\n \
Please click the button below to update data\n" % (len(readbackPVList)))
        layout.addWidget(self.label, 0, 0, 1, 2)

        self.table = QTableWidget()
        sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.table.sizePolicy().hasHeightForWidth())
        self.table.setSizePolicy(sizePolicy)
        self.table.setMinimumSize(QSize(700, 500))
        self.table.resize(self.table.sizeHint())

        self.table.setRowCount(len(setpointPVList))
        #if len(thresholdList):
        if len(rampRatePVList):
            #self.keys = ['setpoint PV','readback PV','SP value','RB value','diff', 'threshold']
            self.keys = [
                'setpoint PV', 'readback PV', 'SP value (Amp)',
                'RB value (Amp)', 'diff', 'ramp-rate (Amp/Sec)'
            ]
        else:
            self.keys = [
                'setpoint PV', 'readback PV', 'SP value', 'RB value', 'diff'
            ]

        self.table.setColumnCount(len(self.keys))
        self.table.setHorizontalHeaderLabels(self.keys)
        layout.addWidget(self.table, 1, 0, 1, 2)

        #=======================================================================
        # toggleButton = QPushButton('Updating started', self)
        # toggleButton.clicked.connect(self.toggle)
        # layout.addWidget(toggleButton, 2, 0, 1, 1)
        #=======================================================================

        updateButton = QPushButton('Update Table', self)
        updateButton.clicked.connect(self.updateTable)
        layout.addWidget(updateButton, 2, 0, 1, 1)

        self.quit = QPushButton('Close Widget', self)
        #self.connect(self.quit, SIGNAL('clicked()'), self.close)
        #self.destroyed.connect(self.cleanup())
        #self.deleteLater.connect(self.cleanup())
        self.connect(self.quit, SIGNAL('clicked()'), self.cleanup)
        layout.addWidget(self.quit, 2, 1, 1, 1)
        self.setLayout(layout)
        #self.timer = cothread.Timer(2, self.updateTable, retrigger=True, reuse=True)
        self.updateTable()
    def __init__(self, parent):
        super(AudioVideoTab, self).__init__(parent)
        self.parent = parent
        self.name = 'AudioVideo'

        self.defaultStr = self.tr('Default')
        self.DisableStream = self.tr('Disable')

        self.formats = config.video_formats
        frequency_values = [self.defaultStr] + config.video_frequency_values
        bitrate_values = [self.defaultStr] + config.video_bitrate_values

        rotation_options = [
            self.tr('None'), '90 ' + self.tr('clockwise'),
            '90 ' + self.tr('clockwise') + ' + ' + self.tr('vertical flip'),
            '90 ' + self.tr('counter clockwise'), '90 ' +
            self.tr('counter clockwise') + ' + ' + self.tr('vertical flip'),
            '180',
            self.tr('horizontal flip'),
            self.tr('vertical flip')
        ]

        digits_validator = QRegExpValidator(QRegExp(r'[1-9]\d*'), self)
        digits_validator_wzero = QRegExpValidator(QRegExp(r'\d*'), self)
        digits_validator_minus = QRegExpValidator(QRegExp(r'(-1|[1-9]\d*)'),
                                                  self)
        time_validator = QRegExpValidator(
            QRegExp(r'\d{1,2}:\d{1,2}:\d{1,2}\.\d+'), self)

        converttoQL = QLabel(self.tr('Convert to:'))
        self.extQCB = QComboBox()
        self.extQCB.setMinimumWidth(100)
        vidcodecQL = QLabel('Video codec:')
        self.vidcodecQCB = QComboBox()
        self.vidcodecQCB.setMinimumWidth(110)
        audcodecQL = QLabel('Audio codec:')
        self.audcodecQCB = QComboBox()
        self.audcodecQCB.setMinimumWidth(110)

        hlayout1 = utils.add_to_layout('h', converttoQL, self.extQCB,
                                       QSpacerItem(180, 20), vidcodecQL,
                                       self.vidcodecQCB, audcodecQL,
                                       self.audcodecQCB)

        commandQL = QLabel(self.tr('Command:'))
        self.commandQLE = QLineEdit()
        self.presetQPB = QPushButton(self.tr('Preset'))
        self.defaultQPB = QPushButton(self.defaultStr)
        hlayout2 = utils.add_to_layout('h', commandQL, self.commandQLE,
                                       self.presetQPB, self.defaultQPB)

        sizeQL = QLabel(self.tr('Video Size:'))
        aspectQL = QLabel(self.tr('Aspect:'))
        frameQL = QLabel(self.tr('Frame Rate (fps):'))
        bitrateQL = QLabel(self.tr('Video Bitrate (kbps):'))

        self.widthQLE = utils.create_LineEdit((70, 16777215),
                                              digits_validator_minus, 4)
        self.heightQLE = utils.create_LineEdit((70, 16777215),
                                               digits_validator_minus, 4)
        label = QLabel('<html><p align="center">x</p></html>')
        layout1 = utils.add_to_layout('h', self.widthQLE, label,
                                      self.heightQLE)
        self.aspect1QLE = utils.create_LineEdit((50, 16777215),
                                                digits_validator, 2)
        self.aspect2QLE = utils.create_LineEdit((50, 16777215),
                                                digits_validator, 2)
        label = QLabel('<html><p align="center">:</p></html>')
        layout2 = utils.add_to_layout('h', self.aspect1QLE, label,
                                      self.aspect2QLE)
        self.frameQLE = utils.create_LineEdit((120, 16777215),
                                              digits_validator, 4)
        self.bitrateQLE = utils.create_LineEdit((130, 16777215),
                                                digits_validator, 6)

        labels = [sizeQL, aspectQL, frameQL, bitrateQL]
        widgets = [layout1, layout2, self.frameQLE, self.bitrateQLE]

        self.preserveaspectQChB = QCheckBox(self.tr("Preserve aspect ratio"))
        self.preservesizeQChB = QCheckBox(self.tr("Preserve video size"))

        preserve_layout = utils.add_to_layout('v', self.preserveaspectQChB,
                                              self.preservesizeQChB)

        videosettings_layout = QHBoxLayout()
        for a, b in zip(labels, widgets):
            a.setText('<html><p align="center">{0}</p></html>'.format(
                a.text()))
            layout = utils.add_to_layout('v', a, b)
            videosettings_layout.addLayout(layout)
            if a == aspectQL:
                # add vidaspectCB in layout after aspectQL
                videosettings_layout.addLayout(preserve_layout)

        freqQL = QLabel(self.tr('Frequency (Hz):'))
        chanQL = QLabel(self.tr('Audio Channels:'))
        bitrateQL = QLabel(self.tr('Audio Bitrate (kbps):'))
        threadsQL = QLabel(self.tr('Threads:'))

        self.freqQCB = QComboBox()
        self.freqQCB.addItems(frequency_values)
        self.chan1QRB = QRadioButton('1')
        self.chan1QRB.setMaximumSize(QSize(51, 16777215))
        self.chan2QRB = QRadioButton('2')
        self.chan2QRB.setMaximumSize(QSize(51, 16777215))
        self.group = QButtonGroup()
        self.group.addButton(self.chan1QRB)
        self.group.addButton(self.chan2QRB)
        spcr1 = QSpacerItem(40, 20, QSizePolicy.Preferred, QSizePolicy.Minimum)
        spcr2 = QSpacerItem(40, 20, QSizePolicy.Preferred, QSizePolicy.Minimum)
        chanlayout = utils.add_to_layout('h', spcr1, self.chan1QRB,
                                         self.chan2QRB, spcr2)
        self.audbitrateQCB = QComboBox()
        self.audbitrateQCB.addItems(bitrate_values)
        self.threadsQLE = utils.create_LineEdit((50, 16777215),
                                                digits_validator_wzero, 1)

        labels = [freqQL, bitrateQL, chanQL, threadsQL]
        widgets = [
            self.freqQCB, self.audbitrateQCB, chanlayout, self.threadsQLE
        ]

        audiosettings_layout = QHBoxLayout()
        for a, b in zip(labels, widgets):
            a.setText('<html><p align="center">{0}</p></html>'.format(
                a.text()))
            layout = utils.add_to_layout('v', a, b)
            audiosettings_layout.addLayout(layout)

        time_format = " (hh:mm:ss):"
        beginQL = QLabel(self.tr("Split file. Begin time") + time_format)
        self.beginQLE = utils.create_LineEdit(None, time_validator, None)
        durationQL = QLabel(self.tr("Duration") + time_format)
        self.durationQLE = utils.create_LineEdit(None, time_validator, None)

        hlayout4 = utils.add_to_layout('h', beginQL, self.beginQLE, durationQL,
                                       self.durationQLE)

        embedQL = QLabel(self.tr("Embed subtitle:"))
        self.embedQLE = QLineEdit()
        self.embedQTB = QToolButton()
        self.embedQTB.setText("...")

        rotateQL = QLabel(self.tr("Rotate:"))
        self.rotateQCB = QComboBox()
        self.rotateQCB.addItems(rotation_options)

        hlayout5 = utils.add_to_layout('h', rotateQL, self.rotateQCB, embedQL,
                                       self.embedQLE, self.embedQTB)

        hidden_layout = utils.add_to_layout('v', videosettings_layout,
                                            audiosettings_layout, hlayout4,
                                            hlayout5)

        line = QFrame()
        line.setFrameShape(QFrame.HLine)
        line.setFrameShadow(QFrame.Sunken)
        self.moreQPB = QPushButton(QApplication.translate('Tab', 'More'))
        self.moreQPB.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        self.moreQPB.setCheckable(True)
        hlayout3 = utils.add_to_layout('h', line, self.moreQPB)

        self.frame = QFrame()
        self.frame.setLayout(hidden_layout)
        self.frame.hide()

        final_layout = utils.add_to_layout('v', hlayout1, hlayout2, hlayout3,
                                           self.frame)
        self.setLayout(final_layout)

        self.presetQPB.clicked.connect(self.choose_preset)
        self.defaultQPB.clicked.connect(self.set_default_command)
        self.embedQTB.clicked.connect(self.open_subtitle_file)
        self.moreQPB.toggled.connect(self.frame.setVisible)
        self.moreQPB.toggled.connect(
            lambda: QTimer.singleShot(100, self.resize_parent))
        self.widthQLE.textChanged.connect(self.command_update_size)
        self.heightQLE.textChanged.connect(self.command_update_size)
        self.aspect1QLE.textChanged.connect(self.command_update_aspect)
        self.aspect2QLE.textChanged.connect(self.command_update_aspect)
        self.frameQLE.textChanged.connect(self.command_update_frames)
        self.bitrateQLE.textChanged.connect(self.command_update_vidbitrate)
        self.threadsQLE.textChanged.connect(self.command_update_threads)
        self.beginQLE.textChanged.connect(self.command_update_begin_time)
        self.durationQLE.textChanged.connect(self.command_update_duration)
        self.embedQLE.textChanged.connect(self.command_update_subtitles)
        self.vidcodecQCB.currentIndexChanged.connect(
            self.command_update_vcodec)
        self.audcodecQCB.currentIndexChanged.connect(
            self.command_update_acodec)
        self.freqQCB.currentIndexChanged.connect(self.command_update_frequency)
        self.rotateQCB.currentIndexChanged.connect(
            self.command_update_rotation)
        self.audbitrateQCB.currentIndexChanged.connect(
            self.command_update_audbitrate)
        self.chan1QRB.clicked.connect(
            lambda: self.command_update_channels('1'))
        self.chan2QRB.clicked.connect(
            lambda: self.command_update_channels('2'))
        self.preserveaspectQChB.toggled.connect(
            self.command_update_preserve_aspect)
        self.preservesizeQChB.toggled.connect(
            self.command_update_preserve_size)
Exemplo n.º 4
0
    def showPluginsSearchOptions(self):
        """
        Loads the search options of all the selected plugins and populates the relevant UI elements
        with input fields for the string options and checkboxes for the boolean options
        """
        pl = []
        for pluginName in self.selectedPlugins:
            plugin = self.PluginManager.getPluginByName(pluginName, 'Input')
            pl.append(plugin)
            '''
            Build the configuration page from the available saerch options
            and add the page to the stackwidget
            '''
            page = QWidget()
            page.setObjectName(_fromUtf8('searchconfig_page_' + plugin.name))
            scroll = QScrollArea()
            scroll.setWidgetResizable(True)
            layout = QVBoxLayout()
            titleLabel = QLabel(
                _fromUtf8(plugin.name + self.trUtf8(' Search Options')))
            layout.addWidget(titleLabel)
            vboxWidget = QWidget()
            vboxWidget.setObjectName(
                _fromUtf8('searchconfig_vboxwidget_container_' + plugin.name))
            vbox = QGridLayout()
            vbox.setObjectName(
                _fromUtf8('searchconfig_vbox_container_' + plugin.name))
            gridLayoutRowIndex = 0
            # Load the String options first
            pluginStringOptions = plugin.plugin_object.readConfiguration(
                'search_string_options')[1]
            if pluginStringOptions:
                for idx, item in enumerate(pluginStringOptions.keys()):
                    itemLabel = plugin.plugin_object.getLabelForKey(item)
                    label = QLabel()
                    label.setObjectName(
                        _fromUtf8('searchconfig_string_label_' + item))
                    label.setText(itemLabel)
                    vbox.addWidget(label, idx, 0)
                    value = QLineEdit()
                    value.setObjectName(
                        _fromUtf8('searchconfig_string_value_' + item))
                    value.setText(pluginStringOptions[item])
                    vbox.addWidget(value, idx, 1)
                    gridLayoutRowIndex = idx + 1
            # Load the boolean options
            pluginBooleanOptions = plugin.plugin_object.readConfiguration(
                'search_boolean_options')[1]
            if pluginBooleanOptions:
                for idx, item in enumerate(pluginBooleanOptions.keys()):
                    itemLabel = plugin.plugin_object.getLabelForKey(item)
                    cb = QCheckBox(itemLabel)
                    cb.setObjectName(
                        _fromUtf8('searchconfig_boolean_label_' + item))
                    if pluginBooleanOptions[item] == 'True':
                        cb.toggle()
                    vbox.addWidget(cb, gridLayoutRowIndex + idx, 0)
            # If there are no search options just show a message
            if not pluginBooleanOptions and not pluginStringOptions:
                label = QLabel()
                label.setObjectName(_fromUtf8('no_search_config_options'))
                label.setText(
                    self.trUtf8(
                        'This plugin does not offer any search options.'))
                vbox.addWidget(label, 0, 0)

            vboxWidget.setLayout(vbox)
            scroll.setWidget(vboxWidget)
            layout.addWidget(scroll)
            layout.addStretch(1)
            page.setLayout(layout)
            self.ui.searchConfiguration.addWidget(page)

        self.ui.searchConfiguration.setCurrentIndex(0)

        self.SearchConfigPluginConfigurationListModel = PluginConfigurationListModel(
            pl, self)
        self.SearchConfigPluginConfigurationListModel.checkPluginConfiguration(
        )
        self.ui.placeProjectWizardSearchConfigPluginsList.setModel(
            self.SearchConfigPluginConfigurationListModel)
        self.ui.placeProjectWizardSearchConfigPluginsList.clicked.connect(
            self.changePluginConfigurationPage)
Exemplo n.º 5
0
    def __init__(self, parent, text):
        QWidget.__init__(self, parent)

        self.text_editor = QTextEdit(self)
        self.text_editor.setText(text)
        self.text_editor.setReadOnly(True)

        # Type frame
        type_layout = QHBoxLayout()
        type_label = QLabel(_("Import as"))
        type_layout.addWidget(type_label)
        data_btn = QRadioButton(_("data"))
        data_btn.setChecked(True)
        self._as_data = True
        type_layout.addWidget(data_btn)
        code_btn = QRadioButton(_("code"))
        self._as_code = False
        type_layout.addWidget(code_btn)
        txt_btn = QRadioButton(_("text"))
        type_layout.addWidget(txt_btn)
        h_spacer = QSpacerItem(40, 20, QSizePolicy.Expanding,
                               QSizePolicy.Minimum)
        type_layout.addItem(h_spacer)
        type_frame = QFrame()
        type_frame.setLayout(type_layout)

        # Opts frame
        grid_layout = QGridLayout()
        grid_layout.setSpacing(0)

        col_label = QLabel(_("Column separator:"))
        grid_layout.addWidget(col_label, 0, 0)
        col_w = QWidget()
        col_btn_layout = QHBoxLayout()
        self.tab_btn = QRadioButton(_("Tab"))
        self.tab_btn.setChecked(True)
        col_btn_layout.addWidget(self.tab_btn)
        other_btn_col = QRadioButton(_("other"))
        col_btn_layout.addWidget(other_btn_col)
        col_w.setLayout(col_btn_layout)
        grid_layout.addWidget(col_w, 0, 1)
        self.line_edt = QLineEdit(",")
        self.line_edt.setMaximumWidth(30)
        self.line_edt.setEnabled(False)
        self.connect(other_btn_col, SIGNAL("toggled(bool)"), self.line_edt,
                     SLOT("setEnabled(bool)"))
        grid_layout.addWidget(self.line_edt, 0, 2)

        row_label = QLabel(_("Row separator:"))
        grid_layout.addWidget(row_label, 1, 0)
        row_w = QWidget()
        row_btn_layout = QHBoxLayout()
        self.eol_btn = QRadioButton(_("EOL"))
        self.eol_btn.setChecked(True)
        row_btn_layout.addWidget(self.eol_btn)
        other_btn_row = QRadioButton(_("other"))
        row_btn_layout.addWidget(other_btn_row)
        row_w.setLayout(row_btn_layout)
        grid_layout.addWidget(row_w, 1, 1)
        self.line_edt_row = QLineEdit(";")
        self.line_edt_row.setMaximumWidth(30)
        self.line_edt_row.setEnabled(False)
        self.connect(other_btn_row, SIGNAL("toggled(bool)"), self.line_edt_row,
                     SLOT("setEnabled(bool)"))
        grid_layout.addWidget(self.line_edt_row, 1, 2)

        grid_layout.setRowMinimumHeight(2, 15)

        other_group = QGroupBox(_("Additionnal options"))
        other_layout = QGridLayout()
        other_group.setLayout(other_layout)

        skiprows_label = QLabel(_("Skip rows:"))
        other_layout.addWidget(skiprows_label, 0, 0)
        self.skiprows_edt = QLineEdit('0')
        self.skiprows_edt.setMaximumWidth(30)
        intvalid = QIntValidator(0, len(unicode(text).splitlines()),
                                 self.skiprows_edt)
        self.skiprows_edt.setValidator(intvalid)
        other_layout.addWidget(self.skiprows_edt, 0, 1)

        other_layout.setColumnMinimumWidth(2, 5)

        comments_label = QLabel(_("Comments:"))
        other_layout.addWidget(comments_label, 0, 3)
        self.comments_edt = QLineEdit('#')
        self.comments_edt.setMaximumWidth(30)
        other_layout.addWidget(self.comments_edt, 0, 4)

        self.trnsp_box = QCheckBox(_("Transpose"))
        #self.trnsp_box.setEnabled(False)
        other_layout.addWidget(self.trnsp_box, 1, 0, 2, 0)

        grid_layout.addWidget(other_group, 3, 0, 2, 0)

        opts_frame = QFrame()
        opts_frame.setLayout(grid_layout)

        self.connect(data_btn, SIGNAL("toggled(bool)"), opts_frame,
                     SLOT("setEnabled(bool)"))
        self.connect(data_btn, SIGNAL("toggled(bool)"), self,
                     SLOT("set_as_data(bool)"))
        self.connect(code_btn, SIGNAL("toggled(bool)"), self,
                     SLOT("set_as_code(bool)"))
        #        self.connect(txt_btn, SIGNAL("toggled(bool)"),
        #                     self, SLOT("is_text(bool)"))

        # Final layout
        layout = QVBoxLayout()
        layout.addWidget(type_frame)
        layout.addWidget(self.text_editor)
        layout.addWidget(opts_frame)
        self.setLayout(layout)
Exemplo n.º 6
0
    def mostrar(self):
        self.move(QtGui.QApplication.desktop().screen().rect().center() - self.rect().center())

        label=QLabel(self)
        label.setGeometry(QtCore.QRect(10, 5, 50, 40))
        label.setText("Titulo")

        global editTextTitulo
        editTextTitulo=QtGui.QPlainTextEdit(self)
        #left top
        editTextTitulo.setGeometry(QtCore.QRect(10, 35, 130, 27))

        labelBloque=QLabel(self)
        labelBloque.setGeometry(QtCore.QRect(10, 30, 150, 100))
        labelBloque.setText("Bloque de codigo")

        global editTextBloque
        #editTextBloque=QtGui.QLineEdit(self)
        editTextBloque=QtGui.QPlainTextEdit(self)
        #left top
        editTextBloque.setGeometry(QtCore.QRect(10, 90, 300, 400))

        label_3 = QtGui.QLabel(self)
        label_3.setGeometry(QtCore.QRect(350, 90, 101, 21))
        label_3.setText("Sintaxis")

        global comboBoxSintaxis
        comboBoxSintaxis= QtGui.QComboBox(self)
        comboBoxSintaxis.setGeometry(QtCore.QRect(350, 110, 131, 24))

        list1 = [
            self.tr('Select One'),
            self.tr('apache'),
            self.tr('c#'),
            self.tr('bash'),
            self.tr('c++'),
            self.tr('css'),
            self.tr('coffeeScript'),
            self.tr('diff'),
            self.tr('html'),
            self.tr('xml'),
            self.tr('http'),
            self.tr('ini'),
            self.tr('json'),
            self.tr('javascript'),
            self.tr('lisp'),
            self.tr('makefile'),
            self.tr('markdown'),
            self.tr('objective-C'),
            self.tr('perl'),
            self.tr('python'),
            self.tr('ruby'),
            self.tr('sql'),
            self.tr('session'),
            self.tr('arduino'),
            self.tr('arm assembler'),
            self.tr('clojure'),
            self.tr('excel'),
            self.tr('f#'),
            self.tr('go'),
            self.tr('haskell'),
            self.tr('groovy'),
            self.tr('r'),
            self.tr('sml'),
            self.tr('swift'),
            self.tr('vb.net'),
            self.tr('yaml'),
        ]

        comboBoxSintaxis.clear()
        for text in list1:
            comboBoxSintaxis.addItem(text)

        label_4 = QtGui.QLabel(self)
        label_4.setGeometry(QtCore.QRect(350, 150, 150, 21))
        label_4.setText("Tiempo expiracion")

        global comboBoxTiempo
        comboBoxTiempo= QtGui.QComboBox(self)
        comboBoxTiempo.setGeometry(QtCore.QRect(350, 170, 131, 24))

        list2 = [
            self.tr('Select One'),
            self.tr('never'),
            self.tr('10 minutes'),
            self.tr('15 minutes'),
            self.tr('30 minutes'),
            self.tr('1 hour'),
            self.tr('1 day'),
            self.tr('1 week'),
        ]

        comboBoxTiempo.clear()
        for text in list2:
            comboBoxTiempo.addItem(text)

        label_5 = QtGui.QLabel(self)
        label_5.setGeometry(QtCore.QRect(350, 210, 101, 21))
        label_5.setText("Tipo exposicion")

        global comboBoxTipo
        comboBoxTipo= QtGui.QComboBox(self)
        comboBoxTipo.setGeometry(QtCore.QRect(350, 230, 131, 24))

        list3 = [
            self.tr('Select One'),
            self.tr('public'),
            self.tr('private'),
            self.tr('unlisted'),
        ]

        comboBoxTipo.clear()
        for text in list3:
            comboBoxTipo.addItem(text)

        botonEnviar=QtGui.QPushButton(self)
        botonEnviar.setText("Publicar")
        botonEnviar.setGeometry(QtCore.QRect(350, 400, 131, 24))
        #botonEnviar.clicked.connect(self.publicar)
        self.connect(botonEnviar, Qt.SIGNAL("clicked()"), publicar)
Exemplo n.º 7
0
    def __init__(self, parent=None):
        '''
        Constructor
        '''
        QWidget.__init__(self, parent)
        self.mainLayout = QVBoxLayout()
        self.setLayout(self.mainLayout)

        self.addTalkGroupBox = QGroupBox("Add Talk")
        self.mainLayout.addWidget(self.addTalkGroupBox)

        self.addTalkLayout = QFormLayout()
        self.addTalkGroupBox.setLayout(self.addTalkLayout)

        # Title
        self.titleLabel = QLabel("Title")
        self.titleLineEdit = QLineEdit()
        if hasattr(QLineEdit(), 'setPlaceholderText'):
            self.titleLineEdit.setPlaceholderText("Title of the presentation")
        self.titleLabel.setBuddy(self.titleLineEdit)
        self.addTalkLayout.addRow(self.titleLabel, self.titleLineEdit)

        # Presenter
        self.presenterLabel = QLabel("Presenter")
        self.presenterLineEdit = QLineEdit()
        if hasattr(QLineEdit(), 'setPlaceholderText'):
            self.presenterLineEdit.setPlaceholderText(
                "Name person or people presenting (comma separated)")
        self.presenterLabel.setBuddy(self.presenterLineEdit)
        self.addTalkLayout.addRow(self.presenterLabel, self.presenterLineEdit)

        # Event
        self.eventLabel = QLabel("Event")
        self.eventLineEdit = QLineEdit()
        if hasattr(QLineEdit(), 'setPlaceholderText'):
            self.eventLineEdit.setPlaceholderText(
                "The name of the Event this talk is being presented at")
        self.eventLabel.setBuddy(self.eventLineEdit)
        self.addTalkLayout.addRow(self.eventLabel, self.eventLineEdit)

        # Room
        self.roomLabel = QLabel("Room")
        self.roomLineEdit = QLineEdit()
        if hasattr(QLineEdit(), 'setPlaceholderText'):
            self.roomLineEdit.setPlaceholderText(
                "The Room in which the presentation is taking place")
        self.roomLabel.setBuddy(self.roomLineEdit)
        self.addTalkLayout.addRow(self.roomLabel, self.roomLineEdit)

        # Date
        current_date = QDate()
        self.dateLabel = QLabel("Date")
        self.dateEdit = QDateEdit()
        self.dateEdit.setDate(current_date.currentDate())
        self.dateLabel.setBuddy(self.dateEdit)
        self.addTalkLayout.addRow(self.dateLabel, self.dateEdit)

        self.dateEdit.setCalendarPopup(True)

        # Time
        current_time = QTime()
        self.timeLabel = QLabel("Time")
        self.timeEdit = QTimeEdit()
        self.timeEdit.setTime(current_time.currentTime())
        self.timeLabel.setBuddy(self.dateEdit)
        self.addTalkLayout.addRow(self.timeLabel, self.timeEdit)

        # Buttons
        addIcon = QIcon.fromTheme("list-add")
        cancelIcon = QIcon.fromTheme("edit-clear")

        self.buttonsWidget = QHBoxLayout()
        self.addButton = QPushButton("Add")
        self.addButton.setIcon(addIcon)
        self.cancelButton = QPushButton("Cancel")
        self.cancelButton.setIcon(cancelIcon)
        self.buttonsWidget.addWidget(self.addButton)
        self.buttonsWidget.addWidget(self.cancelButton)
        self.addTalkLayout.addRow(None, self.buttonsWidget)
    def __init__(self, files, tab, delete, parent, test=False):
        """
        Keyword arguments:
        files  -- list with dicts containing file names
        tab -- instanseof AudioVideoTab, ImageTab or DocumentTab
               indicating currently active tab
        delete -- boolean that shows if files must removed after conversion
        parent -- parent widget

        files:
        Each dict have only one key and one corresponding value.
        Key is a file to be converted and it's value is the name of the new
        file that will be converted.

        Example list:
        [{"/foo/bar.png" : "/foo/bar.bmp"}, {"/f/bar2.png" : "/f/bar2.bmp"}]
        """
        super(Progress, self).__init__(parent)
        self.parent = parent

        self.files = files
        self.num_total_files = len(self.files)
        self.tab = tab
        self.delete = delete
        if not test:
            self._type = tab.name
            self.step = int(100 / len(files))
        self.ok = 0
        self.error = 0
        self.running = True

        self.nowQL = QLabel(self.tr('In progress: '))
        totalQL = QLabel(self.tr('Total:'))
        self.nowQPBar = QProgressBar()
        self.nowQPBar.setValue(0)
        self.totalQPBar = QProgressBar()
        self.totalQPBar.setValue(0)
        self.cancelQPB = QPushButton(self.tr('Cancel'))

        detailsQPB = QCommandLinkButton(self.tr('Details'))
        detailsQPB.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        detailsQPB.setCheckable(True)
        detailsQPB.setMaximumWidth(113)
        line = QFrame()
        line.setFrameShape(QFrame.HLine)
        line.setFrameShadow(QFrame.Sunken)
        self.outputQTE = QTextEdit()
        self.outputQTE.setReadOnly(True)
        self.frame = QFrame()
        frame_layout = utils.add_to_layout('h', self.outputQTE)
        self.frame.setLayout(frame_layout)
        self.frame.hide()

        hlayout = utils.add_to_layout('h', None, self.nowQL, None)
        hlayout2 = utils.add_to_layout('h', None, totalQL, None)
        hlayout3 = utils.add_to_layout('h', detailsQPB, line)
        hlayout4 = utils.add_to_layout('h', self.frame)
        hlayout5 = utils.add_to_layout('h', None, self.cancelQPB)
        vlayout = utils.add_to_layout('v', hlayout, self.nowQPBar, hlayout2,
                                      self.totalQPBar, None, hlayout3,
                                      hlayout4, hlayout5)
        self.setLayout(vlayout)

        detailsQPB.toggled.connect(self.resize_dialog)
        detailsQPB.toggled.connect(self.frame.setVisible)
        self.cancelQPB.clicked.connect(self.reject)
        self.file_converted_signal.connect(self.next_file)
        self.refr_bars_signal.connect(self.refresh_progress_bars)
        self.update_text_edit_signal.connect(self.update_text_edit)

        self.resize(484, 200)
        self.setWindowTitle('FF Multi Converter - ' + self.tr('Conversion'))

        if not test:
            self.get_data()  # should be first and not in QTimer.singleShot()
            QTimer.singleShot(0, self.manage_conversions)
Exemplo n.º 9
0
    def __init__(self):
        super().__init__()

        self.data = None
        self.preprocessors = None

        # Learner name
        box = gui.widgetBox(self.controlArea, self.tr("Name"))
        gui.lineEdit(box, self, "learner_name")

        # Basic properties
        form = QGridLayout()
        basic_box = gui.widgetBox(self.controlArea,
                                  "Basic properties",
                                  orientation=form)

        form.addWidget(QLabel(self.tr("Number of trees in the forest: ")), 0,
                       0, Qt.AlignLeft)
        spin = gui.spin(basic_box,
                        self,
                        "n_estimators",
                        minv=1,
                        maxv=1e4,
                        callback=self.settingsChanged,
                        addToLayout=False,
                        controlWidth=50)
        form.addWidget(spin, 0, 1, Qt.AlignRight)

        max_features_cb = gui.checkBox(
            basic_box,
            self,
            "use_max_features",
            callback=self.settingsChanged,
            addToLayout=False,
            label="Consider a number of best attributes at each split")

        max_features_spin = gui.spin(basic_box,
                                     self,
                                     "max_features",
                                     2,
                                     50,
                                     addToLayout=False,
                                     callback=self.settingsChanged,
                                     controlWidth=50)

        form.addWidget(max_features_cb, 1, 0, Qt.AlignLeft)
        form.addWidget(max_features_spin, 1, 1, Qt.AlignRight)

        random_state_cb = gui.checkBox(basic_box,
                                       self,
                                       "use_random_state",
                                       callback=self.settingsChanged,
                                       addToLayout=False,
                                       label="Use seed for random generator:")
        random_state_spin = gui.spin(basic_box,
                                     self,
                                     "random_state",
                                     0,
                                     2**31 - 1,
                                     addToLayout=False,
                                     callback=self.settingsChanged,
                                     controlWidth=50)

        form.addWidget(random_state_cb, 2, 0, Qt.AlignLeft)
        form.addWidget(random_state_spin, 2, 1, Qt.AlignRight)
        self._max_features_spin = max_features_spin
        self._random_state_spin = random_state_spin

        # Growth control
        form = QGridLayout()
        growth_box = gui.widgetBox(self.controlArea,
                                   "Growth control",
                                   orientation=form)

        max_depth_cb = gui.checkBox(
            growth_box,
            self,
            "use_max_depth",
            label="Set maximal depth of individual trees",
            callback=self.settingsChanged,
            addToLayout=False)

        max_depth_spin = gui.spin(growth_box,
                                  self,
                                  "max_depth",
                                  2,
                                  50,
                                  addToLayout=False,
                                  callback=self.settingsChanged)

        form.addWidget(max_depth_cb, 3, 0, Qt.AlignLeft)
        form.addWidget(max_depth_spin, 3, 1, Qt.AlignRight)

        max_leaf_nodes_cb = gui.checkBox(
            growth_box,
            self,
            "use_max_leaf_nodes",
            label="Stop splitting nodes with maximum instances: ",
            callback=self.settingsChanged,
            addToLayout=False)

        max_leaf_nodes_spin = gui.spin(growth_box,
                                       self,
                                       "max_leaf_nodes",
                                       0,
                                       100,
                                       addToLayout=False,
                                       callback=self.settingsChanged)

        form.addWidget(max_leaf_nodes_cb, 4, 0, Qt.AlignLeft)
        form.addWidget(max_leaf_nodes_spin, 4, 1, Qt.AlignRight)
        self._max_depth_spin = max_depth_spin
        self._max_leaf_nodes_spin = max_leaf_nodes_spin

        # Index on the output
        #         gui.doubleSpin(self.controlArea, self, "index_output", 0, 10000, 1,
        #                        label="Index of tree on the output")

        gui.button(self.controlArea,
                   self,
                   "&Apply",
                   callback=self.apply,
                   default=True)

        self.settingsChanged()
        self.apply()
Exemplo n.º 10
0
    def attachCurves(self, names, settings, usedMnts):
        """
        To attach the curves for the layers to the profile
        :param names: layers names
        :param settings: project settings
        :param usedMnts: if use mnt or not
        """
        if (self.__profiles is None) or (self.__profiles == 0):
            return

        self.__getLinearPoints()
        if usedMnts is not None and (usedMnts[0] or usedMnts[1]
                                     or usedMnts[2]):
            self.__getMnt(settings)

        c = 0

        if self.__mntPoints is not None:
            for p in range(len(self.__mntPoints[0])):
                if usedMnts[p]:
                    legend = QLabel("<font color='" + self.__colors[c] + "'>" +
                                    self.__mntPoints[0][p] + "</font>")
                    self.__legendLayout.addWidget(legend)

                    if self.__lib == 'Qwt5':

                        xx = [
                            list(g) for k, g in itertools.groupby(
                                self.__mntPoints[1], lambda x: x is None)
                            if not k
                        ]
                        yy = [
                            list(g) for k, g in itertools.groupby(
                                self.__mntPoints[2][p], lambda x: x is None)
                            if not k
                        ]

                        for j in range(len(xx)):
                            curve = QwtPlotCurve(self.__mntPoints[0][p])
                            curve.setData(xx[j], yy[j])
                            curve.setPen(QPen(QColor(self.__colors[c]), 3))
                            curve.attach(self.__plotWdg)

                    elif self.__lib == 'Matplotlib':
                        qcol = QColor(self.__colors[c])
                        self.__plotWdg.figure.get_axes()[0].plot(
                            self.__mntPoints[1],
                            self.__mntPoints[2][p],
                            gid=self.__mntPoints[0][p],
                            linewidth=3)
                        tmp = self.__plotWdg.figure.get_axes()[0].get_lines()
                        for t in range(len(tmp)):
                            if self.__mntPoints[0][p] == tmp[t].get_gid():
                                tmp[c].set_color((old_div(qcol.red(), 255.0),
                                                  old_div(qcol.green(), 255.0),
                                                  old_div(qcol.blue(), 255.0),
                                                  old_div(qcol.alpha(),
                                                          255.0)))
                                self.__plotWdg.draw()
                                break
                    c += 1

        if 'z' in self.__profiles[0]:
            for i in range(len(self.__profiles[0]['z'])):
                if i < self.__numLines:
                    v = 0
                else:
                    v = i - self.__numLines + 1
                name = names[v]
                xx = []
                yy = []
                for prof in self.__profiles:
                    if isinstance(prof['z'][i], list):
                        for z in prof['z'][i]:
                            xx.append(prof['l'])
                            yy.append(z)
                    else:
                        xx.append(prof['l'])
                        yy.append(prof['z'][i])

                for j in range(len(yy)):
                    if yy[j] is None:
                        xx[j] = None

                if i == 0 or i > (self.__numLines - 1):
                    legend = QLabel("<font color='" + self.__colors[c] + "'>" +
                                    name + "</font>")
                    self.__legendLayout.addWidget(legend)

                if self.__lib == 'Qwt5':

                    # Split xx and yy into single lines at None values
                    xx = [
                        list(g)
                        for k, g in itertools.groupby(xx, lambda x: x is None)
                        if not k
                    ]
                    yy = [
                        list(g)
                        for k, g in itertools.groupby(yy, lambda x: x is None)
                        if not k
                    ]

                    # Create & attach one QwtPlotCurve per one single line
                    for j in range(len(xx)):
                        curve = QwtPlotCurve(name)
                        curve.setData(xx[j], yy[j])
                        curve.setPen(QPen(QColor(self.__colors[c]), 3))
                        if i > (self.__numLines - 1):
                            curve.setStyle(QwtPlotCurve.Dots)
                            pen = QPen(QColor(self.__colors[c]), 8)
                            pen.setCapStyle(Qt.RoundCap)
                            curve.setPen(pen)
                        curve.attach(self.__plotWdg)

                elif self.__lib == 'Matplotlib':
                    qcol = QColor(self.__colors[c])
                    if i < self.__numLines:
                        self.__plotWdg.figure.get_axes()[0].plot(xx,
                                                                 yy,
                                                                 gid=name,
                                                                 linewidth=3)
                    else:
                        self.__plotWdg.figure.get_axes()[0].plot(
                            xx,
                            yy,
                            gid=name,
                            linewidth=5,
                            marker='o',
                            linestyle='None')
                    tmp = self.__plotWdg.figure.get_axes()[0].get_lines()
                    for t in range(len(tmp)):
                        if name == tmp[t].get_gid():
                            tmp[c].set_color(
                                (old_div(qcol.red(),
                                         255.0), old_div(qcol.green(), 255.0),
                                 old_div(qcol.blue(),
                                         255.0), old_div(qcol.alpha(), 255.0)))
                            self.__plotWdg.draw()
                            break
                c += 1

        # scaling this
        try:
            self.__reScalePlot(None, True)
        except:
            self.__iface.messageBar().pushMessage(QCoreApplication.translate(
                "VDLTools", "Rescale problem... (trace printed)"),
                                                  level=QgsMessageBar.CRITICAL,
                                                  duration=0)
            print(sys.exc_info()[0], traceback.format_exc())
        if self.__lib == 'Qwt5':
            self.__plotWdg.replot()
        elif self.__lib == 'Matplotlib':
            self.__plotWdg.figure.get_axes()[0].redraw_in_frame()
            self.__plotWdg.draw()
            self.__activateMouseTracking(True)
            self.__marker.show()
Exemplo n.º 11
0
    def __init__(self, iface, geometry, mntButton=False, zerosButton=False):
        """
        Constructor
        :param iface: interface
        :param width: dock widget geometry
        """
        QDockWidget.__init__(self)
        self.setWindowTitle(
            QCoreApplication.translate("VDLTools", "Profile Tool"))
        self.__iface = iface
        self.__geom = geometry
        self.__canvas = self.__iface.mapCanvas()
        self.__types = ['PDF', 'PNG']  # ], 'SVG', 'PS']
        self.__libs = []
        if Qwt5_loaded:
            self.__lib = 'Qwt5'
            self.__libs.append('Qwt5')
            if matplotlib_loaded:
                self.__libs.append('Matplotlib')
        elif matplotlib_loaded:
            self.__lib = 'Matplotlib'
            self.__libs.append('Matplotlib')
        else:
            self.__lib = None
            self.__iface.messageBar().pushMessage(QCoreApplication.translate(
                "VDLTools", "No graph lib available (qwt5 or matplotlib)"),
                                                  level=QgsMessageBar.CRITICAL,
                                                  duration=0)

        self.__doTracking = False
        self.__vline = None

        self.__profiles = None
        self.__numLines = None
        self.__mntPoints = None

        self.__marker = None
        self.__tabmouseevent = None

        if self.__geom is not None:
            self.setGeometry(self.__geom)

        self.__contentWidget = QWidget()
        self.setWidget(self.__contentWidget)

        self.__boxLayout = QHBoxLayout()
        self.__contentWidget.setLayout(self.__boxLayout)

        self.__plotFrame = QFrame()
        self.__frameLayout = QHBoxLayout()
        self.__plotFrame.setLayout(self.__frameLayout)

        self.__printLayout = QHBoxLayout()
        self.__printLayout.addWidget(self.__plotFrame)

        self.__legendLayout = QVBoxLayout()
        self.__printLayout.addLayout(self.__legendLayout)

        self.__printWdg = QWidget()
        self.__printWdg.setLayout(self.__printLayout)

        self.__plotWdg = None
        self.__scaleButton = None
        self.__changePlotWidget()

        size = QSize(150, 20)

        self.__boxLayout.addWidget(self.__printWdg)

        self.__vertLayout = QVBoxLayout()

        self.__libCombo = QComboBox()
        self.__libCombo.setFixedSize(size)
        self.__libCombo.addItems(self.__libs)
        self.__vertLayout.addWidget(self.__libCombo)
        self.__libCombo.currentIndexChanged.connect(self.__setLib)

        if mntButton:
            self.__displayMnt = False
            self.__mntButton = QPushButton(
                QCoreApplication.translate("VDLTools", "Display MNT"))
            self.__mntButton.setFixedSize(size)
            self.__mntButton.clicked.connect(self.__mnt)
            self.__vertLayout.addWidget(self.__mntButton)

        if zerosButton:
            self.__displayZeros = False
            self.__zerosButton = QPushButton(
                QCoreApplication.translate("VDLTools", "Display Zeros"))
            self.__zerosButton.setFixedSize(size)
            self.__zerosButton.clicked.connect(self.__zeros)
            self.__vertLayout.addWidget(self.__zerosButton)
        else:
            self.__displayZeros = True

        self.__scale11 = False
        self.__scaleButton = QPushButton(
            QCoreApplication.translate("VDLTools", "Scale 1:1"))
        self.__scaleButton.setFixedSize(size)
        self.__scaleButton.clicked.connect(self.__scale)
        if self.__lib == 'Qwt5':
            self.__scaleButton.setVisible(True)
        else:
            self.__scaleButton.setVisible(False)
        self.__vertLayout.addWidget(self.__scaleButton)

        self.__maxLabel = QLabel("y max")
        self.__maxLabel.setFixedSize(size)
        self.__vertLayout.addWidget(self.__maxLabel)
        self.__maxSpin = QSpinBox()
        self.__maxSpin.setFixedSize(size)
        self.__maxSpin.setRange(-10000, 10000)
        self.__maxSpin.valueChanged.connect(self.__reScalePlot)
        self.__vertLayout.addWidget(self.__maxSpin)
        self.__vertLayout.insertSpacing(10, 20)

        self.__minLabel = QLabel("y min")
        self.__minLabel.setFixedSize(size)
        self.__vertLayout.addWidget(self.__minLabel)
        self.__minSpin = QSpinBox()
        self.__minSpin.setFixedSize(size)
        self.__minSpin.setRange(-10000, 10000)
        self.__minSpin.valueChanged.connect(self.__reScalePlot)
        self.__vertLayout.addWidget(self.__minSpin)
        self.__vertLayout.insertSpacing(10, 40)

        self.__typeCombo = QComboBox()
        self.__typeCombo.setFixedSize(size)
        self.__typeCombo.addItems(self.__types)
        self.__vertLayout.addWidget(self.__typeCombo)
        self.__saveButton = QPushButton(
            QCoreApplication.translate("VDLTools", "Save"))
        self.__saveButton.setFixedSize(size)
        self.__saveButton.clicked.connect(self.__save)
        self.__vertLayout.addWidget(self.__saveButton)

        self.__boxLayout.addLayout(self.__vertLayout)

        self.__maxSpin.setEnabled(False)
        self.__minSpin.setEnabled(False)

        self.__colors = []
        for cn in QColor.colorNames():
            qc = QColor(cn)
            val = qc.red() + qc.green() + qc.blue()
            if 0 < val < 450:
                self.__colors.append(cn)
Exemplo n.º 12
0
    def __init__(self, parent=None, callback=None):
        super(FormSection, self).__init__(parent)

        self.callback = callback

        self.oSectionForm = []

        self.setWindowTitle('Section Information')
        self.resize(400, 300)

        layout = QVBoxLayout()

        self.textbox1 = QLineEdit()
        self.textbox1.setPlaceholderText('<type domain name here>')

        self.textbox2 = QLineEdit()
        self.textbox2.setPlaceholderText('<type section name here>')

        self.textbox3 = QLineEdit()
        self.textbox3.setPlaceholderText('<type section hydrometer code here>')
        self.textbox3.setText('-9999')

        self.textbox4 = QLineEdit()
        self.textbox4.setPlaceholderText('<type section drainage area here>')
        self.textbox4.setText('-9999')

        self.textbox5 = QLineEdit()
        self.textbox5.setPlaceholderText('<type section alert threshold here>')
        self.textbox5.setText('-9999')

        self.textbox6 = QLineEdit()
        self.textbox6.setPlaceholderText('<type section alarm threshold here>')
        self.textbox6.setText('-9999')

        layout.addWidget(QLabel("Domain Name:"))
        layout.addWidget(self.textbox1)
        layout.addWidget(QLabel("Section Name:"))
        layout.addWidget(self.textbox2)
        layout.addWidget(QLabel("Section Hydrometer Code:"))
        layout.addWidget(self.textbox3)
        layout.addWidget(QLabel("Section Area [km^2]:"))
        layout.addWidget(self.textbox4)
        layout.addWidget(QLabel("Section Alert Threshold [m^3/s]:"))
        layout.addWidget(self.textbox5)
        layout.addWidget(QLabel("Section Alarm Threshold [m^3/s]:"))
        layout.addWidget(self.textbox6)

        self.textbox1.editingFinished.connect(self.enterPress)
        self.textbox2.editingFinished.connect(self.enterPress)
        self.textbox3.editingFinished.connect(self.enterPress)
        self.textbox4.editingFinished.connect(self.enterPress)
        self.textbox5.editingFinished.connect(self.enterPress)
        self.textbox6.editingFinished.connect(self.enterPress)

        button_yes = QPushButton('Yes', self)
        button_cancel = QPushButton('Cancel', self)
        layout.addWidget(button_yes)
        layout.addWidget(button_cancel)

        layout.connect(button_yes, SIGNAL("clicked()"), self.button_click)
        layout.connect(button_cancel, SIGNAL("clicked()"), self.button_cancel)

        # ButtonYes connection(s)
        button_yes.clicked.connect(self.emitSignal)
        button_yes.clicked.connect(self.close)
        # ButtonCancel connection(s)
        button_cancel.clicked.connect(self.close)

        # Set layout
        self.setLayout(layout)
        self.layout = layout
Exemplo n.º 13
0
    def setupUi(self, Form):
        Form.setObjectName(_fromUtf8("Form"))
        Form.resize(435, 580)
        self.verticalLayout = QVBoxLayout(Form)
        self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))

        self.gbGeneral = GroupBox(Form)
        self.gbGeneral.Caption = "General"
        self.verticalLayout.addWidget(self.gbGeneral)

        # self.cmbAerodrome = ComboBoxPanel(self.gbGeneral, True)
        # self.cmbAerodrome.Caption = "Aerodrome"
        # self.cmbAerodrome.LabelWidth = 120
        # self.gbGeneral.Add = self.cmbAerodrome
        #
        # self.cmbRwyDir = ComboBoxPanel(self.gbGeneral, True)
        # self.cmbRwyDir.Caption = "Runway Direction"
        # self.cmbRwyDir.LabelWidth = 120
        # self.cmbRwyDir.Width = 120
        # self.gbGeneral.Add = self.cmbRwyDir

        self.cmbRnavSpecification = ComboBoxPanel(self.gbGeneral)
        self.cmbRnavSpecification.Caption = "Rnav Specification"
        self.cmbRnavSpecification.LabelWidth = 150
        self.gbGeneral.Add = self.cmbRnavSpecification

        self.frameChbThree = Frame(self.gbGeneral, "HL")
        self.gbGeneral.Add = self.frameChbThree

        self.chbUseTwoWpt = CheckBox(self.frameChbThree)
        self.chbUseTwoWpt.Caption = "Use 2 Waypoints"
        self.frameChbThree.Add = self.chbUseTwoWpt

        self.chbInsertSymbol = CheckBox(self.frameChbThree)
        self.chbInsertSymbol.Caption = "Insert Symbol(s)"
        self.frameChbThree.Add = self.chbInsertSymbol

        self.chbCatH = CheckBox(self.frameChbThree)
        self.chbCatH.Caption = "Cat.H"
        self.frameChbThree.Add = self.chbCatH

        self.cmbPhaseOfFlight = ComboBoxPanel(self.gbGeneral)
        self.cmbPhaseOfFlight.Caption = "Phase Of Flight"
        self.cmbPhaseOfFlight.LabelWidth = 150
        self.gbGeneral.Add = self.cmbPhaseOfFlight

        self.pnlArp = PositionPanel(self.gbGeneral)
        self.pnlArp.Caption = "Aerodrome Reference Point(ARP)"
        self.pnlArp.btnCalculater.hide()
        self.pnlArp.hideframe_Altitude()
        self.gbGeneral.Add = self.pnlArp

        self.gbWaypoint1 = GroupBox(self.gbGeneral)
        self.gbWaypoint1.Caption = "Waypoint1"
        self.gbGeneral.Add = self.gbWaypoint1

        self.cmbType1 = ComboBoxPanel(self.gbWaypoint1)
        self.cmbType1.Caption = "Type"
        self.cmbType1.LabelWidth = 150
        self.gbWaypoint1.Add = self.cmbType1

        self.pnlTolerances = RnavTolerancesPanel(self.gbWaypoint1)
        self.pnlTolerances.set_Att(Distance(0.8, DistanceUnits.NM))
        self.pnlTolerances.set_Xtt(Distance(1, DistanceUnits.NM))
        self.pnlTolerances.set_Asw(Distance(2, DistanceUnits.NM))
        self.gbWaypoint1.Add = self.pnlTolerances

        self.pnlWaypoint1 = PositionPanel(self.gbWaypoint1)
        self.pnlWaypoint1.btnCalculater.hide()
        self.pnlWaypoint1.hideframe_Altitude()
        self.gbWaypoint1.Add = self.pnlWaypoint1

        self.gbWaypoint2 = GroupBox(self.gbGeneral)
        self.gbWaypoint2.Caption = "Waypoint2"
        self.gbGeneral.Add = self.gbWaypoint2

        self.cmbType2 = ComboBoxPanel(self.gbWaypoint2)
        self.cmbType2.Caption = "Type"
        self.cmbType2.LabelWidth = 150
        self.gbWaypoint2.Add = self.cmbType2

        self.pnlTolerances2 = RnavTolerancesPanel(self.gbWaypoint2)
        self.pnlTolerances2.set_Att(Distance(0.8, DistanceUnits.NM))
        self.pnlTolerances2.set_Xtt(Distance(1, DistanceUnits.NM))
        self.pnlTolerances2.set_Asw(Distance(2, DistanceUnits.NM))
        self.gbWaypoint2.Add = self.pnlTolerances2

        self.pnlWaypoint2 = PositionPanel(self.gbWaypoint2)
        self.pnlWaypoint2.btnCalculater.hide()
        self.pnlWaypoint2.hideframe_Altitude()
        self.gbWaypoint2.Add = self.pnlWaypoint2

        self.frmRadioBtns = Frame(self.gbGeneral, "HL")
        self.gbGeneral.Add = self.frmRadioBtns

        self.rdnTF = QRadioButton(self.frmRadioBtns)
        self.rdnTF.setObjectName("rdnTF")
        self.rdnTF.setText("TF")
        self.rdnTF.setChecked(True)
        self.frmRadioBtns.Add = self.rdnTF

        self.rdnDF = QRadioButton(self.frmRadioBtns)
        self.rdnDF.setObjectName("rdnDF")
        self.rdnDF.setText("DF")
        self.frmRadioBtns.Add = self.rdnDF

        self.rdnCF = QRadioButton(self.frmRadioBtns)
        self.rdnCF.setObjectName("rdnCF")
        self.rdnCF.setText("CF")
        self.frmRadioBtns.Add = self.rdnCF


        self.chbCircularArcs = CheckBox(self.gbGeneral)
        self.chbCircularArcs.Caption = "Use Circular Arcs Method for Turns <= 30"
        self.gbGeneral.Add = self.chbCircularArcs

        self.gbParameters = GroupBox(Form)
        self.gbParameters.Caption = "Parameters"
        self.verticalLayout.addWidget(self.gbParameters)

        self.cmbSelectionMode = ComboBoxPanel(self.gbParameters)
        self.cmbSelectionMode.Caption = "Selection Mode"
        self.cmbSelectionMode.LabelWidth = 150
        self.gbParameters.Add = self.cmbSelectionMode


        self.pnlInbound = TrackRadialBoxPanel(self.gbParameters)
        self.pnlInbound.Caption = "In-bound Track"
        self.pnlInbound.LabelWidth = 150
        self.gbParameters.Add = self.pnlInbound

        self.pnlOutbound = TrackRadialBoxPanel(self.gbParameters)
        self.pnlOutbound.Caption = "Out-bound Track"
        self.pnlOutbound.LabelWidth = 150
        self.gbParameters.Add = self.pnlOutbound


        # icon = QIcon()
        # icon.addPixmap(QPixmap(_fromUtf8("Resource/coordinate_capture.png")), QIcon.Normal, QIcon.Off)

        self.pnlIas = SpeedBoxPanel(self.gbParameters)
        self.pnlIas.Caption = "IAS"
        self.pnlIas.LabelWidth = 150
        self.pnlIas.Value = Speed(250)
        self.gbParameters.Add = self.pnlIas

        self.pnlTas = SpeedBoxPanel(self.gbParameters)
        self.pnlTas.Caption = "TAS"
        self.pnlTas.Enabled = False
        self.pnlTas.LabelWidth = 150
        self.gbParameters.Add = self.pnlTas

        self.pnlAltitude = AltitudeBoxPanel(self.gbParameters)
        self.pnlAltitude.Caption = "Altitude"
        self.pnlAltitude.LabelWidth = 150
        self.pnlAltitude.Value = Altitude(1000)
        self.gbParameters.Add = self.pnlAltitude

        self.pnlIsa = NumberBoxPanel(self.gbParameters, "0.0")
        self.pnlIsa.CaptionUnits = define._degreeStr + "C"
        self.pnlIsa.Caption = "ISA"
        self.pnlIsa.LabelWidth = 150
        self.pnlIsa.Value = 15
        self.gbParameters.Add = self.pnlIsa

        self.pnlBankAngle = NumberBoxPanel(self.gbParameters, "0.0")
        self.pnlBankAngle.CaptionUnits = define._degreeStr
        self.pnlBankAngle.Caption = "Bank Angle"
        self.pnlBankAngle.LabelWidth = 150
        self.pnlBankAngle.Value = 25
        self.gbParameters.Add = self.pnlBankAngle

        self.pnlBankEstTime = NumberBoxPanel(self.gbParameters, "0.0")
        self.pnlBankEstTime.Caption = "Bank Establishment Time"
        self.pnlBankEstTime.Value = 1
        self.pnlBankEstTime.LabelWidth = 150
        self.pnlBankEstTime.Value = 5
        self.gbParameters.Add = self.pnlBankEstTime

        self.pnlPilotTime = NumberBoxPanel(self.gbParameters, "0.0")
        self.pnlPilotTime.Caption = "Pilot Reaction Time"
        self.pnlPilotTime.Value = 6
        self.pnlPilotTime.LabelWidth = 150
        self.gbParameters.Add = self.pnlPilotTime

        self.pnlWind = WindPanel(self.gbParameters)
        self.pnlWind.LabelWidth = 145
        self.gbParameters.Add = self.pnlWind

        self.pnlPrimaryMoc = AltitudeBoxPanel(self.gbParameters)
        self.pnlPrimaryMoc.Caption = "Primary Moc"
        self.pnlPrimaryMoc.LabelWidth = 150
        self.gbParameters.Add = self.pnlPrimaryMoc

        self.cmbConstructionType = ComboBoxPanel(self.gbParameters)
        self.cmbConstructionType.Caption = "Construction Type"
        self.cmbConstructionType.LabelWidth = 150
        self.gbParameters.Add = self.cmbConstructionType

        self.frameMOCmultipiler = Frame(self.gbParameters, "HL")
        self.gbParameters.Add = self.frameMOCmultipiler

        self.labelMOCmultipiler = QLabel(self.frameMOCmultipiler)
        self.labelMOCmultipiler.setMinimumSize(QSize(145, 0))
        self.labelMOCmultipiler.setMaximumSize(QSize(145, 16777215))
        font = QFont()
        font.setBold(False)
        font.setWeight(50)
        self.labelMOCmultipiler.setFont(font)
        self.labelMOCmultipiler.setObjectName(_fromUtf8("labelMOCmultipiler"))
        self.labelMOCmultipiler.setText("MOCmultipiler")
        self.frameMOCmultipiler.Add = self.labelMOCmultipiler

        self.mocSpinBox = QSpinBox(self.frameMOCmultipiler)
        sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.mocSpinBox.sizePolicy().hasHeightForWidth())
        self.mocSpinBox.setSizePolicy(sizePolicy)
        self.mocSpinBox.setMinimumSize(QSize(70, 0))
        self.mocSpinBox.setMaximumSize(QSize(70, 16777215))
        self.mocSpinBox.setMinimum(1)
        self.mocSpinBox.setObjectName(_fromUtf8("mocSpinBox"))
        self.frameMOCmultipiler.Add = self.mocSpinBox

        spacerItem = QSpacerItem(10,10,QSizePolicy.Expanding, QSizePolicy.Minimum)
        self.frameMOCmultipiler.layoutBoxPanel.addItem(spacerItem)

        self.chbDrawTolerance = CheckBox(self.gbParameters)
        self.chbDrawTolerance.Caption = "Draw Waypoint Tolerance"
        self.gbParameters.Add = self.chbDrawTolerance
    def __init__(self, field_group=None, parent=None, iface=None):
        """Constructor."""
        # Init from parent class
        QWidget.__init__(self, parent)

        # Attributes
        self.layer = None
        self.metadata = {}
        self.parent = parent
        self.iface = iface
        self.field_group = field_group
        self.setting = QSettings()  # TODO(IS): Make dynamic

        # Main container
        self.main_layout = QVBoxLayout()

        # Inner layout
        self.header_layout = QHBoxLayout()
        self.content_layout = QHBoxLayout()
        self.footer_layout = QHBoxLayout()

        # Header
        self.header_label = QLabel()
        self.header_label.setWordWrap(True)

        # Content
        self.field_layout = QVBoxLayout()
        self.parameter_layout = QHBoxLayout()

        self.field_description = QLabel(tr('List of fields'))

        self.field_list = QListWidget()
        self.field_list.setSelectionMode(QAbstractItemView.ExtendedSelection)
        self.field_list.setDragDropMode(QAbstractItemView.DragDrop)
        self.field_list.setDefaultDropAction(Qt.MoveAction)

        self.field_list.setSizePolicy(QSizePolicy.Maximum,
                                      QSizePolicy.Expanding)
        # noinspection PyUnresolvedReferences
        self.field_list.itemSelectionChanged.connect(self.update_footer)

        # Footer
        self.footer_label = QLabel()

        # Parameters
        self.extra_parameters = [(GroupSelectParameter,
                                  GroupSelectParameterWidget)]

        self.parameters = []
        self.parameter_container = None

        # Adding to layout
        self.header_layout.addWidget(self.header_label)

        self.field_layout.addWidget(self.field_description)
        self.field_layout.addWidget(self.field_list)
        self.field_layout.setSizeConstraint(QLayout.SetMaximumSize)

        self.content_layout.addLayout(self.field_layout)
        self.content_layout.addLayout(self.parameter_layout)

        self.footer_layout.addWidget(self.footer_label)

        self.main_layout.addLayout(self.header_layout)
        self.main_layout.addLayout(self.content_layout)
        self.main_layout.addLayout(self.footer_layout)

        self.setLayout(self.main_layout)
Exemplo n.º 15
0
    def __init__(self, data, win_parent=None):
        """
        +-----------------+
        | Edit Node Props |
        +-----------------+------+
        |  LEwingTip             |
        |  Node2                 |
        |  Node3                 |
        |  Node4                 |
        |                        |
        |  All Nodes:            |
        |    Color     red       |
        |    PointSize 3         |
        |    Opacity   0.3       |
        |    Show/Hide           |
        |                        |
        |  Name        LEwingTip |
        |  Location    X Y Z     |
        |  Coord       0         |
        |  CoordType   R, C, S   |
        |                        |
        |   Previous     Next    |
        |                        |
        |          Close         |
        +------------------------+
        """
        QDialog.__init__(self, win_parent)
        self.setWindowTitle('Edit Node Properties')

        #default
        self.win_parent = win_parent
        self.out_data = data

        point_properties = data['point_properties']
        print(point_properties)
        #name = point_properties.name
        point_size = point_properties.point_size
        opacity = point_properties.opacity
        color = point_properties.color
        show = point_properties.is_visible

        self.points = data['points']

        self.keys = sorted(self.points.keys())
        keys = self.keys
        #nrows = len(keys)

        active_point = data['active_point']
        #self.active_key = keys[0]
        self.active_key = active_point
        name = self.active_key
        description = self.points[self.active_key][0]

        self._use_old_table = False
        items = ['Node %i' % val for val in keys]
        header_labels = ['Nodes']
        table_model = Model(items, header_labels, self)
        view = SingleChoiceQTableView(self)  #Call your custom QTableView here
        view.setModel(table_model)
        if qt_version in [4, 'pyside']:
            view.horizontalHeader().setResizeMode(QHeaderView.Stretch)
        else:
            view.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)
        self.table = view

        #self.representation = actor_obj.representation
        #print('rep =', self.representation)

        table = self.table
        #headers = [QtCore.QString('Groups')]

        header = table.horizontalHeader()
        header.setStretchLastSection(True)

        #----------------------------------------------
        #self._default_is_apply = False

        self.color = QLabel("Color:")
        self.color_edit = QPushButton()
        #self.color_edit.setFlat(True)

        color = self.out_data['point_properties'].color
        opacity = self.out_data['point_properties'].opacity
        show = self.out_data['point_properties'].is_visible
        #color = self.out_data[self.active_key].color
        qcolor = QColor()
        qcolor.setRgb(*color)
        #print('color =%s' % str(color))
        palette = QPalette(
            self.color_edit.palette())  # make a copy of the palette
        #palette.setColor(QPalette.Active, QPalette.Base, \
        #qcolor)
        palette.setColor(QPalette.Background, QColor('blue'))  # ButtonText
        self.color_edit.setPalette(palette)

        self.color_edit.setStyleSheet("QPushButton {"
                                      "background-color: rgb(%s, %s, %s);" %
                                      tuple(color) +
                                      #"border:1px solid rgb(255, 170, 255); "
                                      "}")

        self.all_nodes_header = QLabel("All Nodes:")
        self.point_size = QLabel("Point Size:")
        self.point_size_edit = QSpinBox(self)
        self.point_size_edit.setRange(1, 10)
        self.point_size_edit.setSingleStep(1)
        self.point_size_edit.setValue(point_size)

        self.opacity = QLabel("Opacity:")
        self.opacity_edit = QDoubleSpinBox(self)
        self.opacity_edit.setRange(0.1, 1.0)
        self.opacity_edit.setDecimals(1)
        self.opacity_edit.setSingleStep(0.1)
        self.opacity_edit.setValue(opacity)

        # show/hide
        self.checkbox_show = QCheckBox("Show")
        self.checkbox_hide = QCheckBox("Hide")
        self.checkbox_show.setChecked(show)
        self.checkbox_hide.setChecked(not show)

        #----------------------------------------------
        self.nodes_header = QLabel("Single Node:")
        self.name = QLabel("ID:")
        self.name_edit = QLineEdit('Node %i' % name)
        self.name_edit.setDisabled(True)

        self.description = QLabel("Description:")
        self.description_edit = QLineEdit(str(description))
        #self.description_edit.setDisabled(True)

        location_x = 0.1
        location_y = 0.1
        location_z = 0.1
        self.location = QLabel("Location:")
        self.location_x_edit = QDoubleSpinBox(self)
        self.location_y_edit = QDoubleSpinBox(self)
        self.location_z_edit = QDoubleSpinBox(self)
        #self.location_x_edit.setDecimals(1)
        delta_x = abs(location_x) / 100. if location_x != 0.0 else 0.1
        delta_y = abs(location_y) / 100. if location_y != 0.0 else 0.1
        delta_z = abs(location_z) / 100. if location_z != 0.0 else 0.1
        self.location_x_edit.setSingleStep(delta_x)
        self.location_y_edit.setSingleStep(delta_y)
        self.location_z_edit.setSingleStep(delta_z)
        self.location_x_edit.setValue(location_x)
        self.location_y_edit.setValue(location_y)
        self.location_z_edit.setValue(location_z)

        self.coord = QLabel("Coord:")
        self.coord_edit = QSpinBox(self)
        self.coord_edit.setRange(0, 99999999)
        #self.coord_edit.setSingleStep(1)
        self.coord_edit.setValue(0)

        self.coord_type = QLabel("Coord Type:")
        #----------------------------------------------

        # closing
        #if self._default_is_apply:
        #self.apply_button.setDisabled(True)

        self.close_button = QPushButton("Close")

        self.create_layout()
        self.set_connections()
Exemplo n.º 16
0
    def initControls(self):
        self.main_frame = QWidget()
        self.plot3 = Qwt.QwtPlot(self)
        self.plot3.setCanvasBackground(Qt.white)  
        self.plot3.enableAxis(Qwt.QwtPlot.yLeft, False)
        self.plot3.enableAxis(Qwt.QwtPlot.xBottom, False)
        self.plot1 = Qwt.QwtPlot(self)
        self.plot1.setCanvasBackground(Qt.white)

        top1_hbox = QHBoxLayout()
        SeacherButton  = QPushButton("&Select")
        FrontButton = QPushButton("<<")
        LaterButton = QPushButton(">>")
        self.connect(SeacherButton, SIGNAL('clicked()'), self.SeacherButton)
        self.connect(FrontButton, SIGNAL('clicked()'), self.FrontButton)
        self.connect(LaterButton, SIGNAL('clicked()'), self.LaterButton)
        FrontButton.setFixedWidth(50)
        SeacherButton.setFixedWidth(100)
        LaterButton.setFixedWidth(50)
        top1_hbox.addWidget(FrontButton)
        top1_hbox.addWidget(SeacherButton)
        top1_hbox.addWidget(LaterButton)
        self.id=self.row
        self.ID_label = QLabel("Entry No. %s Of 212964    Libaray Name:Nist2011 "%(self.id+1))
        top1_hbox.addWidget(self.ID_label)
        
        top2_hbox = QHBoxLayout()
        Name_label = QLabel("Name:")
        Name_label.setFixedWidth(70)
        self.Name_edit = QLineEdit()
        #Name_edit.setFixedWidth(150)
        top2_hbox.addWidget(Name_label)
        top2_hbox.addWidget(self.Name_edit)
               
        
        top3_hbox = QHBoxLayout()
        Formula_label = QLabel("Formula:")
        Formula_label.setFixedWidth(70)
        self.Formula_edit = QLineEdit()   
        #Name_edit.setFixedWidth(150)
        top3_hbox.addWidget(Formula_label)
        top3_hbox.addWidget(self.Formula_edit)    
        
        
        top4_hbox = QHBoxLayout()

        MW_label = QLabel("MW:")
        MW_label.setFixedWidth(70)
        self.MW_edit = QLineEdit()
        ExactMW_label = QLabel("Exact Mass:")
        ExactMW_label.setFixedWidth(70)
        self.ExactMW_edit = QLineEdit()    
        Cas_label = QLabel("CAS#:")
        Cas_label.setFixedWidth(70)
        self.Cas_edit = QLineEdit()
        Nist_label = QLabel("NIST#:")
        Nist_label.setFixedWidth(70)
        self.Nist_edit = QLineEdit()
        
        top4_hbox.addWidget(MW_label)
        top4_hbox.addWidget(self.MW_edit)
        top4_hbox.addWidget(ExactMW_label)
        top4_hbox.addWidget(self.ExactMW_edit)
        top4_hbox.addWidget(Cas_label)
        top4_hbox.addWidget(self.Cas_edit)
        top4_hbox.addWidget(Nist_label)
        top4_hbox.addWidget(self.Nist_edit) 
        top5_hbox = QHBoxLayout()
        Cont_label = QLabel("Contributor:")
        Cont_label.setFixedWidth(70)
        self.Cont_edit = QLineEdit()   
        #Name_edit.setFixedWidth(150)
        top5_hbox.addWidget(Cont_label)
        top5_hbox.addWidget(self.Cont_edit)
        top6_hbox = QHBoxLayout()
        Peak_label = QLabel("10 largest peaks:")
        Peak_label.setFixedWidth(100)
        self.Peak_edit = QLineEdit()   
        #Name_edit.setFixedWidth(150)
        top6_hbox.addWidget(Peak_label)
        top6_hbox.addWidget(self.Peak_edit) 
        top_Vbox = QVBoxLayout()
        top_Vbox.addLayout(top1_hbox)
        top_Vbox.addLayout(top2_hbox)
        top_Vbox.addLayout(top3_hbox)
        top_Vbox.addLayout(top4_hbox)
        top_Vbox.addLayout(top5_hbox)
        top_Vbox.addLayout(top6_hbox)
        
        below_hbox = QHBoxLayout()
        below_hbox.addWidget(self.plot1,3)
        below_hbox.addWidget(self.plot3,1)

        hbox = QVBoxLayout()
        hbox.addLayout(top_Vbox)
        hbox.addLayout(below_hbox)
        self.setLayout(hbox)
Exemplo n.º 17
0
 def __init__(self):
     #parent's constructors
     DegenPrimerConfig.__init__(self)
     QMainWindow.__init__(self)
     #working directory
     self._cwdir = os.getcwd()
     #session independent configuration
     self._settings = QSettings()
     #try to load UI
     self.load_ui(self._ui_file, self)
     #fields
     Field.customize_field = self._customize_field
     self._fields = dict()
     #config and cwdir path choosers
     self._build_group_gui(self._config_group)
     #job-id label
     self._job_id_label = QLabel(self)
     self.configForm.addWidget(self._job_id_label)
     #sequence db view
     self._loaded_files = []
     self._seq_db_widget = None
     self._seq_db_box = None
     self._seq_db_button = None
     for group in self._option_groups:
         self._build_group_gui(group)
     #setup default values
     self._reset_fields()
     #setup buttons
     self._run_widgets = (
         self.abortButton,
         self.elapsedTimeLineEdit,
         self.elapsedTimeLabel,
     )
     self._idle_widgets = (
         self.saveButton,
         self.runButton,
         self.resetButton,
         self.reloadButton,
     )
     self.reloadButton.clicked.connect(self.reload_config)
     self.resetButton.clicked.connect(self._reset_fields)
     self.saveButton.clicked.connect(self._save_config)
     self.runButton.clicked.connect(self._analyse)
     self.abortButton.clicked.connect(self._abort_analysis)
     self._show_run_specific_widgets(False)
     #setup terminal output
     self._append_terminal_output.connect(
         self.terminalOutput.insertPlainText)
     self.terminalOutput.textChanged.connect(
         self.terminalOutput.ensureCursorVisible)
     #pipeline thread
     self._pipeline_thread = SubprocessThread(degen_primer_pipeline)
     self._pipeline_thread.started.connect(self.lock_buttons)
     self._pipeline_thread.results_received.connect(self.register_reports)
     self._pipeline_thread.finished.connect(self.show_results)
     self._pipeline_thread.finished.connect(self.unlock_buttons)
     self._pipeline_thread.update_timer.connect(self.update_timer)
     self._pipeline_thread.message_received.connect(self.show_message)
     self._pipeline_thread_stop.connect(self._pipeline_thread.stop)
     #restore GUI state
     self._restore_mainwindow_state()
Exemplo n.º 18
0
    def __init__(self):
        QWidget.__init__(self)

        self.shortcuts_text = {
            "Duplicate":
            self.tr("Duplicate the line/selection"),
            "Remove-line":
            self.tr("Remove the line/selection"),
            "Move-up":
            self.tr("Move the line/selection up"),
            "Move-down":
            self.tr("Move the line/selection down"),
            "Close-tab":
            self.tr("Close the current tab"),
            "New-file":
            self.tr("Create a New tab"),
            "New-project":
            self.tr("Create a new Project"),
            "Open-file":
            self.tr("Open a File"),
            "Open-project":
            self.tr("Open a Project"),
            "Save-file":
            self.tr("Save the current file"),
            "Save-project":
            self.tr("Save the current project opened files"),
            "Print-file":
            self.tr("Print current file"),
            "Redo":
            self.tr("Redo"),
            "Comment":
            self.tr("Comment line/selection"),
            "Uncomment":
            self.tr("Uncomment line/selection"),
            "Horizontal-line":
            self.tr("Insert Horizontal line"),
            "Title-comment":
            self.tr("Insert comment Title"),
            "Indent-less":
            self.tr("Indent less"),
            "Hide-misc":
            self.tr("Hide Misc Container"),
            "Hide-editor":
            self.tr("Hide Editor Area"),
            "Hide-explorer":
            self.tr("Hide Explorer"),
            "Run-file":
            self.tr("Execute current file"),
            "Run-project":
            self.tr("Execute current project"),
            "Debug":
            self.tr("Debug"),
            "Switch-Focus":
            self.tr("Switch keyboard focus"),
            "Stop-execution":
            self.tr("Stop Execution"),
            "Hide-all":
            self.tr("Hide all (Except Editor)"),
            "Full-screen":
            self.tr("Full Screen"),
            "Find":
            self.tr("Find"),
            "Find-replace":
            self.tr("Find & Replace"),
            "Find-with-word":
            self.tr("Find word under cursor"),
            "Find-next":
            self.tr("Find Next"),
            "Find-previous":
            self.tr("Find Previous"),
            "Help":
            self.tr("Show Python Help"),
            "Split-horizontal":
            self.tr("Split Tabs Horizontally"),
            "Split-vertical":
            self.tr("Split Tabs Vertically"),
            "Follow-mode":
            self.tr("Activate/Deactivate Follow Mode"),
            "Reload-file":
            self.tr("Reload File"),
            "Jump":
            self.tr("Jump to line"),
            "Find-in-files":
            self.tr("Find in Files"),
            "Import":
            self.tr("Import from everywhere"),
            "Go-to-definition":
            self.tr("Go to definition"),
            "Complete-Declarations":
            self.tr("Complete Declarations"),
            "Code-locator":
            self.tr("Show Code Locator"),
            "File-Opener":
            self.tr("Show File Opener"),
            "Navigate-back":
            self.tr("Navigate Back"),
            "Navigate-forward":
            self.tr("Navigate Forward"),
            "Open-recent-closed":
            self.tr("Open recent closed file"),
            "Change-Tab":
            self.tr("Change to the next Tab"),
            "Change-Tab-Reverse":
            self.tr("Change to the previous Tab"),
            "Show-Code-Nav":
            self.tr("Activate History Navigation"),
            "Show-Bookmarks-Nav":
            self.tr("Activate Bookmarks Navigation"),
            "Show-Breakpoints-Nav":
            self.tr("Activate Breakpoints Navigation"),
            "Show-Paste-History":
            self.tr("Show copy/paste history"),
            "History-Copy":
            self.tr("Copy into copy/paste history"),
            "History-Paste":
            self.tr("Paste from copy/paste history"),
            "change-split-focus":
            self.tr("Change the keyboard focus between the current splits"),
            "Add-Bookmark-or-Breakpoint":
            self.tr("Insert Bookmark/Breakpoint"),
            "move-tab-to-next-split":
            self.tr("Move the current Tab to the next split."),
            "change-tab-visibility":
            self.tr("Show/Hide the Tabs in the Editor Area."),
            "Highlight-Word":
            self.tr("Highlight occurrences for word under cursor")
        }

        self.shortcut_dialog = ShortcutDialog(self)
        #main layout
        main_vbox = QVBoxLayout(self)
        #layout for buttons
        buttons_layout = QVBoxLayout()
        #widgets
        self.result_widget = TreeResult()
        load_defaults_button = QPushButton(self.tr("Load defaults"))
        #add widgets
        main_vbox.addWidget(self.result_widget)
        buttons_layout.addWidget(load_defaults_button)
        main_vbox.addLayout(buttons_layout)
        main_vbox.addWidget(
            QLabel(
                self.tr("The Shortcut's Text in the Menus are "
                        "going to be refreshed on restart.")))
        #load data!
        self.result_widget.setColumnWidth(0, 400)
        self._load_shortcuts()
        #signals
        #open the set shortcut dialog
        self.connect(self.result_widget,
                     SIGNAL("itemDoubleClicked(QTreeWidgetItem*, int)"),
                     self._open_shortcut_dialog)
        #load defaults shortcuts
        self.connect(load_defaults_button, SIGNAL("clicked()"),
                     self._load_defaults_shortcuts)
        #one shortcut has changed
        self.connect(self.shortcut_dialog, SIGNAL('shortcutChanged'),
                     self._shortcut_changed)
Exemplo n.º 19
0
    def __init__(self, parent, isArea=False):
        QWidget.__init__(self, parent)

        while not isinstance(parent, QDialog):
            parent = parent.parent()
        self.setObjectName("TextBoxPanel" +
                           str(len(parent.findChildren(TextBoxPanel))))

        self.hLayoutBoxPanel = QHBoxLayout(self)
        self.hLayoutBoxPanel.setSpacing(0)
        self.hLayoutBoxPanel.setContentsMargins(0, 0, 0, 0)
        self.hLayoutBoxPanel.setObjectName(("hLayoutBoxPanel"))
        self.frameBoxPanel = QFrame(self)
        sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.frameBoxPanel.sizePolicy().hasHeightForWidth())
        self.frameBoxPanel.setSizePolicy(sizePolicy)
        self.frameBoxPanel.setFrameShape(QFrame.NoFrame)
        self.frameBoxPanel.setFrameShadow(QFrame.Raised)
        self.frameBoxPanel.setObjectName(("frameBoxPanel"))
        self.hLayoutframeBoxPanel = QHBoxLayout(self.frameBoxPanel)
        self.hLayoutframeBoxPanel.setSpacing(0)
        self.hLayoutframeBoxPanel.setMargin(0)
        self.hLayoutframeBoxPanel.setObjectName(("hLayoutframeBoxPanel"))
        self.captionLabel = QLabel(self.frameBoxPanel)
        sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.captionLabel.sizePolicy().hasHeightForWidth())
        self.captionLabel.setSizePolicy(sizePolicy)
        self.captionLabel.setMinimumSize(QSize(200, 0))
        self.captionLabel.setMaximumSize(QSize(200, 16777215))
        font = QFont()
        font.setBold(False)
        font.setWeight(50)
        self.captionLabel.setFont(font)
        self.captionLabel.setObjectName(("captionLabel"))
        self.hLayoutframeBoxPanel.addWidget(self.captionLabel)

        if not isArea:
            self.textBox = QLineEdit(self.frameBoxPanel)
            self.textBox.setEnabled(True)
            font = QFont()
            font.setBold(False)
            font.setWeight(50)
            self.textBox.setFont(font)
            self.textBox.setObjectName(("textBox"))
            self.textBox.setMinimumWidth(70)
            self.textBox.setMaximumWidth(70)
            # self.textBox.setText("0.0")
            self.hLayoutframeBoxPanel.addWidget(self.textBox)
        else:
            self.textBox = QTextEdit(self.frameBoxPanel)
            self.textBox.setEnabled(True)
            font = QFont()
            font.setBold(False)
            font.setWeight(50)
            self.textBox.setFont(font)
            self.textBox.setObjectName(("textBox"))
            # self.textBox.setText("0.0")
            self.textBox.setMaximumHeight(60)
            self.hLayoutframeBoxPanel.addWidget(self.textBox)

        self.imageButton = QPushButton(self.frameBoxPanel)
        self.imageButton.setText((""))
        icon = QIcon()
        icon.addPixmap(QPixmap(("Resource/convex_hull.png")), QIcon.Normal,
                       QIcon.Off)
        self.imageButton.setIcon(icon)
        self.imageButton.setObjectName(("imageButton"))
        self.imageButton.setVisible(False)
        self.hLayoutframeBoxPanel.addWidget(self.imageButton)

        self.hLayoutBoxPanel.addWidget(self.frameBoxPanel)

        self.spacerItem = QSpacerItem(0, 0, QSizePolicy.Expanding,
                                      QSizePolicy.Minimum)
        self.hLayoutframeBoxPanel.addItem(self.spacerItem)

        self.textBox.textChanged.connect(self.textBoxChanged)
        self.imageButton.clicked.connect(self.imageButtonClicked)

        self.textBox.setText("")

        self.captionUnits = ""

        self.isArea = isArea
Exemplo n.º 20
0
    def __init__(self, parent, resoution = "0.0000"):
        QWidget.__init__(self, parent)
        while not isinstance(parent, QDialog):
            parent = parent.parent()
        self.setObjectName("NumberBoxPanel" + str(len(parent.findChildren(NumberBoxPanel))))


        self.hLayoutBoxPanel = QHBoxLayout(self)
        self.hLayoutBoxPanel.setSpacing(0)
        self.hLayoutBoxPanel.setContentsMargins(0,0,0,0)
        self.hLayoutBoxPanel.setObjectName(("hLayoutBoxPanel"))
        self.frameBoxPanel = QFrame(self)
        sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.frameBoxPanel.sizePolicy().hasHeightForWidth())
        self.frameBoxPanel.setSizePolicy(sizePolicy)
        self.frameBoxPanel.setFrameShape(QFrame.NoFrame)
        self.frameBoxPanel.setFrameShadow(QFrame.Raised)
        self.frameBoxPanel.setObjectName(("frameBoxPanel"))
        self.hLayoutframeBoxPanel = QHBoxLayout(self.frameBoxPanel)
        self.hLayoutframeBoxPanel.setSpacing(0)
        self.hLayoutframeBoxPanel.setMargin(0)
        self.hLayoutframeBoxPanel.setObjectName(("hLayoutframeBoxPanel"))
        self.captionLabel = QLabel(self.frameBoxPanel)
        sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.captionLabel.sizePolicy().hasHeightForWidth())
        self.captionLabel.setSizePolicy(sizePolicy)
        self.captionLabel.setMinimumSize(QSize(200, 0))
        self.captionLabel.setMaximumSize(QSize(200, 16777215))
        font = QFont()
        font.setBold(False)
        font.setWeight(50)
        self.captionLabel.setFont(font)
        self.captionLabel.setObjectName(("captionLabel"))
        self.hLayoutframeBoxPanel.addWidget(self.captionLabel)

        if resoution != None:
            self.numberBox = QLineEdit(self.frameBoxPanel)
            self.numberBox.setEnabled(True)
            font = QFont()
            font.setBold(False)
            font.setWeight(50)
            self.numberBox.setFont(font)
            self.numberBox.setObjectName(self.objectName() + "_numberBox")
            self.numberBox.setText("0.0")
            self.numberBox.setMinimumWidth(70)
            self.numberBox.setMaximumWidth(70)
            self.hLayoutframeBoxPanel.addWidget(self.numberBox)
            self.numberBox.textChanged.connect(self.numberBoxChanged)
            self.numberBox.editingFinished.connect(self.numberBoxEditingFinished)
        else:
            self.numberBox = QSpinBox(self.frameBoxPanel)
            self.numberBox.setObjectName(self.objectName() + "_numberBox")
            self.numberBox.setMinimumWidth(70)
            self.numberBox.setMaximumWidth(70)
            self.numberBox.setMinimum(-100000000)
            self.numberBox.setMaximum(100000000)
            self.numberBox.setValue(1)
            self.hLayoutframeBoxPanel.addWidget(self.numberBox)

        self.imageButton = QPushButton(self.frameBoxPanel)

        self.imageButton.setText((""))
        icon = QIcon()
        icon.addPixmap(QPixmap(("Resource/convex_hull.png")), QIcon.Normal, QIcon.Off)
        self.imageButton.setIcon(icon)
        self.imageButton.setObjectName(("imageButton"))
        self.imageButton.setVisible(False)
        self.hLayoutframeBoxPanel.addWidget(self.imageButton)

        self.hLayoutBoxPanel.addWidget(self.frameBoxPanel)

        spacerItem = QSpacerItem(10,10,QSizePolicy.Expanding, QSizePolicy.Minimum)
        self.hLayoutBoxPanel.addItem(spacerItem)


        self.imageButton.clicked.connect(self.imageButtonClicked)

        self.numberResolution = resoution
        str0 = String.Number2String(6.6788, "0.0000")
        self.Value = 0
        self.captionUnits = ""
Exemplo n.º 21
0
    def __init__(self, parent):
        super(Interface, self).__init__()
        self._preferences, vbox = parent, QVBoxLayout(self)
        self.toolbar_settings = settings.TOOLBAR_ITEMS

        groupBoxExplorer = QGroupBox(
            translations.TR_PREFERENCES_INTERFACE_EXPLORER_PANEL)
        #groupBoxToolbar = QGroupBox(
        #translations.TR_PREFERENCES_INTERFACE_TOOLBAR_CUSTOMIZATION)
        groupBoxLang = QGroupBox(
            translations.TR_PREFERENCES_INTERFACE_LANGUAGE)

        #Explorer
        vboxExplorer = QVBoxLayout(groupBoxExplorer)
        self._checkProjectExplorer = QCheckBox(
            translations.TR_PREFERENCES_SHOW_EXPLORER)
        self._checkSymbols = QCheckBox(
            translations.TR_PREFERENCES_SHOW_SYMBOLS)
        self._checkWebInspetor = QCheckBox(
            translations.TR_PREFERENCES_SHOW_WEB_INSPECTOR)
        self._checkFileErrors = QCheckBox(
            translations.TR_PREFERENCES_SHOW_FILE_ERRORS)
        self._checkMigrationTips = QCheckBox(
            translations.TR_PREFERENCES_SHOW_MIGRATION)
        vboxExplorer.addWidget(self._checkProjectExplorer)
        vboxExplorer.addWidget(self._checkSymbols)
        vboxExplorer.addWidget(self._checkWebInspetor)
        vboxExplorer.addWidget(self._checkFileErrors)
        vboxExplorer.addWidget(self._checkMigrationTips)
        #GUI - Toolbar
        #vbox_toolbar = QVBoxLayout(groupBoxToolbar)
        #hbox_select_items = QHBoxLayout()
        #label_toolbar = QLabel(translations.TR_PREFERENCES_TOOLBAR_ITEMS)
        #label_toolbar.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        #hbox_select_items.addWidget(label_toolbar)
        #self._comboToolbarItems = QComboBox()
        #self._load_combo_data(self._comboToolbarItems)
        #self._btnItemAdd = QPushButton(QIcon(":img/add"), '')
        #self._btnItemAdd.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        #self._btnItemAdd.setIconSize(QSize(16, 16))
        #self._btnItemRemove = QPushButton(QIcon(':img/delete'), '')
        #self._btnItemRemove.setIconSize(QSize(16, 16))
        #self._btnDefaultItems = QPushButton(
        #translations.TR_PREFERENCES_TOOLBAR_DEFAULT)
        #self._btnDefaultItems.setSizePolicy(QSizePolicy.Fixed,
        #QSizePolicy.Fixed)
        #self._btnItemRemove.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        #hbox_select_items.addWidget(self._comboToolbarItems)
        #hbox_select_items.addWidget(self._btnItemAdd)
        #hbox_select_items.addWidget(self._btnItemRemove)
        #hbox_select_items.addWidget(self._btnDefaultItems)
        #vbox_toolbar.addLayout(hbox_select_items)
        #self._toolbar_items = QToolBar()
        #self._toolbar_items.setObjectName("custom")
        #self._toolbar_items.setToolButtonStyle(Qt.ToolButtonIconOnly)
        #self._load_toolbar()
        #vbox_toolbar.addWidget(self._toolbar_items)
        #vbox_toolbar.addWidget(QLabel(
        #translations.TR_PREFERENCES_TOOLBAR_CONFIG_HELP))
        #Language
        vboxLanguage = QVBoxLayout(groupBoxLang)
        vboxLanguage.addWidget(
            QLabel(translations.TR_PREFERENCES_SELECT_LANGUAGE))
        self._comboLang = QComboBox()
        self._comboLang.setEnabled(False)
        vboxLanguage.addWidget(self._comboLang)
        vboxLanguage.addWidget(
            QLabel(translations.TR_PREFERENCES_REQUIRES_RESTART))

        #Load Languages
        self._load_langs()

        #Settings
        self._checkProjectExplorer.setChecked(settings.SHOW_PROJECT_EXPLORER)
        self._checkSymbols.setChecked(settings.SHOW_SYMBOLS_LIST)
        self._checkWebInspetor.setChecked(settings.SHOW_WEB_INSPECTOR)
        self._checkFileErrors.setChecked(settings.SHOW_ERRORS_LIST)
        self._checkMigrationTips.setChecked(settings.SHOW_MIGRATION_LIST)

        vbox.addWidget(groupBoxExplorer)
        #vbox.addWidget(groupBoxToolbar)
        vbox.addWidget(groupBoxLang)

        #Signals
        #self.connect(self._btnItemAdd, SIGNAL("clicked()"),
        #self.toolbar_item_added)
        #self.connect(self._btnItemRemove, SIGNAL("clicked()"),
        #self.toolbar_item_removed)
        #self.connect(self._btnDefaultItems, SIGNAL("clicked()"),
        #self.toolbar_items_default)

        self.connect(self._preferences, SIGNAL("savePreferences()"), self.save)
Exemplo n.º 22
0
    def __createStatusLayout(self):
        ## Make the currently running, start and stop button, running status
        self.__currentPatternLabel = QLabel(PATTERN_PREAMBLE +
                                            EMPTY_PATTERN_SELECTED)
        font = self.__currentPatternLabel.font()
        self.__setFont(self.__currentPatternLabel, CONTROL_LABEL_FONT_SIZE)
        self.__currentStatusLabel = QLabel(STATUS_PREAMBLE + STOPPED)
        self.__setFont(self.__currentStatusLabel, CONTROL_LABEL_FONT_SIZE)
        self.StartButton = QPushButton("Start")
        self.__setFont(self.StartButton, CONTROL_BUTTON_FONT_SIZE)
        self.StartButton.setMinimumSize(CONTROL_BUTTON_WIDTH,
                                        CONTROL_BUTTON_HEIGHT)
        startIcon = QIcon(START_ICON_LOC)
        stopIcon = QIcon(STOP_ICON_LOC)
        self.StartButton.setIcon(startIcon)
        self.StopButton = QPushButton("Stop")
        self.__setFont(self.StopButton, CONTROL_BUTTON_FONT_SIZE)
        self.StopButton.setIcon(stopIcon)
        self.StopButton.setMinimumSize(CONTROL_BUTTON_WIDTH,
                                       CONTROL_BUTTON_HEIGHT)
        self.StartButton.clicked.connect(self.__handleStart)
        self.StopButton.clicked.connect(self.__handleStop)

        # put on the first row of the left coloumn, first two of the right column
        controlLayout = QHBoxLayout()

        leftHandColumn = QVBoxLayout()
        rightHandColumn = QVBoxLayout()
        leftHandColumn.addWidget(self.__currentPatternLabel)

        rightHandColumn.addWidget(self.__currentStatusLabel)
        startStopLayout = QHBoxLayout()
        startStopLayout.addWidget(self.StartButton)
        startStopLayout.addWidget(self.StopButton)
        rightHandColumn.addLayout(startStopLayout)

        ## Make Intensity Layout
        self.__intensityLabel = QLabel(INTENSITY_PREAMBLE +
                                       str(self.__currentIntensity))
        self.__setFont(self.__intensityLabel, CONTROL_LABEL_FONT_SIZE)
        self.__intensityButton = QPushButton("Set Intensity...")
        self.__setFont(self.__intensityButton, CONTROL_BUTTON_FONT_SIZE)
        self.__intensityButton.setMinimumSize(CONTROL_BUTTON_WIDTH * 2,
                                              CONTROL_BUTTON_HEIGHT)
        self.__intensityButton.setMaximumSize(CONTROL_BUTTON_WIDTH * 2,
                                              CONTROL_BUTTON_HEIGHT)
        self.__intensityButton.clicked.connect(self.__intensityButtonClicked)
        intensityIcon = QIcon(INTENSITY_ICON_LOC)
        self.__intensityButton.setIcon(intensityIcon)

        intensityLayout = QVBoxLayout()
        intensityLayout.addWidget(self.__intensityLabel)
        intensityLayout.addWidget(self.__intensityButton)

        # add intensity layout to left hand column
        leftHandColumn.addLayout(intensityLayout)

        # Add shutdown button
        self.ShutdownButton = QPushButton("Shutdown")
        self.__setFont(self.ShutdownButton, CONTROL_BUTTON_FONT_SIZE)
        self.ShutdownButton.setMinimumSize(160, CONTROL_BUTTON_HEIGHT)
        shutdownIcon = QIcon(SHUTDOWN_ICON_LOC)
        self.ShutdownButton.setIcon(shutdownIcon)
        self.ShutdownButton.clicked.connect(self.__shutdown)

        rightHandColumn.addWidget(self.ShutdownButton)

        infoBarLayout = QHBoxLayout()
        infoBarLayout.addLayout(leftHandColumn)
        infoBarLayout.addStretch(1)
        infoBarLayout.addLayout(rightHandColumn)

        return infoBarLayout
Exemplo n.º 23
0
    def __init__(self, *args):
        PluginBase.__init__(self, BrickletAmbientLightV2, *args)

        self.al = self.device

        self.has_clamped_output = self.firmware_version >= (2, 0, 2)

        self.cbe_illuminance = CallbackEmulator(self.al.get_illuminance,
                                                self.cb_illuminance,
                                                self.increase_error_count)

        self.illuminance_label = IlluminanceLabel('Illuminance: ')
        self.alf = AmbientLightFrame()
        self.out_of_range_label = QLabel('out-of-range')
        self.saturated_label = QLabel('sensor saturated')

        self.out_of_range_label.hide()
        self.out_of_range_label.setStyleSheet('QLabel { color: red }')
        self.saturated_label.hide()
        self.saturated_label.setStyleSheet('QLabel { color: magenta }')

        self.current_value = None

        plot_list = [['', Qt.red, self.get_current_value]]
        self.plot_widget = PlotWidget('Illuminance [lx]', plot_list)

        layout_h = QHBoxLayout()
        layout_h.addStretch()
        layout_h.addWidget(self.illuminance_label)
        layout_h.addWidget(self.out_of_range_label)
        layout_h.addWidget(self.saturated_label)
        layout_h.addWidget(self.alf)
        layout_h.addStretch()
        
        self.range_label = QLabel('Illuminance Range: ')
        self.range_combo = QComboBox()
        if self.has_clamped_output: # Also means that the unlimited range is available
            self.range_combo.addItem("Unlimited", BrickletAmbientLightV2.ILLUMINANCE_RANGE_UNLIMITED)
        self.range_combo.addItem("0 - 64000 Lux", BrickletAmbientLightV2.ILLUMINANCE_RANGE_64000LUX)
        self.range_combo.addItem("0 - 32000 Lux", BrickletAmbientLightV2.ILLUMINANCE_RANGE_32000LUX)
        self.range_combo.addItem("0 - 16000 Lux", BrickletAmbientLightV2.ILLUMINANCE_RANGE_16000LUX)
        self.range_combo.addItem("0 - 8000 Lux", BrickletAmbientLightV2.ILLUMINANCE_RANGE_8000LUX)
        self.range_combo.addItem("0 - 1300 Lux", BrickletAmbientLightV2.ILLUMINANCE_RANGE_1300LUX)
        self.range_combo.addItem("0 - 600 Lux", BrickletAmbientLightV2.ILLUMINANCE_RANGE_600LUX)
        self.range_combo.currentIndexChanged.connect(self.new_config)
        
        self.time_label = QLabel('Integration Time: ')
        self.time_combo = QComboBox()
        self.time_combo.addItem("50ms", BrickletAmbientLightV2.INTEGRATION_TIME_50MS)
        self.time_combo.addItem("100ms", BrickletAmbientLightV2.INTEGRATION_TIME_100MS)
        self.time_combo.addItem("150ms", BrickletAmbientLightV2.INTEGRATION_TIME_150MS)
        self.time_combo.addItem("200ms", BrickletAmbientLightV2.INTEGRATION_TIME_200MS)
        self.time_combo.addItem("250ms", BrickletAmbientLightV2.INTEGRATION_TIME_250MS)
        self.time_combo.addItem("300ms", BrickletAmbientLightV2.INTEGRATION_TIME_300MS)
        self.time_combo.addItem("350ms", BrickletAmbientLightV2.INTEGRATION_TIME_350MS)
        self.time_combo.addItem("400ms", BrickletAmbientLightV2.INTEGRATION_TIME_400MS)
        self.time_combo.currentIndexChanged.connect(self.new_config)
        
        layout_hc = QHBoxLayout()
        layout_hc.addStretch()
        layout_hc.addWidget(self.range_label)
        layout_hc.addWidget(self.range_combo)
        layout_hc.addStretch()
        layout_hc.addWidget(self.time_label)
        layout_hc.addWidget(self.time_combo)
        layout_hc.addStretch()

        layout = QVBoxLayout(self)
        layout.addLayout(layout_h)
        layout.addWidget(self.plot_widget)
        layout.addLayout(layout_hc)
Exemplo n.º 24
0
    def __drawPatternButtons(self):
        self.__mode = PATTERN_SELECT_MODE
        self.__startValid()

        self.__clearLayout(self.__selectedPatternLayout)
        self.__clearLayout(self.__defaultButtonLayout)
        self.__clearLayout(self.__intensitySelectLayout)
        self.__clearLayout(self.__presetButtonLayout)

        self.__defaultButtonLayout = QVBoxLayout()
        self.__selectedPatternLayout = QVBoxLayout()
        self.__intensityLayout = QVBoxLayout()
        self.__presetButtonLayout = QVBoxLayout()
        self.__buttons = list()

        # add label for this screen
        patternLabelLayout = QHBoxLayout()
        patternLabelLayout.addStretch(1)
        patternLabel = QLabel("Temporal Patterns")
        self.__setFont(patternLabel, PAGE_INFO_LABEL_SIZE)
        patternLabelLayout.addWidget(patternLabel)
        patternLabelLayout.addStretch(1)
        self.__defaultButtonLayout.addLayout(patternLabelLayout)

        self.__Log("Redrawing Buttons")
        numOfButtons = len(self.__patterns)  # + 1         # One for preset
        numOfRows = numOfButtons / BUTTONS_PER_ROW
        lastRowStretch = False
        if numOfButtons % BUTTONS_PER_ROW != 0:
            numOfRows += 1
            lastRowStretch = True
        self.__Log("Buttons: %d, Rows: %d" % (numOfButtons, numOfRows))
        for i in range(0, numOfRows):
            #self.__Log("Row %d"%i)
            newRow = QHBoxLayout()
            buttonsLeft = numOfButtons - i * BUTTONS_PER_ROW
            buttonsInRow = BUTTONS_PER_ROW
            if buttonsLeft < BUTTONS_PER_ROW:
                buttonsInRow = buttonsLeft
                newRow.addStretch(1)
            for j in range(0, buttonsInRow):
                patternId = i * BUTTONS_PER_ROW + j
                #print "Pattern ID %d"%patternId
                pattern = self.__patterns[patternId]
                name = pattern.GetName()
                desc = pattern.GetDescription()
                #print "Name %s"%name
                newLabel = QLabel(desc)
                self.__setFont(newLabel, PATTERN_LABEL_FONT_SIZE)
                newButton = TagPushButton(self, name)
                newButton.setMinimumSize(MIN_BUTTON_WIDTH, MIN_BUTTON_HEIGHT)
                self.__setFont(newButton, PATTERN_BUTTON_FONT_SIZE)
                self.__buttons.append(newButton)
                newButtonLayout = QVBoxLayout()
                newButtonLayout.addWidget(newButton)
                labelLayout = QHBoxLayout()
                labelLayout.addStretch()
                labelLayout.addWidget(newLabel)
                labelLayout.addStretch()
                newButtonLayout.addLayout(labelLayout)
                newButtonLayout.addStretch(1)
                newRow.addLayout(newButtonLayout)

            # Iflast row and < full, add stretch to left and right side (left done above)
            if lastRowStretch and i == numOfRows - 1:
                ## Add the preset button here, we know it's there
                button = TagPushButton(self, PRESET_TAG)
                self.__setFont(button, PATTERN_BUTTON_FONT_SIZE)
                button.setMinimumSize(MIN_BUTTON_WIDTH, MIN_BUTTON_HEIGHT)
                presetLayout = QVBoxLayout()
                presetLayout.addWidget(button)
                presetLayout.addStretch(1)
                newRow.addLayout(presetLayout)
                newRow.addStretch(1)
            self.__defaultButtonLayout.addLayout(newRow)

        self.__mainLayout.addLayout(self.__defaultButtonLayout)
Exemplo n.º 25
0
    def __init__(self,
                 parent,
                 text,
                 title=None,
                 icon=None,
                 contents_title=None,
                 varname=None):
        QDialog.__init__(self, parent)

        # Destroying the C++ object right after closing the dialog box,
        # otherwise it may be garbage-collected in another QThread
        # (e.g. the editor's analysis thread in Spyder), thus leading to
        # a segmentation fault on UNIX or an application crash on Windows
        self.setAttribute(Qt.WA_DeleteOnClose)

        if title is None:
            title = _("Import wizard")
        self.setWindowTitle(title)
        if icon is None:
            self.setWindowIcon(get_icon("fileimport.png"))
        if contents_title is None:
            contents_title = _("Raw text")

        if varname is None:
            varname = _("variable_name")

        self.var_name, self.clip_data = None, None

        # Setting GUI
        self.tab_widget = QTabWidget(self)
        self.text_widget = ContentsWidget(self, text)
        self.table_widget = PreviewWidget(self)

        self.tab_widget.addTab(self.text_widget, _("text"))
        self.tab_widget.setTabText(0, contents_title)
        self.tab_widget.addTab(self.table_widget, _("table"))
        self.tab_widget.setTabText(1, _("Preview"))
        self.tab_widget.setTabEnabled(1, False)

        name_layout = QHBoxLayout()
        name_h_spacer = QSpacerItem(40, 20, QSizePolicy.Expanding,
                                    QSizePolicy.Minimum)
        name_layout.addItem(name_h_spacer)

        name_label = QLabel(_("Name"))
        name_layout.addWidget(name_label)
        self.name_edt = QLineEdit()
        self.name_edt.setMaximumWidth(100)
        self.name_edt.setText(varname)
        name_layout.addWidget(self.name_edt)

        btns_layout = QHBoxLayout()
        cancel_btn = QPushButton(_("Cancel"))
        btns_layout.addWidget(cancel_btn)
        self.connect(cancel_btn, SIGNAL("clicked()"), self, SLOT("reject()"))
        h_spacer = QSpacerItem(40, 20, QSizePolicy.Expanding,
                               QSizePolicy.Minimum)
        btns_layout.addItem(h_spacer)
        self.back_btn = QPushButton(_("Previous"))
        self.back_btn.setEnabled(False)
        btns_layout.addWidget(self.back_btn)
        self.connect(self.back_btn, SIGNAL("clicked()"),
                     ft_partial(self._set_step, step=-1))
        self.fwd_btn = QPushButton(_("Next"))
        btns_layout.addWidget(self.fwd_btn)
        self.connect(self.fwd_btn, SIGNAL("clicked()"),
                     ft_partial(self._set_step, step=1))
        self.done_btn = QPushButton(_("Done"))
        self.done_btn.setEnabled(False)
        btns_layout.addWidget(self.done_btn)
        self.connect(self.done_btn, SIGNAL("clicked()"), self,
                     SLOT("process()"))

        self.connect(self.text_widget, SIGNAL("asDataChanged(bool)"),
                     self.fwd_btn, SLOT("setEnabled(bool)"))
        self.connect(self.text_widget, SIGNAL("asDataChanged(bool)"),
                     self.done_btn, SLOT("setDisabled(bool)"))
        layout = QVBoxLayout()
        layout.addLayout(name_layout)
        layout.addWidget(self.tab_widget)
        layout.addLayout(btns_layout)
        self.setLayout(layout)
Exemplo n.º 26
0
    def __drawPatternSettings(self,
                              pattern,
                              withColors=False,
                              withLogMessage=False,
                              logMessage=""):
        self.__mode = PATTERN_EDIT_MODE
        if pattern.CanStart():
            self.__currentPatternLabel.setText(PATTERN_PREAMBLE +
                                               pattern.GetName() + ' ' +
                                               pattern.GetColorString())
        else:
            self.__currentPatternLabel.setText(PATTERN_PREAMBLE +
                                               EMPTY_PATTERN_SELECTED)

        self.__startValid()
        self.__Log("Draw pattern settings")
        self.__Log("Pattern \'%s\' pressed" % pattern.GetName())
        self.__Log("Clearing pattern layout.")
        self.__clearLayout(self.__selectedPatternLayout)
        self.__clearLayout(self.__defaultButtonLayout)
        self.__clearLayout(self.__intensitySelectLayout)
        self.__clearLayout(self.__presetButtonLayout)

        self.__defaultButtonLayout = QVBoxLayout()
        self.__selectedPatternLayout = QVBoxLayout()
        self.__intensityLayout = QVBoxLayout()
        self.__presetButtonLayout = QVBoxLayout()

        # Pattern picture
        patternLayout = QHBoxLayout()
        patLabel = QLabel(pattern.GetName())
        self.__setFont(patLabel, PAGE_INFO_LABEL_SIZE)
        image = QLabel("ICON HERE")
        patternLayout.addStretch(1)
        patternLayout.addWidget(patLabel)
        patternLayout.addStretch(1)
        self.__selectedPatternLayout.addLayout(patternLayout)

        # Color choosing buttons
        numOfColors = pattern.GetRequiredColors()
        self.__Log("Number of required colors is %d" % numOfColors)
        colorButtonLayout = QHBoxLayout()
        colorButtonLayout.addStretch(1)
        for x in range(1, numOfColors + 1, 1):
            buttonLayout = QVBoxLayout()

            # Make Button
            newButton = IDPushButton(self, "Color %d..." % x, x)
            self.__setFont(newButton, PATTERN_BUTTON_FONT_SIZE)
            newButton.setMaximumSize(100, 100)

            # Make Label
            newLabel = QLabel(self.__selectedPattern.GetColorByIndex(x - 1))
            self.__setFont(newLabel, PATTERN_LABEL_FONT_SIZE)
            buttonLayout.addWidget(newButton)
            labelLayout = QHBoxLayout()
            labelLayout.addStretch(1)
            labelLayout.addWidget(newLabel)
            labelLayout.addStretch(1)

            # Add label to button layout, button layout to color button layout
            buttonLayout.addLayout(labelLayout)
            colorButtonLayout.addLayout(buttonLayout)

        colorButtonLayout.addStretch(1)
        self.__selectedPatternLayout.addLayout(colorButtonLayout)
        if withColors:
            self.__selectedPatternLayout.addLayout(
                self.__colorButtonChooserLayout)
        self.__selectedPatternLayout.addStretch(1)

        # Control buttons
        controlButtonLayout = QHBoxLayout()
        controlButtonLayout.addStretch(1)
        saveButton = TagPushButton(self, "Save as Preset")
        saveIcon = QIcon(SAVE_ICON_LOC)
        saveButton.setIcon(saveIcon)
        backButton = TagPushButton(self, "Back")
        backIcon = QIcon(BACK_ICON_LOC)
        backButton.setIcon(backIcon)

        saveButton.setMinimumSize(CONTROL_BUTTON_WIDTH, CONTROL_BUTTON_HEIGHT)
        backButton.setMinimumSize(CONTROL_BUTTON_WIDTH, CONTROL_BUTTON_HEIGHT)
        self.__setFont(saveButton, CONTROL_BUTTON_FONT_SIZE)
        self.__setFont(backButton, CONTROL_BUTTON_FONT_SIZE)

        ## If we just saved a preset, show the QLabel that we did.
        if (withLogMessage and logMessage != ""):
            logLabel = QLabel(logMessage)
            self.__setFont(logLabel, CONTROL_LABEL_FONT_SIZE)
            controlButtonLayout.addWidget(logLabel)

        ## Check to see if adding a preset is okay?
        if len(self.__savedPresets) >= MAX_NUM_PRESETS:
            saveButton.setEnabled(False)
            presetsFullLabel = QLabel("Presets Full!")
            self.__setFont(presetsFullLabel, CONTROL_LABEL_FONT_SIZE)
            controlButtonLayout.addWidget(presetsFullLabel)
        else:
            saveButton.setEnabled(self.__selectedPattern.CanStart())

        controlButtonLayout.addWidget(saveButton)
        controlButtonLayout.addWidget(backButton)
        self.__selectedPatternLayout.addLayout(controlButtonLayout)

        self.__mainLayout.addLayout(self.__selectedPatternLayout)
Exemplo n.º 27
0
    def __createLayout(self, bpointsModel):
        " Creates the widget layout "

        verticalLayout = QVBoxLayout(self)
        verticalLayout.setContentsMargins(0, 0, 0, 0)
        verticalLayout.setSpacing(0)

        self.headerFrame = QFrame()
        self.headerFrame.setFrameStyle(QFrame.StyledPanel)
        self.headerFrame.setAutoFillBackground(True)
        headerPalette = self.headerFrame.palette()
        headerBackground = headerPalette.color(QPalette.Background)
        headerBackground.setRgb(min(headerBackground.red() + 30, 255),
                                min(headerBackground.green() + 30, 255),
                                min(headerBackground.blue() + 30, 255))
        headerPalette.setColor(QPalette.Background, headerBackground)
        self.headerFrame.setPalette(headerPalette)
        self.headerFrame.setFixedHeight(24)

        self.__breakpointLabel = QLabel("Breakpoints")

        fixedSpacer = QSpacerItem(3, 3)

        headerLayout = QHBoxLayout()
        headerLayout.setContentsMargins(0, 0, 0, 0)
        headerLayout.addSpacerItem(fixedSpacer)
        headerLayout.addWidget(self.__breakpointLabel)
        self.headerFrame.setLayout(headerLayout)

        self.bpointsList = BreakPointView(self, bpointsModel)

        self.__editButton = QAction(PixmapCache().getIcon('bpprops.png'),
                                    "Edit breakpoint properties", self)
        self.__editButton.triggered.connect(self.__onEdit)
        self.__editButton.setEnabled(False)

        self.__jumpToCodeButton = QAction(
            PixmapCache().getIcon('gotoline.png'), "Jump to the code", self)
        self.__jumpToCodeButton.triggered.connect(self.__onJumpToCode)
        self.__jumpToCodeButton.setEnabled(False)

        self.__enableButton = QAction(PixmapCache().getIcon('bpenable.png'),
                                      "Enable selected breakpoint", self)
        self.__enableButton.triggered.connect(self.__onEnableDisable)
        self.__enableButton.setEnabled(False)

        self.__disableButton = QAction(PixmapCache().getIcon('bpdisable.png'),
                                       "Disable selected breakpoint", self)
        self.__disableButton.triggered.connect(self.__onEnableDisable)
        self.__disableButton.setEnabled(False)

        self.__enableAllButton = QAction(
            PixmapCache().getIcon('bpenableall.png'),
            "Enable all the breakpoint", self)
        self.__enableAllButton.triggered.connect(self.__onEnableAll)
        self.__enableAllButton.setEnabled(False)

        self.__disableAllButton = QAction(
            PixmapCache().getIcon('bpdisableall.png'),
            "Disable all the breakpoint", self)
        self.__disableAllButton.triggered.connect(self.__onDisableAll)
        self.__disableAllButton.setEnabled(False)

        self.__delButton = QAction(PixmapCache().getIcon('delitem.png'),
                                   "Delete selected breakpoint", self)
        self.__delButton.triggered.connect(self.__onDel)
        self.__delButton.setEnabled(False)

        self.__delAllButton = QAction(PixmapCache().getIcon('bpdelall.png'),
                                      "Delete all the breakpoint", self)
        self.__delAllButton.triggered.connect(self.__onDelAll)
        self.__delAllButton.setEnabled(False)

        # Toolbar
        self.toolbar = QToolBar()
        self.toolbar.setOrientation(Qt.Horizontal)
        self.toolbar.setMovable(False)
        self.toolbar.setAllowedAreas(Qt.TopToolBarArea)
        self.toolbar.setIconSize(QSize(16, 16))
        self.toolbar.setFixedHeight(28)
        self.toolbar.setContentsMargins(0, 0, 0, 0)
        self.toolbar.addAction(self.__editButton)
        self.toolbar.addAction(self.__jumpToCodeButton)
        fixedSpacer2 = QWidget()
        fixedSpacer2.setFixedWidth(5)
        self.toolbar.addWidget(fixedSpacer2)
        self.toolbar.addAction(self.__enableButton)
        self.toolbar.addAction(self.__enableAllButton)
        fixedSpacer3 = QWidget()
        fixedSpacer3.setFixedWidth(5)
        self.toolbar.addWidget(fixedSpacer3)
        self.toolbar.addAction(self.__disableButton)
        self.toolbar.addAction(self.__disableAllButton)
        expandingSpacer = QWidget()
        expandingSpacer.setSizePolicy(QSizePolicy.Expanding,
                                      QSizePolicy.Expanding)
        fixedSpacer4 = QWidget()
        fixedSpacer4.setFixedWidth(5)
        self.toolbar.addWidget(fixedSpacer4)
        self.toolbar.addWidget(expandingSpacer)
        self.toolbar.addAction(self.__delButton)
        fixedSpacer5 = QWidget()
        fixedSpacer5.setFixedWidth(5)
        self.toolbar.addWidget(fixedSpacer5)
        self.toolbar.addAction(self.__delAllButton)

        verticalLayout.addWidget(self.headerFrame)
        verticalLayout.addWidget(self.toolbar)
        verticalLayout.addWidget(self.bpointsList)
        return
Exemplo n.º 28
0
    def __createPresetPatternLayout(self):
        self.__clearLayout(self.__selectedPatternLayout)
        self.__clearLayout(self.__defaultButtonLayout)
        self.__clearLayout(self.__intensitySelectLayout)
        self.__clearLayout(self.__presetButtonLayout)

        self.__currentPatternLabel.setText(PATTERN_PREAMBLE +
                                           EMPTY_PATTERN_SELECTED)

        self.__defaultButtonLayout = QVBoxLayout()
        self.__selectedPatternLayout = QVBoxLayout()
        self.__intensityLayout = QVBoxLayout()
        self.__presetButtonLayout = QVBoxLayout()

        presetLabelLayout = QHBoxLayout()
        presetLabelLayout.addStretch(1)
        presetPatternLabel = QLabel("Preset Patterns")
        self.__setFont(presetPatternLabel, PAGE_INFO_LABEL_SIZE)
        presetLabelLayout.addWidget(presetPatternLabel)
        presetLabelLayout.addStretch(1)
        self.__presetButtonLayout.addLayout(presetLabelLayout)

        if len(self.__savedPresets) <= 0:
            return
        numOfButtons = len(self.__savedPresets)

        numOfRows = numOfButtons / BUTTONS_PER_ROW
        lastRowStretch = False
        if numOfButtons % BUTTONS_PER_ROW != 0:
            numOfRows += 1
            lastRowStretch = True
        self.__Log("Buttons: %d, Rows: %d" % (numOfButtons, numOfRows))
        for i in range(0, numOfRows):
            self.__Log("Row %d" % i)
            newRow = QHBoxLayout()
            buttonsLeft = numOfButtons - i * BUTTONS_PER_ROW
            buttonsInRow = BUTTONS_PER_ROW
            if buttonsLeft < BUTTONS_PER_ROW:
                buttonsInRow = buttonsLeft
                newRow.addStretch(1)
            for j in range(0, buttonsInRow):
                patternId = i * BUTTONS_PER_ROW + j
                #print "Pattern ID %d"%patternId
                pattern = self.__savedPresets[patternId]
                name = pattern.GetName()
                desc = ",".join(pattern.GetColorList())
                #print "Name %s"%name
                newLabel = QLabel(desc)
                self.__setFont(newLabel, PATTERN_LABEL_FONT_SIZE)
                newButton = IDPushButton(self, name, patternId)
                newButton.setMinimumSize(MIN_BUTTON_WIDTH, MIN_BUTTON_HEIGHT)
                self.__setFont(newButton, PATTERN_BUTTON_FONT_SIZE)
                self.__buttons.append(newButton)
                newButtonLayout = QVBoxLayout()
                newButtonLayout.addWidget(newButton)
                labelLayout = QHBoxLayout()
                labelLayout.addStretch(1)
                labelLayout.addWidget(newLabel)
                labelLayout.addStretch(1)
                newButtonLayout.addLayout(labelLayout)
                newRow.addLayout(newButtonLayout)

            # Iflast row and < full, add stretch to left and right side (left done above)
            if lastRowStretch and i == numOfRows - 1:
                newRow.addStretch(1)
            self.__presetButtonLayout.addLayout(newRow)
Exemplo n.º 29
0
    def update(self):
        for i in range(self.layout().count()):
            self.layout().itemAt(0).widget().close()
            self.layout().takeAt(0)

        result = self.result
        scheduler = result.scheduler
        cycles_per_ms = float(result.model.cycles_per_ms)

        sg = QWidget()
        sg.setLayout(QVBoxLayout())

        count_layout = QVBoxLayout()
        count_group = QGroupBox("Scheduling events: ")
        count_group.setLayout(count_layout)

        count_layout.addWidget(QLabel(
            "schedule count: {}".format(scheduler.schedule_count)))
        count_layout.addWidget(QLabel(
            "on_activate count: {}".format(scheduler.activate_count)))
        count_layout.addWidget(QLabel(
            "on_terminate count: {}".format(scheduler.terminate_count)))

        overhead_layout = QVBoxLayout()
        overhead_group = QGroupBox("Scheduling overhead: ")
        overhead_group.setLayout(overhead_layout)

        overhead_layout.addWidget(QLabel(
            "schedule overhead: {:.4f}ms ({:.0f} cycles)".format(
                scheduler.schedule_overhead / cycles_per_ms,
                scheduler.schedule_overhead)))
        overhead_layout.addWidget(QLabel(
            "on_activate overhead: {:.4f}ms ({:.0f} cycles)".format(
                scheduler.activate_overhead / cycles_per_ms,
                scheduler.activate_overhead)))
        overhead_layout.addWidget(QLabel(
            "on_terminate overhead: {:.4f}ms ({:.0f} cycles)".format(
                scheduler.terminate_overhead / cycles_per_ms,
                scheduler.terminate_overhead)))
        sum_overhead = (scheduler.schedule_overhead +
                        scheduler.activate_overhead +
                        scheduler.terminate_overhead)
        overhead_layout.addWidget(QLabel(
            "Sum: {:.4f}ms ({:.0f} cycles)".format(
                sum_overhead / cycles_per_ms, sum_overhead)))

        timer_layout = QVBoxLayout()
        timer_group = QGroupBox("Timers")
        timer_group.setLayout(timer_layout)

        for proc in self.result.model.processors:
            timer_layout.addWidget(QLabel(
                "{}: {}".format(proc.name, result.timers[proc])
            ))

        sg.layout().addWidget(count_group)
        sg.layout().addWidget(overhead_group)
        sg.layout().addWidget(timer_group)

        qsa = QScrollArea()
        qsa.setWidget(sg)
        self.layout().addWidget(qsa)
    def initUI(self):

        # Choose file dialog
        loadFileBtn = QPushButton("Load files:")
        loadFileBtn.clicked.connect(self.loadImage)

        self.loadFileLine = []
        loadFileDialogBtn = []
        self.loadFileCB = []
        for i in range(0, 4):
            self.loadFileLine.append(QLineEdit(""))
            loadFileDialogBtn.append(QPushButton("..."))
            loadFileDialogBtn[i].setMaximumWidth(40)
            if (i > 0):
                self.loadFileCB.append(QCheckBox())
                # self.loadFileCB[i-1].stateChanged.connect(self.updateImage)
        loadFileDialogBtn[0].clicked.connect(lambda: self.openNewFileDialog(0))
        loadFileDialogBtn[1].clicked.connect(lambda: self.openNewFileDialog(1))
        loadFileDialogBtn[2].clicked.connect(lambda: self.openNewFileDialog(2))
        loadFileDialogBtn[3].clicked.connect(lambda: self.openNewFileDialog(3))
        loadFileDialogBtn[1].clicked.connect(
            lambda: self.loadFileCB[0].setChecked(True))
        loadFileDialogBtn[2].clicked.connect(
            lambda: self.loadFileCB[1].setChecked(True))
        loadFileDialogBtn[3].clicked.connect(
            lambda: self.loadFileCB[2].setChecked(True))

        self.labelImage = QLabel()

        labelChannels = QLabel("Channels:")
        self.comboChannel0 = QComboBox()
        self.comboChannel0.addItems(['G', 'L', 'S'])
        self.comboChannel0.currentIndexChanged.connect(self.updateImage)
        self.comboChannel1 = QComboBox()
        self.comboChannel1.addItems(['G', 'L', 'S'])
        self.comboChannel1.currentIndexChanged.connect(self.updateImage)
        self.comboChannel2 = QComboBox()
        self.comboChannel2.addItems(['G', 'L', 'S'])
        self.comboChannel2.currentIndexChanged.connect(self.updateImage)

        labelKernels = QLabel("Kernels:")
        self.kernel0SB = QSpinBox()
        self.kernel0SB.setMinimum(1)
        self.kernel0SB.setMaximum(31)
        self.kernel0SB.setValue(15)
        self.kernel0SB.setSingleStep(2)
        self.kernel0SB.valueChanged.connect(self.updateImage)
        self.kernel1SB = QSpinBox()
        self.kernel1SB.setMinimum(1)
        self.kernel1SB.setMaximum(31)
        self.kernel1SB.setValue(15)
        self.kernel1SB.setSingleStep(2)
        self.kernel1SB.valueChanged.connect(self.updateImage)
        self.kernel2SB = QSpinBox()
        self.kernel2SB.setMinimum(1)
        self.kernel2SB.setMaximum(31)
        self.kernel2SB.setValue(15)
        self.kernel2SB.setSingleStep(2)
        self.kernel2SB.valueChanged.connect(self.updateImage)

        self.labelSobelX = QLabel()
        self.chboxSobelX0 = QCheckBox()
        self.chboxSobelX0.stateChanged.connect(self.updateImage)
        self.chboxSobelX1 = QCheckBox()
        self.chboxSobelX1.stateChanged.connect(self.updateImage)
        self.chboxSobelX2 = QCheckBox()
        self.chboxSobelX2.stateChanged.connect(self.updateImage)
        self.slider1SobelX = QSlider(Qt.Horizontal)
        self.slider1SobelX.setMinimum(0)
        self.slider1SobelX.setMaximum(255)
        self.slider1SobelX.setValue(20)
        self.slider1SobelX.valueChanged.connect(self.sliderChange)
        self.slider2SobelX = QSlider(Qt.Horizontal)
        self.slider2SobelX.setMinimum(0)
        self.slider2SobelX.setMaximum(255)
        self.slider2SobelX.setValue(100)
        self.slider2SobelX.valueChanged.connect(self.sliderChange)

        self.labelSobelY = QLabel()
        self.chboxSobelY0 = QCheckBox()
        self.chboxSobelY0.stateChanged.connect(self.updateImage)
        self.chboxSobelY1 = QCheckBox()
        self.chboxSobelY1.stateChanged.connect(self.updateImage)
        self.chboxSobelY2 = QCheckBox()
        self.chboxSobelY2.stateChanged.connect(self.updateImage)
        self.slider1SobelY = QSlider(Qt.Horizontal)
        self.slider1SobelY.setMinimum(0)
        self.slider1SobelY.setMaximum(255)
        self.slider1SobelY.setValue(20)
        self.slider1SobelY.valueChanged.connect(self.sliderChange)
        self.slider2SobelY = QSlider(Qt.Horizontal)
        self.slider2SobelY.setMinimum(0)
        self.slider2SobelY.setMaximum(255)
        self.slider2SobelY.setValue(100)
        self.slider2SobelY.valueChanged.connect(self.sliderChange)

        self.labelSobelM = QLabel()
        self.chboxSobelM0 = QCheckBox()
        self.chboxSobelM0.stateChanged.connect(self.updateImage)
        self.chboxSobelM1 = QCheckBox()
        self.chboxSobelM1.stateChanged.connect(self.updateImage)
        self.chboxSobelM2 = QCheckBox()
        self.chboxSobelM2.stateChanged.connect(self.updateImage)
        self.slider1SobelM = QSlider(Qt.Horizontal)
        self.slider1SobelM.setMinimum(0)
        self.slider1SobelM.setMaximum(255)
        self.slider1SobelM.setValue(30)
        self.slider1SobelM.valueChanged.connect(self.sliderChange)
        self.slider2SobelM = QSlider(Qt.Horizontal)
        self.slider2SobelM.setMinimum(0)
        self.slider2SobelM.setMaximum(255)
        self.slider2SobelM.setValue(100)
        self.slider2SobelM.valueChanged.connect(self.sliderChange)

        self.labelSobelA = QLabel()
        self.chboxSobelA0 = QCheckBox()
        self.chboxSobelA0.stateChanged.connect(self.updateImage)
        self.chboxSobelA1 = QCheckBox()
        self.chboxSobelA1.stateChanged.connect(self.updateImage)
        self.chboxSobelA2 = QCheckBox()
        self.chboxSobelA2.stateChanged.connect(self.updateImage)
        self.slider1SobelA = QSlider(Qt.Horizontal)
        self.slider1SobelA.setMinimum(0)
        self.slider1SobelA.setMaximum(255)
        self.slider1SobelA.setValue(int(0.7 / np.pi * 510))
        self.slider1SobelA.valueChanged.connect(self.sliderChange)
        self.slider2SobelA = QSlider(Qt.Horizontal)
        self.slider2SobelA.setMinimum(0)
        self.slider2SobelA.setMaximum(255)
        self.slider2SobelA.setValue(int(1.3 / np.pi * 510))
        self.slider2SobelA.valueChanged.connect(self.sliderChange)

        self.sliderChange()

        # Layouts
        layoutMain = QVBoxLayout()
        layoutMain2 = QHBoxLayout()
        layoutSettings = QVBoxLayout()
        layoutChannels = QHBoxLayout()
        layoutKernelSB = QHBoxLayout()
        layoutChboxSobelX = QHBoxLayout()
        layoutChboxSobelY = QHBoxLayout()
        layoutChboxSobelM = QHBoxLayout()
        layoutChboxSobelA = QHBoxLayout()

        layoutsChooseFile = []
        for i in range(0, 4):
            layoutsChooseFile.append(QHBoxLayout())
            if i == 0:
                layoutsChooseFile[i].addWidget(loadFileBtn)
            else:
                layoutsChooseFile[i].addWidget(self.loadFileCB[i - 1])
            layoutsChooseFile[i].addWidget(self.loadFileLine[i])
            layoutsChooseFile[i].addWidget(loadFileDialogBtn[i])
            layoutMain.addLayout(layoutsChooseFile[i])

        layoutMain.addLayout(layoutMain2, 1)

        layoutMain2.addWidget(self.labelImage, 1)
        layoutMain2.addLayout(layoutSettings)

        layoutSettings.addWidget(labelChannels)
        layoutSettings.addLayout(layoutChannels)
        layoutChannels.addWidget(self.comboChannel0)
        layoutChannels.addWidget(self.comboChannel1)
        layoutChannels.addWidget(self.comboChannel2)
        layoutSettings.addWidget(labelKernels)
        layoutSettings.addLayout(layoutKernelSB)
        layoutKernelSB.addWidget(self.kernel0SB)
        layoutKernelSB.addWidget(self.kernel1SB)
        layoutKernelSB.addWidget(self.kernel2SB)
        layoutSettings.addWidget(self.labelSobelX)
        layoutSettings.addLayout(layoutChboxSobelX)
        layoutChboxSobelX.addWidget(self.chboxSobelX0)
        layoutChboxSobelX.addWidget(self.chboxSobelX1)
        layoutChboxSobelX.addWidget(self.chboxSobelX2)
        layoutSettings.addWidget(self.slider1SobelX)
        layoutSettings.addWidget(self.slider2SobelX)
        layoutSettings.addWidget(self.labelSobelY)
        layoutSettings.addLayout(layoutChboxSobelY)
        layoutChboxSobelY.addWidget(self.chboxSobelY0)
        layoutChboxSobelY.addWidget(self.chboxSobelY1)
        layoutChboxSobelY.addWidget(self.chboxSobelY2)
        layoutSettings.addWidget(self.slider1SobelY)
        layoutSettings.addWidget(self.slider2SobelY)
        layoutSettings.addWidget(self.labelSobelM)
        layoutSettings.addLayout(layoutChboxSobelM)
        layoutChboxSobelM.addWidget(self.chboxSobelM0)
        layoutChboxSobelM.addWidget(self.chboxSobelM1)
        layoutChboxSobelM.addWidget(self.chboxSobelM2)
        layoutSettings.addWidget(self.slider1SobelM)
        layoutSettings.addWidget(self.slider2SobelM)
        layoutSettings.addWidget(self.labelSobelA)
        layoutSettings.addLayout(layoutChboxSobelA)
        layoutChboxSobelA.addWidget(self.chboxSobelA0)
        layoutChboxSobelA.addWidget(self.chboxSobelA1)
        layoutChboxSobelA.addWidget(self.chboxSobelA2)
        layoutSettings.addWidget(self.slider1SobelA)
        layoutSettings.addWidget(self.slider2SobelA)
        layoutSettings.addStretch(1)

        mainWidget = QWidget()
        mainWidget.setLayout(layoutMain)
        self.setCentralWidget(mainWidget)
        self.showMaximized()