pktools 2.6.7
Processing Kernel for geospatial data
Static Public Member Functions | Static Public Attributes | List of all members
qgis.pktoolsUtils.pktoolsUtils Class Reference

Static Public Member Functions

def pktoolsPath ()
 
def runpktools (commands, progress)
 

Static Public Attributes

string PKTOOLS_FOLDER = "PKTOOLS_FOLDER"
 

Detailed Description

Definition at line 35 of file pktoolsUtils.py.

Member Function Documentation

◆ pktoolsPath()

def qgis.pktoolsUtils.pktoolsUtils.pktoolsPath ( )
static

Definition at line 40 of file pktoolsUtils.py.

40 def pktoolsPath():
41 folder = ProcessingConfig.getSetting(pktoolsUtils.PKTOOLS_FOLDER)
42
43 if folder is None or folder == '':
44 if isWindows():
45 testfolder = os.path.join(os.path.dirname(QgsApplication.prefixPath()), 'pktools')
46 testfolder = os.path.join(testfolder, 'bin')
47 if os.path.exists(os.path.join(testfolder, 'pkinfo')):
48 folder = testfolder
49 folder = testfolder
50 else:
51 testfolder = "/usr/bin"
52 if os.path.exists(os.path.join(testfolder, "pkinfo")):
53 folder = testfolder
54 else:
55 testfolder = "/usr/local/bin"
56 if os.path.exists(os.path.join(testfolder, "pkinfo")):
57 folder = testfolder
58 folder = testfolder
59 return folder
60

◆ runpktools()

def qgis.pktoolsUtils.pktoolsUtils.runpktools (   commands,
  progress 
)
static

Definition at line 62 of file pktoolsUtils.py.

62 def runpktools(commands, progress):
63 settings = QSettings()#from gdal
64 loglines = []
65 loglines.append("pktools execution console output")
66 loglines.append(commands)
67 progress.setInfo('pktools command:')
68 commandline = " ".join(commands)
69 progress.setCommand(commandline)
70 proc = subprocess.Popen(
71 commandline,
72 shell=True,
73 stdout=subprocess.PIPE,
74 stdin=open(os.devnull),
75 stderr=subprocess.STDOUT,
76 universal_newlines=True,
77 ).stdout
78 progress.setInfo('pktools command output:')
79
80 for line in iter(proc.readline, ""):
81 progress.setConsoleInfo(line)
82 loglines.append(line)
83 ProcessingLog.addToLog(ProcessingLog.LOG_INFO, loglines)
84
85 ProcessingLog.addToLog(ProcessingLog.LOG_INFO, commandline)
86 pktoolsUtils.consoleOutput = loglines
87
88# @staticmethod
89# def getConsoleOutput():
90# return pktoolsUtils.consoleOutput

Member Data Documentation

◆ PKTOOLS_FOLDER

string qgis.pktoolsUtils.pktoolsUtils.PKTOOLS_FOLDER = "PKTOOLS_FOLDER"
static

Definition at line 37 of file pktoolsUtils.py.


The documentation for this class was generated from the following file: