mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-16 00:03:12 -04:00
replace foo.replace( QRegExp(regexp), bar) with re.sub(regexp,bar,foo) (fixes #8066)
This commit is contained in:
parent
b98e1e05cb
commit
192e13013b
@ -33,6 +33,7 @@ from widgetBatchBase import GdalToolsBaseBatchWidget as BaseBatchWidget
|
|||||||
import GdalTools_utils as Utils
|
import GdalTools_utils as Utils
|
||||||
|
|
||||||
import os.path
|
import os.path
|
||||||
|
import re
|
||||||
|
|
||||||
class GdalToolsDialog( QWidget, Ui_Widget, BaseBatchWidget ):
|
class GdalToolsDialog( QWidget, Ui_Widget, BaseBatchWidget ):
|
||||||
def __init__( self, iface ):
|
def __init__( self, iface ):
|
||||||
@ -228,7 +229,7 @@ class GdalToolsDialog( QWidget, Ui_Widget, BaseBatchWidget ):
|
|||||||
for f in files:
|
for f in files:
|
||||||
self.inFiles.append( inDir + "/" + f )
|
self.inFiles.append( inDir + "/" + f )
|
||||||
if outDir != None:
|
if outDir != None:
|
||||||
outFile = f.replace( QRegExp( "\.[a-zA-Z0-9]{2,4}" ), outExt )
|
outFile = re.sub( f, "\.[a-zA-Z0-9]{2,4}", outExt )
|
||||||
self.outFiles.append( outDir + "/" + outFile )
|
self.outFiles.append( outDir + "/" + outFile )
|
||||||
|
|
||||||
self.errors = QStringList()
|
self.errors = QStringList()
|
||||||
|
@ -33,6 +33,8 @@ from widgetBatchBase import GdalToolsBaseBatchWidget as BaseBatchWidget
|
|||||||
from dialogSRS import GdalToolsSRSDialog as SRSDialog
|
from dialogSRS import GdalToolsSRSDialog as SRSDialog
|
||||||
import GdalTools_utils as Utils
|
import GdalTools_utils as Utils
|
||||||
|
|
||||||
|
import re
|
||||||
|
|
||||||
class GdalToolsDialog(QWidget, Ui_Widget, BaseBatchWidget):
|
class GdalToolsDialog(QWidget, Ui_Widget, BaseBatchWidget):
|
||||||
|
|
||||||
def __init__(self, iface):
|
def __init__(self, iface):
|
||||||
@ -298,7 +300,7 @@ class GdalToolsDialog(QWidget, Ui_Widget, BaseBatchWidget):
|
|||||||
for f in files:
|
for f in files:
|
||||||
self.inFiles.append( inDir + "/" + f )
|
self.inFiles.append( inDir + "/" + f )
|
||||||
if outDir != None:
|
if outDir != None:
|
||||||
outFile = f.replace( QRegExp( "\.[a-zA-Z0-9]{2,4}" ), outExt )
|
outFile = re.sub( "\.[a-zA-Z0-9]{2,4}", outExt, f )
|
||||||
self.outFiles.append( outDir + "/" + outFile )
|
self.outFiles.append( outDir + "/" + outFile )
|
||||||
|
|
||||||
self.errors = QStringList()
|
self.errors = QStringList()
|
||||||
|
@ -34,6 +34,8 @@ from .ui.ui_DlgSqlWindow import Ui_DbManagerDlgSqlWindow as Ui_Dialog
|
|||||||
from .highlighter import SqlHighlighter
|
from .highlighter import SqlHighlighter
|
||||||
from .completer import SqlCompleter
|
from .completer import SqlCompleter
|
||||||
|
|
||||||
|
import re
|
||||||
|
|
||||||
class DlgSqlWindow(QDialog, Ui_Dialog):
|
class DlgSqlWindow(QDialog, Ui_Dialog):
|
||||||
|
|
||||||
def __init__(self, iface, db, parent=None):
|
def __init__(self, iface, db, parent=None):
|
||||||
@ -134,7 +136,7 @@ class DlgSqlWindow(QDialog, Ui_Dialog):
|
|||||||
if sql == "":
|
if sql == "":
|
||||||
sql = self.editSql.toPlainText()
|
sql = self.editSql.toPlainText()
|
||||||
# try to sanitize query
|
# try to sanitize query
|
||||||
sql = sql.replace( QRegExp( ";\\s*$" ), "" )
|
sql = re.sub( ";\\s*$", "", sql )
|
||||||
return sql
|
return sql
|
||||||
|
|
||||||
def clearSql(self):
|
def clearSql(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user