Python PyQt5.QtCore.Qt.ItemIsSelectable() Examples

The following are 30 code examples of PyQt5.QtCore.Qt.ItemIsSelectable(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module PyQt5.QtCore.Qt , or try the search function .
Example #1
Source File: view_av.py    From QualCoder with MIT License 6 votes vote down vote up
def __init__(self, segment, scaler, text_for_segment, code_av_dialog):
            super(SegmentGraphicsItem, self).__init__(None)

            self.segment = segment
            self.scaler = scaler
            #self.text_for_segment = text_for_segment
            self.code_av_dialog = code_av_dialog
            self.reload_segment = False
            self.setFlag(self.ItemIsSelectable, True)
            tooltip = self.segment['codename'] + " "
            seg_time = "[" + msecs_to_mins_and_secs(self.segment['pos0']) + " - "
            seg_time += msecs_to_mins_and_secs(self.segment['pos1']) + "]"
            tooltip += seg_time
            if self.segment['memo'] != "":
                tooltip += "\n" + _("Memo: ") + self.segment['memo']
            self.setToolTip(tooltip)
            self.draw_segment() 
Example #2
Source File: completionmodel.py    From qutebrowser with GNU General Public License v3.0 6 votes vote down vote up
def flags(self, index):
        """Return the item flags for index.

        Override QAbstractItemModel::flags.

        Return: The item flags, or Qt.NoItemFlags on error.
        """
        if not index.isValid():
            return Qt.NoItemFlags
        if index.parent().isValid():
            # item
            return (Qt.ItemIsEnabled | Qt.ItemIsSelectable |
                    Qt.ItemNeverHasChildren)
        else:
            # category
            return Qt.NoItemFlags 
Example #3
Source File: dlg_findCollTx.py    From PIVX-SPMT with MIT License 6 votes vote down vote up
def display_utxos(self):
        def item(value):
            item = QTableWidgetItem(value)
            item.setTextAlignment(Qt.AlignCenter)
            item.setFlags(Qt.ItemIsEnabled | Qt.ItemIsSelectable)
            return item

        self.tableW.setRowCount(len(self.utxos))
        for row, utxo in enumerate(self.utxos):
            pivxAmount = round(int(utxo.get('satoshis', 0))/1e8, 8)
            self.tableW.setItem(row, 0, item(str(pivxAmount)))
            self.tableW.setItem(row, 1, item(str(utxo['confirmations'])))
            self.tableW.setItem(row, 2, item(utxo.get('txid', None)))
            self.tableW.setItem(row, 3, item(str(utxo.get('vout', None))))

        if len(self.utxos):
            self.tableW.resizeColumnsToContents()
            self.lblMessage.setVisible(False)
            self.tableW.horizontalHeader().setSectionResizeMode(2, QHeaderView.Stretch)

        else:
            self.lblMessage.setText('<b style="color:purple">No UTXO found for current address.\nEnter tx manually</b>')
            self.lblMessage.setVisible(True) 
Example #4
Source File: LogBlockDebugTab.py    From crazyflie-clients-python with GNU General Public License v2.0 6 votes vote down vote up
def _update_tree(self, conf, value):
        """Update the block tree"""
        self._block_tree.clear()
        for block in self._helper.cf.log.log_blocks:
            item = QtWidgets.QTreeWidgetItem()
            item.setFlags(Qt.ItemIsEnabled |
                          Qt.ItemIsSelectable)
            item.setData(0, Qt.DisplayRole, block.id)
            item.setData(1, Qt.EditRole, block.name)
            item.setData(2, Qt.DisplayRole, (block.period_in_ms))
            item.setData(3, Qt.DisplayRole, block.added)
            item.setData(4, Qt.EditRole, block.started)
            item.setData(5, Qt.EditRole, block.err_no)
            for var in block.variables:
                subItem = QtWidgets.QTreeWidgetItem()
                subItem.setFlags(Qt.ItemIsEnabled |
                                 Qt.ItemIsSelectable)
                subItem.setData(6, Qt.EditRole, var.name)
                item.addChild(subItem)

            self._block_tree.addTopLevelItem(item)
            self._block_tree.expandItem(item) 
Example #5
Source File: wallet_data_models.py    From dash-masternode-tool with MIT License 6 votes vote down vote up
def flags(self, index):
        return Qt.ItemIsEnabled | Qt.ItemIsSelectable | Qt.ItemIsEditable 
Example #6
Source File: import_survey.py    From QualCoder with MIT License 6 votes vote down vote up
def fill_tableWidget(self):
        ''' Fill table widget with data. '''

        numRows = self.ui.tableWidget.rowCount()
        for row in range(0, numRows):
            self.ui.tableWidget.removeRow(0)
        self.ui.tableWidget.setColumnCount(len(self.fields))
        for c, field in enumerate(self.fields):
            item = QtWidgets.QTableWidgetItem(field + "\n" + self.fields_type[c] + "\n")
            self.ui.tableWidget.setHorizontalHeaderItem(c, item)
        self.ui.tableWidget.setRowCount(len(self.data))
        for row in range(0, len(self.data)):
            for col in range(0, len(self.fields)):
                value = str(self.data[row][col])
                item = QtWidgets.QTableWidgetItem(value)
                item.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)  # not editatble
                self.ui.tableWidget.setItem(row, col, item)
        self.ui.tableWidget.resizeColumnsToContents()
        for col in range(0, self.ui.tableWidget.columnCount()):
            if self.ui.tableWidget.columnWidth(col) > 200:
                self.ui.tableWidget.setColumnWidth(col, 200) 
Example #7
Source File: ProtocolTableModel.py    From urh with GNU General Public License v3.0 5 votes vote down vote up
def flags(self, index: QModelIndex):
        if index.isValid():
            alignment_offset = self.get_alignment_offset_at(index.row())
            if index.column() < alignment_offset:
                return Qt.ItemIsSelectable | Qt.ItemIsEnabled

            if self.is_writeable:
                return Qt.ItemIsEnabled | Qt.ItemIsEditable | Qt.ItemIsSelectable
            else:
                return Qt.ItemIsEnabled | Qt.ItemIsSelectable
        else:
            return Qt.NoItemFlags 
Example #8
Source File: models.py    From tdm with GNU General Public License v3.0 5 votes vote down vote up
def flags(self, idx):
        return Qt.ItemIsSelectable | Qt.ItemIsEnabled 
Example #9
Source File: GeneratorListModel.py    From urh with GNU General Public License v3.0 5 votes vote down vote up
def flags(self, index):
        flags = Qt.ItemIsEnabled | Qt.ItemIsSelectable | Qt.ItemIsEditable

        try:
            lbl = self.labels[index.row()]
        except IndexError:
            return flags

        if len(lbl.fuzz_values) > 1:
            flags |= Qt.ItemIsUserCheckable
        else:
            lbl.fuzz_me = False
        return flags 
Example #10
Source File: RulesetTableModel.py    From urh with GNU General Public License v3.0 5 votes vote down vote up
def flags(self, index: QModelIndex):
        return Qt.ItemIsSelectable | Qt.ItemIsEnabled | Qt.ItemIsEditable 
Example #11
Source File: PluginListModel.py    From urh with GNU General Public License v3.0 5 votes vote down vote up
def flags(self, index):
        return Qt.ItemIsEnabled | Qt.ItemIsSelectable | Qt.ItemIsUserCheckable 
Example #12
Source File: GeneratorTableModel.py    From urh with GNU General Public License v3.0 5 votes vote down vote up
def flags(self, index: QModelIndex):
        if not index.isValid():
            return Qt.ItemIsEnabled

        return Qt.ItemIsEnabled | Qt.ItemIsDropEnabled | Qt.ItemIsSelectable | Qt.ItemIsDragEnabled | Qt.ItemIsEditable 
Example #13
Source File: SimulatorMessageFieldModel.py    From urh with GNU General Public License v3.0 5 votes vote down vote up
def flags(self, index: QModelIndex):
        row, col = index.row(), index.column()
        label = self.message_type[row]  # type: SimulatorProtocolLabel

        if col == 2 and label.is_checksum_label:
            return Qt.ItemIsSelectable

        flags = Qt.ItemIsEnabled | Qt.ItemIsSelectable

        if not(col == 3 and label.value_type_index == 1):
            flags |= Qt.ItemIsEditable

        return flags 
Example #14
Source File: GeneratorTreeModel.py    From urh with GNU General Public License v3.0 5 votes vote down vote up
def flags(self, index: QModelIndex):
        if not index.isValid():
            return Qt.ItemIsEnabled

        return Qt.ItemIsEnabled | Qt.ItemIsSelectable | Qt.ItemIsDragEnabled | Qt.ItemIsDropEnabled 
Example #15
Source File: SimulatorMessageTableModel.py    From urh with GNU General Public License v3.0 5 votes vote down vote up
def flags(self, index: QModelIndex):
        if index.isValid():
            if self.is_writeable:
                return Qt.ItemIsEnabled | Qt.ItemIsEditable | Qt.ItemIsSelectable
            else:
                return Qt.ItemIsEnabled | Qt.ItemIsSelectable
        else:
            return Qt.NoItemFlags 
Example #16
Source File: MessageTypeTableModel.py    From urh with GNU General Public License v3.0 5 votes vote down vote up
def flags(self, index):
        return Qt.ItemIsEnabled | Qt.ItemIsSelectable | Qt.ItemIsUserCheckable | Qt.ItemIsEditable 
Example #17
Source File: SimulatorParticipantListModel.py    From urh with GNU General Public License v3.0 5 votes vote down vote up
def flags(self, index: QModelIndex):
        return Qt.ItemIsEnabled | Qt.ItemIsSelectable | Qt.ItemIsUserCheckable 
Example #18
Source File: FuzzingTableModel.py    From urh with GNU General Public License v3.0 5 votes vote down vote up
def flags(self, QModelIndex):
        return Qt.ItemIsEnabled | Qt.ItemIsSelectable | Qt.ItemIsEditable 
Example #19
Source File: SectionComboBoxDelegate.py    From urh with GNU General Public License v3.0 5 votes vote down vote up
def add_parent_item(self, text):
        item = QStandardItem(text)
        item.setFlags(item.flags() & ~(Qt.ItemIsEnabled | Qt.ItemIsSelectable))
        item.setData("parent", Qt.AccessibleDescriptionRole)

        font = item.font()
        font.setBold(True)
        item.setFont(font)

        self.model().appendRow(item) 
Example #20
Source File: test_message_type_options_gui.py    From urh with GNU General Public License v3.0 5 votes vote down vote up
def test_edit_rules(self):
        num_rules = len(self.message_type.ruleset)
        self.assertEqual(num_rules, self.dialog.ruleset_table_model.rowCount())
        self.dialog.ui.rbAssignAutomatically.click()
        self.assertFalse(self.message_type.assign_manually)
        self.dialog.ui.rbAssignManually.click()
        self.assertTrue(self.message_type.assign_manually)

        self.dialog.ui.rbAssignAutomatically.click()
        self.assertTrue(self.dialog.ui.btnAddRule.isEnabled())
        self.dialog.ui.btnAddRule.click()
        self.assertEqual(num_rules + 1, len(self.message_type.ruleset))
        self.assertEqual(num_rules + 1, self.dialog.ruleset_table_model.rowCount())

        model = self.dialog.ruleset_table_model
        model.setData(model.index(0, 0), 10, role=Qt.EditRole)
        self.assertEqual(self.message_type.ruleset[0].start, 9)
        model.setData(model.index(0, 1), 20, role=Qt.EditRole)
        self.assertEqual(self.message_type.ruleset[0].end, 20)
        model.setData(model.index(0, 2), 2, role=Qt.EditRole)
        self.assertEqual(self.message_type.ruleset[0].value_type, 2)
        model.setData(model.index(0, 3), 2, role=Qt.EditRole)
        model.setData(model.index(0, 4), "10101", role=Qt.EditRole)
        self.assertEqual(self.message_type.ruleset[0].target_value, "10101")

        for i in range(model.rowCount()):
            for j in range(model.columnCount()):
                self.assertEqual(model.flags(model.index(i, j)),
                                 Qt.ItemIsSelectable | Qt.ItemIsEnabled | Qt.ItemIsEditable)

        self.dialog.ui.btnRemoveRule.click()
        self.assertEqual(num_rules, len(self.message_type.ruleset))
        self.assertEqual(num_rules, self.dialog.ruleset_table_model.rowCount()) 
Example #21
Source File: dlg_selectMNs.py    From PIVX-SPMT with MIT License 5 votes vote down vote up
def loadMasternodes(self):
        for row, mn in enumerate(self.main_wnd.caller.masternode_list):
            name = mn.get('name')
            txid = mn.get('collateral').get('txid')
            item = masternodeItem(name, txid)
            item.setTextAlignment(Qt.AlignCenter)
            item.setFlags(Qt.ItemIsEnabled | Qt.ItemIsSelectable)
            self.ui.mnList.setItem(row, 0, item)
            # check if already selected
            if name in [x[1] for x in self.main_wnd.votingMasternodes]:
                item.setSelected(True) 
Example #22
Source File: DyTreeWidget.py    From DevilYuan with MIT License 5 votes vote down vote up
def __InitFieldItem(self, parent, item):
        treeItem = QTreeWidgetItem(parent)
        treeItem.setText(0, item)
        treeItem.setFlags(Qt.ItemIsUserCheckable | Qt.ItemIsEnabled | Qt.ItemIsSelectable)
        treeItem.setCheckState(0, Qt.Unchecked)

        return treeItem 
Example #23
Source File: RedditObjectItemDisplayModel.py    From DownloaderForReddit with GNU General Public License v3.0 5 votes vote down vote up
def flags(self, QModelIndex):
        return Qt.ItemIsSelectable | Qt.ItemIsEnabled 
Example #24
Source File: settings_model.py    From CHATIMUSMAXIMUS with GNU General Public License v3.0 5 votes vote down vote up
def flags(self, index):
        if not index.isValid():
            return 0

        if index.column() == 0:
            return Qt.ItemIsEnabled | Qt.ItemIsSelectable

        return Qt.ItemIsEditable | Qt.ItemIsEnabled | Qt.ItemIsSelectable 
Example #25
Source File: ObjList.py    From KStock with GNU General Public License v3.0 5 votes vote down vote up
def flags(self, index):
        flags = QAbstractTableModel.flags(self, index)
        if not index.isValid():
            return flags
        prop = self.getProperty(index)
        if prop is None:
            return flags
        flags |= Qt.ItemIsEnabled
        flags |= Qt.ItemIsSelectable
        mode = prop.get('mode', "Read/Write")
        if "Write" in mode:
            flags |= Qt.ItemIsEditable
        return flags 
Example #26
Source File: wallet_data_models.py    From dash-masternode-tool with MIT License 5 votes vote down vote up
def flags(self, index):
        return Qt.ItemIsEnabled | Qt.ItemIsSelectable | Qt.ItemIsEditable 
Example #27
Source File: wallet_data_models.py    From dash-masternode-tool with MIT License 5 votes vote down vote up
def flags(self, index):
        return Qt.ItemIsEnabled | Qt.ItemIsSelectable | Qt.ItemIsEditable 
Example #28
Source File: find_coll_tx_dlg.py    From dash-masternode-tool with MIT License 5 votes vote down vote up
def flags(self, index):
        return Qt.ItemIsEnabled | Qt.ItemIsSelectable | Qt.ItemIsEditable 
Example #29
Source File: DyTreeWidget.py    From DevilYuan with MIT License 5 votes vote down vote up
def __InitFieldItem(self, parent, item):
        treeItem = QTreeWidgetItem(parent)
        treeItem.setText(0, item)
        treeItem.setFlags(Qt.ItemIsUserCheckable | Qt.ItemIsEnabled | Qt.ItemIsSelectable)
        treeItem.setCheckState(0, Qt.Unchecked)

        return treeItem 
Example #30
Source File: settings.py    From vidcutter with GNU General Public License v3.0 5 votes vote down vote up
def initCategories(self):
        generalButton = QListWidgetItem(self.categories)
        generalButton.setIcon(QIcon(':/images/settings-general.png'))
        generalButton.setText('General')
        generalButton.setToolTip('General settings')
        generalButton.setTextAlignment(Qt.AlignHCenter)
        generalButton.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)
        videoButton = QListWidgetItem(self.categories)
        videoButton.setIcon(QIcon(':/images/settings-video.png'))
        videoButton.setText('Video')
        videoButton.setToolTip('Video settings')
        videoButton.setTextAlignment(Qt.AlignHCenter)
        videoButton.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)
        themeButton = QListWidgetItem(self.categories)
        themeButton.setIcon(QIcon(':/images/settings-theme.png'))
        themeButton.setText('Theme')
        themeButton.setToolTip('Theme settings')
        themeButton.setTextAlignment(Qt.AlignHCenter)
        themeButton.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)
        ffmpegButton = QListWidgetItem(self.categories)
        ffmpegButton.setIcon(QIcon(':/images/settings-ffmpeg.png'))
        ffmpegButton.setText('Tools')
        ffmpegButton.setToolTip('Tools settings')
        ffmpegButton.setTextAlignment(Qt.AlignHCenter)
        ffmpegButton.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)
        logsButton = QListWidgetItem(self.categories)
        logsButton.setIcon(QIcon(':/images/settings-logs.png'))
        logsButton.setText('Logs')
        logsButton.setToolTip('Logging settings')
        logsButton.setTextAlignment(Qt.AlignHCenter)
        logsButton.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)
        self.categories.currentItemChanged.connect(self.changePage)
        self.categories.setCurrentRow(0)
        self.categories.setMaximumWidth(self.categories.sizeHintForColumn(0) + 2)