diff options
author | rahulp13 | 2020-07-24 01:08:02 +0530 |
---|---|---|
committer | rahulp13 | 2020-07-24 01:08:02 +0530 |
commit | c13e7b0f873e4857f1ce7924c0a72609df3ddca2 (patch) | |
tree | 119f73a57ec709c494b2c9e34cf309e2619008c7 /src/modelEditor | |
parent | 175208c2553bde875968a9bc53176b6039ba9360 (diff) | |
download | eSim-c13e7b0f873e4857f1ce7924c0a72609df3ddca2.tar.gz eSim-c13e7b0f873e4857f1ce7924c0a72609df3ddca2.tar.bz2 eSim-c13e7b0f873e4857f1ce7924c0a72609df3ddca2.zip |
platform independent library and image paths, flake8 compliant
Diffstat (limited to 'src/modelEditor')
-rw-r--r-- | src/modelEditor/ModelEditor.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/modelEditor/ModelEditor.py b/src/modelEditor/ModelEditor.py index 0b6990f3..e8fda482 100644 --- a/src/modelEditor/ModelEditor.py +++ b/src/modelEditor/ModelEditor.py @@ -30,7 +30,12 @@ class ModelEditorclass(QtGui.QWidget): def __init__(self): QtGui.QWidget.__init__(self) - self.savepathtest = 'library/deviceModelLibrary' + + self.init_path = '../../' + if os.name == 'nt': + self.init_path = '' + + self.savepathtest = self.init_path + 'library/deviceModelLibrary' self.obj_appconfig = Appconfig() self.newflag = 0 self.layout = QtGui.QVBoxLayout() @@ -252,7 +257,7 @@ class ModelEditorclass(QtGui.QWidget): - Accordingly call `createtable(path)` to draw tables usingg QTable - Check for the state of button before rendering ''' - self.path = 'library/deviceModelLibrary/Templates' + self.path = self.init_path + 'library/deviceModelLibrary/Templates' if self.diode.isChecked(): if filetype == 'Diode': path = os.path.join(self.path, 'D.xml') @@ -326,7 +331,7 @@ class ModelEditorclass(QtGui.QWidget): QtGui.QFileDialog.getOpenFileName( self, "Open Library Directory", - "library/deviceModelLibrary", + self.init_path + "library/deviceModelLibrary", "*.lib")) self.createtable(self.editfile) except BaseException: @@ -471,7 +476,7 @@ class ModelEditorclass(QtGui.QWidget): ET.SubElement(param, tags).text = text tree = ET.ElementTree(root) defaultcwd = os.getcwd() - self.savepath = 'library/deviceModelLibrary' + self.savepath = self.init_path + 'library/deviceModelLibrary' if self.diode.isChecked(): savepath = os.path.join(self.savepath, 'Diode') os.chdir(savepath) @@ -695,7 +700,7 @@ class ModelEditorclass(QtGui.QWidget): QtGui.QFileDialog.getOpenFileName( self, "Open Library Directory", - "library/deviceModelLibrary", + self.init_path + "library/deviceModelLibrary", "*.lib")) libopen = open(self.libfile) filedata = libopen.read().split() |