diff --git a/browsedatasource.py b/browsedatasource.py deleted file mode 100644 index 37135a7..0000000 --- a/browsedatasource.py +++ /dev/null @@ -1,46 +0,0 @@ -# -*- coding: utf-8 -*- - -# Form implementation generated from reading ui file 'C:\Users\DEMO\Dropbox\dev\changeDataSource\browsedatasource.ui' -# -# Created: Wed Nov 04 23:39:53 2015 -# by: PyQt4 UI code generator 4.10.2 -# -# WARNING! All changes made in this file will be lost! - -from builtins import object -from qgis.PyQt import QtCore, QtGui, QtWidgets - -try: - _fromUtf8 = QtCore.QString.fromUtf8 -except AttributeError: - def _fromUtf8(s): - return s - -try: - _encoding = QtWidgets.QApplication.UnicodeUTF8 - def _translate(context, text, disambig): - return QtWidgets.QApplication.translate(context, text, disambig, _encoding) -except AttributeError: - def _translate(context, text, disambig): - return QtWidgets.QApplication.translate(context, text, disambig) - -class Ui_dataSourceBrowser(object): - def setupUi(self, dataSourceBrowser): - dataSourceBrowser.setObjectName(_fromUtf8("dataSourceBrowser")) - dataSourceBrowser.resize(400, 444) - self.buttonBox = QtWidgets.QDialogButtonBox(dataSourceBrowser) - self.buttonBox.setGeometry(QtCore.QRect(50, 400, 341, 32)) - self.buttonBox.setOrientation(QtCore.Qt.Horizontal) - self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok) - self.buttonBox.setObjectName(_fromUtf8("buttonBox")) - self.dataSourceTree = QtWidgets.QTreeView(dataSourceBrowser) - self.dataSourceTree.setGeometry(QtCore.QRect(10, 11, 381, 381)) - self.dataSourceTree.setObjectName(_fromUtf8("dataSourceTree")) - - self.retranslateUi(dataSourceBrowser) - self.buttonBox.accepted.connect(dataSourceBrowser.accept) - self.buttonBox.rejected.connect(dataSourceBrowser.reject) - - def retranslateUi(self, dataSourceBrowser): - dataSourceBrowser.setWindowTitle(_translate("dataSourceBrowser", "Dialog", None)) - diff --git a/changeDataSource.py b/changeDataSource.py index a8a9d9d..f8181b5 100644 --- a/changeDataSource.py +++ b/changeDataSource.py @@ -24,17 +24,14 @@ from __future__ import absolute_import from builtins import range from builtins import object -from PyQt5.QtCore import * -from PyQt5.QtGui import * -from PyQt5.QtXml import * -from PyQt5.QtWidgets import * -from qgis.core import * -# Initialize Qt resources from file resources.py -from . import resources_rc +from qgis.PyQt.QtCore import QCoreApplication, Qt, pyqtSignal, QSettings, QTranslator, qVersion +from qgis.PyQt.QtGui import QIcon, QFontMetrics +from qgis.PyQt.QtWidgets import QTableWidgetItem, QAction, QDialogButtonBox, QLineEdit, QPushButton, QSizePolicy, QToolButton, QStyle, QHeaderView, QApplication +from qgis.core import QgsProject, QgsMapLayer, QgsFeature, QgsGeometry, QgsExpressionContext, QgsExpressionContextScope, QgsExpression, QgsFeatureRequest, Qgis, QgsVectorLayer + # Import the code for the dialog from .changeDataSource_dialog import changeDataSourceDialog,dataSourceBrowser -from .setdatasource import setDataSource -from qgis.gui import QgsMessageBar +from .setDataSource import setDataSource import os.path @@ -169,16 +166,16 @@ def add_action( def initGui(self): """Create the menu entries and toolbar icons inside the QGIS GUI.""" - icon_path = os.path.join(self.plugin_dir,"icon.png") + icon_path = os.path.join(self.plugin_dir, "icon", "icon.png") self.add_action( icon_path, text=self.tr(u'changeDataSource'), callback=self.run, parent=self.iface.mainWindow()) - self.changeDSActionVector = QAction(QIcon(os.path.join(self.plugin_dir,"icon.png")), u"Change vector datasource", self.iface ) - self.changeDSActionRaster = QAction(QIcon(os.path.join(self.plugin_dir,"icon.png")), u"Change raster datasource", self.iface ) - self.iface.addCustomActionForLayerType(self.changeDSActionVector,"", QgsMapLayer.VectorLayer,True) - self.iface.addCustomActionForLayerType(self.changeDSActionRaster,"", QgsMapLayer.RasterLayer,True) + self.changeDSActionVector = QAction(QIcon(os.path.join(self.plugin_dir, "icon", "icon.png")), u"Change vector datasource", self.iface ) + self.changeDSActionRaster = QAction(QIcon(os.path.join(self.plugin_dir, "icon", "icon.png")), u"Change raster datasource", self.iface ) + self.iface.addCustomActionForLayerType(self.changeDSActionVector,"", QgsMapLayer.LayerType.VectorLayer,True) + self.iface.addCustomActionForLayerType(self.changeDSActionRaster,"", QgsMapLayer.LayerType.RasterLayer,True) self.changeDSTool = setDataSource(self, ) self.browserDialog = dataSourceBrowser() self.dlg.handleBadLayersCheckbox.hide() @@ -192,9 +189,9 @@ def connectSignals(self): self.changeDSActionRaster.triggered.connect(self.changeLayerDS) self.dlg.replaceButton.clicked.connect(self.replaceDS) self.dlg.layerTable.verticalHeader().sectionClicked.connect(self.activateSelection) - self.dlg.buttonBox.button(QDialogButtonBox.Reset).clicked.connect(lambda: self.buttonBoxHub("Reset")) - self.dlg.buttonBox.button(QDialogButtonBox.Apply).clicked.connect(lambda: self.buttonBoxHub("Apply")) - self.dlg.buttonBox.button(QDialogButtonBox.Cancel).clicked.connect(lambda: self.buttonBoxHub("Cancel")) + self.dlg.buttonBox.button(QDialogButtonBox.StandardButton.Reset).clicked.connect(lambda: self.buttonBoxHub("Reset")) + self.dlg.buttonBox.button(QDialogButtonBox.StandardButton.Apply).clicked.connect(lambda: self.buttonBoxHub("Apply")) + self.dlg.buttonBox.button(QDialogButtonBox.StandardButton.Cancel).clicked.connect(lambda: self.buttonBoxHub("Cancel")) #self.dlg.reconcileButton.clicked.connect(self.reconcileUnhandled) self.dlg.closedDialog.connect(self.removeServiceLayers) #self.dlg.handleBadLayersCheckbox.stateChanged.connect(self.handleBadLayerOption) @@ -259,7 +256,7 @@ def populateLayerTable(self, onlyUnhandled = None): self.layersPropLayer = QgsVectorLayer(layersPropLayerDef,"layerTable","memory") dummyFeatures = [] - self.dlg.layerTable.horizontalHeader().setDefaultAlignment(Qt.AlignLeft) + self.dlg.layerTable.horizontalHeader().setDefaultAlignment(Qt.AlignmentFlag.AlignLeft) self.dlg.layerTable.horizontalHeader().setSectionsClickable(False) @@ -269,7 +266,7 @@ def populateLayerTable(self, onlyUnhandled = None): lr = QgsProject.instance() for layer in lr.mapLayers().values(): - if layer.type() == QgsMapLayer.VectorLayer or layer.type() == QgsMapLayer.RasterLayer: + if layer.type() == QgsMapLayer.LayerType.VectorLayer or layer.type() == QgsMapLayer.LayerType.RasterLayer: provider = layer.dataProvider().name() source = layer.source() cellStyle = "" @@ -283,7 +280,7 @@ def populateLayerTable(self, onlyUnhandled = None): self.dlg.layerTable.setCellWidget(lastRow,4,self.getButtonWidget(lastRow)) layerDummyFeature = QgsFeature(self.layersPropLayer.fields()) - if layer.type() == QgsMapLayer.VectorLayer: + if layer.type() == QgsMapLayer.LayerType.VectorLayer: type = "vector" enumGeometryTypes =('Point','Line','Polygon','UnknownGeometry','NoGeometry') geometry = enumGeometryTypes[layer.geometryType()] @@ -300,14 +297,14 @@ def populateLayerTable(self, onlyUnhandled = None): QgsProject.instance().layerTreeRoot().findLayer(self.layersPropLayer.id()).setItemVisibilityChecked(False) self.dlg.mFieldExpressionWidget.setLayer(self.layersPropLayer) self.dlg.layerTable.resizeColumnToContents(1) - self.dlg.layerTable.horizontalHeader().setSectionResizeMode(2,QHeaderView.ResizeToContents) + self.dlg.layerTable.horizontalHeader().setSectionResizeMode(2,QHeaderView.ResizeMode.ResizeToContents) self.dlg.layerTable.setColumnWidth(4,30) self.dlg.layerTable.setShowGrid(False) - self.dlg.layerTable.horizontalHeader().setSectionResizeMode(3,QHeaderView.Stretch) # was QHeaderView.Stretch + self.dlg.layerTable.horizontalHeader().setSectionResizeMode(3,QHeaderView.ResizeMode.Stretch) # was QHeaderView.Stretch def getButtonWidget(self,row): edit = QPushButton("...",parent = self.dlg.layerTable) - edit.setSizePolicy(QSizePolicy.Ignored,QSizePolicy.Ignored) + edit.setSizePolicy(QSizePolicy.Policy.Ignored,QSizePolicy.Policy.Ignored) edit.clicked.connect(lambda: self.browseAction(row)) return edit @@ -322,7 +319,7 @@ def browseAction(self,row): rowLayer = QgsProject.instance().mapLayer(layerId) enumLayerTypes = ("vector","raster","plugin") if newType and enumLayerTypes[rowLayer.type()] != newType: - self.iface.messageBar().pushMessage("Error", "Layer type mismatch %s/%s" % (enumLayerTypes[rowLayer.type()], newType), level=QgsMessageBar.CRITICAL, duration=4) + self.iface.messageBar().pushMessage("Error", "Layer type mismatch %s/%s" % (enumLayerTypes[rowLayer.type()], newType), level=Qgis.MessageLevel.Critical, duration=4) return None if newDatasource: self.dlg.layerTable.cellWidget(row,3).setText(newDatasource) @@ -334,12 +331,12 @@ def getLabelWidget(self,txt,column, style = None): method that returns a preformatted qlineedit widget ''' edit = QLineEdit(parent = self.dlg.layerTable) - idealWidth = QApplication.instance().fontMetrics().width(txt) + idealWidth = QFontMetrics(QApplication.font()).horizontalAdvance(txt) edit.setMinimumWidth(idealWidth) if column == 2: edit.setMaximumWidth(60) edit.setText(txt) - edit.setSizePolicy(QSizePolicy.Minimum,QSizePolicy.Ignored) + edit.setSizePolicy(QSizePolicy.Policy.Minimum,QSizePolicy.Policy.Ignored) if style: edit.setStyleSheet(style) else: @@ -377,9 +374,7 @@ def replaceDS(self): indexes.append(row) self.replaceList.append(QgsProject.instance().mapLayer(self.dlg.layerTable.cellWidget(row,0).text())) for row in indexes: - layerId = self.dlg.layerTable.cellWidget(row,0) cell = self.dlg.layerTable.cellWidget(row,3) - orig = cell.text() if self.dlg.mFieldExpressionWidget.isValidExpression(): exp = QgsExpression(self.dlg.mFieldExpressionWidget.currentText()) scope.setFeature(next(self.layersPropLayer.getFeatures(QgsFeatureRequest(row+1)))) @@ -399,7 +394,6 @@ def applyDSChanges(self):#, reconcileUnhandled = False): rowProviderCell = self.dlg.layerTable.cellWidget(row,2) rowDatasourceCell = self.dlg.layerTable.cellWidget(row,3) rowLayerID = self.dlg.layerTable.cellWidget(row,0).text() - rowLayerName = self.dlg.layerTable.cellWidget(row,1).text() rowProvider = rowProviderCell.text() rowDatasource = rowDatasourceCell.text() rowLayer = QgsProject.instance().mapLayer(rowLayerID) @@ -462,7 +456,7 @@ def run(self): self.dlg.raise_() self.dlg.activateWindow() # Run the dialog event loop - result = self.dlg.exec_() + result = self.dlg.exec() # See if OK was pressed if result: # Do something useful here - delete the line containing pass and @@ -484,10 +478,10 @@ def __init__(self, parent=None): self.button = QToolButton(self) self.button.setIcon(QIcon(os.path.join(os.path.dirname(__file__),"BrowseButton.png"))) self.button.setStyleSheet('border: 0px; padding: 0px;') - self.button.setCursor(Qt.ArrowCursor) + self.button.setCursor(Qt.CursorShape.ArrowCursor) self.button.clicked.connect(self.buttonClicked.emit) - frameWidth = self.style().pixelMetric(QStyle.PM_DefaultFrameWidth) + frameWidth = self.style().pixelMetric(QStyle.PixelMetric.PM_DefaultFrameWidth) buttonSize = self.button.sizeHint() self.setStyleSheet('QLineEdit {padding-left: %dpx; }' % (buttonSize.width() + frameWidth + 1)) @@ -496,7 +490,7 @@ def __init__(self, parent=None): def resizeEvent(self, event): buttonSize = self.button.sizeHint() - frameWidth = self.style().pixelMetric(QStyle.PM_DefaultFrameWidth) + frameWidth = self.style().pixelMetric(QStyle.PixelMetric.PM_DefaultFrameWidth) self.button.move(self.rect().right() - frameWidth - buttonSize.width(), (self.rect().bottom() - buttonSize.height() + 1)/2) super(browseLineEdit, self).resizeEvent(event) diff --git a/changeDataSource_dialog.py b/changeDataSource_dialog.py index dbed5a9..73bd8f7 100644 --- a/changeDataSource_dialog.py +++ b/changeDataSource_dialog.py @@ -24,11 +24,12 @@ import os -from qgis.PyQt import QtGui, uic, QtWidgets +from qgis.PyQt import uic, QtWidgets from qgis.PyQt.QtCore import pyqtSignal from qgis.core import QgsBrowserModel, QgsMimeDataUtils -from .changeDataSource_dialog_base import Ui_changeDataSourceDialogBase -from .browsedatasource import Ui_dataSourceBrowser + +Ui_changeDataSourceDialogBase = uic.loadUiType(os.path.join(os.path.dirname(__file__), 'ui', 'changeDataSource_dialog_base.ui'))[0] +Ui_dataSourceBrowser = uic.loadUiType(os.path.join(os.path.dirname(__file__), 'ui', 'browsedatasource.ui'))[0] class changeDataSourceDialog(QtWidgets.QDialog, Ui_changeDataSourceDialogBase): @@ -71,7 +72,6 @@ def __init__(self, parent=None): self.acceptedFlag = None def getUriFromBrowser(self,index): - uriItem = self.browserModel.dataItem(index) uri_list = QgsMimeDataUtils.decodeUriList(self.browserModel.mimeData([index])) try: #print uri_list[0].providerKey,uri_list[0].uri @@ -95,7 +95,6 @@ def rejectedAction(self): def uri(title=""): dialog = dataSourceBrowser() dialog.setWindowTitle(title) - result = dialog.exec_() dialog.show() if dialog.acceptedFlag: return (dialog.result) diff --git a/changeDataSource_dialog_base.py b/changeDataSource_dialog_base.py deleted file mode 100644 index 1a1112e..0000000 --- a/changeDataSource_dialog_base.py +++ /dev/null @@ -1,118 +0,0 @@ -# -*- coding: utf-8 -*- - -# Form implementation generated from reading ui file 'C:\Users\DEMO\Dropbox\dev\changeDataSource\changeDataSource_dialog_base.ui' -# -# Created: Sun Nov 22 22:12:30 2015 -# by: PyQt4 UI code generator 4.10.2 -# -# WARNING! All changes made in this file will be lost! - -from builtins import object -from qgis.PyQt import QtCore, QtGui, QtWidgets - -try: - _fromUtf8 = QtCore.QString.fromUtf8 -except AttributeError: - def _fromUtf8(s): - return s - -try: - _encoding = QtWidgets.QApplication.UnicodeUTF8 - def _translate(context, text, disambig): - return QtWidgets.QApplication.translate(context, text, disambig, _encoding) -except AttributeError: - def _translate(context, text, disambig): - return QtWidgets.QApplication.translate(context, text, disambig) - -class Ui_changeDataSourceDialogBase(object): - def setupUi(self, changeDataSourceDialogBase): - changeDataSourceDialogBase.setObjectName(_fromUtf8("changeDataSourceDialogBase")) - changeDataSourceDialogBase.resize(1027, 461) - self.verticalLayout = QtWidgets.QVBoxLayout(changeDataSourceDialogBase) - self.verticalLayout.setObjectName(_fromUtf8("verticalLayout")) - self.layerTable = QtWidgets.QTableWidget(changeDataSourceDialogBase) - self.layerTable.setAlternatingRowColors(True) - self.layerTable.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection) - self.layerTable.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows) - self.layerTable.setGridStyle(QtCore.Qt.DotLine) - self.layerTable.setObjectName(_fromUtf8("layerTable")) - self.layerTable.setColumnCount(0) - self.layerTable.setRowCount(0) - self.layerTable.horizontalHeader().setHighlightSections(False) - self.layerTable.horizontalHeader().setSortIndicatorShown(True) - self.layerTable.verticalHeader().setVisible(True) - self.verticalLayout.addWidget(self.layerTable) - self.horizontalLayout = QtWidgets.QHBoxLayout() - self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout")) - self.label = QtWidgets.QLabel(changeDataSourceDialogBase) - self.label.setObjectName(_fromUtf8("label")) - self.horizontalLayout.addWidget(self.label) - self.findEdit = QtWidgets.QLineEdit(changeDataSourceDialogBase) - self.findEdit.setMaximumSize(QtCore.QSize(100, 16777215)) - self.findEdit.setObjectName(_fromUtf8("findEdit")) - self.horizontalLayout.addWidget(self.findEdit) - self.label_2 = QtWidgets.QLabel(changeDataSourceDialogBase) - self.label_2.setObjectName(_fromUtf8("label_2")) - self.horizontalLayout.addWidget(self.label_2) - self.replaceEdit = QtWidgets.QLineEdit(changeDataSourceDialogBase) - self.replaceEdit.setMaximumSize(QtCore.QSize(100, 16777215)) - self.replaceEdit.setObjectName(_fromUtf8("replaceEdit")) - self.horizontalLayout.addWidget(self.replaceEdit) - self.label_4 = QtWidgets.QLabel(changeDataSourceDialogBase) - self.label_4.setObjectName(_fromUtf8("label_4")) - self.horizontalLayout.addWidget(self.label_4) - self.mFieldExpressionWidget = QgsFieldExpressionWidget(changeDataSourceDialogBase) - self.mFieldExpressionWidget.setObjectName(_fromUtf8("mFieldExpressionWidget")) - self.horizontalLayout.addWidget(self.mFieldExpressionWidget) - self.label_3 = QtWidgets.QLabel(changeDataSourceDialogBase) - self.label_3.setObjectName(_fromUtf8("label_3")) - self.horizontalLayout.addWidget(self.label_3) - self.datasourceCombo = QtWidgets.QComboBox(changeDataSourceDialogBase) - self.datasourceCombo.setObjectName(_fromUtf8("datasourceCombo")) - self.horizontalLayout.addWidget(self.datasourceCombo) - self.onlySelectedCheck = QtWidgets.QCheckBox(changeDataSourceDialogBase) - self.onlySelectedCheck.setObjectName(_fromUtf8("onlySelectedCheck")) - self.horizontalLayout.addWidget(self.onlySelectedCheck) - self.replaceButton = QtWidgets.QPushButton(changeDataSourceDialogBase) - self.replaceButton.setObjectName(_fromUtf8("replaceButton")) - self.horizontalLayout.addWidget(self.replaceButton) - self.verticalLayout.addLayout(self.horizontalLayout) - self.horizontalLayout_2 = QtWidgets.QHBoxLayout() - self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2")) - spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) - self.horizontalLayout_2.addItem(spacerItem) - self.handleBadLayersCheckbox = QtWidgets.QCheckBox(changeDataSourceDialogBase) - self.handleBadLayersCheckbox.setObjectName(_fromUtf8("handleBadLayersCheckbox")) - self.horizontalLayout_2.addWidget(self.handleBadLayersCheckbox) - self.reconcileButton = QtWidgets.QPushButton(changeDataSourceDialogBase) - self.reconcileButton.setObjectName(_fromUtf8("reconcileButton")) - self.horizontalLayout_2.addWidget(self.reconcileButton) - self.buttonBox = QtWidgets.QDialogButtonBox(changeDataSourceDialogBase) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.buttonBox.sizePolicy().hasHeightForWidth()) - self.buttonBox.setSizePolicy(sizePolicy) - self.buttonBox.setOrientation(QtCore.Qt.Horizontal) - self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Apply|QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Reset) - self.buttonBox.setObjectName(_fromUtf8("buttonBox")) - self.horizontalLayout_2.addWidget(self.buttonBox) - self.verticalLayout.addLayout(self.horizontalLayout_2) - - self.retranslateUi(changeDataSourceDialogBase) - self.buttonBox.accepted.connect(changeDataSourceDialogBase.accept) - self.buttonBox.rejected.connect(changeDataSourceDialogBase.reject) - - def retranslateUi(self, changeDataSourceDialogBase): - changeDataSourceDialogBase.setWindowTitle(_translate("changeDataSourceDialogBase", "Change datasource", None)) - self.layerTable.setSortingEnabled(True) - self.label.setText(_translate("changeDataSourceDialogBase", "Find:", None)) - self.label_2.setText(_translate("changeDataSourceDialogBase", "Replace:", None)) - self.label_4.setText(_translate("changeDataSourceDialogBase", "expression", None)) - self.label_3.setText(_translate("changeDataSourceDialogBase", "New datasource type:", None)) - self.onlySelectedCheck.setText(_translate("changeDataSourceDialogBase", "Between selected rows", None)) - self.replaceButton.setText(_translate("changeDataSourceDialogBase", "Replace", None)) - self.handleBadLayersCheckbox.setText(_translate("changeDataSourceDialogBase", "Handle bad layers", None)) - self.reconcileButton.setText(_translate("changeDataSourceDialogBase", "Reconcile unhandled", None)) - -from qgis.gui import QgsFieldExpressionWidget diff --git a/BrowseButton.png b/icon/BrowseButton.png similarity index 100% rename from BrowseButton.png rename to icon/BrowseButton.png diff --git a/icon.png b/icon/icon.png similarity index 100% rename from icon.png rename to icon/icon.png diff --git a/metadata.txt b/metadata.txt index 59f0e18..0584371 100644 --- a/metadata.txt +++ b/metadata.txt @@ -8,12 +8,13 @@ [general] name=changeDataSource -qgisMinimumVersion=3.0 +qgisMinimumVersion=4.0 description=Right click on layer tree to change single layer datasource of click on icon to change datasources globally version=3.1 author=enrico ferreguti email=enricofer@gmail.com about= The plugin allows to change the datasources of the loaded layers. The operation can be performed right clicking on legend items for single layer or globally on a summary table by clicking on toolbar plugin icon. The plugin takes control of bad layers handling allowing to specify valid datasources working on project +supportsQt6=true # End of mandatory metadata @@ -43,7 +44,7 @@ homepage=https://geogear.wordpress.com/2016/01/29/changedatasourceplugin-plugin- tracker= https://github.com/enricofer/changeDataSource/issues repository= https://github.com/enricofer/changeDataSource category=Plugins -icon=icon.png +icon=icon/icon.png # experimental flag experimental=False diff --git a/resources.qrc b/resources.qrc deleted file mode 100644 index c11026e..0000000 --- a/resources.qrc +++ /dev/null @@ -1,5 +0,0 @@ - - - icon.png - - diff --git a/resources_rc.py b/resources_rc.py deleted file mode 100644 index dee7c92..0000000 --- a/resources_rc.py +++ /dev/null @@ -1,134 +0,0 @@ -# -*- coding: utf-8 -*- - -# Resource object code -# -# Created by: The Resource Compiler for PyQt5 (Qt v5.6.2) -# -# WARNING! All changes made in this file will be lost! - -from PyQt5 import QtCore - -qt_resource_data = b"\ -\x00\x00\x05\x99\ -\x89\ -\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\ -\x00\x00\x20\x00\x00\x00\x20\x08\x06\x00\x00\x00\x73\x7a\x7a\xf4\ -\x00\x00\x00\x09\x70\x48\x59\x73\x00\x00\x0b\x13\x00\x00\x0b\x13\ -\x01\x00\x9a\x9c\x18\x00\x00\x00\x20\x63\x48\x52\x4d\x00\x00\x6d\ -\x75\x00\x00\x73\xa0\x00\x00\xfc\xdd\x00\x00\x83\x64\x00\x00\x70\ -\xe8\x00\x00\xec\x68\x00\x00\x30\x3e\x00\x00\x10\x90\xe4\xec\x99\ -\xea\x00\x00\x05\x1f\x49\x44\x41\x54\x78\xda\xec\x97\x69\x4c\x94\ -\x57\x14\x86\x9f\x6f\x36\x86\x75\x1c\x06\x06\x46\xaa\x80\x82\x80\ -\xa3\x54\x16\x43\x4d\xac\xb6\xb4\xd5\x68\x6a\xb5\x44\x6d\x4b\xd4\ -\x12\x13\xb1\x26\xb6\x4d\xdc\x5a\x35\xa6\xed\x0f\x6d\xb0\x8b\x8d\ -\x8d\x6d\x6c\xeb\x16\xb7\x28\xd5\x6a\x8c\x46\x22\x46\x69\x45\x5c\ -\x2b\xb8\x14\x2d\x46\x29\x03\xcc\xb0\x0e\x30\x30\x33\x7c\x33\xcc\ -\xed\x0f\x95\x16\x97\x5a\xc5\xc6\xb4\xf5\x24\x37\xb9\x39\x39\xe7\ -\xbe\xef\x79\xcf\xcd\x5d\x24\x21\x04\x8f\xd3\x54\xbd\x5d\xa0\x28\ -\x7f\x51\x77\x05\x35\x95\xb5\xdd\xfe\xa8\x98\xbe\xdd\xf3\xd1\x53\ -\x56\x4a\xf7\xca\x97\x1e\x46\x81\x5b\xa0\x91\x51\x01\xf4\x31\x25\ -\xd1\x27\xd4\x1f\x00\x4d\x70\xff\xee\x18\xd9\x51\x45\x4b\xb3\x8b\ -\x16\x6b\x39\x00\xb6\x1a\xe7\x5d\xc9\x3c\x30\x81\xa2\xfc\x45\x22\ -\x31\x3d\x0d\x63\x74\xc2\x03\xe5\xc9\x8e\x2a\x00\x76\x7d\xb3\x93\ -\xec\x85\x5b\xa4\x87\x6e\xc1\x2d\x99\xfd\xe4\x52\xd4\x81\xa1\xa8\ -\x82\x13\x7a\x54\x7e\x3b\xa0\xcb\x56\x82\x68\xb7\x20\xd7\x5f\xa4\ -\xa2\xc6\x40\x6b\x83\xd4\xfb\x3d\xe0\xef\x2c\x45\x65\xb5\x21\x07\ -\x27\x03\xe0\x75\x5c\x01\xc0\xd3\xd1\x8c\x68\xb7\xe0\xb6\xd7\xd3\ -\xd9\x56\x87\xbb\xa6\xbc\x47\x5e\x97\x2b\x1a\x88\xee\xe1\x53\xf0\ -\x98\xed\xdf\x49\x40\xf6\x74\xfd\xcf\x15\x78\x42\xe0\x09\x81\xff\ -\x14\x01\xd5\xd6\x6d\x5b\x08\xd1\x1b\xc9\xcc\x1c\xc3\xd5\x6a\x2b\ -\xf6\x76\x77\x5a\xb4\xce\x6f\xbe\xcb\xd1\x11\xfb\x54\x7c\xac\xc3\ -\xe3\xf1\x54\xda\xae\x57\x0d\xd4\x19\xfa\x54\x57\xb5\xb8\x57\xfc\ -\x23\xef\x01\x01\x08\x21\xfc\x74\xba\x90\x60\xc9\xd7\xb5\x66\x66\ -\xee\x1b\x19\xe5\x95\x97\x59\xff\xf1\x26\xbc\x5e\x2f\x6f\x2e\x98\ -\x46\x9a\x39\x95\x8d\x9b\x76\x0d\xb0\x05\xea\x50\xa8\x5a\x1e\x1d\ -\x01\x59\x96\x09\xd0\x6a\x5e\x68\xb0\xda\xe6\x36\xd6\xd9\xc3\xab\ -\xaf\x55\x0f\x29\xad\x29\x25\x28\xbb\x8d\x59\x1f\xe5\xa0\xf2\xd3\ -\x10\x98\xd3\xca\x89\xfc\x22\x2a\xcb\x2e\x67\x44\xc6\xbd\x82\x3e\ -\xa8\x83\x4e\x36\x3f\x92\xfe\xa9\x86\x0e\x19\x1a\xda\xd2\x64\x5f\ -\xfe\xd6\xbc\x9c\x8c\x72\xcb\x65\x02\x09\x40\x37\xba\x03\x63\x0a\ -\x34\x07\xd7\x01\x60\x1a\x04\x0a\x9b\x8f\xd9\x4b\x67\xa9\x5b\xbc\ -\x76\x52\x62\x86\xb1\x7a\xd9\x64\xf4\xfc\xd4\x7b\x02\xe9\xe9\xc3\ -\x45\xd9\xa9\xf3\xde\xd2\x8a\xf3\x78\xc6\xda\xd0\x44\x83\x5e\x0f\ -\x2e\x3b\xa8\x23\x6e\xf4\xa7\xa3\x11\xc2\x9e\x85\xd6\xc4\x4b\xb8\ -\xad\xf0\x4b\x61\x00\x5d\x9d\x3e\xd0\xf6\x5e\x03\xc5\x85\x0b\x17\ -\xda\x0c\xfa\xb0\x93\xc3\xa2\xd2\x51\x7a\xc0\x10\x03\x9d\x5e\x30\ -\x68\x4d\x4c\x8e\x99\x41\x56\xcc\x34\xfa\xf8\x85\xe3\xf6\x81\x3e\ -\x16\xd4\x1e\x30\x47\x26\xa1\x33\x0e\xc5\xe7\xd7\x1f\x90\xfe\x36\ -\x98\xc3\xe9\xbd\x53\x81\x23\x85\x45\x2f\x7f\xba\xe6\x93\x57\x3b\ -\xa3\x6b\x89\x4c\x80\x8e\x36\x88\x0d\x89\xe3\xf3\xe7\xf3\x49\x08\ -\x1d\x06\xc0\xa5\xc6\xd3\xcc\x3b\xf2\x1a\x35\x1d\xd7\x31\xc4\x41\ -\xc9\xb9\x03\x8c\x9f\x6e\x61\xd9\xc2\x0f\x18\x10\x25\xd0\x78\xcb\ -\x00\x88\x30\xf4\x5c\xbc\xce\x15\x8d\xc3\xe9\xc5\xe2\x1c\xd8\xed\ -\x9b\xb3\xb2\xb0\x07\x63\xd5\xee\xed\xbb\xb3\xea\xb5\x55\xb1\xe6\ -\xb9\x20\x75\x42\xab\x03\x72\x86\x2f\xe8\x06\x07\x30\x87\x0d\xe7\ -\xf5\xc4\x5c\x56\x9e\x5a\x4a\x60\xb8\x8f\xa8\xb7\xbb\x38\xbb\xa4\ -\x94\x1f\x0f\x16\x63\x9e\x3b\x89\x43\x9b\x8f\xdd\xa5\xde\xf0\x7b\ -\x82\xf6\xb0\xec\xc9\xd3\x52\x5f\x7c\x6e\xec\xbe\x88\x6c\x44\xca\ -\x36\x44\xd2\x7a\x44\x49\xcd\x21\x71\xbb\x15\x5c\xdf\x29\xcc\x1b\ -\x35\x22\x79\x13\x22\x62\x2a\x62\x52\xd6\x44\x71\xe6\x6c\xd9\xb9\ -\x73\x57\xad\x53\x84\x10\x08\x21\xf8\x72\xe3\x5e\xd1\xd4\x64\x17\ -\x8b\xf3\x36\x88\x5b\xbe\xfb\x0d\x45\xee\x9c\x59\x3f\x8f\x4a\x7d\ -\x7e\x67\xe3\x79\x90\x94\xe0\x03\x8e\xfc\xb6\xf7\x0e\xa2\xc7\xaa\ -\xf7\xe3\x43\xa6\xab\x0b\xda\x2b\x24\xb2\xc7\x4d\x27\x3e\x39\xf9\ -\x6b\xa5\x52\x99\xff\xe7\x38\xb7\xdb\xf9\x40\x9b\x50\x2a\xdc\x7f\ -\x38\x7e\xc2\xcc\x71\x87\x4d\xef\xca\xfd\xf4\x09\xe0\x71\x80\x02\ -\x0d\xb9\xc9\x4b\x98\x9a\x38\x1b\x80\xcd\x97\xbe\x60\xc3\xc5\x55\ -\x20\xc9\xa8\x03\xc1\x72\x0a\xc2\x8b\x92\x58\x9d\xb7\x19\x4b\x53\ -\x0b\x31\xbe\x82\xbb\xbe\x9c\x5b\x1b\x6c\x74\x99\xdf\xb9\x2b\x70\ -\x6d\x5d\x33\x2b\x16\xe5\x48\xaa\x60\x7d\x90\x1c\xa0\x0e\xb6\xd7\ -\x6f\x95\x83\x5c\x83\x64\xbd\x71\x7c\x27\xc2\x5f\x66\x75\xe9\x87\ -\x6c\x2d\x5f\x85\x00\x9a\x3b\x5b\xd1\xa8\x41\x38\xa1\x76\x8f\x1f\ -\xee\x0a\x3f\xfa\xf6\x33\xa1\x0b\x0d\x61\x60\x9c\x89\xca\x92\x02\ -\x9e\x19\x33\x12\xaf\xe3\x0a\x72\x5d\x19\x83\xa5\x1f\x00\xf8\xbe\ -\x61\x04\x59\x2f\xa5\xa3\xd5\x06\xa0\xd5\x6a\x7a\x10\x58\x9c\xb7\ -\xe1\x8f\x8f\xc9\x8e\x6d\x3b\xfa\x1f\x3d\x50\xdc\xef\x57\x9b\xe5\ -\x58\x45\xc6\x1e\x4c\x19\xe0\x75\x82\xc7\x73\x23\x58\xa3\x06\xc9\ -\x1f\xea\x4b\x60\x50\xf1\x58\x16\xbe\xf7\x3e\xb2\x5a\xc5\xce\x82\ -\x13\xd4\x5a\xad\x2c\xcb\x52\x92\x3e\x22\x1c\xb9\xae\x0c\xef\xf5\ -\x1b\xe0\x4d\x56\x0f\x47\x2c\xa3\xd8\x65\x79\xfa\x9e\xf2\x17\x6e\ -\xff\x4c\x52\x01\x52\x92\x79\x70\x55\x8d\xa5\xb6\xea\x5a\xd5\xd5\ -\xbd\xf6\x0a\x26\x36\x9e\x04\xc9\x05\x09\xb9\x20\x3c\x50\xfe\x15\ -\xf8\x82\x40\x63\x04\xa7\x68\xb7\x25\xa7\xc5\xe5\xb6\xb8\x14\xfb\ -\xc6\x2b\x42\xf1\x0f\x52\x42\xf5\x3a\xb1\x77\x7b\xd9\x4d\xd9\x47\ -\xdc\x01\x72\xdf\xcb\x28\x31\x31\x01\xa3\x31\x8c\xe6\xd6\xe6\x83\ -\x27\xd7\x1f\x1f\x32\x25\x73\xea\xb7\xd6\x5a\x5b\x78\xf1\xb6\x7d\ -\xf3\x51\x40\xa6\xff\xa4\xe5\x86\xb0\xb0\x8e\xc2\x53\xfb\x67\xa4\ -\x8f\x4b\xcd\x3b\x73\xfa\xec\x3e\x9d\x31\x1a\x95\x2a\x00\x10\x7f\ -\xf9\xf9\xbc\xef\x51\x2c\x84\x40\xad\x51\x4b\x91\x26\x93\x30\x0f\ -\x35\x7f\xa7\x75\x05\xee\x4e\x4d\x4f\xa9\xb7\xd5\x5b\x4d\xc7\xd7\ -\x1e\x1d\x69\x08\x33\x38\x26\x2d\x98\xb0\xb6\xcd\xee\xb0\x94\x14\ -\x1f\x5f\x17\x37\x30\xbe\x51\xa1\x50\xa0\x54\x2a\x6f\xde\xa3\xbd\ -\xb3\xdf\x07\x00\xfc\x5f\x52\x4f\x56\x76\xfb\x53\x00\x00\x00\x00\ -\x49\x45\x4e\x44\xae\x42\x60\x82\ -" - -qt_resource_name = b"\ -\x00\x07\ -\x07\x3b\xe0\xb3\ -\x00\x70\ -\x00\x6c\x00\x75\x00\x67\x00\x69\x00\x6e\x00\x73\ -\x00\x10\ -\x0f\x4f\xe3\xd5\ -\x00\x63\ -\x00\x68\x00\x61\x00\x6e\x00\x67\x00\x65\x00\x44\x00\x61\x00\x74\x00\x61\x00\x53\x00\x6f\x00\x75\x00\x72\x00\x63\x00\x65\ -\x00\x08\ -\x0a\x61\x5a\xa7\ -\x00\x69\ -\x00\x63\x00\x6f\x00\x6e\x00\x2e\x00\x70\x00\x6e\x00\x67\ -" - -qt_resource_struct = b"\ -\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x01\ -\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x02\ -\x00\x00\x00\x14\x00\x02\x00\x00\x00\x01\x00\x00\x00\x03\ -\x00\x00\x00\x3a\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\ -" - -def qInitResources(): - QtCore.qRegisterResourceData(0x01, qt_resource_struct, qt_resource_name, qt_resource_data) - -def qCleanupResources(): - QtCore.qUnregisterResourceData(0x01, qt_resource_struct, qt_resource_name, qt_resource_data) - -qInitResources() diff --git a/setdatasource.py b/setDataSource.py similarity index 91% rename from setdatasource.py rename to setDataSource.py index 2c4ba8c..09085ed 100644 --- a/setdatasource.py +++ b/setDataSource.py @@ -24,17 +24,16 @@ from builtins import str from builtins import range -from qgis.core import * -from PyQt5.QtCore import * -from PyQt5.QtGui import * -from qgis.PyQt import QtCore, QtGui, QtWidgets -from PyQt5.QtXml import * -from .ui_changeDSDialog import Ui_changeDataSourceDialog +from qgis.core import QgsProject, QgsMapLayer, QgsVectorLayer, QgsRasterLayer, Qgis, QgsReadWriteContext +from qgis.PyQt import QtWidgets +from qgis.PyQt.QtXml import QDomDocument from .changeDataSource_dialog import dataSourceBrowser +from qgis.PyQt import uic +from qgis.PyQt.QtGui import QStandardItemModel, QStandardItem -from qgis.gui import QgsManageConnectionsDialog, QgsMessageBar import os.path +Ui_changeDataSourceDialog = uic.loadUiType(os.path.join(os.path.dirname(__file__), 'ui', 'ui_changeDSDialog.ui'))[0] class setDataSource(QtWidgets.QDialog, Ui_changeDataSourceDialog): @@ -59,7 +58,7 @@ def openFileBrowser(self): type,provider,fileName = dataSourceBrowser.uri() enumLayerTypes = ("vector","raster","plugin") if type and enumLayerTypes[self.layer.type()] != type: - self.iface.messageBar().pushMessage("Error", "Layer type mismatch: %s/%s" % (enumLayerTypes[self.layer.type()],type), level=QgsMessageBar.CRITICAL, duration=4) + self.iface.messageBar().pushMessage("Error", "Layer type mismatch: %s/%s" % (enumLayerTypes[self.layer.type()],type), level=Qgis.MessageLevel.Critical, duration=4) else: if fileName: self.lineEdit.setPlainText(fileName) @@ -104,7 +103,7 @@ def openDataSourceDialog(self,layer):#,badLayersHandler): if provider == "ogr" or provider == "gdal": source = QgsProject.instance().readPath(source) - if layer.type() == QgsMapLayer.VectorLayer: + if layer.type() == QgsMapLayer.LayerType.VectorLayer: self.populateComboBox(self.selectDatasourceCombo,list(self.vectorDSList.keys()),predef = provider) else: self.populateComboBox(self.selectDatasourceCombo,list(self.rasterDSList.keys()),predef = provider) @@ -125,8 +124,8 @@ def exrecoverJoins(self, oldLayer, newLayer): ''' convenience method to rebuild joins if lost ''' - for layer in QgsMapLayerRegistry.mapLayers().values(): - if layer.type() == QgsMapLayer.VectorLayer: + for layer in QgsProject.instance().mapLayers().values(): + if layer.type() == QgsMapLayer.LayerType.VectorLayer: for joinDef in layer.vectorJoins(): if joinDef.joinLayerId == oldLayer.id(): newJoinDef = joinDef @@ -149,7 +148,7 @@ def applyDataSource(self,applyLayer,newProvider,newDatasource): # new layer import # fix_print_with_import print("applyDataSource", applyLayer.type()) - if applyLayer.type() == QgsMapLayer.VectorLayer: + if applyLayer.type() == QgsMapLayer.LayerType.VectorLayer: # fix_print_with_import print("vector") probeLayer = QgsVectorLayer(newDatasource,"probe", newProvider) @@ -160,12 +159,12 @@ def applyDataSource(self,applyLayer,newProvider,newDatasource): probeLayer = QgsRasterLayer(newDatasource,"probe", newProvider) extent = probeLayer.extent() if not probeLayer.isValid(): - self.iface.messageBar().pushMessage("Error", "New data source is not valid: "+newProvider+"|"+newDatasource, level=Qgis.Critical, duration=4) + self.iface.messageBar().pushMessage("Error", "New data source is not valid: "+newProvider+"|"+newDatasource, level=Qgis.MessageLevel.Critical, duration=4) return None #print "geometryTypes",probeLayer.geometryType(), applyLayer.geometryType() - if applyLayer.type() == QgsMapLayer.VectorLayer and probeLayer.geometryType() != applyLayer.geometryType(): - self.iface.messageBar().pushMessage("Error", "Geometry type mismatch", level=Qgis.Critical, duration=4) + if applyLayer.type() == QgsMapLayer.LayerType.VectorLayer and probeLayer.geometryType() != applyLayer.geometryType(): + self.iface.messageBar().pushMessage("Error", "Geometry type mismatch", level=Qgis.MessageLevel.Critical, duration=4) return None newDatasource = probeLayer.source() diff --git a/browsedatasource.ui b/ui/browsedatasource.ui similarity index 95% rename from browsedatasource.ui rename to ui/browsedatasource.ui index 359f190..253fccb 100644 --- a/browsedatasource.ui +++ b/ui/browsedatasource.ui @@ -1,78 +1,78 @@ - - - dataSourceBrowser - - - - 0 - 0 - 400 - 444 - - - - Dialog - - - - - 50 - 400 - 341 - 32 - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - 10 - 11 - 381 - 381 - - - - - - - - buttonBox - rejected() - dataSourceBrowser - reject() - - - 316 - 260 - - - 286 - 274 - - - - - buttonBox - accepted() - dataSourceBrowser - accept() - - - 248 - 254 - - - 157 - 274 - - - - - + + + dataSourceBrowser + + + + 0 + 0 + 400 + 444 + + + + Dialog + + + + + 50 + 400 + 341 + 32 + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + 10 + 11 + 381 + 381 + + + + + + + + buttonBox + rejected() + dataSourceBrowser + reject() + + + 316 + 260 + + + 286 + 274 + + + + + buttonBox + accepted() + dataSourceBrowser + accept() + + + 248 + 254 + + + 157 + 274 + + + + + diff --git a/changeDataSource_dialog_base.ui b/ui/changeDataSource_dialog_base.ui similarity index 100% rename from changeDataSource_dialog_base.ui rename to ui/changeDataSource_dialog_base.ui diff --git a/ui_changeDSDialog.ui b/ui/ui_changeDSDialog.ui similarity index 96% rename from ui_changeDSDialog.ui rename to ui/ui_changeDSDialog.ui index 026870f..cc87f74 100644 --- a/ui_changeDSDialog.ui +++ b/ui/ui_changeDSDialog.ui @@ -1,58 +1,58 @@ - - - changeDataSourceDialog - - - - 0 - 0 - 297 - 305 - - - - Change Data Source URI - - - - - - Datasource Types - - - - - - - - - - URI: - - - - - - - - - - Browse - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - + + + changeDataSourceDialog + + + + 0 + 0 + 297 + 305 + + + + Change Data Source URI + + + + + + Datasource Types + + + + + + + + + + URI: + + + + + + + + + + Browse + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + diff --git a/ui_changeDSDialog.py b/ui_changeDSDialog.py deleted file mode 100644 index 52eeea4..0000000 --- a/ui_changeDSDialog.py +++ /dev/null @@ -1,62 +0,0 @@ -# -*- coding: utf-8 -*- - -# Form implementation generated from reading ui file 'Z:\dev\changeDataSource\ui_changeDSDialog.ui' -# -# Created: Tue Sep 29 13:40:52 2015 -# by: PyQt4 UI code generator 4.11.3 -# -# WARNING! All changes made in this file will be lost! - -from builtins import object -from qgis.PyQt import QtCore, QtGui, QtWidgets - -try: - _fromUtf8 = QtCore.QString.fromUtf8 -except AttributeError: - def _fromUtf8(s): - return s - -try: - _encoding = QtWidgets.QApplication.UnicodeUTF8 - def _translate(context, text, disambig): - return QtWidgets.QApplication.translate(context, text, disambig, _encoding) -except AttributeError: - def _translate(context, text, disambig): - return QtWidgets.QApplication.translate(context, text, disambig) - -class Ui_changeDataSourceDialog(object): - def setupUi(self, changeDataSourceDialog): - changeDataSourceDialog.setObjectName(_fromUtf8("changeDataSourceDialog")) - changeDataSourceDialog.resize(297, 305) - self.verticalLayout = QtWidgets.QVBoxLayout(changeDataSourceDialog) - self.verticalLayout.setObjectName(_fromUtf8("verticalLayout")) - self.label_2 = QtWidgets.QLabel(changeDataSourceDialog) - self.label_2.setObjectName(_fromUtf8("label_2")) - self.verticalLayout.addWidget(self.label_2) - self.selectDatasourceCombo = QtWidgets.QComboBox(changeDataSourceDialog) - self.selectDatasourceCombo.setObjectName(_fromUtf8("selectDatasourceCombo")) - self.verticalLayout.addWidget(self.selectDatasourceCombo) - self.label = QtWidgets.QLabel(changeDataSourceDialog) - self.label.setObjectName(_fromUtf8("label")) - self.verticalLayout.addWidget(self.label) - self.lineEdit = QtWidgets.QPlainTextEdit(changeDataSourceDialog) - self.lineEdit.setObjectName(_fromUtf8("lineEdit")) - self.verticalLayout.addWidget(self.lineEdit) - self.openBrowser = QtWidgets.QPushButton(changeDataSourceDialog) - self.openBrowser.setObjectName(_fromUtf8("openBrowser")) - self.verticalLayout.addWidget(self.openBrowser) - self.buttonBox = QtWidgets.QDialogButtonBox(changeDataSourceDialog) - self.buttonBox.setOrientation(QtCore.Qt.Horizontal) - self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok) - self.buttonBox.setObjectName(_fromUtf8("buttonBox")) - self.verticalLayout.addWidget(self.buttonBox) - - self.retranslateUi(changeDataSourceDialog) - QtCore.QMetaObject.connectSlotsByName(changeDataSourceDialog) - - def retranslateUi(self, changeDataSourceDialog): - changeDataSourceDialog.setWindowTitle(_translate("changeDataSourceDialog", "undoLayerChanges", None)) - self.label_2.setText(_translate("changeDataSourceDialog", "Datasource Types", None)) - self.label.setText(_translate("changeDataSourceDialog", "URI:", None)) - self.openBrowser.setText(_translate("changeDataSourceDialog", "Browse", None)) -