From 7fc799678827cc90b91d85498d8a5adee3b73c2a Mon Sep 17 00:00:00 2001 From: PatelVatsalB21 Date: Tue, 5 Jul 2022 10:26:31 +0530 Subject: Resolved Project Files Refresh Problem --- src/frontEnd/ProjectExplorer.py | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'src/frontEnd') diff --git a/src/frontEnd/ProjectExplorer.py b/src/frontEnd/ProjectExplorer.py index 456276c8..bacb569c 100755 --- a/src/frontEnd/ProjectExplorer.py +++ b/src/frontEnd/ProjectExplorer.py @@ -69,13 +69,20 @@ class ProjectExplorer(QtWidgets.QWidget): parentnode, [files, os.path.join(parents, files)] ) self.window.addWidget(self.treewidget) - + self.treewidget.expanded.connect(self.refreshInstant) self.treewidget.doubleClicked.connect(self.openProject) self.treewidget.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) self.treewidget.customContextMenuRequested.connect(self.openMenu) self.setLayout(self.window) self.show() + def refreshInstant(self): + for i in range(self.treewidget.topLevelItemCount()): + if(self.treewidget.topLevelItem(i).isExpanded()): + index = self.treewidget.indexFromItem( + self.treewidget.topLevelItem(i)) + self.refreshProject(indexItem=index) + def addTreeNode(self, parents, children): os.path.join(parents) pathlist = parents.split(os.sep) @@ -137,6 +144,7 @@ class ProjectExplorer(QtWidgets.QWidget): self.save = QtWidgets.QPushButton('Save and Exit') self.save.setDisabled(True) self.windowgrid = QtWidgets.QGridLayout() + self.refreshProject(self.filePath) if (os.path.isfile(str(self.filePath))): self.fopen = open(str(self.filePath), 'r') @@ -202,25 +210,31 @@ class ProjectExplorer(QtWidgets.QWidget): json.dump(self.obj_appconfig.project_explorer, open(self.obj_appconfig.dictPath["path"], 'w')) - def refreshProject(self, filePath=None): + def refreshProject(self, filePath=None, indexItem=None): """ This function refresh the project in explorer area by right \ clicking on project and selecting refresh option. """ if not filePath or filePath is None: - self.indexItem = self.treewidget.currentIndex() + if indexItem is None: + self.indexItem = self.treewidget.currentIndex() + else: + self.indexItem = indexItem + filePath = str( self.indexItem.sibling(self.indexItem.row(), 1).data() ) if os.path.exists(filePath): filelistnew = os.listdir(os.path.join(filePath)) - parentnode = self.treewidget.currentItem() + if indexItem is None: + parentnode = self.treewidget.currentItem() + else: + parentnode = self.treewidget.itemFromIndex(self.indexItem) count = parentnode.childCount() for i in range(count): - for items in self.treewidget.selectedItems(): - items.removeChild(items.child(0)) + parentnode.removeChild(parentnode.child(0)) for files in filelistnew: QtWidgets.QTreeWidgetItem( parentnode, [files, os.path.join(filePath, files)] -- cgit From 99c9974171f3bbbba0012a7a94648bfa00147be3 Mon Sep 17 00:00:00 2001 From: rahulp13 Date: Sat, 17 Sep 2022 22:54:48 +0530 Subject: fix file open issue due to #210 --- src/frontEnd/ProjectExplorer.py | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) (limited to 'src/frontEnd') diff --git a/src/frontEnd/ProjectExplorer.py b/src/frontEnd/ProjectExplorer.py index bacb569c..77c9352e 100755 --- a/src/frontEnd/ProjectExplorer.py +++ b/src/frontEnd/ProjectExplorer.py @@ -132,25 +132,21 @@ class ProjectExplorer(QtWidgets.QWidget): self.filePath = str( self.indexItem.sibling(self.indexItem.row(), 1).data() ) - self.obj_appconfig.print_info( - 'The current project is ' + self.filePath) - - self.textwindow = QtWidgets.QWidget() - self.textwindow.setMinimumSize(600, 500) - self.textwindow.setGeometry(QtCore.QRect(400, 150, 400, 400)) - self.textwindow.setWindowTitle(filename) - - self.text = QtWidgets.QTextEdit() - self.save = QtWidgets.QPushButton('Save and Exit') - self.save.setDisabled(True) - self.windowgrid = QtWidgets.QGridLayout() - self.refreshProject(self.filePath) if (os.path.isfile(str(self.filePath))): self.fopen = open(str(self.filePath), 'r') lines = self.fopen.read() - self.text.setText(lines) + self.textwindow = QtWidgets.QWidget() + self.textwindow.setMinimumSize(600, 500) + self.textwindow.setGeometry(QtCore.QRect(400, 150, 400, 400)) + self.textwindow.setWindowTitle(filename) + + self.text = QtWidgets.QTextEdit() + self.save = QtWidgets.QPushButton('Save and Exit') + self.save.setDisabled(True) + + self.text.setText(lines) self.text.textChanged.connect(self.enable_save) vbox_main = QtWidgets.QVBoxLayout(self.textwindow) @@ -160,6 +156,12 @@ class ProjectExplorer(QtWidgets.QWidget): self.textwindow.show() else: + self.refreshProject(self.filePath) + + self.obj_appconfig.print_info( + 'The current project is: ' + self.filePath + ) + self.obj_appconfig.current_project["ProjectName"] = str( self.filePath) ( -- cgit From 73b784851e40ab6b607a70bf151fe2fa4443e218 Mon Sep 17 00:00:00 2001 From: rahulp13 Date: Sat, 17 Sep 2022 23:29:49 +0530 Subject: fix circuit component element out of range crash --- src/frontEnd/Application.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/frontEnd') diff --git a/src/frontEnd/Application.py b/src/frontEnd/Application.py index d3ef020f..7588b1a1 100644 --- a/src/frontEnd/Application.py +++ b/src/frontEnd/Application.py @@ -10,11 +10,11 @@ # BUGS: --- # NOTES: --- # AUTHOR: Fahim Khan, fahim.elex@gmail.com -# MODIFIED: Rahul Paknikar, rahulp@iitb.ac.in +# MAINTAINED: Rahul Paknikar, rahulp@cse.iitb.ac.in # Sumanto Kar, sumantokar@iitb.ac.in # ORGANIZATION: eSim Team at FOSSEE, IIT Bombay # CREATED: Tuesday 24 February 2015 -# REVISION: Monday 31 January 2022 +# REVISION: Tuesday 13 September 2022 # ========================================================================= import os @@ -949,4 +949,7 @@ def main(args): # Call main function if __name__ == '__main__': # Create and display the splash screen - main(sys.argv) + try: + main(sys.argv) + except Exception as err: + print("Error: ", err) -- cgit