diff options
author | rahulp13 | 2020-02-21 12:39:52 +0530 |
---|---|---|
committer | rahulp13 | 2020-02-21 12:39:52 +0530 |
commit | 567e3b725fcc9d22e27cfd854a573d3e64deaff1 (patch) | |
tree | abd4d995d5891a1196a7ca421b7d7b33cad75552 /src/frontEnd/Application.py | |
parent | 982b49ef618222af80162aa98c07ab281dec1692 (diff) | |
download | eSim-567e3b725fcc9d22e27cfd854a573d3e64deaff1.tar.gz eSim-567e3b725fcc9d22e27cfd854a573d3e64deaff1.tar.bz2 eSim-567e3b725fcc9d22e27cfd854a573d3e64deaff1.zip |
restructured code - pyinstaller
Diffstat (limited to 'src/frontEnd/Application.py')
-rw-r--r-- | src/frontEnd/Application.py | 73 |
1 files changed, 36 insertions, 37 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() |