From 6878fc035376144903a308ed863f7ead2cff48f7 Mon Sep 17 00:00:00 2001 From: vsr Date: Fri, 2 Nov 2018 15:51:58 +0300 Subject: [PATCH] Update to the changed SALOME_PYQT module API --- src/PYLIGHTGUI/PYLIGHTGUI.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/PYLIGHTGUI/PYLIGHTGUI.py b/src/PYLIGHTGUI/PYLIGHTGUI.py index 54e5744..565c22a 100644 --- a/src/PYLIGHTGUI/PYLIGHTGUI.py +++ b/src/PYLIGHTGUI/PYLIGHTGUI.py @@ -27,6 +27,7 @@ from qtsalome import * import libSALOME_Swig import os +import os.path as osp import libSalomePy import vtk @@ -124,6 +125,7 @@ def verbose(): # Create actions and menus def initialize(): + GUIcontext() if verbose(): print("PYLIGHTGUI::initialize()") return @@ -131,7 +133,6 @@ def initialize(): # returns True if activating is successfull and False otherwise def activate(): if verbose() : print("PYLIGHTGUI.activate()") - GUIcontext() return True # called when module is deactivated @@ -186,20 +187,18 @@ def createPopupMenu(popup, context): pass # For saving data in the study -def saveFiles(prefix): +def saveFiles(directory, url): global __data_model__ if verbose(): print("PYLIGHTGUI::saveFile()") - postfix = "PYLIGHT.txt" - filename = prefix+postfix + filename = osp.join(directory, osp.splitext(osp.basename(url))[0]) + "_PYLIGHT.txt" __data_model__.saveFile(filename) - return postfix + return osp.basename(filename) # For restore data from the study -def openFiles(filelist): +def openFiles(filelist, url): global __data_model__ if verbose(): print("PYLIGHTGUI::openFile()") - filename = filelist[0] - filename.append(filelist[1]) + filename = os.path.join(*filelist) __data_model__.loadFile(filename) return True @@ -240,7 +239,7 @@ def savefile(): fn = filename # Get directory name and check access - if os.access(str(fn[:fn.rindex(os.path.sep)]), os.W_OK): + if os.access(str(fn[:fn.rindex(osp.sep)]), os.W_OK): __data_model__.saveFile(filename) else: QMessageBox.warning(sgPyQt.getDesktop(), -- 2.39.2