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 | |
parent | 175208c2553bde875968a9bc53176b6039ba9360 (diff) | |
download | eSim-c13e7b0f873e4857f1ce7924c0a72609df3ddca2.tar.gz eSim-c13e7b0f873e4857f1ce7924c0a72609df3ddca2.tar.bz2 eSim-c13e7b0f873e4857f1ce7924c0a72609df3ddca2.zip |
platform independent library and image paths, flake8 compliant
-rw-r--r-- | src/browser/UserManual.py | 14 | ||||
-rw-r--r-- | src/browser/Welcome.py | 9 | ||||
-rw-r--r-- | src/configuration/Appconfig.py | 9 | ||||
-rw-r--r-- | src/frontEnd/Application.py | 80 | ||||
-rw-r--r-- | src/frontEnd/ProjectExplorer.py | 14 | ||||
-rw-r--r-- | src/frontEnd/Workspace.py | 9 | ||||
-rw-r--r-- | src/kicadtoNgspice/DeviceModel.py | 9 | ||||
-rw-r--r-- | src/kicadtoNgspice/KicadtoNgspice.py | 18 | ||||
-rw-r--r-- | src/kicadtoNgspice/Processing.py | 6 | ||||
-rw-r--r-- | src/kicadtoNgspice/SubcircuitTab.py | 6 | ||||
-rw-r--r-- | src/modelEditor/ModelEditor.py | 15 | ||||
-rw-r--r-- | src/ngspicetoModelica/NgspicetoModelica.py | 11 | ||||
-rw-r--r-- | src/subcircuit/newSub.py | 7 | ||||
-rw-r--r-- | src/subcircuit/openSub.py | 7 | ||||
-rw-r--r-- | src/subcircuit/uploadSub.py | 6 |
15 files changed, 143 insertions, 77 deletions
diff --git a/src/browser/UserManual.py b/src/browser/UserManual.py index f31af29d..886d88a5 100644 --- a/src/browser/UserManual.py +++ b/src/browser/UserManual.py @@ -1,6 +1,5 @@ from PyQt4 import QtGui import subprocess -import platform import os @@ -15,14 +14,15 @@ class UserManual(QtGui.QWidget): self.vlayout = QtGui.QVBoxLayout() - file = os.path.realpath( - 'library/browser/User-Manual/eSim_Manual_2019_Dec_31.pdf' - ) + manual = 'library/browser/User-Manual/eSim_Manual_2.1.pdf' - if 'Win' in platform.system(): - os.startfile(file) + if os.name == 'nt': + os.startfile(os.path.realpath(manual)) else: - subprocess.Popen(['xpdf.real', file], shell=False) + manual_path = '../../' + manual + subprocess.Popen( + ['xdg-open', os.path.realpath(manual_path)], shell=False + ) self.setLayout(self.vlayout) self.show() diff --git a/src/browser/Welcome.py b/src/browser/Welcome.py index 69584f10..aa7b612f 100644 --- a/src/browser/Welcome.py +++ b/src/browser/Welcome.py @@ -1,4 +1,5 @@ from PyQt4 import QtGui, QtCore +import os class Welcome(QtGui.QWidget): @@ -10,10 +11,14 @@ class Welcome(QtGui.QWidget): def __init__(self): QtGui.QWidget.__init__(self) self.vlayout = QtGui.QVBoxLayout() - self.browser = QtGui.QTextBrowser() + + init_path = '../../' + if os.name == 'nt': + init_path = '' + self.browser.setSource(QtCore.QUrl( - "library/browser/welcome.html") + init_path + "library/browser/welcome.html") ) self.browser.setOpenExternalLinks(True) self.browser.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) diff --git a/src/configuration/Appconfig.py b/src/configuration/Appconfig.py index 6a10f3d7..a079d472 100644 --- a/src/configuration/Appconfig.py +++ b/src/configuration/Appconfig.py @@ -13,7 +13,7 @@ # MODIFIED: Rahul Paknikar, rahulp@iitb.ac.in # ORGANIZATION: eSim team at FOSSEE, IIT Bombay. # CREATED: Tuesday 24 February 2015 -# REVISION: Friday 14 February 2020 +# REVISION: Friday 24 July 2020 # ========================================================================= from PyQt4 import QtGui @@ -80,7 +80,12 @@ class Appconfig(QtGui.QWidget): # Open file and read KiCad config path try: - file = open('library/supportFiles/kicad_config_path.txt', 'r') + init_path = '../../' + if os.name == 'nt': + init_path = '' + + file = open(init_path + + 'library/supportFiles/kicad_config_path.txt', 'r') kicad_path = file.read().rstrip() file.close() except BaseException as e: diff --git a/src/frontEnd/Application.py b/src/frontEnd/Application.py index 92013409..6eaf4c9c 100644 --- a/src/frontEnd/Application.py +++ b/src/frontEnd/Application.py @@ -13,10 +13,18 @@ # MODIFIED: Rahul Paknikar, rahulp@iitb.ac.in # ORGANIZATION: eSim team at FOSSEE, IIT Bombay. # CREATED: Tuesday 24 February 2015 -# REVISION: Friday 14 February 2020 +# REVISION: Friday 24 July 2020 # ========================================================================= -from frontEnd import pathmagic # noqa +import os + +if os.name == 'nt': # noqa + init_path = '' + from frontEnd import pathmagic # noqa:F401 +else: + import pathmagic # noqa:F401 + init_path = '../../' + from PyQt4 import QtGui, QtCore from configuration.Appconfig import Appconfig from projManagement.openProject import OpenProjectInfo @@ -27,11 +35,10 @@ from projManagement import Worker from frontEnd import ProjectExplorer from frontEnd import Workspace from frontEnd import DockArea -import time from PyQt4.Qt import QSize -import sys -import os import shutil +import time +import sys # Its our main window of application. @@ -64,10 +71,10 @@ class Application(QtGui.QMainWindow): self.obj_appconfig._app_heigth) self.setWindowTitle(self.obj_appconfig._APPLICATION) self.showMaximized() - self.setWindowIcon(QtGui.QIcon('images/logo.png')) + self.setWindowIcon(QtGui.QIcon(init_path + 'images/logo.png')) self.systemTrayIcon = QtGui.QSystemTrayIcon(self) - self.systemTrayIcon.setIcon(QtGui.QIcon('images/logo.png')) + self.systemTrayIcon.setIcon(QtGui.QIcon(init_path + 'images/logo.png')) self.systemTrayIcon.setVisible(True) def initToolBar(self): @@ -83,28 +90,28 @@ class Application(QtGui.QMainWindow): """ # Top Tool bar self.newproj = QtGui.QAction( - QtGui.QIcon('images/newProject.png'), + QtGui.QIcon(init_path + 'images/newProject.png'), '<b>New Project</b>', self ) self.newproj.setShortcut('Ctrl+N') self.newproj.triggered.connect(self.new_project) self.openproj = QtGui.QAction( - QtGui.QIcon('images/openProject.png'), + QtGui.QIcon(init_path + 'images/openProject.png'), '<b>Open Project</b>', self ) self.openproj.setShortcut('Ctrl+O') self.openproj.triggered.connect(self.open_project) self.closeproj = QtGui.QAction( - QtGui.QIcon('images/closeProject.png'), + QtGui.QIcon(init_path + 'images/closeProject.png'), '<b>Close Project</b>', self ) self.closeproj.setShortcut('Ctrl+X') self.closeproj.triggered.connect(self.close_project) self.wrkspce = QtGui.QAction( - QtGui.QIcon('images/workspace.ico'), + QtGui.QIcon(init_path + 'images/workspace.ico'), '<b>Change Workspace</b>', self ) self.wrkspce.setShortcut('Ctrl+W') @@ -114,17 +121,17 @@ class Application(QtGui.QMainWindow): self.validate_mode() if self.online_flag is True: self.switchmode = QtGui.QAction(QtGui.QIcon( - 'images/online.png'), + init_path + 'images/online.png'), '<b>Go Offline</b>', self ) elif self.online_flag is False: self.switchmode = QtGui.QAction(QtGui.QIcon( - 'images/offline.png'), + init_path + 'images/offline.png'), '<b>Go Online</b>', self ) elif self.online_flag is None: self.switchmode = QtGui.QAction(QtGui.QIcon( - 'images/disable.png'), + init_path + 'images/disable.png'), '<b>Mode switching has been disabled. ' + 'Default mode set to offline</b>', self ) @@ -133,7 +140,8 @@ class Application(QtGui.QMainWindow): self.switchmode.triggered.connect(self.change_mode) self.helpfile = QtGui.QAction( - QtGui.QIcon('images/helpProject.png'), '<b>Help</b>', self + QtGui.QIcon(init_path + 'images/helpProject.png'), + '<b>Help</b>', self ) self.helpfile.setShortcut('Ctrl+H') self.helpfile.triggered.connect(self.help_project) @@ -156,7 +164,7 @@ class Application(QtGui.QMainWindow): self.logo = QtGui.QLabel() self.logopic = QtGui.QPixmap( os.path.join( - os.path.abspath(''), 'images', 'fosseeLogo.png' + os.path.abspath(''), init_path + 'images', 'fosseeLogo.png' )) self.logopic = self.logopic.scaled( QSize(150, 150), QtCore.Qt.KeepAspectRatio) @@ -166,45 +174,49 @@ class Application(QtGui.QMainWindow): # Left Tool bar Action Widget self.kicad = QtGui.QAction( - QtGui.QIcon('images/kicad.png'), + QtGui.QIcon(init_path + 'images/kicad.png'), '<b>Open Schematic</b>', self ) self.kicad.triggered.connect(self.obj_kicad.openSchematic) self.conversion = QtGui.QAction( - QtGui.QIcon('images/ki-ng.png'), + QtGui.QIcon(init_path + 'images/ki-ng.png'), '<b>Convert Kicad to Ngspice</b>', self ) self.conversion.triggered.connect(self.obj_kicad.openKicadToNgspice) self.ngspice = QtGui.QAction( - QtGui.QIcon('images/ngspice.png'), '<b>Simulation</b>', self + QtGui.QIcon(init_path + 'images/ngspice.png'), + '<b>Simulation</b>', self ) self.ngspice.triggered.connect(self.open_ngspice) self.model = QtGui.QAction( - QtGui.QIcon('images/model.png'), '<b>Model Editor</b>', self + QtGui.QIcon(init_path + 'images/model.png'), + '<b>Model Editor</b>', self ) self.model.triggered.connect(self.open_modelEditor) self.subcircuit = QtGui.QAction( - QtGui.QIcon('images/subckt.png'), '<b>Subcircuit</b>', self + QtGui.QIcon(init_path + 'images/subckt.png'), + '<b>Subcircuit</b>', self ) self.subcircuit.triggered.connect(self.open_subcircuit) self.nghdl = QtGui.QAction( - QtGui.QIcon('images/nghdl.png'), '<b>Nghdl</b>', self + QtGui.QIcon(init_path + 'images/nghdl.png'), '<b>Nghdl</b>', self ) self.nghdl.triggered.connect(self.open_nghdl) self.omedit = QtGui.QAction( - QtGui.QIcon('images/omedit.png'), + QtGui.QIcon(init_path + 'images/omedit.png'), '<b>Modelica Converter</b>', self ) self.omedit.triggered.connect(self.open_OMedit) self.omoptim = QtGui.QAction( - QtGui.QIcon('images/omoptim.png'), '<b>OM Optimisation</b>', self + QtGui.QIcon(init_path + 'images/omoptim.png'), + '<b>OM Optimisation</b>', self ) self.omoptim.triggered.connect(self.open_OMoptim) @@ -398,10 +410,14 @@ class Application(QtGui.QMainWindow): "/fp-lib-table-online") # Restore original files - shutil.copy('library/supportFiles/fp-lib-table-online', - self.obj_appconfig.kicad_path + "/") - shutil.copy('library/supportFiles/fp-lib-table', - self.obj_appconfig.kicad_path + "/") + shutil.copy( + init_path + 'library/supportFiles/fp-lib-table-online', + self.obj_appconfig.kicad_path + "/" + ) + shutil.copy( + init_path + 'library/supportFiles/fp-lib-table', + self.obj_appconfig.kicad_path + "/" + ) self.online_flag = False else: @@ -442,7 +458,7 @@ class Application(QtGui.QMainWindow): self.obj_appconfig.kicad_path + "/fp-lib-table" ) self.switchmode.setIcon( - QtGui.QIcon('images/offline.png') + QtGui.QIcon(init_path + 'images/offline.png') ) self.switchmode.setText('<b>Go Online</b>') self.switchmode.setEnabled(True) @@ -460,7 +476,7 @@ class Application(QtGui.QMainWindow): self.obj_appconfig.kicad_path + "/fp-lib-table" ) self.switchmode.setIcon( - QtGui.QIcon('images/online.png') + QtGui.QIcon(init_path + 'images/online.png') ) self.switchmode.setText('<b>Go Offline</b>') self.switchmode.setEnabled(True) @@ -468,7 +484,7 @@ class Application(QtGui.QMainWindow): elif self.online_flag is None: self.switchmode.setIcon( - QtGui.QIcon('images/disable.png') + QtGui.QIcon(init_path + 'images/disable.png') ) self.switchmode.setText( '<b>Mode switching has been ' + @@ -798,7 +814,7 @@ def main(args): print("Starting eSim......") app = QtGui.QApplication(args) - splash_pix = QtGui.QPixmap('images/splash_screen_esim.png') + splash_pix = QtGui.QPixmap(init_path + 'images/splash_screen_esim.png') splash = QtGui.QSplashScreen(splash_pix, QtCore.Qt.WindowStaysOnTopHint) splash.setMask(splash_pix.mask()) splash.show() diff --git a/src/frontEnd/ProjectExplorer.py b/src/frontEnd/ProjectExplorer.py index f0227164..d327427c 100644 --- a/src/frontEnd/ProjectExplorer.py +++ b/src/frontEnd/ProjectExplorer.py @@ -33,23 +33,27 @@ class ProjectExplorer(QtGui.QWidget): self.treewidget.setColumnHidden(1, True) # CSS + init_path = '../../' + if os.name == 'nt': + init_path = '' + self.treewidget.setStyleSheet(" \ QTreeView { border-radius: 15px; border: 1px \ solid gray; padding: 5px; width: 200px; height: 150px; }\ QTreeView::branch:has-siblings:!adjoins-item { \ - border-image: url(images/vline.png) 0;} \ + border-image: url(" + init_path + "images/vline.png) 0;} \ QTreeView::branch:has-siblings:adjoins-item { \ - border-image: url(images/branch-more.png) 0; } \ + border-image: url(" + init_path + "images/branch-more.png) 0; } \ QTreeView::branch:!has-children:!has-siblings:adjoins-item { \ - border-image: url(images/branch-end.png) 0; } \ + border-image: url(" + init_path + "images/branch-end.png) 0; } \ QTreeView::branch:has-children:!has-siblings:closed, \ QTreeView::branch:closed:has-children:has-siblings { \ border-image: none; \ - image: url(images/branch-closed.png); } \ + image: url(" + init_path + "images/branch-closed.png); } \ QTreeView::branch:open:has-children:!has-siblings, \ QTreeView::branch:open:has-children:has-siblings { \ border-image: none; \ - image: url(images/branch-open.png); } \ + image: url(" + init_path + "images/branch-open.png); } \ ") for parents, children in list( diff --git a/src/frontEnd/Workspace.py b/src/frontEnd/Workspace.py index 6940da59..ee3a49f3 100644 --- a/src/frontEnd/Workspace.py +++ b/src/frontEnd/Workspace.py @@ -13,7 +13,7 @@ # MODIFIED: Rahul Paknikar, rahulp@iitb.ac.in # ORGANIZATION: eSim team at FOSSEE, IIT Bombay. # CREATED: Wednesday 05 February 2015 -# REVISION: Friday 14 February 2020 +# REVISION: Friday 24 July 2020 # ========================================================================= from PyQt4 import QtCore, QtGui @@ -82,7 +82,12 @@ class Workspace(QtGui.QWidget): self.setWindowTitle("eSim") self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) self.note.setReadOnly(True) - self.setWindowIcon(QtGui.QIcon('images/logo.png')) + + init_path = '../../' + if os.name == 'nt': + init_path = '' + + self.setWindowIcon(QtGui.QIcon(init_path + 'images/logo.png')) self.setLayout(self.grid) def defaultWorkspace(self): diff --git a/src/kicadtoNgspice/DeviceModel.py b/src/kicadtoNgspice/DeviceModel.py index 31ff74f7..ceb89351 100644 --- a/src/kicadtoNgspice/DeviceModel.py +++ b/src/kicadtoNgspice/DeviceModel.py @@ -364,11 +364,16 @@ class DeviceModel(QtGui.QWidget): sending_btn = self.sender() self.widgetObjCount = int(sending_btn.objectName()) + init_path = '../../' + if os.name == 'nt': + init_path = '' + self.libfile = str( QtGui.QFileDialog.getOpenFileName( self, "Open Library Directory", - "library/deviceModelLibrary", - "*.lib")) + init_path + "library/deviceModelLibrary", "*.lib" + ) + ) # Setting Library to Text Edit Line self.entry_var[self.widgetObjCount].setText(self.libfile) diff --git a/src/kicadtoNgspice/KicadtoNgspice.py b/src/kicadtoNgspice/KicadtoNgspice.py index 6d654158..b52a4de8 100644 --- a/src/kicadtoNgspice/KicadtoNgspice.py +++ b/src/kicadtoNgspice/KicadtoNgspice.py @@ -599,16 +599,16 @@ class MainWindow(QtGui.QWidget): tree = ET.ElementTree(attr_parent) tree.write(fw) - # Create Convert object with the source details & the schematic details - print("=============================================================") - print("SOURCE LIST TRACK") - print(self.obj_track.sourcelisttrack["ITEMS"]) - print("SOURCE ENTRY VAR") - print(self.obj_track.source_entry_var["ITEMS"]) - print("SCHEMATIC INFO") - print(store_schematicInfo) - print("=============================================================") + # print("=============================================================") + # print("SOURCE LIST TRACK") + # print(self.obj_track.sourcelisttrack["ITEMS"]) + # print("SOURCE ENTRY VAR") + # print(self.obj_track.source_entry_var["ITEMS"]) + # print("SCHEMATIC INFO") + # print(store_schematicInfo) + # print("=============================================================") + # Create Convert object with the source details & the schematic details self.obj_convert = Convert.Convert( self.obj_track.sourcelisttrack["ITEMS"], self.obj_track.source_entry_var["ITEMS"], diff --git a/src/kicadtoNgspice/Processing.py b/src/kicadtoNgspice/Processing.py index 67ffd3f5..494c49b4 100644 --- a/src/kicadtoNgspice/Processing.py +++ b/src/kicadtoNgspice/Processing.py @@ -8,7 +8,11 @@ class PrcocessNetlist: - This class include all the function required for pre-proccessing of netlist before converting to Ngspice Netlist. """ - modelxmlDIR = 'library/modelParamXML' + init_path = '../../' + if os.name == 'nt': + init_path = '' + + modelxmlDIR = init_path + 'library/modelParamXML' def __init__(self): pass diff --git a/src/kicadtoNgspice/SubcircuitTab.py b/src/kicadtoNgspice/SubcircuitTab.py index d68cb97e..f4b759c5 100644 --- a/src/kicadtoNgspice/SubcircuitTab.py +++ b/src/kicadtoNgspice/SubcircuitTab.py @@ -146,10 +146,14 @@ class SubcircuitTab(QtGui.QWidget): # print "Object Called is ",sending_btn.objectName() self.widgetObjCount = int(sending_btn.objectName()) + init_path = '../../' + if os.name == 'nt': + init_path = '' + self.subfile = str( QtGui.QFileDialog.getExistingDirectory( self, "Open Subcircuit", - "library/SubcircuitLibrary") + init_path + "library/SubcircuitLibrary") ) self.reply = self.obj_validation.validateSub( self.subfile, self.numPorts[self.widgetObjCount - 1]) 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() diff --git a/src/ngspicetoModelica/NgspicetoModelica.py b/src/ngspicetoModelica/NgspicetoModelica.py index 09e28981..4df65c8d 100644 --- a/src/ngspicetoModelica/NgspicetoModelica.py +++ b/src/ngspicetoModelica/NgspicetoModelica.py @@ -472,12 +472,11 @@ class NgMoConverter: self.mappingData["Devices"][deviceName]["import"] ) + ".NPN" elif trans == 'pnp': - start = ( - self.mappingData - ["Devices"] - [deviceName] - ["import"] - ) + ".PNP" + start = (self.mappingData + ["Devices"] + [deviceName] + ["import"] + ) + ".PNP" else: raise NameError("Transistor " + str(trans) + " Not found") diff --git a/src/subcircuit/newSub.py b/src/subcircuit/newSub.py index 5e98d24a..9c9ebbd8 100644 --- a/src/subcircuit/newSub.py +++ b/src/subcircuit/newSub.py @@ -27,11 +27,16 @@ class NewSub(QtGui.QWidget): - Name can not be empty. - File name already exists. """ + + init_path = '../../' + if os.name == 'nt': + init_path = '' + self.create_schematic = subName # Checking if Workspace already exist or not self.schematic_path = ( os.path.join( - os.path.abspath('library'), + os.path.abspath(init_path + 'library'), 'SubcircuitLibrary', self.create_schematic)) diff --git a/src/subcircuit/openSub.py b/src/subcircuit/openSub.py index 6cb4fe3e..0e0906c0 100644 --- a/src/subcircuit/openSub.py +++ b/src/subcircuit/openSub.py @@ -16,9 +16,14 @@ class openSub(QtGui.QWidget): self.obj_appconfig = Appconfig() def body(self): + + init_path = '../../' + if os.name == 'nt': + init_path = '' + self.editfile = str( QtGui.QFileDialog.getExistingDirectory( - None, "Open File", "library/SubcircuitLibrary")) + None, "Open File", init_path + "library/SubcircuitLibrary")) if self.editfile: self.obj_Appconfig = Appconfig() self.obj_Appconfig.current_subcircuit['SubcircuitName'] \ diff --git a/src/subcircuit/uploadSub.py b/src/subcircuit/uploadSub.py index 25a6e7d4..c7b3951f 100644 --- a/src/subcircuit/uploadSub.py +++ b/src/subcircuit/uploadSub.py @@ -63,8 +63,12 @@ class UploadSub(QtGui.QWidget): print("Invalid file format") return + init_path = '../../' + if os.name == 'nt': + init_path = '' + subcircuit_path = os.path.join( - os.path.abspath('library'), + os.path.abspath(init_path + 'library'), 'SubcircuitLibrary', create_subcircuit ) |