Python PyQt5.QtCore.Qt 模块,Checked() 实例源码

我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用PyQt5.QtCore.Qt.Checked()

项目:pbtk    作者:marin-m    | 项目源码 | 文件源码
def __init__(self, item, name, val, app):
        super().__init__(item, [name + '  '])
        self.name = name
        self.app = app
        self.required = '{%s}' % name in self.app.base_url

        if not self.required:
            self.setCheckState(0, Qt.Checked)
            self.last_check_state = Qt.Checked

        self.widget = QLineEdit()
        self.widget.setFrame(False)
        self.widget.setStyleSheet('padding: 1px 0')
        self.widget.textEdited.connect(self.value_changed)
        self.app.fuzzer.getTree.setItemWidget(self, 1, self.widget)

        self.widget.setText(val)
        self.value = val

        self.widget.setMouseTracking(True)
        self.widget.enterEvent = self.edit
项目:gpvdm    作者:roderickmackenzie    | 项目源码 | 文件源码
def make_entry(self,root,text,true_false):
        depth=0
        pointer=root
        for depth in range(0,len(text)):
            found=False
            for i in range(0,pointer.childCount()):
                if pointer.child(i).text(0)==text[depth]:
                    found=True
                    pointer=pointer.child(i)
                    break
            if found==False:
                pointer=QTreeWidgetItem(pointer, [text[depth]])
                pointer.setFlags(pointer.flags() | Qt.ItemIsUserCheckable)
                #if depth==0:
                #   pointer.setIcon(0,QIcon_load("folder"))

                if true_false==True:
                    pointer.setCheckState(0, Qt.Checked ) 
                else:
                    pointer.setCheckState(0, Qt.Unchecked )
项目:crispy    作者:mretegan    | 项目源码 | 文件源码
def setData(self, index, value, role):
        """Set the role data for the item at index to value."""
        if not index.isValid():
            return False

        node = self.getNode(index)
        column = index.column()

        if role == Qt.DisplayRole or role == Qt.EditRole:
            if column > 0 and not node.childCount():
                try:
                    node.setItemData(column, float(value))
                except ValueError:
                    return False
            else:
                node.setItemData(column, value)

        elif role == Qt.CheckStateRole:
            node.setCheckState(value)
            if value == Qt.Checked:
                self.nodeCheckStateChanged.emit(index)

        self.dataChanged.emit(index, index)

        return True
项目:bit-torrent    作者:borzunov    | 项目源码 | 文件源码
def _update_selection_label(self):
        selected_file_count = 0
        selected_size = 0
        for node, item in self._file_items:
            if item.checkState(0) == Qt.Checked:
                selected_file_count += 1
                selected_size += node.length

        ok_button = self._button_box.button(QDialogButtonBox.Ok)
        if not selected_file_count:
            ok_button.setEnabled(False)
            self._selection_label.setText('Nothing to download')
        else:
            ok_button.setEnabled(True)
            self._selection_label.setText(TorrentAddingDialog.SELECTION_LABEL_FORMAT.format(
                selected_file_count, humanize_size(selected_size)))
项目:urh    作者:jopohl    | 项目源码 | 文件源码
def data(self, index: QModelIndex, role=None):
        row = index.row()
        if role == Qt.DisplayRole:
            if row == 0:
                return "not assigned"
            else:
                try:
                    return self.participants[row-1].name + " ("+ self.participants[row-1].shortname + ")"
                except IndexError:
                    return None

        elif role == Qt.CheckStateRole:
            if row == 0:
                return Qt.Checked if self.show_unassigned else Qt.Unchecked
            else:
                try:
                    return Qt.Checked if self.participants[row-1].show else Qt.Unchecked
                except IndexError:
                    return None
项目:urh    作者:jopohl    | 项目源码 | 文件源码
def __init__(self, name: str, start: int, end: int, color_index: int, fuzz_created=False,
                 auto_created=False, field_type: FieldType = None):
        self.__name = name
        self.start = start
        self.end = end + 1

        self.apply_decoding = True
        self.color_index = color_index
        self.show = Qt.Checked

        self.fuzz_me = Qt.Checked
        self.fuzz_values = []

        self.fuzz_created = fuzz_created

        self.__field_type = field_type  # type: FieldType

        self.display_format_index = 0 if field_type is None else field_type.display_format_index

        self.auto_created = auto_created

        self.copied = False  # keep track if label was already copied for COW in generation to avoid needless recopy
项目:pbtk    作者:marin-m    | 项目源码 | 文件源码
def unvoid(self, recur=True):
        if self.void or self.is_msg:
            if not self.required:
                self.setCheckState(0, Qt.Checked)
                self.last_check_state = Qt.Checked

            if recur and self.parent():
                self.parent().unvoid(True)

            self.void = False
项目:pbtk    作者:marin-m    | 项目源码 | 文件源码
def get_self_pb(self):
        if self.self_pb is None:
            self.self_pb = getattr(self.get_parent_pb(), self.ds.name)

            if self.repeated:
                self.index = len(self.self_pb)

                item_indices[id(self.self_pb)].append(self)

                if self.is_msg:
                    self.self_pb.add()

            if self.is_msg:
                for i in range(self.childCount()):
                    if self.child(i).required:
                        self.child(i).parent_pb = None
                        self.child(i).self_pb = None
                        self.child(i).update(self.child(i).value)

                if hasattr(self.self_pb, 'SetInParent'):
                    self.self_pb.SetInParent()

                if not self.required:
                    self.setCheckState(0, Qt.Checked)
                    self.last_check_state = Qt.Checked

        # Return value is for get_parent_pb recursion
        if self.is_msg:
            if not self.repeated:
                return self.self_pb
            else:
                return self.self_pb[self.index]
项目:pbtk    作者:marin-m    | 项目源码 | 文件源码
def update_check(self, recursive=False, col=None):
        if not self.required and self.last_check_state != self.checkState(0):
            self.last_check_state = self.checkState(0)

            if not self.is_msg:
                if self.last_check_state == Qt.Checked:
                    self.update(self.value)
                else:
                    self.update(None)

            elif not self.self_pb: # We have just checked the message !
                assert self.last_check_state == Qt.Checked
                self.get_self_pb() # Recreates parent

                for i in range(self.childCount()):
                    if self.child(i).required:
                        self.child(i).parent_pb = None
                        self.child(i).self_pb = None
                        self.child(i).update(self.child(i).value)

            else: # We have just unchecked the message !
                assert self.last_check_state != Qt.Checked
                for i in range(self.childCount()):
                    if not self.child(i).required:
                        self.child(i).setCheckState(0, Qt.Unchecked)
                        self.child(i).update_check(True)
                        self.child(i).parent_pb = None
                        self.child(i).self_pb = None

                self.get_self_pb().Clear()
                self.update(None)

            if not recursive:
                self.app.update_fuzzer()

        elif col == 0:
            self.prompt_rename()
项目:pbtk    作者:marin-m    | 项目源码 | 文件源码
def update_check(self, col):
        if not self.required and self.last_check_state != self.checkState(0):
            self.last_check_state = self.checkState(0)
            if self.last_check_state != Qt.Checked:
                del self.app.get_params[self.name]
            else:
                self.app.get_params[self.name] = self.value
            self.app.update_fuzzer()
项目:mnelab    作者:cbrnr    | 项目源码 | 文件源码
def __init__(self, parent, info, title="Channel Properties"):
        super().__init__(parent)
        self.setWindowTitle(title)

        self.model = QStandardItemModel(info["nchan"], 4)
        self.model.setHorizontalHeaderLabels(["#", "Label", "Type", "Bad"])
        for index, ch in enumerate(info["chs"]):
            item = QStandardItem()
            item.setData(index, Qt.DisplayRole)
            item.setFlags(item.flags() & ~Qt.ItemIsEditable)
            self.model.setItem(index, 0, item)
            self.model.setItem(index, 1, QStandardItem(ch["ch_name"]))
            kind = channel_type(info, index).upper()
            self.model.setItem(index, 2, QStandardItem(str(kind)))
            bad = QStandardItem()
            bad.setData(ch["ch_name"] in info["bads"], Qt.UserRole)
            bad.setCheckable(True)
            bad.setEditable(False)
            checked = ch["ch_name"] in info["bads"]
            bad.setCheckState(Qt.Checked if checked else Qt.Unchecked)
            self.model.setItem(index, 3, bad)

        self.model.itemChanged.connect(bad_changed)
        self.proxymodel = MySortFilterProxyModel()
        self.proxymodel.setSourceModel(self.model)

        self.view = QTableView()
        self.view.setModel(self.proxymodel)
        self.view.setItemDelegateForColumn(2, ComboBoxDelegate(self.view))
        self.view.setEditTriggers(QAbstractItemView.AllEditTriggers)
        self.view.verticalHeader().setVisible(False)
        self.view.horizontalHeader().setStretchLastSection(True)
        self.view.setShowGrid(False)
        self.view.setSelectionMode(QAbstractItemView.NoSelection)
        self.view.setSortingEnabled(True)
        self.view.sortByColumn(0, Qt.AscendingOrder)
        self.view.resizeColumnsToContents()
        # for i in range(self.model.rowCount()):
        #         self.view.openPersistentEditor(self.model.index(i, 2))

        vbox = QVBoxLayout(self)
        vbox.addWidget(self.view)
        self.buttonbox = QDialogButtonBox(QDialogButtonBox.Ok |
                                          QDialogButtonBox.Cancel)
        vbox.addWidget(self.buttonbox)
        self.buttonbox.accepted.connect(self.accept)
        self.buttonbox.rejected.connect(self.reject)

        self.resize(400, 650)
项目:mnelab    作者:cbrnr    | 项目源码 | 文件源码
def bad_changed(item):
    if item.checkState() == Qt.Checked:
        item.setData(True, Qt.UserRole)
    else:
        item.setData(False, Qt.UserRole)
项目:vidcutter    作者:ozmartian    | 项目源码 | 文件源码
def setVerboseLogs(self, state: int) -> None:
        self.parent.parent.saveSetting('verboseLogs', state == Qt.Checked)
        self.parent.parent.parent.verboseLogs = (state == Qt.Checked)
项目:vidcutter    作者:ozmartian    | 项目源码 | 文件源码
def setNativeDialogs(self, state: int) -> None:
        self.parent.parent.saveSetting('nativeDialogs', state == Qt.Checked)
        self.parent.parent.nativeDialogs = (state == Qt.Checked)
项目:vidcutter    作者:ozmartian    | 项目源码 | 文件源码
def switchDecoding(self, state: int) -> None:
        self.parent.parent.mpvWidget.mpv.set_property('hwdec', 'auto' if state == Qt.Checked else 'no')
        self.parent.parent.saveSetting('hwdec', state == Qt.Checked)
        self.parent.parent.hardwareDecoding = (state == Qt.Checked)
项目:vidcutter    作者:ozmartian    | 项目源码 | 文件源码
def keepAspectRatio(self, state: int) -> None:
        self.parent.parent.mpvWidget.mpv.set_option('keepaspect', state == Qt.Checked)
        self.parent.settings.setValue('aspectRatio', 'keep' if state == Qt.Checked else 'stretch')
        self.parent.parent.keepRatio = (state == Qt.Checked)
项目:vidcutter    作者:ozmartian    | 项目源码 | 文件源码
def setSmartCut(self, state: int) -> None:
        self.parent.parent.toggleSmartCut(state == Qt.Checked)
项目:vidcutter    作者:ozmartian    | 项目源码 | 文件源码
def keepClips(self, state: int) -> None:
        self.parent.parent.saveSetting('keepClips', state == Qt.Checked)
        self.parent.parent.keepClips = (state == Qt.Checked)
项目:hacked_cnc    作者:hackerspace    | 项目源码 | 文件源码
def handle_response(self, idx, txt):
        root = self.comtree.invisibleRootItem()
        item = root.child(idx)

        item.setText(0, time.strftime("%Y.%m.%d. %H:%M:%S", time.localtime()))
        if not txt:
            txt = 'ok'
        item.setText(2, txt)
        item.setCheckState(0, Qt.Checked)
        self.comtree.scrollToItem(item)

        cmd = item.text(1)

        proc_events()

        if 'G0' in cmd or 'G1' in cmd:
            x, y, z = parse.xyz(cmd[2:])
            # should probably emit signals

            self.current_x = x
            self.current_y = y
            self.current_z = z

        if 'G38.2' in cmd:
            try:
                # e.g. Probe not tripped from LinuxCNC
                # (we get error message from backend)
                if 'error' in txt:
                    z = -999.0
                else:
                    z = parse.probe(txt)
            except:
                self.err('Unable to parse probe: {}'.format(txt))
                self.err('Is your flavor ({}) correct?'.format(self.flavor))
                z = -999.0

            self.gl.result.data.append((self.current_x, self.current_y, z))
            self.update_result()
            self['probe result.lowest'] = min(self['probe result.lowest'], z)
            self['probe result.highest'] = max(self['probe result.highest'], z)
            self['probe result.last'] = z
项目:Mac-Python-3.X    作者:L1nwatch    | 项目源码 | 文件源码
def changeIcon(self):
        icon = QIcon()

        for row in range(self.imagesTable.rowCount()):
            item0 = self.imagesTable.item(row, 0)
            item1 = self.imagesTable.item(row, 1)
            item2 = self.imagesTable.item(row, 2)

            if item0.checkState() == Qt.Checked:
                if item1.text() == "Normal":
                    mode = QIcon.Normal
                elif item1.text() == "Active":
                    mode = QIcon.Active
                elif item1.text() == "Disabled":
                    mode = QIcon.Disabled
                else:
                    mode = QIcon.Selected

                if item2.text() == "On":
                    state = QIcon.On
                else:
                    state = QIcon.Off

                fileName = item0.data(Qt.UserRole)
                image = QImage(fileName)
                if not image.isNull():
                    icon.addPixmap(QPixmap.fromImage(image), mode, state)

        self.previewArea.setIcon(icon)
项目:Mac-Python-3.X    作者:L1nwatch    | 项目源码 | 文件源码
def addImage(self):
        fileNames, _ = QFileDialog.getOpenFileNames(self, "Open Images", '',
                "Images (*.png *.xpm *.jpg);;All Files (*)")

        for fileName in fileNames:
            row = self.imagesTable.rowCount()
            self.imagesTable.setRowCount(row + 1)

            imageName = QFileInfo(fileName).baseName()
            item0 = QTableWidgetItem(imageName)
            item0.setData(Qt.UserRole, fileName)
            item0.setFlags(item0.flags() & ~Qt.ItemIsEditable)

            item1 = QTableWidgetItem("Normal")
            item2 = QTableWidgetItem("Off")

            if self.guessModeStateAct.isChecked():
                if '_act' in fileName:
                    item1.setText("Active")
                elif '_dis' in fileName:
                    item1.setText("Disabled")
                elif '_sel' in fileName:
                    item1.setText("Selected")

                if '_on' in fileName:
                    item2.setText("On")

            self.imagesTable.setItem(row, 0, item0)
            self.imagesTable.setItem(row, 1, item1)
            self.imagesTable.setItem(row, 2, item2)
            self.imagesTable.openPersistentEditor(item1)
            self.imagesTable.openPersistentEditor(item2)

            item0.setCheckState(Qt.Checked)
项目:examples    作者:pyqt    | 项目源码 | 文件源码
def changeIcon(self):
        icon = QIcon()

        for row in range(self.imagesTable.rowCount()):
            item0 = self.imagesTable.item(row, 0)
            item1 = self.imagesTable.item(row, 1)
            item2 = self.imagesTable.item(row, 2)

            if item0.checkState() == Qt.Checked:
                if item1.text() == "Normal":
                    mode = QIcon.Normal
                elif item1.text() == "Active":
                    mode = QIcon.Active
                elif item1.text() == "Disabled":
                    mode = QIcon.Disabled
                else:
                    mode = QIcon.Selected

                if item2.text() == "On":
                    state = QIcon.On
                else:
                    state = QIcon.Off

                fileName = item0.data(Qt.UserRole)
                image = QImage(fileName)
                if not image.isNull():
                    icon.addPixmap(QPixmap.fromImage(image), mode, state)

        self.previewArea.setIcon(icon)
项目:examples    作者:pyqt    | 项目源码 | 文件源码
def addImage(self):
        fileNames, _ = QFileDialog.getOpenFileNames(self, "Open Images", '',
                "Images (*.png *.xpm *.jpg);;All Files (*)")

        for fileName in fileNames:
            row = self.imagesTable.rowCount()
            self.imagesTable.setRowCount(row + 1)

            imageName = QFileInfo(fileName).baseName()
            item0 = QTableWidgetItem(imageName)
            item0.setData(Qt.UserRole, fileName)
            item0.setFlags(item0.flags() & ~Qt.ItemIsEditable)

            item1 = QTableWidgetItem("Normal")
            item2 = QTableWidgetItem("Off")

            if self.guessModeStateAct.isChecked():
                if '_act' in fileName:
                    item1.setText("Active")
                elif '_dis' in fileName:
                    item1.setText("Disabled")
                elif '_sel' in fileName:
                    item1.setText("Selected")

                if '_on' in fileName:
                    item2.setText("On")

            self.imagesTable.setItem(row, 0, item0)
            self.imagesTable.setItem(row, 1, item1)
            self.imagesTable.setItem(row, 2, item2)
            self.imagesTable.openPersistentEditor(item1)
            self.imagesTable.openPersistentEditor(item2)

            item0.setCheckState(Qt.Checked)
项目:Serial    作者:baronleonardo    | 项目源码 | 文件源码
def on_autoscroll_state_changed(self, state):
        if state == Qt.Checked:
            self.is_auto_scrolling = True

        elif state == Qt.Unchecked:
            self.is_auto_scrolling = False
项目:IDACyber    作者:patois    | 项目源码 | 文件源码
def _toggle_sync(self, state):
        self.pw.set_sync_state(state == Qt.Checked)
项目:bit-torrent    作者:borzunov    | 项目源码 | 文件源码
def _traverse_file_tree(self, name: str, node: FileTreeNode, parent: QWidget):
        item = QTreeWidgetItem(parent)
        item.setCheckState(0, Qt.Checked)
        item.setText(0, name)
        if isinstance(node, FileInfo):
            item.setText(1, humanize_size(node.length))
            item.setIcon(0, file_icon)
            self._file_items.append((node, item))
            return

        item.setIcon(0, directory_icon)
        for name, child in node.items():
            self._traverse_file_tree(name, child, item)
项目:bit-torrent    作者:borzunov    | 项目源码 | 文件源码
def _update_checkboxes(self, item: QTreeWidgetItem, column: int):
        if column != 0:
            return

        new_check_state = item.checkState(0)
        self._set_check_state_to_tree(item, new_check_state)

        while True:
            item = item.parent()
            if item is None:
                break

            has_checked_children = False
            has_partially_checked_children = False
            has_unchecked_children = False
            for i in range(item.childCount()):
                state = item.child(i).checkState(0)
                if state == Qt.Checked:
                    has_checked_children = True
                elif state == Qt.PartiallyChecked:
                    has_partially_checked_children = True
                else:
                    has_unchecked_children = True

            if not has_partially_checked_children and not has_unchecked_children:
                new_state = Qt.Checked
            elif has_checked_children or has_partially_checked_children:
                new_state = Qt.PartiallyChecked
            else:
                new_state = Qt.Unchecked
            item.setCheckState(0, new_state)

        self._update_selection_label()
项目:bit-torrent    作者:borzunov    | 项目源码 | 文件源码
def submit_torrent(self):
        self._torrent_info.download_dir = self._download_dir
        self._control.last_download_dir = os.path.abspath(self._download_dir)

        file_paths = []
        for node, item in self._file_items:
            if item.checkState(0) == Qt.Checked:
                file_paths.append(node.path)
        if not self._torrent_info.download_info.single_file_mode:
            self._torrent_info.download_info.select_files(file_paths, 'whitelist')

        self._control_thread.loop.call_soon_threadsafe(self._control.add, self._torrent_info)

        self.close()
项目:urh    作者:jopohl    | 项目源码 | 文件源码
def show(self, value: bool):
        value = Qt.Checked if value else Qt.Unchecked

        if not self.is_group:
            self.protocol.show = value
            self.protocol.qt_signals.show_state_changed.emit()
        else:
            for child in self.__childItems:
                child.__itemData.show = value
            if self.childCount() > 0:
                self.__childItems[0].__itemData.qt_signals.show_state_changed.emit()
项目:urh    作者:jopohl    | 项目源码 | 文件源码
def group_check_state(self):
        if not self.is_group:
            return None

        if self.childCount() == 0:
            return Qt.Unchecked

        if all(child.show for child in self.children):
            return Qt.Checked
        elif any(child.show for child in self.children):
            return Qt.PartiallyChecked
        else:
            return Qt.Unchecked
项目:urh    作者:jopohl    | 项目源码 | 文件源码
def fuzzAll(self):
        unfuzzedLabels = [label for label in self.labels if not label.fuzz_me]
        for label in unfuzzedLabels:
            label.fuzz_me = Qt.Checked
            self.protolabel_fuzzing_status_changed.emit(label)
项目:urh    作者:jopohl    | 项目源码 | 文件源码
def from_xml(cls, tag: ET.Element, field_types_by_caption=None):
        """

        :param tag:
        :type field_types_by_caption: dict[str, FieldType]
        :return:
        """
        field_types_by_caption = dict() if field_types_by_caption is None else field_types_by_caption

        name = tag.get("name")
        start, end = int(tag.get("start", 0)), int(tag.get("end", 0)) - 1
        color_index = int(tag.get("color_index", 0))

        result = ProtocolLabel(name=name, start=start, end=end, color_index=color_index)
        result.apply_decoding = True if tag.get("apply_decoding", 'True') == "True" else False
        result.show = Qt.Checked if Formatter.str2val(tag.get("show", 0), int) else Qt.Unchecked
        result.fuzz_me = Qt.Checked if Formatter.str2val(tag.get("fuzz_me", 0), int) else Qt.Unchecked
        result.fuzz_values = tag.get("fuzz_values", "").split(",")
        result.display_format_index = int(tag.get("display_format_index", 0))
        result.auto_created = True if tag.get("auto_created", 'False') == "True" else False

        if result.name in field_types_by_caption:
            result.field_type = field_types_by_caption[result.name]
        else:
            result.field_type = None

        return result
项目:urh    作者:jopohl    | 项目源码 | 文件源码
def __init__(self, signal: Signal):
        self.messages = []  # type: list[Message]
        self.signal = signal
        self.filename = self.signal.filename if self.signal is not None else ""

        self.__name = "Blank"  # Fallback if Signal has no Name

        self.show = Qt.Checked  # Show in Compare Frame?
        self.qt_signals = ProtocolAnalyzerSignals()

        self.decoder = Encoding(["Non Return To Zero (NRZ)"])  # For Default Encoding of Protocol

        self.message_types = [MessageType("default")]
项目:urh    作者:jopohl    | 项目源码 | 文件源码
def enabled(self, value: bool):
        if value != self.__enabled:
            self.__enabled = Qt.Checked if value else Qt.Unchecked
            self.enabled_changed.emit()
项目:Osdag    作者:osdag-admin    | 项目源码 | 文件源码
def call_3DBeam(self,bgcolor):
        """
        Creating and displaying 3D Beam
        """
        self.display.EraseAll()
        self.ui.chkBxBeam.setChecked(Qt.Checked)
        if self.ui.chkBxBeam.isChecked():
            self.ui.chkBxCol.setChecked(Qt.Unchecked)
            self.ui.chkBxSeatAngle.setChecked(Qt.Unchecked)
            self.ui.btn3D.setChecked(Qt.Unchecked)
            self.ui.mytabWidget.setCurrentIndex(0)

        self.commLogicObj.display_3DModel("Beam",bgcolor)
项目:Osdag    作者:osdag-admin    | 项目源码 | 文件源码
def call_3DColumn(self,bgcolor):
        """
        """
        self.display.EraseAll()
        self.ui.chkBxCol.setChecked(Qt.Checked)
        if self.ui.chkBxCol.isChecked():
            self.ui.chkBxBeam.setChecked(Qt.Unchecked)
            self.ui.chkBxSeatAngle.setChecked(Qt.Unchecked)
            self.ui.btn3D.setChecked(Qt.Unchecked)
            self.ui.mytabWidget.setCurrentIndex(0)
        self.commLogicObj.display_3DModel("Column",bgcolor)
项目:Osdag    作者:osdag-admin    | 项目源码 | 文件源码
def call_3DSeatAngle(self,bgcolor):
        """Displaying Seat Angle in 3D
        """
        self.display.EraseAll()
        self.ui.chkBxSeatAngle.setChecked(Qt.Checked)
        if self.ui.chkBxSeatAngle.isChecked():
            self.ui.chkBxBeam.setChecked(Qt.Unchecked)
            self.ui.chkBxCol.setChecked(Qt.Unchecked)
            self.ui.btn3D.setChecked(Qt.Unchecked)
            self.ui.mytabWidget.setCurrentIndex(0)
        self.commLogicObj.display_3DModel("SeatAngle", bgcolor)
项目:Osdag    作者:osdag-admin    | 项目源码 | 文件源码
def call_3DBeam(self,bgcolor):
        '''
        Creating and displaying 3D Beam
        '''
        self.ui.chkBxBeam.setChecked(Qt.Checked)
        if self.ui.chkBxBeam.isChecked():
            self.ui.chkBxCol.setChecked(Qt.Unchecked)
            self.ui.chkBxFinplate.setChecked(Qt.Unchecked)
            self.ui.btn3D.setChecked(Qt.Unchecked)
            self.ui.mytabWidget.setCurrentIndex(0)

        self.commLogicObj.display_3DModel("Beam",bgcolor)
项目:Osdag    作者:osdag-admin    | 项目源码 | 文件源码
def call_3DColumn(self,bgcolor):
        '''
        '''
        self.ui.chkBxCol.setChecked(Qt.Checked)
        if self.ui.chkBxCol.isChecked():
            self.ui.chkBxBeam.setChecked(Qt.Unchecked)
            self.ui.chkBxFinplate.setChecked(Qt.Unchecked)
            self.ui.btn3D.setChecked(Qt.Unchecked)
            self.ui.mytabWidget.setCurrentIndex(0)
        self.commLogicObj.display_3DModel("Column",bgcolor)
项目:Osdag    作者:osdag-admin    | 项目源码 | 文件源码
def call_3d_model(self, bgcolor):
        self.ui.btn3D.setChecked(Qt.Checked)
        if self.ui.btn3D.isChecked():
            self.ui.chkBxCol.setChecked(Qt.Unchecked)
            self.ui.chkBxEndplate.setChecked(Qt.Unchecked)
            self.ui.chkBxBeam.setChecked(Qt.Unchecked)
        self.commLogicObj.display_3DModel("Model",bgcolor)
项目:Osdag    作者:osdag-admin    | 项目源码 | 文件源码
def call_3d_beam(self,bgcolor):
        '''
        Creating and displaying 3D Beam
        '''
        self.ui.chkBxBeam.setChecked(Qt.Checked)
        if self.ui.chkBxBeam.isChecked():
            self.ui.chkBxCol.setChecked(Qt.Unchecked)
            self.ui.chkBxEndplate.setChecked(Qt.Unchecked)
            self.ui.btn3D.setChecked(Qt.Unchecked)
            self.ui.mytabWidget.setCurrentIndex(0)

        self.commLogicObj.display_3DModel("Beam",bgcolor)
项目:Osdag    作者:osdag-admin    | 项目源码 | 文件源码
def call_3d_column(self,bgcolor):
        '''
        '''
        self.ui.chkBxCol.setChecked(Qt.Checked)
        if self.ui.chkBxCol.isChecked():
            self.ui.chkBxBeam.setChecked(Qt.Unchecked)
            self.ui.chkBxEndplate.setChecked(Qt.Unchecked)
            self.ui.btn3D.setChecked(Qt.Unchecked)
            self.ui.mytabWidget.setCurrentIndex(0)
        self.commLogicObj.display_3DModel("Column",bgcolor)
项目:Osdag    作者:osdag-admin    | 项目源码 | 文件源码
def call_3d_endplate(self,bgcolor):
        '''Displaying EndPlate in 3D
        '''
        self.ui.chkBxEndplate.setChecked(Qt.Checked)
        if self.ui.chkBxEndplate.isChecked():
            self.ui.chkBxBeam.setChecked(Qt.Unchecked)
            self.ui.chkBxCol.setChecked(Qt.Unchecked)
            self.ui.btn3D.setChecked(Qt.Unchecked)
            self.ui.mytabWidget.setCurrentIndex(0)

        self.commLogicObj.display_3DModel("Plate",bgcolor)
项目:Osdag    作者:osdag-admin    | 项目源码 | 文件源码
def call_3d_model(self,bgcolor):
        """

        :return:
        """
        self.ui.btn3D.setChecked(Qt.Checked)
        if self.ui.btn3D.isChecked():
            self.ui.chkBxBeam.setChecked(Qt.Unchecked)
            self.ui.chkBxCol.setChecked(Qt.Unchecked)
            self.ui.checkBoxCleat.setChecked(Qt.Unchecked)
        self.commLogicObj.display_3DModel("Model",bgcolor)
项目:Osdag    作者:osdag-admin    | 项目源码 | 文件源码
def call_3d_column(self,bgcolor):
        """

        :return:
        """
        self.ui.chkBxCol.setChecked(Qt.Checked)
        if self.ui.chkBxCol.isChecked():
            self.ui.chkBxBeam.setChecked(Qt.Unchecked)
            self.ui.checkBoxCleat.setChecked(Qt.Unchecked)
            self.ui.btn3D.setChecked(Qt.Unchecked)
            self.ui.mytabWidget.setCurrentIndex(0)
        self.commLogicObj.display_3DModel("Column",bgcolor)
项目:Osdag    作者:osdag-admin    | 项目源码 | 文件源码
def call_3d_cleatangle(self,bgcolor):
        '''Displaying FinPlate in 3D
        '''
        self.ui.checkBoxCleat.setChecked(Qt.Checked)
        if self.ui.checkBoxCleat.isChecked():
            self.ui.chkBxBeam.setChecked(Qt.Unchecked)
            self.ui.chkBxCol.setChecked(Qt.Unchecked)
            self.ui.btn3D.setChecked(Qt.Unchecked)
            self.ui.mytabWidget.setCurrentIndex(0)
        self.commLogicObj.display_3DModel("cleatAngle",bgcolor)
项目:pyqt5-example    作者:guinslym    | 项目源码 | 文件源码
def changeIcon(self):
        icon = QIcon()

        for row in range(self.imagesTable.rowCount()):
            item0 = self.imagesTable.item(row, 0)
            item1 = self.imagesTable.item(row, 1)
            item2 = self.imagesTable.item(row, 2)

            if item0.checkState() == Qt.Checked:
                if item1.text() == "Normal":
                    mode = QIcon.Normal
                elif item1.text() == "Active":
                    mode = QIcon.Active
                elif item1.text() == "Disabled":
                    mode = QIcon.Disabled
                else:
                    mode = QIcon.Selected

                if item2.text() == "On":
                    state = QIcon.On
                else:
                    state = QIcon.Off

                fileName = item0.data(Qt.UserRole)
                image = QImage(fileName)
                if not image.isNull():
                    icon.addPixmap(QPixmap.fromImage(image), mode, state)

        self.previewArea.setIcon(icon)
项目:pyqt5-example    作者:guinslym    | 项目源码 | 文件源码
def addImage(self):
        fileNames, _ = QFileDialog.getOpenFileNames(self, "Open Images", '',
                "Images (*.png *.xpm *.jpg);;All Files (*)")

        for fileName in fileNames:
            row = self.imagesTable.rowCount()
            self.imagesTable.setRowCount(row + 1)

            imageName = QFileInfo(fileName).baseName()
            item0 = QTableWidgetItem(imageName)
            item0.setData(Qt.UserRole, fileName)
            item0.setFlags(item0.flags() & ~Qt.ItemIsEditable)

            item1 = QTableWidgetItem("Normal")
            item2 = QTableWidgetItem("Off")

            if self.guessModeStateAct.isChecked():
                if '_act' in fileName:
                    item1.setText("Active")
                elif '_dis' in fileName:
                    item1.setText("Disabled")
                elif '_sel' in fileName:
                    item1.setText("Selected")

                if '_on' in fileName:
                    item2.setText("On")

            self.imagesTable.setItem(row, 0, item0)
            self.imagesTable.setItem(row, 1, item1)
            self.imagesTable.setItem(row, 2, item2)
            self.imagesTable.openPersistentEditor(item1)
            self.imagesTable.openPersistentEditor(item2)

            item0.setCheckState(Qt.Checked)
项目:Thread-Chat-Client    作者:Nyamcat    | 项目源码 | 文件源码
def print_list(self, state):
        string = ''
        id_string = ''
        nick_list = []

        self.friend_id = []

        if state == Qt.Checked:
            for x in range(len(tmp)):
                if tmp[x].isChecked() == True:
                    string = tmp[x].text()
                    nick_list.append(string)
                    id_string = tmp2[x]
                    self.friend_id.append(id_string)
        else:
            for x in range(len(tmp)):
                if tmp[x].isChecked() == True:
                    string = tmp[x].text()
                    nick_list.append(string)
                    id_string = tmp2[x]
                    self.friend_id.append(id_string)

        string = ''

        for x in range(len(nick_list)):
            temp = nick_list[x]
            string = string + '\n' + temp
        self.room_member.setPlainText(string)
项目:urh    作者:jopohl    | 项目源码 | 文件源码
def test_generator_label(self):
        labels = self.cframe.proto_analyzer.protocol_labels
        self.assertEqual(len(labels), 2)

        # Open Protocol in Generator
        self.form.ui.tabWidget.setCurrentIndex(2)
        item = self.gframe.tree_model.rootItem.children[0].children[0]
        index = self.gframe.tree_model.createIndex(0, 0, item)
        rect = self.gframe.ui.treeProtocols.visualRect(index)
        self.assertEqual(len(self.gframe.ui.treeProtocols.selectedIndexes()), 0)
        QTest.mousePress(self.gframe.ui.treeProtocols.viewport(), Qt.LeftButton, pos=rect.center())
        self.assertEqual(self.gframe.ui.treeProtocols.selectedIndexes()[0], index)
        mimedata = self.gframe.tree_model.mimeData(self.gframe.ui.treeProtocols.selectedIndexes())
        self.gframe.table_model.dropMimeData(mimedata, 1, -1, -1, self.gframe.table_model.createIndex(0, 0))
        self.assertEqual(self.gframe.table_model.row_count, 3)

        # Check Label in Generator
        labels = self.gframe.table_model.protocol.protocol_labels
        self.assertEqual(len(labels), 2)

        # Fuzz Label
        lbl = copy.deepcopy(self.gframe.table_model.protocol.messages[0].message_type[1])
        self.gframe.table_model.protocol.messages[0].message_type[1] = lbl
        lbl.fuzz_values.append("1")
        lbl.add_fuzz_value()
        lbl.add_fuzz_value()
        lbl.add_fuzz_value()
        lbl.add_fuzz_value()
        lbl.fuzz_me = Qt.Checked
        self.assertEqual(len(lbl.fuzz_values), 5)
        self.gframe.refresh_label_list()
        self.gframe.refresh_table()
        self.gframe.ui.btnFuzz.setEnabled(True)
        self.gframe.ui.btnFuzz.click()
        self.assertTrue(lbl.active_fuzzing)
        self.assertIn(lbl, self.gframe.table_model.protocol.messages[0].message_type)
        self.assertEqual(self.gframe.table_model.row_count, 4 + 3)

        # Check if Background for fuzzed labels is drawn correctly
        self.__check_background_is_drawn(lbl, 43, 43)

        # Delete a line
        old_row_count = self.gframe.table_model.row_count
        self.gframe.ui.tableMessages.selectRow(2)
        QTest.keyClick(self.gframe.ui.tableMessages, Qt.Key_Delete)
        self.assertEqual(self.gframe.table_model.row_count, old_row_count - 1)

        self.__check_background_is_drawn(lbl, 43, 43)

        # Remove everything
        for i in range(old_row_count):
            self.gframe.ui.tableMessages.selectRow(0)
            QTest.keyClick(self.gframe.ui.tableMessages, Qt.Key_Delete)

        self.assertEqual(self.gframe.table_model.row_count, 0)