Python qgis.PyQt.QtCore.Qt.Unchecked() Examples

The following are 11 code examples of qgis.PyQt.QtCore.Qt.Unchecked(). 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 qgis.PyQt.QtCore.Qt , or try the search function .
Example #1
Source File: selectTaskWizard.py    From DsgTools with GNU General Public License v2.0 6 votes vote down vote up
def validateCurrentPage(self):
        if self.currentId() == 0:
            if self.importRadioButton.checkState() == Qt.Unchecked() and self.createNewRadioButton.checkState() == Qt.Unchecked() and self.installRadioButton.checkState() == Qt.Unchecked():
                errorMsg = self.tr('An option must be chosen!\n')
                QMessageBox.warning(self, self.tr('Error!'), errorMsg)
                return False
            if self.installRadioButton.checkState() == Qt.Checked():
                if self.settingComboBox.currentIndex() == 0:
                    errorMsg = self.tr('A setting must be chosen!\n')
                    QMessageBox.warning(self, self.tr('Error!'), errorMsg)
                    return False
                else:
                    return True
            return True
        else:
            return True 
Example #2
Source File: manageComplex.py    From DsgTools with GNU General Public License v2.0 6 votes vote down vote up
def setEditorData(self, editor, index):
        """
        load data from model to editor
        """
        m = index.model()
        try:
            if index.column() == self.column:
                txt = m.data(index, Qt.DisplayRole)
                checkList = txt[1:-1].split(',')
                for i in range(editor.count()):
                    item = editor.item(i)
                    item.setCheckState(Qt.Checked if item.text() in checkList else Qt.Unchecked)
            else:
                # use default
                QItemDelegate.setEditorData(self, editor, index)
        except:
            pass 
Example #3
Source File: htmlExpansionDialog.py    From qgis-kmltools-plugin with GNU General Public License v2.0 5 votes vote down vote up
def clearAll(self):
        cnt = self.model.rowCount()
        for i in range(0, cnt):
            item = self.model.item(i)
            item.setCheckState(Qt.Unchecked) 
Example #4
Source File: project_configuration_dialog.py    From qfieldsync with GNU Lesser General Public License v3.0 5 votes vote down vote up
def toggle_menu_triggered(self, action):
        """
        Toggles usae of layers
        :param action: the menu action that triggered this
        """
        sync_action = SyncAction.NO_ACTION
        if action in (self.remove_hidden_action, self.remove_all_action):
            sync_action = SyncAction.REMOVE
        elif action in (self.add_all_offline_action, self.add_visible_offline_action):
            sync_action = SyncAction.OFFLINE

        # all layers
        if action in (self.remove_all_action, self.add_all_copy_action, self.add_all_offline_action):
            for i in range(self.layersTable.rowCount()):
                item = self.layersTable.item(i, 0)
                layer_source = item.data(Qt.UserRole)
                old_action = layer_source.action
                available_actions, _ = zip(*layer_source.available_actions)
                if sync_action in available_actions:
                    layer_source.action = sync_action
                    if layer_source.action != old_action:
                        self.project.setDirty(True)
                    layer_source.apply()
        # based on visibility
        elif action in (self.remove_hidden_action, self.add_visible_copy_action, self.add_visible_offline_action):
            visible = Qt.Unchecked if action == self.remove_hidden_action else Qt.Checked
            root = QgsProject.instance().layerTreeRoot()
            for layer in QgsProject.instance().mapLayers().values():
                node = root.findLayer(layer.id())
                if node and node.isVisible() == visible:
                    layer_source = LayerSource(layer)
                    old_action = layer_source.action
                    available_actions, _ = zip(*layer_source.available_actions)
                    if sync_action in available_actions:
                        layer_source.action = sync_action
                        if layer_source.action != old_action:
                            self.project.setDirty(True)
                        layer_source.apply()

        self.reloadProject() 
Example #5
Source File: setupEarthCoverage.py    From DsgTools with GNU General Public License v2.0 5 votes vote down vote up
def checkDelimiters(self, setupDict):
        """
        Check delimiters
        """
        for i in range(self.treeWidget.invisibleRootItem().childCount()):
            areaItem = self.treeWidget.invisibleRootItem().child(i)
            for j in range(self.treeWidget.invisibleRootItem().child(i).childCount()):
                delimiterItem = areaItem.child(j)
                if areaItem.text(0) in list(setupDict.keys()):
                    if delimiterItem.text(1) not in setupDict[areaItem.text(0)]:
                        delimiterItem.setCheckState(1,Qt.Unchecked) 
Example #6
Source File: buttonPropWidget.py    From DsgTools with GNU General Public License v2.0 5 votes vote down vote up
def setInterface(self, parameterDict):
        """
        Sets the interface with a dict in the format:
        {
            'buttonColor':--color of the button--, 
            'buttonToolTip'--button toolTip--, 
            'buttonGroupTag':--group tag of the button--,
            'buttonShortcut':--shortcut for the button--,
            'openForm':--open feature form when digitizing--
        }
        """
        if 'buttonColor' in list(parameterDict.keys()):
            self.colorCheckBox.setCheckState(Qt.Checked)
            R,G,B,A = list(map(int,parameterDict['buttonColor'].split(','))) #QColor only accepts int values
            self.mColorButton.setColor(QColor(R,G,B,A))
        else:
            self.colorCheckBox.setCheckState(Qt.Unchecked) #if 'buttonColor' isn't on dict keys, set colorCheckBox as unchecked
        if 'buttonToolTip' in list(parameterDict.keys()):
            self.tooltipCheckBox.setCheckState(Qt.Checked)
            self.toolTipLineEdit.setText(parameterDict['buttonToolTip'])
        else:
            self.tooltipCheckBox.setCheckState(Qt.Unchecked) #if 'buttonToolTip' isn't on dict keys, set tooltipCheckBox as unchecked
            self.toolTipLineEdit.setText('')
        if 'buttonGroupTag' in list(parameterDict.keys()):
            self.customCategoryCheckBox.setCheckState(Qt.Checked)
            self.customCategoryLineEdit.setText(parameterDict['buttonGroupTag'])
        else:
            self.customCategoryCheckBox.setCheckState(Qt.Unchecked) #if 'buttonGroupTag' isn't on dict keys, set customCategoryCheckBox as unchecked
            self.customCategoryLineEdit.setText('')
        if 'buttonShortcut' in list(parameterDict.keys()):
            self.shortcutCheckBox.setCheckState(Qt.Checked)
            self.shortcutWidget.setShortcut(parameterDict['buttonShortcut'])
        else:
            self.shortcutCheckBox.setCheckState(Qt.Unchecked) #if 'buttonShortcut' isn't on dict keys, set shortcutCheckBox as unchecked
            self.shortcutWidget.clearAll()
        if 'openForm' in list(parameterDict.keys()):
            self.openFormCheckBox.setCheckState(Qt.Checked)
        else:
            self.openFormCheckBox.setCheckState(Qt.Unchecked) #if 'openForm' isn't on dict keys, set openFormCheckBox as unchecked 
Example #7
Source File: manageComplex.py    From DsgTools with GNU General Public License v2.0 5 votes vote down vote up
def createEditor(self, parent, option, index):
        """
        Creates a custom editor to edit value relation data
        """
        # special combobox for field type
        if index.column() == self.column:
            list = QListWidget(parent)
            for item in self.itemsDict:
                listItem = QListWidgetItem(item)
                listItem.setCheckState(Qt.Unchecked)
                list.addItem(listItem)
            return list
        return QItemDelegate.createEditor(self, parent, option, index) 
Example #8
Source File: data_sources_model.py    From quickmapservices with GNU General Public License v2.0 5 votes vote down vote up
def uncheckAll(self):
        for row in range(0, self.rootItem.childCount()):
            groupItem = self.rootItem.child(row)
            groupIndex = self.createIndex(row, self.COLUMN_VISIBILITY, groupItem)
            self.setData(groupIndex, Qt.Unchecked, Qt.CheckStateRole) 
Example #9
Source File: data_sources_model.py    From quickmapservices with GNU General Public License v2.0 5 votes vote down vote up
def saveSettings(self):
        hideDSidList = []
        for groupIndex in range(0, self.rootItem.childCount()):
            groupItem = self.rootItem.child(groupIndex)
            for dsIndex in range(0, groupItem.childCount()):
                dsItem = groupItem.child(dsIndex)
                if dsItem.checkState(self.COLUMN_VISIBILITY) == Qt.Unchecked:
                    hideDSidList.append(dsItem.data(self.COLUMN_GROUP_DS, Qt.UserRole).id)
        PluginSettings.set_hide_ds_id_list(hideDSidList) 
Example #10
Source File: settings.py    From qgis-latlontools-plugin with GNU General Public License v2.0 4 votes vote down vote up
def readSettings(self):
        '''Load the user selected settings. The settings are retained even when
        the user quits QGIS. This just loads the saved information into variables,
        but does not update the widgets. The widgets are updated with showEvent.'''
        qset = QSettings()

        ### CAPTURE SETTINGS ###
        self.captureShowLocation = int(qset.value('/LatLonTools/CaptureShowClickedLocation', Qt.Unchecked))
        self.captureCustomCrsAuthId = qset.value('/LatLonTools/CaptureCustomCrsId', 'EPSG:4326')
        self.captureGeohashPrecision = int(qset.value('/LatLonTools/CaptureGeohashPrecision', 12))
        self.captureDmmPrecision =  int(qset.value('/LatLonTools/CaptureDmmPrecision', 4))
        self.captureUtmPrecision =  int(qset.value('/LatLonTools/CaptureUtmPrecision', 0))
        self.captureAddDmsSpace = int(qset.value('/LatLonTools/CaptureAddDmsSpace', Qt.Checked))
        self.capturePadZeroes = int(qset.value('/LatLonTools/CapturePadZeroes', Qt.Unchecked))
        self.captureMaidenheadPrecision = int(qset.value('/LatLonTools/CaptureMaidenheadPrecision', 3))

        ### EXTERNAL MAP ###
        self.showPlacemark = int(qset.value('/LatLonTools/ShowPlacemark', Qt.Checked))
        self.mapProvider = int(qset.value('/LatLonTools/MapProvider', 0))
        self.mapProviderRight = int(qset.value('/LatLonTools/MapProviderRight', 0))
        self.mapZoom = int(qset.value('/LatLonTools/MapZoom', 13))
        self.externalMapShowLocation = int(qset.value('/LatLonTools/ExternMapShowClickedLocation', Qt.Unchecked))
        self.userMapProviders = qset.value('/LatLonTools/UserMapProviders', [])

        ### Multi-zoom Settings ###
        self.multiZoomCustomCrsAuthId = qset.value('/LatLonTools/MultiZoomCustomCrsId', 'EPSG:4326')

        ### BBOX CAPTURE SETTINGS ###
        self.bBoxCrs = int(qset.value('/LatLonTools/BBoxCrs', 0))  # Specifies WGS 84
        self.bBoxFormat = int(qset.value('/LatLonTools/BBoxFormat', 0))
        self.bBoxDelimiter = qset.value('/LatLonTools/BBoxDelimiter', ',')
        self.bBoxDigits = int(qset.value('/LatLonTools/BBoxDigits', 8))
        self.bBoxPrefix = qset.value('/LatLonTools/BBoxPrefix', '')
        self.bBoxSuffix = qset.value('/LatLonTools/BBoxSuffix', '')

        ### COORDINATE CONVERSION SETTINGS ###
        self.converterCustomCrsAuthId = qset.value('/LatLonTools/ConverterCustomCrsId', 'EPSG:4326')
        self.converterCoordOrder = int(qset.value('/LatLonTools/ConverterCoordOrder', self.OrderYX))
        self.converterDDPrec = int(qset.value('/LatLonTools/ConverterDDPrecision', 2))
        self.converter4326DDPrec = int(qset.value('/LatLonTools/Converter4326DDPrecision', 8))
        self.converterDmsPrec = int(qset.value('/LatLonTools/ConverterDmsPrecision', 0))
        self.converterDmmPrec = int(qset.value('/LatLonTools/ConverterDmmPrecision', 4))
        self.converterUtmPrec = int(qset.value('/LatLonTools/ConverterUtmPrecision', 0))
        self.converterPlusCodeLength = int(qset.value('/LatLonTools/ConverterPlusCodeLength', 10))
        self.converterGeohashPrecision = int(qset.value('/LatLonTools/ConverterGeohashPrecision', 12))
        self.converterMaidenheadPrecision = int(qset.value('/LatLonTools/ConverterMaidenheadPrecision', 3))
        self.converterDelimiter = qset.value('/LatLonTools/ConverterDelimiter', ', ')
        self.converterDdmmssDelimiter = qset.value('/LatLonTools/ConverterDdmmssDelimiter', ', ')
        self.converterAddDmsSpace = int(qset.value('/LatLonTools/ConverterAddDmsSpace', Qt.Checked))
        self.converterPadZeroes = int(qset.value('/LatLonTools/ConverterPadZeroes', Qt.Unchecked)) 
Example #11
Source File: data_sources_model.py    From quickmapservices with GNU General Public License v2.0 4 votes vote down vote up
def __setupModelData(self):
        dsList = DataSourcesList().data_sources.values()
        groupInfoList = GroupsList().groups
        groupsItems = []
        groups = []
        for ds in dsList:
            if ds.group in groups:
                group_item = groupsItems[groups.index(ds.group)]
            else:
                group_item = QTreeWidgetItem()
                group_item.setData(self.COLUMN_GROUP_DS, Qt.DisplayRole, ds.group)
                group_item.setData(self.COLUMN_VISIBILITY, Qt.DisplayRole, "")
                group_item.setData(self.COLUMN_SOURCE, Qt.DisplayRole, ds.category)
                group_item.setCheckState(self.COLUMN_VISIBILITY, Qt.Unchecked)

                groupInfo = groupInfoList.get(ds.group)
                if groupInfo is not None:
                    group_item.setIcon(self.COLUMN_GROUP_DS, QIcon(groupInfo.icon))
                else:
                    group_item.setData(self.COLUMN_GROUP_DS, Qt.DisplayRole, ds.group + " (%s!)" % self.tr("group not found"))
                group_item.setData(self.COLUMN_GROUP_DS, Qt.UserRole, groupInfo)

                groups.append(ds.group)
                groupsItems.append(group_item)
                self.rootItem.addChild(group_item)

            ds_item = QTreeWidgetItem()
            ds_item.setData(self.COLUMN_GROUP_DS, Qt.DisplayRole, ds.alias)
            ds_item.setIcon(self.COLUMN_GROUP_DS, QIcon(ds.icon_path))
            ds_item.setData(self.COLUMN_GROUP_DS, Qt.UserRole, ds)
            ds_item.setData(self.COLUMN_VISIBILITY, Qt.DisplayRole, "")
            ds_item.setData(self.COLUMN_SOURCE, Qt.DisplayRole, ds.category)

            ds_check_state = Qt.Checked
            if ds.id in PluginSettings.get_hide_ds_id_list():
                ds_check_state = Qt.Unchecked
            ds_item.setCheckState(self.COLUMN_VISIBILITY, ds_check_state)

            if group_item.childCount() != 0 and group_item.checkState(1) != ds_check_state:
                group_item.setCheckState(self.COLUMN_VISIBILITY, Qt.PartiallyChecked)
            else:
                group_item.setCheckState(self.COLUMN_VISIBILITY, ds_check_state)

            group_item.addChild(
                ds_item
            )