From 862495a703bdd1791048b898e23f46bb6d8ebc22 Mon Sep 17 00:00:00 2001 From: Luc Papeleux <L.Papeleux@ULiege.be> Date: Tue, 7 Dec 2021 16:38:31 +0100 Subject: [PATCH] remove not working AllUser option in externalProgramPath --- externalProgramPath.py | 17 ++++++++++------- externalProgramPathGui.pyw | 15 +++++++-------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/externalProgramPath.py b/externalProgramPath.py index f72b659..bc0da25 100755 --- a/externalProgramPath.py +++ b/externalProgramPath.py @@ -4,7 +4,7 @@ # Define external program paths according to local configuration from prmClasses import * -import os, os.path, shutil #,distutils.spawn +import os, os.path, distutils.spawn class ExtProgs(PRMSet): def __init__(self, verb=False): @@ -16,8 +16,13 @@ class ExtProgs(PRMSet): def loadPaths(self): home = os.path.expanduser("~") - loc = os.path.abspath('.') - return [home, loc] + #print("sys.path[0] = ", sys.path[0]) + #loc = os.path.abspath('.') non, '.' n'est pas le programDir (et pas évident de le trouver entre version Dev & installed) + # et sys.path[0] est le baseDir (pas le programDir !!!) + #print("home Path = ", home) + #print("local Path = ", loc) + #return [home, loc] + return [home] def savePath(self): home = os.path.expanduser("~") @@ -66,12 +71,10 @@ class ExtProgs(PRMSet): print("\t 3. If %s not in the Script last version, add it program in the Script..."%key) return False - #if distutils.spawn.find_executable(os.path.splitext(self.pars[key].val)[0]) : - #if os.path.exists(self.pars[key].val) : - if shutil.which(self.pars[key].val) : + if distutils.spawn.find_executable(os.path.splitext(self.pars[key].val)[0]) : return True else: - print("%s is not found at %s ..."%(key, self.pars[key].val)) + print("%s is not found in %s ..."%(key, self.pars[key].val)) print("\t Check installation and accessibility...") print("\t Use 'externalProgramPathGui' to define the full program path (recommanded)") print("\t or add %s in your user path (not recommanded)"%key) diff --git a/externalProgramPathGui.pyw b/externalProgramPathGui.pyw index 4b9557d..eb7beaf 100755 --- a/externalProgramPathGui.pyw +++ b/externalProgramPathGui.pyw @@ -94,12 +94,11 @@ class ExtProgsConfGui(QWidget): grplay2 = QGridLayout() grplay2.setColumnStretch(2,1) self.mesherGrpBox.setLayout(grplay2) - self.sf['MATLAB'] = ExeFileLine(self, grplay2, self.extProgPath.pars['MATLAB'], exeFileType, 0, 0, 4) + self.sf['MATLAB'] = ExeFileLine(self, grplay2, self.extProgPath.pars['MATLAB'], exeFileType, 0, 0, 4) if isUnix(): self.sf['SCILAB'] = ExeFileLine(self, grplay2, self.extProgPath.pars['SCILAB'], exeFileType, 1, 0, 4) else: - self.sf['SCILAB'] = ExeFileLine(self, grplay2, self.extProgPath.pars['SCILAB'], "bat files (*.bat)", 1, 0, 4) - #self.sf['SCILAB'] = ExeFileLine(self, grplay2, self.extProgPath.pars['SCILAB'], exeFileType, 1, 0, 4) + self.sf['SCILAB'] = ExeFileLine(self, grplay2, self.extProgPath.pars['SCILAB'], "bat file (*.bat)", 1, 0, 4) self.sf['GNUPLOT'] = ExeFileLine(self, grplay2, self.extProgPath.pars['GNUPLOT'], exeFileType, 2, 0, 4) #Text & image @@ -124,9 +123,9 @@ class ExtProgsConfGui(QWidget): butlayout.addWidget(self.saveButton1) self.saveButton1.pressed.connect(self.userSave) - self.saveButton2 = QPushButton(self.tr("All Users Save")) - butlayout.addWidget(self.saveButton2) - self.saveButton2.pressed.connect(self.progSave) + #self.saveButton2 = QPushButton(self.tr("All Users Save")) + #butlayout.addWidget(self.saveButton2) + #self.saveButton2.pressed.connect(self.progSave) self.quitButton = QPushButton(self.tr("Quit")) butlayout.addWidget(self.quitButton) @@ -158,12 +157,12 @@ class ExtProgsConfGui(QWidget): if self.extProgPath.debug : print("Save pressed") self.extProgPath.savePars() - + ''' def progSave(self): if self.extProgPath.debug : print("Save pressed") self.extProgPath.savePars('.') - + ''' def quit(self): if self.extProgPath.debug : print("Quit pressed") -- GitLab