diff options
author | rahulp13 | 2023-06-29 18:27:07 +0530 |
---|---|---|
committer | rahulp13 | 2023-06-29 19:38:37 +0530 |
commit | a281909027a5c82cb1c6b84a6558b35c8b088133 (patch) | |
tree | b047fb7ad397f6d65e880d7cdf5c5212e99b660f /src | |
parent | 6fb36b7f770ecf81e2abd8b8b5d86a1b75e497c5 (diff) | |
download | eSim-a281909027a5c82cb1c6b84a6558b35c8b088133.tar.gz eSim-a281909027a5c82cb1c6b84a6558b35c8b088133.tar.bz2 eSim-a281909027a5c82cb1c6b84a6558b35c8b088133.zip |
removed kicad online mode switching
Diffstat (limited to 'src')
-rw-r--r-- | src/configuration/Appconfig.py | 16 | ||||
-rw-r--r-- | src/frontEnd/Application.py | 170 |
2 files changed, 1 insertions, 185 deletions
diff --git a/src/configuration/Appconfig.py b/src/configuration/Appconfig.py index 00977ca0..4decf0b6 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: Tuesday 13 September 2022 +# REVISION: Thursday 29 June 2023 # ========================================================================= from PyQt5 import QtWidgets @@ -80,20 +80,6 @@ class Appconfig(QtWidgets.QWidget): print("Cannot access Modelica map file --- .esim folder") print(str(e)) - # Open file and read KiCad config path - try: - 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: - kicad_path = None - print(str(e)) - try: project_explorer = json.load(open(dictPath["path"])) except BaseException: diff --git a/src/frontEnd/Application.py b/src/frontEnd/Application.py index 96be7ca4..a6f2cd10 100644 --- a/src/frontEnd/Application.py +++ b/src/frontEnd/Application.py @@ -20,7 +20,6 @@ import os import sys -import shutil import traceback if os.name == 'nt': @@ -56,9 +55,6 @@ class Application(QtWidgets.QMainWindow): # Calling __init__ of super class QtWidgets.QMainWindow.__init__(self, *args) - # Flag for mode of operation. Default is set to offline mode. - self.online_flag = False - # Set slot for simulation end signal to plot simulation data self.simulationEndSignal.connect(self.plotSimulationData) @@ -126,28 +122,6 @@ class Application(QtWidgets.QMainWindow): self.wrkspce.setShortcut('Ctrl+W') self.wrkspce.triggered.connect(self.change_workspace) - self.switchmode = None - self.validate_mode() - if self.online_flag is True: - self.switchmode = QtWidgets.QAction(QtGui.QIcon( - init_path + 'images/online.png'), - '<b>Go Offline</b>', self - ) - elif self.online_flag is False: - self.switchmode = QtWidgets.QAction(QtGui.QIcon( - init_path + 'images/offline.png'), - '<b>Go Online</b>', self - ) - elif self.online_flag is None: - self.switchmode = QtWidgets.QAction(QtGui.QIcon( - init_path + 'images/disable.png'), - '<b>Mode switching has been disabled. ' + - 'Default mode set to offline</b>', self - ) - self.switchmode.setEnabled(False) - self.switchmode.setShortcut('Ctrl+G') - self.switchmode.triggered.connect(self.change_mode) - self.helpfile = QtWidgets.QAction( QtGui.QIcon(init_path + 'images/helpProject.png'), '<b>Help</b>', self @@ -160,7 +134,6 @@ class Application(QtWidgets.QMainWindow): 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) # ## This part is meant for SoC Generation which is currently ## @@ -398,149 +371,6 @@ class Application(QtWidgets.QMainWindow): self.hide() self.obj_workspace.show() - def validate_mode(self): - """ - This functions checks whether proper fp-lib-table* files are \ - available or not. If not, then move appropriate files from \ - library/supportFiles folder and set `self.online_flag` accordingly. - - @params - - @return - None - """ - remove = False - - if self.obj_appconfig.kicad_path is not None: - - if not os.path.exists( - self.obj_appconfig.kicad_path + "/fp-lib-table" - ): - remove = True - elif os.path.exists(self.obj_appconfig.kicad_path + - "/fp-lib-table-offline"): - if os.path.exists(self.obj_appconfig.kicad_path + - "/fp-lib-table-online"): - remove = True - os.remove(self.obj_appconfig.kicad_path + - "/fp-lib-table") - else: - self.online_flag = True - else: - if not os.path.exists(self.obj_appconfig.kicad_path + - "/fp-lib-table-online"): - remove = True - os.remove(self.obj_appconfig.kicad_path + - "/fp-lib-table") - else: - self.online_flag = False - - if remove: - # Remove invalid files - if os.path.exists( - self.obj_appconfig.kicad_path + "/fp-lib-table-offline" - ): - os.remove(self.obj_appconfig.kicad_path + - "/fp-lib-table-offline") - - if os.path.exists( - self.obj_appconfig.kicad_path + "/fp-lib-table-online" - ): - os.remove(self.obj_appconfig.kicad_path + - "/fp-lib-table-online") - - # Restore original files - 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: - self.online_flag = None - - def change_mode(self): - """ - - This function is used for changing mode of operation for KiCad. \ - - There are three modes of operation : - - online - - offline - - disable - - - If none of the KiCad tools (associated with eSim) are \ - open, then validate this mode by calling the function \ - `validate_mode` and depending on online_flag, swap \ - appropriate fp-lib-table files. - - If any of the KiCad tools (associated with eSim) is open, \ - then ask user to close all these tools. - - If `online_flag` is `None`, then disable this feature. - - @params - - @return - None - """ - if not self.obj_kicad.check_open_schematic(): - self.validate_mode() - if self.online_flag is True: - os.rename( - self.obj_appconfig.kicad_path + "/fp-lib-table", - self.obj_appconfig.kicad_path + - "/fp-lib-table-online" - ) - os.rename( - self.obj_appconfig.kicad_path + - "/fp-lib-table-offline", - self.obj_appconfig.kicad_path + "/fp-lib-table" - ) - self.switchmode.setIcon( - QtGui.QIcon(init_path + 'images/offline.png') - ) - self.switchmode.setText('<b>Go Online</b>') - self.switchmode.setEnabled(True) - self.online_flag = False - - elif self.online_flag is False: - os.rename( - self.obj_appconfig.kicad_path + "/fp-lib-table", - self.obj_appconfig.kicad_path + - "/fp-lib-table-offline" - ) - os.rename( - self.obj_appconfig.kicad_path + - "/fp-lib-table-online", - self.obj_appconfig.kicad_path + "/fp-lib-table" - ) - self.switchmode.setIcon( - QtGui.QIcon(init_path + 'images/online.png') - ) - self.switchmode.setText('<b>Go Offline</b>') - self.switchmode.setEnabled(True) - self.online_flag = True - - elif self.online_flag is None: - self.switchmode.setIcon( - QtGui.QIcon(init_path + 'images/disable.png') - ) - self.switchmode.setText( - '<b>Mode switching has been ' + - 'disabled. Default mode set to offline</b>.' - ) - self.switchmode.setEnabled(False) - else: - self.msg = QtWidgets.QErrorMessage() - self.msg.setWindowTitle("Error Message") - self.msg.setModal(True) - self.msg.showMessage( - 'Please save and close all the KiCad ' + - 'windows first, then change the mode' - ) - self.msg.exec_() - def help_project(self): """ This function opens usermanual in dockarea. |