def createEditor (self, parent, option, index):
     column = index.column()
     self.index = index
     content = index.model().data(index, Qt.EditRole)
     if column == 2:
         self.content = index.model().data(index, Qt.EditRole)
         self.editorQWidget = QComboBox(parent)
         self.editorQWidget.setEditable(True)
         self.editorQWidget.addItems(self.module.fieldMapping.values())
         if self.content in self.module.fieldMapping.values():
             self.editorQWidget.setCurrentIndex(self.editorQWidget.findData(self.content))
         else:
             self.editorQWidget.insertItem(0,'')
             self.editorQWidget.setCurrentIndex(0)
         return self.editorQWidget
     else:
         return None
         return QItemDelegate.createEditor(self, parent, option, index)
Esempio n. 2
0
 def create_combobox(self, text, choices, option, default=NoDefault,
                     tip=None):
     """choices: couples (name, key)"""
     label = QLabel(text)
     combobox = QComboBox()
     if tip is not None:
         combobox.setToolTip(tip)
     for name, key in choices:
         combobox.addItem(name, to_qvariant(key))
     self.comboboxes[combobox] = (option, default)
     layout = QHBoxLayout()
     for subwidget in (label, combobox):
         layout.addWidget(subwidget)
     layout.addStretch(1)
     layout.setContentsMargins(0, 0, 0, 0)
     widget = QWidget(self)
     widget.setLayout(layout)
     return widget
Esempio n. 3
0
    def init_party_entity_combo(self):
        """
        Creates the party entity combobox.
        """
        self.entity_combo_label = QLabel()
        combo_text = QApplication.translate('PartyForeignKeyMapper',
                                            'Select a party entity')
        self.entity_combo_label.setText(combo_text)

        self.entity_combo = QComboBox()
        self.spacer_item = QSpacerItem(288, 20, QSizePolicy.Expanding,
                                       QSizePolicy.Minimum)
        self.grid_layout.addItem(self.spacer_item, 0, 4, 1, 1)

        self.grid_layout.addWidget(self.entity_combo_label, 0, 5, 1, 1)
        self.grid_layout.addWidget(self.entity_combo, 0, 6, 1, 1)

        self.populate_parties()
Esempio n. 4
0
    def _init_ui(self):
        lbl_enum = QLabel(self._config_item.tag())
        lbl_enum.setFixedWidth(self.LABEL_WIDTH)

        self._cmbo_enum = QComboBox()
        self._cmbo_enum.addItems(self._config_item.enum_names)

        selected = self._config_item.value()
        index = self._cmbo_enum.findText(selected, QtCore.Qt.MatchFixedString)
        self._cmbo_enum.setCurrentIndex(index)

        hbox = QHBoxLayout()
        hbox.setContentsMargins(0, 0, 0, 0)
        hbox.addWidget(lbl_enum)
        hbox.addWidget(self._cmbo_enum)
        hbox.addStretch()

        self.setLayout(hbox)
Esempio n. 5
0
    def createAdditionalControlWidgets(self):
        self.windowChooser = QComboBox()
        self.windowChooser.addItems(self.prm['data']['available_windows'])
        self.windowChooser.setCurrentIndex(
            self.windowChooser.findText(self.prm['pref']['smoothingWindow']))
        self.windowChooserLabel = QLabel(self.tr('Window:'))
        self.gridBox.addWidget(self.windowChooserLabel, 0, 4)
        self.gridBox.addWidget(self.windowChooser, 0, 5)
        self.windowChooser.currentIndexChanged[int].connect(
            self.onChangeWindowFunction)

        self.poweroftwoOn = QCheckBox(self.tr('Power of 2'))
        self.poweroftwoOn.setChecked(self.prm['pref']['poweroftwo'])
        self.poweroftwoOn.stateChanged[int].connect(self.togglePoweroftwo)
        self.gridBox.addWidget(self.poweroftwoOn, 0, 6)
        self.logXAxisWidget = QCheckBox(self.tr('Log axis'))
        self.logXAxisWidget.stateChanged[int].connect(self.toggleLogXAxis)
        self.gridBox.addWidget(self.logXAxisWidget, 0, 7)
Esempio n. 6
0
    def __init__(self, datalist, comment="", parent=None):
        super(FormComboWidget, self).__init__(parent)
        layout = QVBoxLayout()
        self.setLayout(layout)
        self.combobox = QComboBox()
        layout.addWidget(self.combobox)

        self.stackwidget = QStackedWidget(self)
        layout.addWidget(self.stackwidget)
        self.connect(self.combobox, SIGNAL("currentIndexChanged(int)"),
                     self.stackwidget, SLOT("setCurrentIndex(int)"))

        self.widgetlist = []
        for data, title, comment in datalist:
            self.combobox.addItem(title)
            widget = FormWidget(data, comment=comment, parent=self)
            self.stackwidget.addWidget(widget)
            self.widgetlist.append(widget)
Esempio n. 7
0
    def __init__(self, parent=None):
        super(CoordinatesConverterDialog, self).__init__(parent)
        self.setupUi(self)

        # Output fields for converted coordinates
        self.coordinate_fields = [
            self.lineEdit_mgrs, self.lineEdit_utm, self.lineEdit_wgs_dms,
            self.lineEdit_wgs_degrees, self.lineEdit_wgs_comma
        ]

        # Input fields for geographic coordinate format
        self.lat_deg_input = QLineEdit()
        self.lat_min_input = QLineEdit()
        self.lat_sec_input = QLineEdit()
        self.long_deg_input = QLineEdit()
        self.long_min_input = QLineEdit()
        self.long_sec_input = QLineEdit()

        # Input fields for utm coordinate format
        self.utm_zone_input = QLineEdit()
        self.hemisphere = QComboBox()
        self.hemisphere.addItem('N')
        self.hemisphere.addItem('S')
        self.utm_easting_input = QLineEdit()
        self.utm_northing_input = QLineEdit()
        self.zone_label = QLabel('Zone')

        # Input fields for mgrs coordinate format
        self.mgrs_zone_input = QLineEdit()
        self.mgrs_square_input = QLineEdit()
        self.mgrs_easting_input = QLineEdit()
        self.mgrs_northing_input = QLineEdit()
        self.square_label = QLabel('100km Quadrat')

        self.comboBox_format.setCurrentIndex(0)
        self.hemisphere.setCurrentIndex(1)
        self.input_fields = [
            self.lat_deg_input, self.lat_min_input, self.lat_sec_input,
            self.long_deg_input, self.long_min_input, self.long_sec_input,
            self.utm_zone_input, self.utm_easting_input,
            self.utm_northing_input, self.mgrs_zone_input,
            self.mgrs_square_input, self.mgrs_easting_input,
            self.mgrs_northing_input
        ]
Esempio n. 8
0
    def __init__(self, *args):
        PluginBase.__init__(self, BrickletPressure, *args)

        self.p = self.device

        self.cbe_pressure = CallbackEmulator(self.p.get_pressure,
                                             self.cb_pressure,
                                             self.increase_error_count)

        self.current_pressure = None  # float, kPa

        plots = [('Pressure', Qt.red, lambda: self.current_pressure,
                  '{:.3f} kPa'.format)]
        self.plot_widget = PlotWidget('Pressure [kPa]', plots)

        self.combo_sensor = QComboBox()
        self.combo_sensor.addItem('MPX5500')
        self.combo_sensor.addItem('MPXV5004')
        self.combo_sensor.addItem('MPX4115A')
        self.combo_sensor.currentIndexChanged.connect(
            self.combo_sensor_changed)

        self.spin_average = QSpinBox()
        self.spin_average.setMinimum(1)
        self.spin_average.setMaximum(50)
        self.spin_average.setSingleStep(1)
        self.spin_average.setValue(50)
        self.spin_average.editingFinished.connect(self.spin_average_finished)

        hlayout = QHBoxLayout()
        hlayout.addWidget(QLabel('Sensor Type:'))
        hlayout.addWidget(self.combo_sensor)
        hlayout.addStretch()
        hlayout.addWidget(QLabel('Moving Average Length:'))
        hlayout.addWidget(self.spin_average)

        line = QFrame()
        line.setFrameShape(QFrame.HLine)
        line.setFrameShadow(QFrame.Sunken)

        layout = QVBoxLayout(self)
        layout.addWidget(self.plot_widget)
        layout.addWidget(line)
        layout.addLayout(hlayout)
Esempio n. 9
0
    def __init__(self, base):
        QDialog.__init__(self)
        self.base = base
        self.setWindowTitle(i18n.get('search'))
        self.setFixedSize(270, 110)
        self.setWindowFlags(Qt.Window | Qt.WindowTitleHint
                            | Qt.WindowCloseButtonHint
                            | Qt.CustomizeWindowHint)
        self.setModal(True)

        self.accounts_combo = QComboBox()
        accounts = self.base.core.get_registered_accounts()
        for account in accounts:
            protocol = get_protocol_from(account.id_)
            icon = QIcon(base.get_image_path('%s.png' % protocol))
            self.accounts_combo.addItem(icon, get_username_from(account.id_),
                                        account.id_)

        self.criteria = QLineEdit()
        self.criteria.setToolTip(i18n.get('criteria_tooltip'))

        form = QFormLayout()
        form.addRow(i18n.get('criteria'), self.criteria)
        form.addRow(i18n.get('account'), self.accounts_combo)
        form.setContentsMargins(30, 10, 10, 5)
        form.setFieldGrowthPolicy(QFormLayout.AllNonFixedFieldsGrow)

        button = QPushButton(i18n.get('search'))
        button_box = QHBoxLayout()
        button_box.addStretch(0)
        button_box.addWidget(button)
        button_box.setContentsMargins(0, 0, 15, 15)

        button.clicked.connect(self.accept)

        layout = QVBoxLayout()
        layout.addLayout(form)
        layout.addLayout(button_box)
        layout.setSpacing(5)
        layout.setContentsMargins(0, 0, 0, 0)
        self.setLayout(layout)
        self.criteria.setFocus()

        self.exec_()
Esempio n. 10
0
    def __setup_ui(self):
        self.setMaximumSize(300, 200)
        self.setMinimumSize(300, 200)
        vlayout = QVBoxLayout()

        host_layout = QHBoxLayout()
        port_layout = QHBoxLayout()
        schema_layout = QHBoxLayout()
        btn_layout = QHBoxLayout()

        host_layout.addWidget(QLabel('Host'), 3)
        #self.__host_edit = QLineEdit('192.168.184.128')
        self.__host_edit = QLineEdit()
        self.__host_edit.setValidator(QRegExpValidator(self.__host_reg))
        host_layout.addWidget(self.__host_edit, 7)

        port_layout.addWidget(QLabel('Port'), 3)
        #self.__port_edit = QLineEdit('6641')
        self.__port_edit = QLineEdit()
        self.__port_edit.setValidator(QRegExpValidator(self.__port_reg))
        port_layout.addWidget(self.__port_edit, 7)

        schema_layout.addWidget(QLabel('Schema'), 3)
        self.__schema_combo_box = QComboBox()
        self.__schema_combo_box.addItems(
            QStringList() << 'Open_vSwitch' << 'OVN_Northbound' <<
            'OVN_Southbound' << 'hardware_vtep')
        self.__schema_combo_box.view().setSpacing(3)
        #self.__schema_combo_box.setCurrentIndex(1)
        schema_layout.addWidget(self.__schema_combo_box, 7)

        self.ok_btn = QPushButton('ok')
        #self.ok_btn.setFlat(True)
        self.ok_btn.setEnabled(False)
        self.cancel_btn = QPushButton('cancel')
        btn_layout.addWidget(self.ok_btn, 5)
        btn_layout.addWidget(self.cancel_btn, 5)

        vlayout.addLayout(host_layout)
        vlayout.addLayout(port_layout)
        vlayout.addLayout(schema_layout)
        vlayout.addLayout(btn_layout)

        self.setLayout(vlayout)
Esempio n. 11
0
    def __init__(self, name, default, parent=None):
        """
        Initialise layout.

        Arguments:
        name - Name of the widget
        default - Default value for the widget
        parent - Parent widget

        Returns:
        None
        """
        super(NotificationWidget, self).__init__(parent)

        # Global content
        self.name = name
        self.default = default
        if self.default == 'choose':
            self.edit = QComboBox(self)
        else:
            self.edit = QLineEdit(self.name, self)
            self.edit.setReadOnly(True)
        self.check_box = QCheckBox(self.name, self)

        # Event
        self.check_box.stateChanged.connect(self._change_state)

        # Layout
        layout = QHBoxLayout(self)
        layout.setContentsMargins(0, 0, 0, 0)
        layout.addWidget(self.check_box)
        layout.addWidget(self.edit)
        self.edit.setEnabled(False)

        # Default
        if self.default == 'choose':
            pass
        else:
            self.edit.setText(default)

        # Object name
        self.edit.setObjectName('noti_edit')
        self.check_box.setObjectName('noti_check')
        self.exceptions = []
Esempio n. 12
0
    def __init__(self, base):
        ModalDialog.__init__(self, 290, 110)
        self.base = base
        self.setWindowTitle(i18n.get('select_friend_to_send_message'))

        self.accounts_combo = QComboBox()
        accounts = self.base.core.get_registered_accounts()
        for account in accounts:
            protocol = get_protocol_from(account.id_)
            icon = QIcon(base.get_image_path('%s.png' % protocol))
            self.accounts_combo.addItem(icon, get_username_from(account.id_),
                                        account.id_)

        completer = QCompleter(self.base.load_friends_list())
        completer.setCaseSensitivity(Qt.CaseInsensitive)
        self.friend = QLineEdit()
        self.friend.setCompleter(completer)
        select_button = QPushButton(i18n.get('select'))
        select_button.clicked.connect(self.__validate)

        friend_caption = "%s (@)" % i18n.get('friend')
        form = QFormLayout()
        form.addRow(friend_caption, self.friend)
        form.addRow(i18n.get('account'), self.accounts_combo)
        form.setContentsMargins(30, 10, 10, 5)
        form.setFieldGrowthPolicy(QFormLayout.AllNonFixedFieldsGrow)

        button = QPushButton(i18n.get('search'))
        button_box = QHBoxLayout()
        button_box.addStretch(0)
        button_box.addWidget(select_button)
        button_box.setContentsMargins(0, 0, 15, 15)

        layout = QVBoxLayout()
        layout.addLayout(form)
        layout.addLayout(button_box)
        layout.setSpacing(5)
        layout.setContentsMargins(0, 0, 0, 0)
        self.setLayout(layout)

        #load_button = ImageButton(base, 'action-status-menu.png',
        #        i18n.get('load_friends_list'))

        self.exec_()
Esempio n. 13
0
    def __init__(self, *args):
        PluginBase.__init__(self, BrickletACCurrent, *args)

        self.acc = self.device

        self.cbe_current = CallbackEmulator(self.acc.get_current,
                                            self.cb_current,
                                            self.increase_error_count)

        self.current_current = None  # float, A

        plots = [('Current', Qt.red, lambda: self.current_current,
                  format_current)]
        self.plot_widget = PlotWidget('Current [A]', plots)

        self.label_average = QLabel('Moving Average Length:')
        self.spin_average = QSpinBox()
        self.spin_average.setMinimum(1)
        self.spin_average.setMaximum(50)
        self.spin_average.setSingleStep(1)
        self.spin_average.setValue(50)
        self.spin_average.editingFinished.connect(self.spin_average_finished)

        self.label_range = QLabel('Current Range:')
        self.combo_range = QComboBox()
        self.combo_range.addItem("0")  # TODO: Adjust ranges
        self.combo_range.addItem("1")
        self.combo_range.currentIndexChanged.connect(self.new_config)

        hlayout = QHBoxLayout()
        hlayout.addWidget(self.label_average)
        hlayout.addWidget(self.spin_average)
        hlayout.addStretch()
        hlayout.addWidget(self.label_range)
        hlayout.addWidget(self.combo_range)

        line = QFrame()
        line.setFrameShape(QFrame.HLine)
        line.setFrameShadow(QFrame.Sunken)

        layout = QVBoxLayout(self)
        layout.addWidget(self.plot_widget)
        layout.addWidget(line)
        layout.addLayout(hlayout)
Esempio n. 14
0
    def createWidgetShortcut(self):
        """
        Create shortcut widget
        """
        self.shortcutAndroidGroup = QGroupBox(self.tr(""))
        shortcutAndroidlayout = QGridLayout()

        self.shortcutAndroidComboBox = QComboBox(self)
        for i in xrange(len(KEYS_SHORTCUT_ANDROID)):
            if len(KEYS_SHORTCUT_ANDROID[i]) == 0:
                self.shortcutAndroidComboBox.insertSeparator(i + 2)
            else:
                self.shortcutAndroidComboBox.addItem (KEYS_SHORTCUT_ANDROID[i])

        shortcutAndroidlayout.addWidget( QLabel( self.tr("Button:") ) , 0,1)
        shortcutAndroidlayout.addWidget(self.shortcutAndroidComboBox, 0, 2)
        
        self.shortcutAndroidGroup.setLayout(shortcutAndroidlayout)
        self.shortcutAndroidGroup.hide()
Esempio n. 15
0
    def createDialog (self):
        """
        Create qt dialog
        """
        
        self.TIMEOUT_ANDROID_ACTION = Settings.instance().readValue( key = 'TestGenerator/timeout-android-action' )

        self.timeoutAndroidLine = QLineEdit()
        self.timeoutAndroidLine.setText(str(self.TIMEOUT_ANDROID_ACTION))
        validatorAndroid = QDoubleValidator(self)
        validatorAndroid.setNotation(QDoubleValidator.StandardNotation)
        self.timeoutAndroidLine.setValidator(validatorAndroid)
        self.timeoutAndroidLine.installEventFilter(self)

        self.agentNameLineAndroid = QLineEdit("AGENT_ANDROID")

        self.agentsAndroidList = QComboBox()
        self.agentsAndroidList.setMinimumWidth(300)
        
        optionAndroidLayout = QGridLayout()
        optionAndroidLayout.addWidget(QLabel( self.tr("Max time to run action:") ), 1, 0)
        optionAndroidLayout.addWidget(self.timeoutAndroidLine, 1, 1)

        optionAndroidLayout.addWidget(QLabel( self.tr("Agent Key Name:") ), 3, 0)
        optionAndroidLayout.addWidget(self.agentNameLineAndroid, 3, 1)

        optionAndroidLayout.addWidget(QLabel( self.tr("Agent:") ), 4, 0)
        optionAndroidLayout.addWidget(self.agentsAndroidList, 4, 1)

        self.buttonBox = QDialogButtonBox(self)
        self.buttonBox.setStyleSheet( """QDialogButtonBox { 
            dialogbuttonbox-buttons-have-icons: 1;
            dialog-ok-icon: url(:/ok.png);
            dialog-cancel-icon: url(:/ko.png);
        }""")
        self.buttonBox.setStandardButtons(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)

        mainLayout = QVBoxLayout()
        mainLayout.addLayout(optionAndroidLayout)
        mainLayout.addWidget(self.buttonBox)
        self.setLayout(mainLayout)

        self.setWindowTitle(self.tr("Android Options"))
Esempio n. 16
0
    def __init__(self, parent):
        super(ImageTab, self).__init__(parent)
        self.parent = parent
        self.name = 'Images'
        self.formats = [
            'bmp', 'cgm', 'dpx', 'emf', 'eps', 'fpx', 'gif', 'jbig', 'jng',
            'jpeg', 'mrsid', 'p7', 'pdf', 'picon', 'png', 'ppm', 'psd', 'rad',
            'tga', 'tif', 'webp', 'xpm'
        ]

        self.extra_img = [
            'bmp2', 'bmp3', 'dib', 'epdf', 'epi', 'eps2', 'eps3', 'epsf',
            'epsi', 'icon', 'jpe', 'jpg', 'pgm', 'png24', 'png32', 'pnm', 'ps',
            'ps2', 'ps3', 'sid', 'tiff'
        ]

        pattern = QRegExp(r'^[1-9]\d*')
        validator = QRegExpValidator(pattern, self)

        converttoLabel = QLabel(self.tr('Convert to:'))
        self.extComboBox = QComboBox()
        self.extComboBox.addItems(self.formats)

        hlayout1 = pyqttools.add_to_layout(QHBoxLayout(), converttoLabel,
                                           self.extComboBox, None)

        sizeLabel = QLabel('<html><p align="center">' +
                           self.tr('Image Size:') + '</p></html>')
        self.widthLineEdit = pyqttools.create_LineEdit((50, 16777215),
                                                       validator, 4)
        self.heightLineEdit = pyqttools.create_LineEdit((50, 16777215),
                                                        validator, 4)
        label = QLabel('x')
        label.setMaximumWidth(25)
        self.aspectCheckBox = QCheckBox(self.tr("Maintain aspect ratio"))
        hlayout2 = pyqttools.add_to_layout(QHBoxLayout(), self.widthLineEdit,
                                           label, self.heightLineEdit)
        vlayout = pyqttools.add_to_layout(QVBoxLayout(), sizeLabel, hlayout2)
        hlayout3 = pyqttools.add_to_layout(QHBoxLayout(), vlayout,
                                           self.aspectCheckBox, None)
        final_layout = pyqttools.add_to_layout(QVBoxLayout(), hlayout1,
                                               hlayout3)
        self.setLayout(final_layout)
Esempio n. 17
0
    def createEditor(self, parent, option, index):
        """
        Create the editor

        @param parent: 
        @type parent:

        @param option: 
        @type option:

        @param index: 
        @type index:

        @return:
        @rtype:
        """
        value = self.getValue(index)
        if index.column() == COL_VALUE:
            editor = QComboBox(parent)
            editor.activated.connect(self.onItemActivated)
            editor.addItem(value)
            editor.insertSeparator(1)

            # get running agents from context
            runningAgents = ServerAgents.instance().getRunningAgents()
            runningAgents = sorted(
                runningAgents)  # sort agents list, new in v12.2

            for i in xrange(len(runningAgents)):
                if len(runningAgents[i]) == 0:
                    editor.insertSeparator(i + 2)
                else:
                    editor.addItem(runningAgents[i])
            editor.insertSeparator(len(runningAgents) + 2)

            # add alias
            params = []
            for pr in self.parent.model.getData():
                params.append(pr['name'])
            editor.addItems(params)

            return editor
        return QItemDelegate.createEditor(self, parent, option, index)
Esempio n. 18
0
    def createWidgetText(self):
        """
        Create text widget
        """
        self.textGroup = QGroupBox(self.tr(""))

        # text
        self.textLine = QLineEdit(self)
        self.textLine.setMinimumWidth(300)
        self.textCombo = QComboBox(self)
        self.textCombo.addItems(LIST_TYPES)

        mainTextlayout = QGridLayout()
        mainTextlayout.addWidget(QLabel(self.tr("Send the value:")), 0, 0)
        mainTextlayout.addWidget(self.textCombo, 0, 1)
        mainTextlayout.addWidget(self.textLine, 0, 2)

        self.textGroup.setLayout(mainTextlayout)
        self.textGroup.hide()
Esempio n. 19
0
    def __init__(self, parent, *args, **kwargs):
        QDialog.__init__(self, parent, *args, **kwargs)

        vbox = QVBoxLayout()
        vbox.addWidget(FBoxTitle(u"<h3>Ajout de contact </h3>"))
        self.combo_grp = QComboBox()
        groups = Group()
        groups.name = "Aucun"

        self.list_grp = Group.all()
        self.list_grp.append(groups)
        self.list_grp.reverse()

        for index in self.list_grp:
            sentence = u"%(name)s" % {'name': index.name}
            self.combo_grp.addItem(sentence)

        self.full_name = LineEdit()
        self.msg_e_or_c = FLabel("")
        self.full_name.setFont(QFont("Arial", 16))
        self.phone_number = IntLineEdit()
        self.phone_number.setInputMask("D9.99.99.99")
        self.phone_number.setAlignment(Qt.AlignCenter)
        self.phone_number.setFont(QFont("Arial", 16))

        send_butt = Button(u"Enregistrer")
        send_butt.clicked.connect(self.save_form)
        cancel_but = Button(u"Fermer")
        cancel_but.clicked.connect(self.cancel)

        formbox = QGridLayout()
        formbox.addWidget(FLabel(u"Groupes:"), 0, 0)
        formbox.addWidget(self.combo_grp, 1, 0)
        formbox.addWidget(FLabel(u"Nom complèt: "), 0, 1)
        formbox.addWidget(self.full_name, 1, 1)
        formbox.addWidget(FLabel(u"Numéro: "), 0, 2)
        formbox.addWidget(self.phone_number, 1, 2)
        formbox.addWidget(send_butt, 2, 1)
        formbox.addWidget(cancel_but, 2, 0)
        formbox.addWidget(self.msg_e_or_c, 3, 0, 3, 2)

        vbox.addLayout(formbox)
        self.setLayout(vbox)
    def __init__(self):
        super(LabelControlItems, self).__init__()
        
        nlabels = 5
        
        self.combobox_labels = QComboBox()
        self.label_label = QLabel("Label: ")
        self.label_text = QLabel("Text: ")
        self.text_label = QLineEdit("Label1")
        self.button_label = QPushButton("On/Off")
        
        self.scale_labelsize = QSlider(Qt.Horizontal)
        self.label_labelsize = QLabel("Label Size")
        self.scale_labelsize.setMinimum(1)
        self.scale_labelsize.setValue(20)
        
        self.button_label.setCheckable(True)
        
        for i in range(nlabels):
            self.combobox_labels.addItem("Label"+str(i+1))
            
        layout = QGridLayout()
        
        layout.addWidget(self.label_label,0,0)
        layout.addWidget(self.combobox_labels,1,0)
        layout.addWidget(self.label_text,0,1)
        layout.addWidget(self.text_label,1,1)
        layout.addWidget(self.button_label,1,2)

        layout.addWidget(self.label_labelsize,0,3)
        layout.addWidget(self.scale_labelsize,1,3)        


            
        
            
        for col, stretch in enumerate((5,5,5,5)):
            layout.setColumnStretch(col, stretch)            
        
        layout.setMargin(5)
        layout.setHorizontalSpacing(5)       
        layout.setVerticalSpacing(0)                  
        self.setLayout(layout)
Esempio n. 21
0
    def __init__(self, *args):
        QMainWindow.__init__(self, *args)
        self.d_plot = Plot(self)
        self.setCentralWidget(self.d_plot)

        self.toolBar = QToolBar(self)
        self.btnPrint = QToolButton(self.toolBar)
        self.btnPrint.setText("Print")
        self.btnPrint.setToolButtonStyle(Qt.ToolButtonTextUnderIcon)
        self.toolBar.addWidget(self.btnPrint)
        #self.btnPrint.clicked.connect(self.d_plot.printPlot() )

        self.toolBar.addSeparator()

        self.toolBar.addWidget(QLabel("Color Map "))
        self.mapBox = QComboBox(self.toolBar)
        self.mapBox.addItem("RGB")
        self.mapBox.addItem("Indexed Colors")
        self.mapBox.addItem("Hue")
        self.mapBox.addItem("Alpha")
        self.mapBox.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        self.toolBar.addWidget(self.mapBox)
        self.mapBox.currentIndexChanged['int'].connect(self.d_plot.setColorMap)
        self.toolBar.addWidget(QLabel(" Opacity "))
        self.slider = QSlider(Qt.Horizontal)
        self.slider.setRange(0, 255)
        self.slider.setValue(255)
        self.slider.valueChanged['int'].connect(self.d_plot.setAlpha)
        self.toolBar.addWidget(self.slider)
        self.toolBar.addWidget(QLabel("   "))
        self.btnSpectrogram = QCheckBox("Spectrogram", self.toolBar)
        self.toolBar.addWidget(self.btnSpectrogram)
        self.btnSpectrogram.toggled['bool'].connect(
            self.d_plot.showSpectrogram)

        self.btnContour = QCheckBox("Contour", self.toolBar)
        self.toolBar.addWidget(self.btnContour)
        #self.btnContour.toggled['bool'](self.d_plot.showContour )

        self.addToolBar(self.toolBar)

        self.btnSpectrogram.setChecked(True)
        self.btnContour.setChecked(False)
Esempio n. 22
0
    def __init__(self, parent, csv_path):
        QTreeWidgetItem.__init__(self, parent)

        self._csv_path = csv_path
        self.widget = QWidget()
        self.widget.setLayout(QHBoxLayout())
        self.cb_enabled = QCheckBox()
        self.le_label = QLineEdit("")
        self.cb_graph_type = QComboBox()
        self.cb_graph_type.addItems(["NORMAL", "RATE", "DELTA"])

        self.widget.layout().addWidget(self.cb_enabled)
        self.widget.layout().addWidget(QLabel(os.path.basename(csv_path)))
        self.widget.layout().addWidget(QLabel("Label:"))
        self.widget.layout().addWidget(self.le_label)
        self.widget.layout().addWidget(QLabel("Type:"))
        self.widget.layout().addWidget(self.cb_graph_type)

        self.treeWidget().setItemWidget(self, 0, self.widget)
    def _getCombobox(self,
                     values,
                     primary_selected_value=None,
                     secondary_selected_value=None,
                     currentindex_changed_callback=None):
        '''
        Get a combobox filled with the given values
        
        :param values: The values as key = value, value = description or text
        :type values: Dict
        
        :returns: A combobox
        :rtype: QWidget
        '''

        widget = QWidget()
        combobox = QComboBox()
        layout = QHBoxLayout(widget)
        layout.addWidget(combobox, 1)
        layout.setAlignment(Qt.AlignCenter)
        layout.setContentsMargins(5, 0, 5, 0)
        widget.setLayout(layout)

        current_item_index = 0
        selected_index = 0

        for key, value in values.iteritems():
            combobox.addItem(value, key)

            # Select value
            if key == secondary_selected_value and selected_index == 0:
                selected_index = current_item_index
            if key == primary_selected_value:
                selected_index = current_item_index

            current_item_index += 1

        combobox.setCurrentIndex(selected_index)

        if currentindex_changed_callback is not None:
            combobox.currentIndexChanged.connect(currentindex_changed_callback)

        return widget
Esempio n. 24
0
    def _create_dropdownbox(self, key, value):
        # atomic_widget = QWidget()
        row, col = self.__calculate_new_grid_position()
        # layout = QBoxLayout(self.horizontal)
        atomic_widget = QComboBox()
        # atomic_widget.addItem("C")
        # atomic_widget.addItem("C++")
        values = self.dropdownboxes[key]
        # values = self.dropdownboxes[key][0]
        if value is not None and value in values:
            # vali = atomic_widget.findText(value)
            atomic_widget.findText(value)
        atomic_widget.addItems(values)
        # this does not work. I used findText()
        # atomic_widget.setCurrentIndex(vali)
        # layout.addWidget(cb)

        # atomic_widget.setLayout(layout)
        return atomic_widget
Esempio n. 25
0
    def settings(self, parent):
        # CRIANDO O COMBOBOX
        self.comboBox = QComboBox(parent)

        # LISTANDO AS PORTAS COM DISPONIVEIS
        self.lstPort = Control.find_ports()
        if self.lstPort == []:
            self.comboBox.addItem(
                "Nenhum dispositivo conectado. Reinicie o programa.")
        else:
            self.comboBox.addItems(self.lstPort)

        # CRIANDO O LABEL
        mensagem = "Selecione a porta COM conectada ao Arduino: "
        self.labelComboBox = QLabel(mensagem, parent)

        # ADICIONANDO O COMBOBOX E O LABEL AO LAYOUT
        self.addWidget(self.labelComboBox)
        self.addWidget(self.comboBox)
Esempio n. 26
0
    def __init__(self, parent=None):
        QWidget.__init__(self, parent)

        layout = QVBoxLayout()
        self.setLayout(layout)

        self.liveCheckBox = QCheckBox("Live Source")
        self.liveCheckBox.setToolTip('Act as a live video source')
        layout.addWidget(self.liveCheckBox)

        formWidget = QWidget()
        formLayout = QFormLayout()
        formWidget.setLayout(formLayout)
        layout.addWidget(formWidget)

        self.patternLabel = QLabel("Pattern")
        self.patternComboBox = QComboBox()

        formLayout.addRow(self.patternLabel, self.patternComboBox)
Esempio n. 27
0
    def createWidgetGetWait(self):
        """
        Create wait text widget
        """
        self.getWaitGroup = QGroupBox(self.tr(""))

        self.valueWaitLine = QLineEdit(self)
        self.valueWaitLine.setMinimumWidth(300)
        self.valueWaitLine.setValidator(self.validatorInt)
        self.valueWaitCombo = QComboBox(self)
        self.valueWaitCombo.addItems( LIST_TYPES )

        mainTextlayout = QGridLayout()
        mainTextlayout.addWidget(  QLabel( self.tr("Value (in seconds):") ), 0, 0 )
        mainTextlayout.addWidget(  self.valueWaitCombo, 0, 1 )
        mainTextlayout.addWidget(  self.valueWaitLine, 0, 2 )

        self.getWaitGroup.setLayout(mainTextlayout)
        self.getWaitGroup.hide()
Esempio n. 28
0
    def __init__(self, term, termname, pagetitle, parent=None):
        super(AddDialog, self).__init__(parent)
        self.sid = term
        displayInfo = self.pullSubjects()
        self.pagetitle = pagetitle
        self.termname = termname

        self.l1 = QLabel("Assessment Types")
        self.le = QComboBox()
        for dd in displayInfo:
            self.le.addItem(str(dd['name']).upper(), dd['id'])

        self.le.setObjectName("name")

        self.l2 = QLabel("Max Score")
        self.le2 = QLineEdit()
        self.le2.setObjectName("maxscore")

        self.pb = QPushButton()
        self.pb.setObjectName("Submit")
        self.pb.setText("Submit")

        self.pb1 = QPushButton()
        self.pb1.setObjectName("Cancel")
        self.pb1.setText("Cancel")

        layout = QFormLayout()
        layout.addRow(self.l1, self.le)
        layout.addRow(self.l2, self.le2)
        layout.addRow(self.pb1, self.pb)

        groupBox = QGroupBox('Add Assessment')
        groupBox.setLayout(layout)

        grid = QGridLayout()
        grid.addWidget(groupBox, 0, 0)
        self.setLayout(grid)
        self.connect(self.pb, SIGNAL("clicked()"),
                     lambda: self.button_click(self))
        self.connect(self.pb1, SIGNAL("clicked()"),
                     lambda: self.button_close(self))

        self.setWindowTitle(self.pagetitle)
Esempio n. 29
0
    def __init__(self, parent=None):
        super(MainWindow, self).__init__(parent)
        self.setupUi(self)
        #para jalar todos los componentes de la interfaz
        #con la linea de arriba se puede ver que jala los componentes, y que to-do salio

        #diccionario para cambiar los valores
        # DICCIONARIO CON LAS preferencias
        #nombre Diccionario = tipo Diccionario ( llaves=valor, llave=valor  )
        self.configuraciones = dict(color="black", grosor=2, opacidad=0.5, ejeX=True, ejeY=True)

        miLabel = QLabel("Dispositivos: ")
        self.miComboBox = QComboBox(self)
        self.toolBar.addWidget(miLabel)
        self.toolBar.addWidget(self.miComboBox)

        #botones de la barra superior
        self.actionInformacion.triggered.connect(self.funcionInformacion)
        self.actionAjustes.triggered.connect(self.funcionConfiguracion)

        self.actionRefresh.triggered.connect(self.funcionRefrescar)

        self.pushButton_Iniciar.clicked.connect(self.funcionStart)

        #linea para poder mostrar que dispositivos estan conectados
        dispositivos = serial.tools.list_ports.comports()

        #crear grafica y sus propiedades
        self.crear_grafica()  # funcion
        self.grafica_datos_x = []
        self.grafica_datos_y = []
        self.contador_x = 0

        for usb in dispositivos:
            print (usb.device)
            self.miComboBox.addItem(usb.device) #agrega un elemento al ComboBox

        #llamar
        self.funcionCurrentUsb()

        #senial para detectar el dispositivo deleccionado
        self.miComboBox.currentIndexChanged.connect(self.funcionCurrentUsb)
Esempio n. 30
0
    def createDialog (self):
        """
        Create qt dialog
        """
        self.buttonBox = QDialogButtonBox(self)
        self.buttonBox.setStyleSheet( """QDialogButtonBox { 
            dialogbuttonbox-buttons-have-icons: 1;
            dialog-ok-icon: url(:/ok.png);
            dialog-cancel-icon: url(:/test-close-black.png);
        }""")
        self.buttonBox.setStandardButtons(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)

        self.stepIdLabel = QLabel("%s" % self.stepId)
        stepTitleLayout = QGridLayout()

        # mandatory args
        self.argsLayout = QGridLayout()
        for i in xrange(len(self.stepData['obj'])):
            self.argsLayout.addWidget(QLabel( self.stepData['obj'][i]['name']), i, 0)
            typeParam  = QRadioButton( self.stepData['obj'][i]['type'])
            typeParam.setEnabled(False)
            self.argsLayout.addWidget(typeParam, i, 1)
            if self.stepData['obj'][i]['type'] == 'string':
                typeParam.setChecked(True)
                self.argsLayout.addWidget(QTextEdit( ), i, 2)
            if self.stepData['obj'][i]['type'] == "boolean":
                boolCombo = QComboBox( )
                valBool = [ "True", "False" ]
                boolCombo.addItems(valBool)
                boolCombo.setEnabled(False) # feature not yet available in abstract mode
                typeParam.setChecked(True)
                self.argsLayout.addWidget(boolCombo, i, 2)

        mainLayout = QVBoxLayout()
        mainLayout.addLayout(stepTitleLayout)
        mainLayout.addLayout(self.argsLayout)
        mainLayout.addWidget(self.buttonBox)
        self.setLayout(mainLayout)

        self.setWindowTitle(self.tr("Step configuration"))
        self.resize(450, 250)
        self.center()