Skip to content

Commit

Permalink
Use QGIS user manual for GDAL algorithms help files
Browse files Browse the repository at this point in the history
because they are available for most of the algs and wouldn't be used otherwise. Also when someone hits algA help button, he should be given the algA help and not the main gdal utility doc.
  • Loading branch information
DelazJ authored and nyalldawson committed Dec 26, 2018
1 parent 309920a commit ea9b09f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 38 deletions.
10 changes: 0 additions & 10 deletions python/plugins/processing/algs/gdal/GdalAlgorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,16 +142,6 @@ def processAlgorithm(self, parameters, context, feedback):

return results

def helpUrl(self):
helpPath = GdalUtils.gdalHelpPath()
if helpPath == '':
return None

if os.path.exists(helpPath):
return QUrl.fromLocalFile(os.path.join(helpPath, '{}.html'.format(self.commandName()))).toString()
else:
return helpPath + '{}.html'.format(self.commandName())

def commandName(self):
parameters = {}
for param in self.parameterDefinitions():
Expand Down
6 changes: 0 additions & 6 deletions python/plugins/processing/algs/gdal/GdalAlgorithmProvider.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,18 +103,12 @@ def load(self):
ProcessingConfig.settingIcons[self.name()] = self.icon()
ProcessingConfig.addSetting(Setting(self.name(), 'ACTIVATE_GDAL',
self.tr('Activate'), True))
ProcessingConfig.addSetting(Setting(
self.name(),
GdalUtils.GDAL_HELP_PATH,
self.tr('Location of GDAL docs'),
GdalUtils.gdalHelpPath()))
ProcessingConfig.readSettings()
self.refreshAlgorithms()
return True

def unload(self):
ProcessingConfig.removeSetting('ACTIVATE_GDAL')
ProcessingConfig.removeSetting(GdalUtils.GDAL_HELP_PATH)

def isActive(self):
return ProcessingConfig.getSetting('ACTIVATE_GDAL')
Expand Down
26 changes: 4 additions & 22 deletions python/plugins/processing/algs/gdal/GdalUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,10 @@ def getSupportedRasters():
if extensions:
GdalUtils.supportedRasters[shortName] = extensions
# Only creatable rasters can be referenced in output rasters
if ((gdal.DCAP_CREATE in metadata
and metadata[gdal.DCAP_CREATE] == 'YES')
or (gdal.DCAP_CREATECOPY in metadata
and metadata[gdal.DCAP_CREATECOPY] == 'YES')):
if ((gdal.DCAP_CREATE in metadata and
metadata[gdal.DCAP_CREATE] == 'YES') or
(gdal.DCAP_CREATECOPY in metadata and
metadata[gdal.DCAP_CREATECOPY] == 'YES')):
GdalUtils.supportedOutputRasters[shortName] = extensions

return GdalUtils.supportedRasters
Expand Down Expand Up @@ -240,24 +240,6 @@ def version():
def readableVersion():
return gdal.VersionInfo('RELEASE_NAME')

@staticmethod
def gdalHelpPath():
helpPath = ProcessingConfig.getSetting(GdalUtils.GDAL_HELP_PATH)

if helpPath is None:
if isWindows():
pass
elif isMac():
pass
else:
searchPaths = ['/usr/share/doc/libgdal-doc/gdal']
for path in searchPaths:
if os.path.exists(path):
helpPath = os.path.abspath(path)
break

return helpPath if helpPath is not None else 'http://www.gdal.org/'

@staticmethod
def ogrConnectionStringFromLayer(layer):
"""Generates OGR connection string from a layer
Expand Down

0 comments on commit ea9b09f

Please sign in to comment.