From 1d9967fa80981e856825a5d5910902245f2390ba Mon Sep 17 00:00:00 2001 From: anjalijaiswal08 Date: Wed, 19 Jun 2019 17:54:55 +0530 Subject: Issue #87 solved: Documentation of src/frontend --- src/frontEnd/Application.py | 102 ++++++++++++++++++++++------------------ src/frontEnd/DockArea.py | 40 +++++++++------- src/frontEnd/ProjectExplorer.py | 23 +++++---- src/frontEnd/Workspace.py | 11 ++++- 4 files changed, 97 insertions(+), 79 deletions(-) (limited to 'src') diff --git a/src/frontEnd/Application.py b/src/frontEnd/Application.py index c2790a80..66fc2b91 100755 --- a/src/frontEnd/Application.py +++ b/src/frontEnd/Application.py @@ -39,7 +39,6 @@ class Application(QtGui.QMainWindow): def __init__(self, *args): """Initialize main Application window.""" - # Calling __init__ of super class QtGui.QMainWindow.__init__(self, *args) @@ -69,12 +68,11 @@ class Application(QtGui.QMainWindow): def initToolBar(self): """ In this function we are setting icons, short-cuts,and - defining functonality for:. - a)Top-tool-bar (New project, Open project, Close - project, Help option ) - b)Left-tool-bar (Open Schematic, Convert KiCad to - NgSpice, Simuation, Model Editor, Subcircuit, NGHDL, - Modelica Converter, OM Optimisation ) + defining functonality for: + + - Top-tool-bar (New project, Open project, Close project, Help option ) + - Left-tool-bar (Open Schematic, Convert KiCad to NgSpice, Simuation, + Model Editor, Subcircuit, NGHDL, Modelica Converter, OM Optimisation ) """ # Top Tool bar self.newproj = QtGui.QAction( @@ -199,16 +197,17 @@ class Application(QtGui.QMainWindow): When exit button is pressed a Message box pops out with exit message and buttons 'Yes', 'No'. - 1. If 'Yes' is pressed:. - a)it checks that program(process) in procThread_list - (list made in Appconfig.py): - a.1) if available it terminates that program - a.2) if the program(process) is not available, - it checks for it in process_obj (list made in - Appconfig.py) if found it closes the program. + 1. If 'Yes' is pressed: + - it checks that program(process) in procThread_list (list made in + Appconfig.py): + + - if available it terminates that program + - if the program(process) is not available, it checks for it + in process_obj (list made in Appconfig.py) if found it + closes the program. - 2. If 'No' is pressed: - a)the program just continues as it was doing earlier. + 2. If 'No' is pressed: + - the program just continues as it was doing earlier. ''' exit_msg = "Are you sure you want to exit the program\ ? All unsaved data will be lost." @@ -246,11 +245,13 @@ class Application(QtGui.QMainWindow): def close_project(self): """ This function first checks whether project(file) is present in list. - a)If present: - :-it first kills that process-id. - :-closes that file. - :-Shows message "Current project is closed" - b)If not present:- pass + + - If present: + - it first kills that process-id. + - closes that file. + - Shows message "Current project is closed" + + - If not present: pass """ print("Function : Close Project") current_project = self.obj_appconfig.current_project['ProjectName'] @@ -308,10 +309,10 @@ class Application(QtGui.QMainWindow): # This page opens usermanual in dockarea. def help_project(self): """ - 1)It prints the message ""Function : Help"" - 2)Uses print_info() method of class Appconfig - form Configuration/Appconfig.py file. - 3)Call method usermanual() from ./DockArea.py. + - It prints the message ""Function : Help"" + - Uses print_info() method of class Appconfig + from Configuration/Appconfig.py file. + - Call method usermanual() from ./DockArea.py. """ print("Function : Help") self.obj_appconfig.print_info('Help is called') @@ -348,9 +349,10 @@ class Application(QtGui.QMainWindow): """ When 'subcircuit' icon is clicked wich is present in left-tool-bar of main page: - a) Meassge shown on screen "Subcircuit editor is called". - b) 'subcircuiteditor()'' function is called using object - 'obj_dockarea' of class 'Mainview'. + + - Meassge shown on screen "Subcircuit editor is called". + - 'subcircuiteditor()' function is called using object + 'obj_dockarea' of class 'Mainview'. """ print("Function : Subcircuit editor") self.obj_appconfig.print_info('Subcircuit editor is called') @@ -361,10 +363,11 @@ class Application(QtGui.QMainWindow): """ This function uses validateTool() method from Validation.py: - a) If 'nghdl' is present in executables list then - it adds passes command 'nghdl -e' to WorkerThread class of - Worker.py. - b) If 'nghdl' not present then it shows error message. + + - If 'nghdl' is present in executables list then + it adds passes command 'nghdl -e' to WorkerThread class of + Worker.py. + - If 'nghdl' not present then it shows error message. """ print("Function : Nghdl") self.obj_appconfig.print_info('Nghdl is called') @@ -385,11 +388,12 @@ class Application(QtGui.QMainWindow): # This function opens model editor option in left-tool-bar. def open_modelEditor(self): """ - When model editor icon is clicked wich is present in + When model editor icon is clicked which is present in left-tool-bar of main page: - a) Meassge shown on screen "Model editor is called". - b) 'modeleditor()'' function is called using object - 'obj_dockarea' of class 'Mainview'. + + - Meassge shown on screen "Model editor is called". + - 'modeleditor()' function is called using object + 'obj_dockarea' of class 'Mainview'. """ print("Function : Model editor") self.obj_appconfig.print_info('Model editor is called') @@ -475,11 +479,12 @@ class Application(QtGui.QMainWindow): """ This function uses validateTool() method from Validation.py: - a) If 'OMOptim' is present in executables list then - it adds passes command 'OMOptim' to WorkerThread class of - Worker.py. - b) If 'OMOptim' not present then it shows error message with - link to download it on Linux and Windows. + + - If 'OMOptim' is present in executables list then + it adds passes command 'OMOptim' to WorkerThread class of + Worker.py. + - If 'OMOptim' not present then it shows error message with + link to download it on Linux and Windows. """ print("Function : OM Optim") self.obj_appconfig.print_info('OM Optim is called') @@ -510,12 +515,15 @@ class Application(QtGui.QMainWindow): class MainView(QtGui.QWidget): """ This class defines whole view and style of main page: - a)Position of tool bars: - :-Top tool bar. - :-Left tool bar. - b) Project explorer Area. - c) Dock area. - d)Console area. + + - Position of tool bars: + + - Top tool bar. + - Left tool bar. + + - Project explorer Area. + - Dock area. + - Console area. """ diff --git a/src/frontEnd/DockArea.py b/src/frontEnd/DockArea.py index 8b8e975b..99270366 100644 --- a/src/frontEnd/DockArea.py +++ b/src/frontEnd/DockArea.py @@ -17,10 +17,21 @@ dock = {} # class DockArea(QtGui.QMainWindow): - """Sdf.""" + """ + This class contains function for designing UI of all the editors + in dock area part: + + - Test Editor. + - Model Editor. + - Python Plotting. + - NgSpice Editor. + - Kicad to NgSpice Editor. + - Subcircuit Editor. + - Modelica editor. + """ def __init__(self): - """Sdf.""" + """This act as constructor for class DockArea.""" QtGui.QMainWindow.__init__(self) self.obj_appconfig = Appconfig() @@ -43,9 +54,8 @@ class DockArea(QtGui.QMainWindow): # self.tabifyDockWidget(dock['Notes'],dock['Blank']) self.show() - # This function create widget for Library Editor def createTestEditor(self): - """Sdf.""" + """This function create widget for Library Editor.""" global count self.testWidget = QtGui.QWidget() self.testArea = QtGui.QTextEdit() @@ -71,9 +81,8 @@ class DockArea(QtGui.QMainWindow): dock['Tips-' + str(count)]) count = count + 1 - # This function create widget for interactive PythonPlotting def plottingEditor(self): - """Sdf.""" + """This function create widget for interactive PythonPlotting""" self.projDir = self.obj_appconfig.current_project["ProjectName"] self.projName = os.path.basename(self.projDir) # self.project = os.path.join(self.projDir,self.projName) @@ -102,7 +111,6 @@ class DockArea(QtGui.QMainWindow): dock['Plotting-' + str(count)]) count = count + 1 - # This function creates widget for NgSpice window. def ngspiceEditor(self, projDir): """Sdf.""" self.projDir = projDir @@ -142,9 +150,8 @@ class DockArea(QtGui.QMainWindow): dock['NgSpice-' + str(count)]) count = count + 1 - # This function defines UI for model editor. def modelEditor(self): - """Sdf.""" + """This function defines UI for model editor.""" print("in model editor") global count self.modelwidget = QtGui.QWidget() @@ -178,9 +185,8 @@ class DockArea(QtGui.QMainWindow): dock['Model Editor-' + str(count)]) count = count + 1 - # This function is creating Editor UI for Kicad to Ngspice conversion. def kicadToNgspiceEditor(self, clarg1, clarg2=None): - """Sdf.""" + """This function is creating Editor UI for Kicad to Ngspice conversion.""" global count self.kicadToNgspiceWidget = QtGui.QWidget() self.kicadToNgspiceLayout = QtGui.QVBoxLayout() @@ -211,9 +217,8 @@ class DockArea(QtGui.QMainWindow): dock['kicadToNgspice-' + str(count)]) count = count + 1 - # This function creates a widget for different subcircuit options. def subcircuiteditor(self): - """Sdf.""" + """This function creates a widget for different subcircuit options.""" global count self.subcktWidget = QtGui.QWidget() self.subcktLayout = QtGui.QVBoxLayout() @@ -243,9 +248,7 @@ class DockArea(QtGui.QMainWindow): dock['Subcircuit-' + str(count)]) count = count + 1 - # This function creates a widget for different subcircuit options. def usermanual(self): - """Sdf.""" global count self.usermanualWidget = QtGui.QWidget() self.usermanualLayout = QtGui.QVBoxLayout() @@ -272,7 +275,6 @@ class DockArea(QtGui.QMainWindow): count = count + 1 - # This function sets up the UI for ngspice to modelica conversion. def modelicaEditor(self, projDir): """Dfg.""" global count @@ -303,9 +305,11 @@ class DockArea(QtGui.QMainWindow): count = count + 1 - # This function when called closes the opened file. def closeDock(self): - """Sdf.""" + """ + This function checks for the project in **dock_dict** + and closes it. + """ self.temp = self.obj_appconfig.current_project['ProjectName'] for dockwidget in self.obj_appconfig.dock_dict[self.temp]: dockwidget.close() diff --git a/src/frontEnd/ProjectExplorer.py b/src/frontEnd/ProjectExplorer.py index 8d0ef4ec..8304ac20 100644 --- a/src/frontEnd/ProjectExplorer.py +++ b/src/frontEnd/ProjectExplorer.py @@ -8,19 +8,20 @@ from configuration.Appconfig import Appconfig class ProjectExplorer(QtGui.QWidget): """ This class contains function: - a)One work as a constructor(__init__). - b)For saving data. - c)for renaming project. - d)for refreshing project. - e)for removing project. - f) for saving data. + + - One work as a constructor(__init__). + - For saving data. + - for renaming project. + - for refreshing project. + - for removing project. + - for saving data. """ def __init__(self): """ This method is doing following tasks: - a)Working as a constructor for class ProjectExplorer. - b)view of project explorer area. + - Working as a constructor for class ProjectExplorer. + - view of project explorer area. """ QtGui.QWidget.__init__(self) self.obj_appconfig = Appconfig() @@ -55,7 +56,7 @@ class ProjectExplorer(QtGui.QWidget): pathlist = parents.split(os.sep) parentnode = QtGui.QTreeWidgetItem( self.treewidget, [pathlist[-1], parents] - ) + ) for files in children: QtGui.QTreeWidgetItem( parentnode, [files, os.path.join(parents, files)]) @@ -172,7 +173,7 @@ class ProjectExplorer(QtGui.QWidget): def save_data(self): """ This function first opens file in write-mode, when write - operation is performed it closes that file and then window. + operation is performed it closes that file and then it closes window. """ self.fopen = open(self.filePath, 'w') self.fopen.write(self.text.toPlainText()) @@ -225,7 +226,6 @@ class ProjectExplorer(QtGui.QWidget): json.dump(self.obj_appconfig.project_explorer, open(self.obj_appconfig.dictPath, 'w')) - # """ def renameProject(self): indexItem = self.treewidget.currentIndex() baseFileName = str(indexItem.data()) @@ -273,4 +273,3 @@ class ProjectExplorer(QtGui.QWidget): self.obj_appconfig.project_explorer.items() ): self.addTreeNode(parent, children) - # """ diff --git a/src/frontEnd/Workspace.py b/src/frontEnd/Workspace.py index 30d0607b..55a8c95e 100644 --- a/src/frontEnd/Workspace.py +++ b/src/frontEnd/Workspace.py @@ -20,11 +20,18 @@ from configuration.Appconfig import Appconfig import time import os -# This class creates Workspace GUI. - +# This class creates Workspace GUI. class Workspace(QtGui.QWidget): """ + This class creates UI for WorkSpace selection window. + + This window contains text area to select location of your choice + or browse location for workspace area. + + By default workspace is set in ~/eSim-Workspace. + + This workspace area contains all the projects made by user. """ -- cgit