Skip to content

Commit

Permalink
Remove references to QPyNullVariant
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed May 13, 2016
1 parent 89b7a4a commit 25f2e63
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 22 deletions.
11 changes: 5 additions & 6 deletions python/plugins/db_manager/db_plugins/oracle/connector.py
Expand Up @@ -23,14 +23,13 @@
***************************************************************************/
"""

from qgis.PyQt.QtCore import QPyNullVariant
from qgis.PyQt.QtSql import QSqlDatabase

from ..connector import DBConnector
from ..plugin import ConnectionError, DbError, Table

import os
from qgis.core import QGis, QgsApplication
from qgis.core import QGis, QgsApplication, NULL
from . import QtSqlDB
import sqlite3

Expand Down Expand Up @@ -611,7 +610,7 @@ def getVectorTables(self, schema=None):
for i, tbl in enumerate(lst_tables):
item = list(tbl)
detectedSrid = item.pop()
if isinstance(detectedSrid, QPyNullVariant):
if detectedSrid == NULL:
detectedSrid = u"-1"
else:
detectedSrid = int(detectedSrid)
Expand Down Expand Up @@ -779,7 +778,7 @@ def getTableGeomTypes(self, table, geomCol):
geomtypes = []
srids = []
for row in rows:
if isinstance(row[1], QPyNullVariant):
if row[1] == NULL:
srids.append(-1)
else:
srids.append(int(row[1]))
Expand Down Expand Up @@ -831,7 +830,7 @@ def getTableRowEstimation(self, table):
res = self._fetchone(c)
c.close()

if not res or isinstance(res[0], QPyNullVariant):
if not res or res[0] == NULL:
return 0
else:
return int(res[0])
Expand Down Expand Up @@ -1113,7 +1112,7 @@ def getTableEstimatedExtent(self, table, geom):

if not res_d or len(res_d) < 2:
return None
elif isinstance(res_d[0], QPyNullVariant):
elif res_d[0] == NULL:
return None
else:
res.extend(res_d)
Expand Down
18 changes: 9 additions & 9 deletions python/plugins/db_manager/db_plugins/oracle/plugin.py
Expand Up @@ -26,11 +26,11 @@
# this will disable the dbplugin if the connector raise an ImportError
from .connector import OracleDBConnector

from qgis.PyQt.QtCore import Qt, QSettings, QPyNullVariant
from qgis.PyQt.QtCore import Qt, QSettings
from qgis.PyQt.QtGui import QIcon, QKeySequence
from qgis.PyQt.QtWidgets import QAction, QApplication, QMessageBox

from qgis.core import QgsVectorLayer
from qgis.core import QgsVectorLayer, NULL

from ..plugin import ConnectionError, InvalidDataException, DBPlugin, \
Database, Schema, Table, VectorTable, TableField, TableConstraint, \
Expand Down Expand Up @@ -487,12 +487,12 @@ def __init__(self, row, table):

self.primaryKey = False
self.num = int(self.num)
if isinstance(self.charMaxLen, QPyNullVariant):
if self.charMaxLen == NULL:
self.charMaxLen = None
else:
self.charMaxLen = int(self.charMaxLen)

if isinstance(self.modifier, QPyNullVariant):
if self.modifier == NULL:
self.modifier = None
else:
self.modifier = int(self.modifier)
Expand All @@ -502,7 +502,7 @@ def __init__(self, row, table):
else:
self.notNull = True

if isinstance(self.comment, QPyNullVariant):
if self.comment == NULL:
self.comment = u""

# find out whether fields are part of primary key
Expand Down Expand Up @@ -571,22 +571,22 @@ def __init__(self, row, table):
else:
self.type = ORTableConstraint.TypeUnknown

if isinstance(row[6], QPyNullVariant):
if row[6] == NULL:
self.checkSource = u""
else:
self.checkSource = row[6]

if isinstance(row[8], QPyNullVariant):
if row[8] == NULL:
self.foreignTable = u""
else:
self.foreignTable = row[8]

if isinstance(row[7], QPyNullVariant):
if row[7] == NULL:
self.foreignOnDelete = u""
else:
self.foreignOnDelete = row[7]

if isinstance(row[9], QPyNullVariant):
if row[9] == NULL:
self.foreignKey = u""
else:
self.foreignKey = row[9]
Expand Down
5 changes: 3 additions & 2 deletions python/plugins/processing/core/ProcessingConfig.py
Expand Up @@ -27,8 +27,9 @@

import os

from qgis.PyQt.QtCore import QPyNullVariant, QCoreApplication, QSettings, QObject, pyqtSignal
from qgis.PyQt.QtCore import QCoreApplication, QSettings, QObject, pyqtSignal
from qgis.PyQt.QtGui import QIcon
from qgis.core import NULL
from processing.tools.system import defaultOutputFolder
import processing.tools.dataobjects

Expand Down Expand Up @@ -196,7 +197,7 @@ def getSetting(name):
if name in ProcessingConfig.settings.keys():
v = ProcessingConfig.settings[name].value
try:
if isinstance(v, QPyNullVariant):
if v == NULL:
v = None
except:
pass
Expand Down
12 changes: 7 additions & 5 deletions python/plugins/processing/gui/ConfigDialog.py
Expand Up @@ -29,8 +29,8 @@

from qgis.PyQt import uic
from qgis.PyQt.QtCore import (Qt,
QEvent,
QPyNullVariant)
QEvent
)
from qgis.PyQt.QtWidgets import (QFileDialog,
QDialog,
QStyle,
Expand All @@ -45,8 +45,10 @@
QStandardItemModel,
QStandardItem)

from qgis.gui import QgsDoubleSpinBox
from qgis.gui import QgsSpinBox
from qgis.gui import (QgsDoubleSpinBox,
QgsSpinBox
)
from qgis.core import NULL

from processing.core.ProcessingConfig import (ProcessingConfig,
settingsWatcher,
Expand Down Expand Up @@ -340,7 +342,7 @@ def eventFilter(self, editor, event):
return QStyledItemDelegate.eventFilter(self, editor, event)

def convertValue(self, value):
if value is None or isinstance(value, QPyNullVariant):
if value is None or value == NULL:
return ""
try:
return int(value)
Expand Down

0 comments on commit 25f2e63

Please sign in to comment.