Skip to content

Commit

Permalink
[review] fix issues from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
Rashad Kanavath authored and nyalldawson committed Feb 22, 2019
1 parent 8e78d20 commit 0c1de04
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 11 deletions.
Binary file removed images/themes/default/providerOtb.png
Binary file not shown.
1 change: 1 addition & 0 deletions images/themes/default/providerOtb.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion python/plugins/processing/algs/otb/OtbAlgorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def __init__(self, group, name, descriptionfile, display_name='', groupId=''):
self.defineCharacteristicsFromFile()

def icon(self):
return QgsApplication.getThemeIcon("/providerOtb.png")
return QgsApplication.getThemeIcon("/providerOtb.svg")

def createInstance(self):
return self.__class__(self._group, self._name, self._descriptionfile)
Expand Down
15 changes: 5 additions & 10 deletions python/plugins/processing/algs/otb/OtbAlgorithmProvider.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ def __init__(self):
self.algs = []
#!hack for 6.6!#
self.version = '6.6.0'
self.descriptionFile = ''

def load(self):
group = self.name()
Expand Down Expand Up @@ -118,16 +117,16 @@ def createAlgsList(self):
line = lines.readline().strip('\n').strip()
while line != '' and not line.startswith('#'):
data = line.split('|')
self.descriptionFile = self.descrFile(folder, str(data[1]) + '.txt')
descriptionFile = self.descrFile(folder, str(data[1]) + '.txt')
group, name = str(data[0]), str(data[1])
if name not in alg_names:
algs.append(OtbAlgorithm(group, name, self.descriptionFile))
algs.append(OtbAlgorithm(group, name, descriptionFile))
#avoid duplicate algorithms from algs.txt file (possible but rare)
alg_names.append(name)
line = lines.readline().strip('\n').strip()
except Exception as e:
import traceback
errmsg = "Could not open OTB algorithm from file: \n" + self.descriptionFile + "\nError:\n" + traceback.format_exc()
errmsg = "Could not open OTB algorithm from file: \n" + descriptionFile + "\nError:\n" + traceback.format_exc()
QgsMessageLog.logMessage(self.tr(errmsg), self.tr('Processing'), Qgis.Critical)
return algs

Expand Down Expand Up @@ -301,12 +300,8 @@ def descrFile(self, d, f):
return os.path.join(self.descrFolder(d), f)

def appDirs(self, v):
#!hack needed for QGIS < 3.2!#
v = v.replace(';', os.pathsep)
#!hack needed for QGIS < 3.2!#
folders = v.split(os.pathsep)
app_dirs = []
for f in folders:
for f in v.split(';'):
if f is not None and os.path.exists(f):
app_dirs.append(self.normalize_path(f))
return app_dirs
Expand All @@ -327,7 +322,7 @@ def supportsNonFileBasedOutput(self):
return False

def icon(self):
return QgsApplication.getThemeIcon("/providerOtb.png")
return QgsApplication.getThemeIcon("/providerOtb.svg")

def tr(self, string, context=''):
if context == '':
Expand Down

0 comments on commit 0c1de04

Please sign in to comment.