Skip to content

Commit

Permalink
added saveQML function and connected it
Browse files Browse the repository at this point in the history
  • Loading branch information
bogind committed Oct 1, 2020
1 parent 6d6fbaf commit 1dd468f
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion qlyrx.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,14 +265,24 @@ def load_vectors(self):


def enableQmlSaving(self):
print(self.dlg.saveQmlCheck.checkState())
if self.dlg.saveQmlCheck.isChecked():
self.dlg.QMLSaveLocation.setEnabled(True)
self.dlg.qmlLabel.setEnabled(True)
else:
self.dlg.QMLSaveLocation.setDisabled(True)
self.dlg.qmlLabel.setDisabled(True)


def saveQML(self,layer):
try:
if(len(self.dlg.QMLSaveLocation.filePath())) > 0:
QmlPath = self.dlg.QMLSaveLocation.filePath()
layer.saveNamedStyle(QmlPath)
else:
self.mb.pushWarning('QML Not Saved','missing Path')
except Exception as e:
self.mb.pushCritical('Error',"Something went wrong with saving the QML, please send us the following error: {}".format(e))


def read_lyrx(self, file=None):
with open(file, mode="r", encoding="utf-8") as json_file:
Expand Down Expand Up @@ -1486,5 +1496,7 @@ def run(self):
geometry_general_type_str = self.generalise_geom_type(layer) if not isRaster else 'raster'

self.apply_lyrx_symbols(layer, j_data, geometry_general_type_str)
if self.dlg.saveQmlCheck.isChecked():
self.saveQML(layer)
self.mb.pushSuccess('Yay',"It's Working")
#pass

0 comments on commit 1dd468f

Please sign in to comment.