diff options
Diffstat (limited to 'src/frontEnd')
-rw-r--r-- | src/frontEnd/Application.py | 73 | ||||
-rw-r--r-- | src/frontEnd/ProjectExplorer.py | 10 | ||||
-rw-r--r-- | src/frontEnd/Workspace.py | 11 |
3 files changed, 47 insertions, 47 deletions
diff --git a/src/frontEnd/Application.py b/src/frontEnd/Application.py index 1b8a18c5..3ecf9941 100644 --- a/src/frontEnd/Application.py +++ b/src/frontEnd/Application.py @@ -16,7 +16,7 @@ # REVISION: Friday 14 February 2020 # ========================================================================= -import pathmagic # noqa +from frontEnd import pathmagic # noqa from PyQt4 import QtGui, QtCore from configuration.Appconfig import Appconfig from projManagement.openProject import OpenProjectInfo @@ -64,10 +64,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('images/logo.png')) self.systemTrayIcon = QtGui.QSystemTrayIcon(self) - self.systemTrayIcon.setIcon(QtGui.QIcon('../../images/logo.png')) + self.systemTrayIcon.setIcon(QtGui.QIcon('images/logo.png')) self.systemTrayIcon.setVisible(True) def initToolBar(self): @@ -83,28 +83,28 @@ class Application(QtGui.QMainWindow): """ # Top Tool bar self.newproj = QtGui.QAction( - QtGui.QIcon('../../images/newProject.png'), + QtGui.QIcon('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('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('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('images/workspace.ico'), '<b>Change Workspace</b>', self ) self.wrkspce.setShortcut('Ctrl+W') @@ -112,19 +112,19 @@ class Application(QtGui.QMainWindow): self.switchmode = None self.validate_mode() - if self.online_flag == True: + if self.online_flag is True: self.switchmode = QtGui.QAction(QtGui.QIcon( - '../../images/online.png'), + 'images/online.png'), '<b>Go Offline</b>', self ) - elif self.online_flag == False: + elif self.online_flag is False: self.switchmode = QtGui.QAction(QtGui.QIcon( - '../../images/offline.png'), + 'images/offline.png'), '<b>Go Online</b>', self ) elif self.online_flag is None: self.switchmode = QtGui.QAction(QtGui.QIcon( - '../../images/disable.png'), + 'images/disable.png'), '<b>Mode switching has been disabled. ' + 'Default mode set to offline</b>', self ) @@ -133,7 +133,7 @@ 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('images/helpProject.png'), '<b>Help</b>', self ) self.helpfile.setShortcut('Ctrl+H') self.helpfile.triggered.connect(self.help_project) @@ -156,7 +156,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(''), 'images', 'fosseeLogo.png' )) self.logopic = self.logopic.scaled( QSize(150, 150), QtCore.Qt.KeepAspectRatio) @@ -166,48 +166,45 @@ class Application(QtGui.QMainWindow): # Left Tool bar Action Widget self.kicad = QtGui.QAction( - QtGui.QIcon('../../images/kicad.png'), + QtGui.QIcon('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('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('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('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('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('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('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('images/omoptim.png'), '<b>OM Optimisation</b>', self ) self.omoptim.triggered.connect(self.open_OMoptim) @@ -353,7 +350,7 @@ class Application(QtGui.QMainWindow): """ This functions checks whether proper fp-lib-table* files are \ available or not. If not, then move appropriate files from \ - supportFiles folder and set `self.online_flag` accordingly. + library/supportFiles folder and set `self.online_flag` accordingly. @params @@ -385,7 +382,7 @@ class Application(QtGui.QMainWindow): "/fp-lib-table") else: self.online_flag = False - + if remove: # Remove invalid files if os.path.exists( @@ -401,9 +398,9 @@ class Application(QtGui.QMainWindow): "/fp-lib-table-online") # Restore original files - shutil.copy('../supportFiles/fp-lib-table-online', + shutil.copy('library/supportFiles/fp-lib-table-online', self.obj_appconfig.kicad_path + "/") - shutil.copy('../supportFiles/fp-lib-table', + shutil.copy('library/supportFiles/fp-lib-table', self.obj_appconfig.kicad_path + "/") self.online_flag = False @@ -445,7 +442,7 @@ class Application(QtGui.QMainWindow): self.obj_appconfig.kicad_path + "/fp-lib-table" ) self.switchmode.setIcon( - QtGui.QIcon('../../images/offline.png') + QtGui.QIcon('images/offline.png') ) self.switchmode.setText('<b>Go Online</b>') self.switchmode.setEnabled(True) @@ -463,7 +460,7 @@ class Application(QtGui.QMainWindow): self.obj_appconfig.kicad_path + "/fp-lib-table" ) self.switchmode.setIcon( - QtGui.QIcon('../../images/online.png') + QtGui.QIcon('images/online.png') ) self.switchmode.setText('<b>Go Offline</b>') self.switchmode.setEnabled(True) @@ -471,10 +468,12 @@ class Application(QtGui.QMainWindow): elif self.online_flag is None: self.switchmode.setIcon( - QtGui.QIcon('../../images/disable.png') + QtGui.QIcon('images/disable.png') + ) + self.switchmode.setText( + '<b>Mode switching has been ' + + 'disabled. Default mode set to offline</b>.' ) - self.switchmode.setText('<b>Mode switching has been ' + - 'disabled. Default mode set to offline</b>.') self.switchmode.setEnabled(False) else: self.msg = QtGui.QErrorMessage() @@ -799,7 +798,7 @@ def main(args): print("Starting eSim......") app = QtGui.QApplication(args) - splash_pix = QtGui.QPixmap('../../images/splash_screen_esim.png') + splash_pix = QtGui.QPixmap('images/splash_screen_esim.png') splash = QtGui.QSplashScreen(splash_pix, QtCore.Qt.WindowStaysOnTopHint) splash.setMask(splash_pix.mask()) splash.show() @@ -809,13 +808,13 @@ def main(args): try: file = open(os.path.join( - os.path.expanduser("~"),".esim/workspace.txt"), 'r' + os.path.expanduser("~"), ".esim/workspace.txt"), 'r' ) work = int(file.read(1)) file.close() except IOError: work = 0 - if work is not 0: + if work != 0: appView.obj_workspace.defaultWorkspace() else: appView.hide() diff --git a/src/frontEnd/ProjectExplorer.py b/src/frontEnd/ProjectExplorer.py index 4462c584..c733c9b1 100644 --- a/src/frontEnd/ProjectExplorer.py +++ b/src/frontEnd/ProjectExplorer.py @@ -38,19 +38,19 @@ class ProjectExplorer(QtGui.QWidget): 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(images/vline.png) 0;} \ QTreeView::branch:has-siblings:adjoins-item { \ - border-image: url(../../images/branch-more.png) 0; } \ + border-image: url(images/branch-more.png) 0; } \ QTreeView::branch:!has-children:!has-siblings:adjoins-item { \ - border-image: url(../../images/branch-end.png) 0; } \ + border-image: url(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(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(images/branch-open.png); } \ ") for parents, children in list( diff --git a/src/frontEnd/Workspace.py b/src/frontEnd/Workspace.py index 09092a69..6940da59 100644 --- a/src/frontEnd/Workspace.py +++ b/src/frontEnd/Workspace.py @@ -64,7 +64,7 @@ class Workspace(QtGui.QWidget): self.cancelbtn = QtGui.QPushButton('Cancel') self.cancelbtn.clicked.connect(self.defaultWorkspace) - #Checkbox + # Checkbox self.chkbox = QtGui.QCheckBox('Set Default', self) self.chkbox.setCheckState(int(self.obj_appconfig.workspace_check)) @@ -82,7 +82,7 @@ class Workspace(QtGui.QWidget): self.setWindowTitle("eSim") self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) self.note.setReadOnly(True) - self.setWindowIcon(QtGui.QIcon('../../images/logo.png')) + self.setWindowIcon(QtGui.QIcon('images/logo.png')) self.setLayout(self.grid) def defaultWorkspace(self): @@ -121,7 +121,8 @@ class Workspace(QtGui.QWidget): file = open(os.path.join( os.path.expanduser("~"), ".esim/workspace.txt"), 'w' ) - file.writelines(str(self.obj_appconfig.workspace_check) + + file.writelines( + str(self.obj_appconfig.workspace_check) + " " + self.workspace_loc.text() ) file.close() @@ -148,10 +149,10 @@ class Workspace(QtGui.QWidget): self.obj_appconfig.project_explorer = json.load( open(self.obj_appconfig.dictPath["path"]) ) - except: + except BaseException: self.obj_appconfig.project_explorer = {} - Appconfig.project_explorer = self.obj_appconfig.project_explorer + Appconfig.project_explorer = self.obj_appconfig.project_explorer var_appView.obj_Mainview.obj_projectExplorer.treewidget.clear() for parent, children in self.obj_appconfig.project_explorer.items(): |