Skip to content

Commit

Permalink
Release v3.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
gacarrillor committed Feb 18, 2019
1 parent 26745be commit 2f26b96
Show file tree
Hide file tree
Showing 10 changed files with 146 additions and 114 deletions.
21 changes: 10 additions & 11 deletions LoadFiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,24 +172,23 @@ def loadLayers( self ):
# Look if there is a style to apply
bStyleFound = False
if self.bStyles:
# Has layer a style to apply?
styleFile = os.path.join( baseName, os.path.splitext( baseName )[0] + ".qml" )

if not os.path.exists( styleFile ) and self.bGroups:
if self.bGroups:
# Has the group a style to apply?
aGroup = os.path.dirname( layerPath )
aBaseGroup = os.path.basename( aGroup )
styleFile = os.path.join( aGroup, aBaseGroup + ".qml" )
aGroup = os.path.dirname(layerPath)
aBaseGroup = os.path.basename(aGroup)
styleFile = os.path.join(aGroup, aBaseGroup + ".qml")

if os.path.exists( styleFile ):
ml.loadNamedStyle( styleFile )
bStyleFound = True
if os.path.exists(styleFile):
ml.loadNamedStyle(styleFile)
bStyleFound = True
QgsApplication.messageLog().logMessage("QML for group '{}' applied to layer '{}'".format(
aBaseGroup, ml.name()), "Load Them All", Qgis.Info)

if bStyleFound:
self.iface.layerTreeView().refreshLayerSymbology( ml.id() )
else:
QgsApplication.messageLog().logMessage(
"No style found for layer {} nor for its group!".format(layerPath), "Load Them All", Qgis.Info)
"No style found for layer group '{}' or 'create groups' option is disabled!".format(aBaseGroup), "Load Them All", Qgis.Warning)
# End Styles

else:
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ There are several options for you to configure how layers should be loaded to QG
* **Include parent in search**: Make alphanumeric filters work with the parent name prepended. If enabled, an alphanumeric filter like 'Starts with: rivers' won't match the sublayer rivers, because the parent layer name is taken into account (e.g., 'parent_layer_name rivers').
* **Include parent in loaded sublayers**: Prepend the parent layer name in all its sublayers.

* **Apply layer style**: Whether or not to load QML styles for a single layer (layer_name.qml) or for all layers inside a group (group_name.qml), if they are found in the layer folder.
* **Apply group style to layers**: Whether or not to load QML style (group_name.qml) for all layers inside a group. The QML file must have the same name as the parent folder and must be found in the layer folder.

The plugin supports the following file extensions:
* Vectors
Expand Down Expand Up @@ -103,7 +103,7 @@ LICENSE: GPL v2.0
Code contributors:
* David Bakeman (v2.1 and v2.4)
* Sören Gebbert (v2.3)
* Jean Hemmi (V3.1 and French translation)
* Jean Hemmi (v3.1 and French translation)

More info about LoadThemAll at http://geotux.tuxfamily.org/index.php/en/geo-blogs/item/264-plugin-load-them-all-para-quantum-gis

Expand Down
85 changes: 44 additions & 41 deletions Ui_DockWidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def setupUi(self, DockWidget):
self.scrollArea.setWidgetResizable(True)
self.scrollArea.setObjectName("scrollArea")
self.scrollAreaWidgetContents = QtWidgets.QWidget()
self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 287, 579))
self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 323, 570))
self.scrollAreaWidgetContents.setObjectName("scrollAreaWidgetContents")
self.gridLayout = QtWidgets.QGridLayout(self.scrollAreaWidgetContents)
self.gridLayout.setObjectName("gridLayout")
Expand Down Expand Up @@ -80,7 +80,7 @@ def setupUi(self, DockWidget):
self.scrollArea_2.setWidgetResizable(True)
self.scrollArea_2.setObjectName("scrollArea_2")
self.scrollAreaWidgetContents_4 = QtWidgets.QWidget()
self.scrollAreaWidgetContents_4.setGeometry(QtCore.QRect(0, 0, 302, 608))
self.scrollAreaWidgetContents_4.setGeometry(QtCore.QRect(0, 0, 323, 598))
self.scrollAreaWidgetContents_4.setObjectName("scrollAreaWidgetContents_4")
self.gridLayout_11 = QtWidgets.QGridLayout(self.scrollAreaWidgetContents_4)
self.gridLayout_11.setObjectName("gridLayout_11")
Expand Down Expand Up @@ -135,7 +135,7 @@ def setupUi(self, DockWidget):
self.scrollArea_3.setAlignment(QtCore.Qt.AlignCenter)
self.scrollArea_3.setObjectName("scrollArea_3")
self.scrollAreaWidgetContents_2 = QtWidgets.QWidget()
self.scrollAreaWidgetContents_2.setGeometry(QtCore.QRect(0, 0, 348, 469))
self.scrollAreaWidgetContents_2.setGeometry(QtCore.QRect(0, 0, 323, 493))
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
Expand Down Expand Up @@ -235,7 +235,7 @@ def setupUi(self, DockWidget):
self.chkAddParentLayerName.setChecked(True)
self.chkAddParentLayerName.setObjectName("chkAddParentLayerName")
self.gridLayout_13.addWidget(self.chkAddParentLayerName, 1, 0, 1, 1)
self.gridLayout_14.addWidget(self.groupBox_2, 8, 0, 1, 1)
self.gridLayout_14.addWidget(self.groupBox_2, 10, 0, 1, 1)
self.groupBox = QtWidgets.QGroupBox(self.scrollAreaWidgetContents_2)
self.groupBox.setMinimumSize(QtCore.QSize(0, 60))
self.groupBox.setMaximumSize(QtCore.QSize(16777215, 100))
Expand Down Expand Up @@ -263,12 +263,14 @@ def setupUi(self, DockWidget):
self.horizontalLayout_2.setStretch(0, 1)
self.horizontalLayout_2.setStretch(1, 1)
self.gridLayout_5.addLayout(self.horizontalLayout_2, 0, 0, 1, 1)
self.gridLayout_14.addWidget(self.groupBox, 10, 0, 1, 1)
self.gridLayout_14.addWidget(self.groupBox, 12, 0, 1, 1)
spacerItem3 = QtWidgets.QSpacerItem(20, 13, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Preferred)
self.gridLayout_14.addItem(spacerItem3, 11, 0, 1, 1)
self.gridLayout_14.addItem(spacerItem3, 13, 0, 1, 1)
self.chkStyles = QtWidgets.QCheckBox(self.scrollAreaWidgetContents_2)
self.chkStyles.setObjectName("chkStyles")
self.gridLayout_14.addWidget(self.chkStyles, 9, 0, 1, 1)
self.gridLayout_14.addWidget(self.chkStyles, 8, 0, 1, 1)
spacerItem4 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
self.gridLayout_14.addItem(spacerItem4, 9, 0, 1, 1)
self.gridLayout_3.addLayout(self.gridLayout_14, 0, 0, 1, 1)
self.scrollArea_3.setWidget(self.scrollAreaWidgetContents_2)
self.gridLayout_4.addWidget(self.scrollArea_3, 0, 0, 1, 1)
Expand All @@ -286,33 +288,33 @@ def setupUi(self, DockWidget):
self.scrollArea_4.setWidgetResizable(True)
self.scrollArea_4.setObjectName("scrollArea_4")
self.scrollAreaWidgetContents_3 = QtWidgets.QWidget()
self.scrollAreaWidgetContents_3.setGeometry(QtCore.QRect(0, 0, 358, 486))
self.scrollAreaWidgetContents_3.setGeometry(QtCore.QRect(0, 0, 358, 474))
self.scrollAreaWidgetContents_3.setObjectName("scrollAreaWidgetContents_3")
self.gridLayout_12 = QtWidgets.QGridLayout(self.scrollAreaWidgetContents_3)
self.gridLayout_12.setObjectName("gridLayout_12")
spacerItem4 = QtWidgets.QSpacerItem(20, 15, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
self.gridLayout_12.addItem(spacerItem4, 0, 0, 1, 1)
spacerItem5 = QtWidgets.QSpacerItem(20, 15, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
self.gridLayout_12.addItem(spacerItem5, 0, 0, 1, 1)
self.label_4 = QtWidgets.QLabel(self.scrollAreaWidgetContents_3)
self.label_4.setScaledContents(False)
self.label_4.setAlignment(QtCore.Qt.AlignCenter)
self.label_4.setWordWrap(True)
self.label_4.setTextInteractionFlags(QtCore.Qt.LinksAccessibleByMouse|QtCore.Qt.TextSelectableByKeyboard|QtCore.Qt.TextSelectableByMouse)
self.label_4.setObjectName("label_4")
self.gridLayout_12.addWidget(self.label_4, 1, 0, 1, 1)
spacerItem5 = QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
self.gridLayout_12.addItem(spacerItem5, 2, 0, 1, 1)
spacerItem6 = QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
self.gridLayout_12.addItem(spacerItem6, 2, 0, 1, 1)
self.gridLayout_9 = QtWidgets.QGridLayout()
self.gridLayout_9.setObjectName("gridLayout_9")
spacerItem6 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.gridLayout_9.addItem(spacerItem6, 0, 0, 1, 1)
spacerItem7 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.gridLayout_9.addItem(spacerItem7, 0, 0, 1, 1)
self.btnHelp = QtWidgets.QPushButton(self.scrollAreaWidgetContents_3)
self.btnHelp.setObjectName("btnHelp")
self.gridLayout_9.addWidget(self.btnHelp, 0, 1, 1, 1)
spacerItem7 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.gridLayout_9.addItem(spacerItem7, 0, 2, 1, 1)
spacerItem8 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.gridLayout_9.addItem(spacerItem8, 0, 2, 1, 1)
self.gridLayout_12.addLayout(self.gridLayout_9, 3, 0, 1, 1)
spacerItem8 = QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
self.gridLayout_12.addItem(spacerItem8, 4, 0, 1, 1)
spacerItem9 = QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
self.gridLayout_12.addItem(spacerItem9, 4, 0, 1, 1)
self.label_5 = QtWidgets.QLabel(self.scrollAreaWidgetContents_3)
self.label_5.setMinimumSize(QtCore.QSize(0, 40))
font = QtGui.QFont()
Expand All @@ -329,12 +331,12 @@ def setupUi(self, DockWidget):
self.label_5.setTextInteractionFlags(QtCore.Qt.LinksAccessibleByKeyboard|QtCore.Qt.LinksAccessibleByMouse|QtCore.Qt.TextBrowserInteraction|QtCore.Qt.TextSelectableByKeyboard|QtCore.Qt.TextSelectableByMouse)
self.label_5.setObjectName("label_5")
self.gridLayout_12.addWidget(self.label_5, 5, 0, 1, 1)
spacerItem9 = QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
self.gridLayout_12.addItem(spacerItem9, 6, 0, 1, 1)
spacerItem10 = QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
self.gridLayout_12.addItem(spacerItem10, 6, 0, 1, 1)
self.horizontalLayout_4 = QtWidgets.QHBoxLayout()
self.horizontalLayout_4.setObjectName("horizontalLayout_4")
spacerItem10 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout_4.addItem(spacerItem10)
spacerItem11 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout_4.addItem(spacerItem11)
self.label_2 = QtWidgets.QLabel(self.scrollAreaWidgetContents_3)
self.label_2.setMaximumSize(QtCore.QSize(85, 16777215))
self.label_2.setText("")
Expand All @@ -346,8 +348,8 @@ def setupUi(self, DockWidget):
self.verticalLayout_3.setContentsMargins(9, -1, -1, -1)
self.verticalLayout_3.setSpacing(0)
self.verticalLayout_3.setObjectName("verticalLayout_3")
spacerItem11 = QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
self.verticalLayout_3.addItem(spacerItem11)
spacerItem12 = QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
self.verticalLayout_3.addItem(spacerItem12)
self.label = QtWidgets.QLabel(self.scrollAreaWidgetContents_3)
self.label.setMinimumSize(QtCore.QSize(230, 0))
font = QtGui.QFont()
Expand All @@ -372,8 +374,8 @@ def setupUi(self, DockWidget):
self.label_3.setTextInteractionFlags(QtCore.Qt.LinksAccessibleByMouse|QtCore.Qt.TextSelectableByKeyboard|QtCore.Qt.TextSelectableByMouse)
self.label_3.setObjectName("label_3")
self.verticalLayout_3.addWidget(self.label_3)
spacerItem12 = QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Maximum)
self.verticalLayout_3.addItem(spacerItem12)
spacerItem13 = QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Maximum)
self.verticalLayout_3.addItem(spacerItem13)
self.label_7 = QtWidgets.QLabel(self.scrollAreaWidgetContents_3)
font = QtGui.QFont()
font.setFamily("Sans Serif")
Expand All @@ -384,22 +386,22 @@ def setupUi(self, DockWidget):
self.label_7.setTextInteractionFlags(QtCore.Qt.LinksAccessibleByMouse|QtCore.Qt.TextSelectableByKeyboard|QtCore.Qt.TextSelectableByMouse)
self.label_7.setObjectName("label_7")
self.verticalLayout_3.addWidget(self.label_7)
spacerItem13 = QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
self.verticalLayout_3.addItem(spacerItem13)
spacerItem14 = QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
self.verticalLayout_3.addItem(spacerItem14)
self.horizontalLayout_4.addLayout(self.verticalLayout_3)
spacerItem14 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout_4.addItem(spacerItem14)
spacerItem15 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout_4.addItem(spacerItem15)
self.gridLayout_12.addLayout(self.horizontalLayout_4, 7, 0, 1, 1)
spacerItem15 = QtWidgets.QSpacerItem(20, 5, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
self.gridLayout_12.addItem(spacerItem15, 8, 0, 1, 1)
spacerItem16 = QtWidgets.QSpacerItem(20, 5, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
self.gridLayout_12.addItem(spacerItem16, 8, 0, 1, 1)
self.scrollArea_4.setWidget(self.scrollAreaWidgetContents_3)
self.gridLayout_7.addWidget(self.scrollArea_4, 0, 0, 1, 1)
self.tabWidget.addTab(self.tabAbout, "")
self.gridLayout_8.addWidget(self.tabWidget, 0, 0, 1, 1)
self.horizontalLayout = QtWidgets.QHBoxLayout()
self.horizontalLayout.setObjectName("horizontalLayout")
spacerItem16 = QtWidgets.QSpacerItem(10, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout.addItem(spacerItem16)
spacerItem17 = QtWidgets.QSpacerItem(10, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout.addItem(spacerItem17)
self.progressBar = QtWidgets.QProgressBar(self.dockWidgetContents)
self.progressBar.setProperty("value", 0)
self.progressBar.setObjectName("progressBar")
Expand All @@ -410,13 +412,13 @@ def setupUi(self, DockWidget):
self.btnCancel = QtWidgets.QPushButton(self.dockWidgetContents)
self.btnCancel.setObjectName("btnCancel")
self.horizontalLayout.addWidget(self.btnCancel)
spacerItem17 = QtWidgets.QSpacerItem(10, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout.addItem(spacerItem17)
spacerItem18 = QtWidgets.QSpacerItem(10, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout.addItem(spacerItem18)
self.gridLayout_8.addLayout(self.horizontalLayout, 1, 0, 1, 1)
DockWidget.setWidget(self.dockWidgetContents)

self.retranslateUi(DockWidget)
self.tabWidget.setCurrentIndex(3)
self.tabWidget.setCurrentIndex(0)
QtCore.QMetaObject.connectSlotsByName(DockWidget)

def retranslateUi(self, DockWidget):
Expand Down Expand Up @@ -446,16 +448,17 @@ def retranslateUi(self, DockWidget):
self.chkAddParentLayerName.setText(_translate("DockWidget", "Include parent name in loaded sublayers"))
self.txtNumLayersToConfirm.setText(_translate("DockWidget", "50"))
self.label_6.setText(_translate("DockWidget", "Number of layers to show you a confirmation dialog before the load"))
self.chkStyles.setText(_translate("DockWidget", "Apply styles"))
self.chkStyles.setToolTip(_translate("DockWidget", "When checked, if groups are checked and a QML is found inside a layer folder with the\n"
"same folder name (e.g., my_group.qml), it will be applied to all layers inside that group."))
self.chkStyles.setText(_translate("DockWidget", "Apply group style to layers"))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tabConfiguration), _translate("DockWidget", "Configuration"))
self.label_4.setText(_translate("DockWidget", "The <i>Load Them All</i> plugin allows you to load at the same time a number of layers stored in a directory structure, based on a variety of filters you may customize."))
self.btnHelp.setText(_translate("DockWidget", "Help"))
self.label_5.setText(_translate("DockWidget", "<html><head/><body><p>Feel free to report bugs, suggest improvements or say hello at gcarrillo@linuxmail.org or directly at the <a href=\"https://github.com/gacarrillor/loadthemall\"><span style=\" text-decoration: underline; color:#0000ff;\">GitHub repository</span></a></p></body></html>"))
self.label.setText(_translate("DockWidget", "Copyright (C) 2010-2018 Germán Carrillo"))
self.label.setText(_translate("DockWidget", "Copyright (C) 2010-2019 Germán Carrillo"))
self.label_3.setText(_translate("DockWidget", "<i>Licensed under the terms of GNU GPL 2</i>"))
self.label_7.setText(_translate("DockWidget", "<html><head/><body><p><span style=\" font-style:italic;\">Code contributors:</span><br/><br/>     David Bakeman (v2.1 and v2.4)<br/>     Soeren Gebbert (v2.3)<br/>     Jean Hemmi (V3.0.2 &amp; fr translation)</p></body></html>"))
self.label_7.setText(_translate("DockWidget", "<html><head/><body><p><span style=\" font-style:italic;\">Code contributors:</span><br/><br/>     David Bakeman (v2.1 and v2.4)<br/>     Soeren Gebbert (v2.3)<br/>     Jean Hemmi (v3.1 &amp; French transl.)</p></body></html>"))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tabAbout), _translate("DockWidget", "About"))
self.btnLoadLayers.setText(_translate("DockWidget", "Load layers"))
self.btnCancel.setText(_translate("DockWidget", "Cancel"))

import resources_rc
Loading

0 comments on commit 2f26b96

Please sign in to comment.