From 453c2dab78f81046fcbd42034a86c4e759a0ff68 Mon Sep 17 00:00:00 2001 From: rahulp13 Date: Sun, 16 Feb 2020 22:56:59 +0530 Subject: workspace functionality --- src/frontEnd/Application.py | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) (limited to 'src/frontEnd/Application.py') diff --git a/src/frontEnd/Application.py b/src/frontEnd/Application.py index cd40214b..1b8a18c5 100644 --- a/src/frontEnd/Application.py +++ b/src/frontEnd/Application.py @@ -103,6 +103,13 @@ class Application(QtGui.QMainWindow): self.closeproj.setShortcut('Ctrl+X') self.closeproj.triggered.connect(self.close_project) + self.wrkspce = QtGui.QAction( + QtGui.QIcon('../../images/workspace.ico'), + 'Change Workspace', self + ) + self.wrkspce.setShortcut('Ctrl+W') + self.wrkspce.triggered.connect(self.change_workspace) + self.switchmode = None self.validate_mode() if self.online_flag == True: @@ -135,6 +142,7 @@ class Application(QtGui.QMainWindow): self.topToolbar.addAction(self.newproj) self.topToolbar.addAction(self.openproj) self.topToolbar.addAction(self.closeproj) + self.topToolbar.addAction(self.wrkspce) self.topToolbar.addAction(self.switchmode) self.topToolbar.addAction(self.helpfile) @@ -332,6 +340,15 @@ class Application(QtGui.QMainWindow): os.path.basename(current_project) + ' is Closed.' ) + def change_workspace(self): + """ + This function call changes Workspace + """ + print("Function : Change Workspace") + self.obj_workspace.returnWhetherClickedOrNot(self) + self.hide() + self.obj_workspace.show() + def validate_mode(self): """ This functions checks whether proper fp-lib-table* files are \ @@ -789,8 +806,21 @@ def main(args): appView = Application() appView.splash = splash appView.obj_workspace.returnWhetherClickedOrNot(appView) - appView.hide() - appView.obj_workspace.show() + + try: + file = open(os.path.join( + os.path.expanduser("~"),".esim/workspace.txt"), 'r' + ) + work = int(file.read(1)) + file.close() + except IOError: + work = 0 + if work is not 0: + appView.obj_workspace.defaultWorkspace() + else: + appView.hide() + appView.obj_workspace.show() + sys.exit(app.exec_()) -- cgit