diff options
author | fahim | 2015-05-20 15:49:06 +0530 |
---|---|---|
committer | fahim | 2015-05-20 15:49:06 +0530 |
commit | a062393843db4033f11837a3c7800136c00fef36 (patch) | |
tree | 84e870fb08b3a9a7e8d4ceb9e40a871b02b4e57e /src/frontEnd/ProjectExplorer.py | |
parent | 73e306db40503eba8f80a3a3508aebe76081ea2b (diff) | |
download | eSim-a062393843db4033f11837a3c7800136c00fef36.tar.gz eSim-a062393843db4033f11837a3c7800136c00fef36.tar.bz2 eSim-a062393843db4033f11837a3c7800136c00fef36.zip |
Subject: Added refresh button in Project explorer.
Description: Added refresh button in project explorer.
Diffstat (limited to 'src/frontEnd/ProjectExplorer.py')
-rw-r--r-- | src/frontEnd/ProjectExplorer.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/frontEnd/ProjectExplorer.py b/src/frontEnd/ProjectExplorer.py index 921d0594..8d91dc6c 100644 --- a/src/frontEnd/ProjectExplorer.py +++ b/src/frontEnd/ProjectExplorer.py @@ -2,6 +2,7 @@ from PyQt4 import QtGui,QtCore import os import json from configuration.Appconfig import Appconfig +from lxml.etree import tostring class ProjectExplorer(QtGui.QWidget): def __init__(self): @@ -50,6 +51,8 @@ class ProjectExplorer(QtGui.QWidget): if level == 0: deleteproject = menu.addAction(self.tr("Remove Project")) deleteproject.triggered.connect(self.removeProject) + refreshproject= menu.addAction(self.tr("Refresh")) + refreshproject.triggered.connect(self.refreshProject) elif level == 1: openfile = menu.addAction(self.tr("Open")) openfile.triggered.connect(self.openProject) @@ -108,4 +111,21 @@ class ProjectExplorer(QtGui.QWidget): self.obj_appconfig.current_project["ProjectName"] = None del self.obj_appconfig.project_explorer[str(self.filePath)] + json.dump(self.obj_appconfig.project_explorer, open(self.obj_appconfig.dictPath,'w')) + + def refreshProject(self): + self.indexItem =self.treewidget.currentIndex() + filename= self.indexItem.data().toString() + self.filePath= str(self.indexItem.sibling(self.indexItem.row(), 1).data().toString()) + filelistnew= os.listdir(os.path.join(self.filePath)) + print filelistnew + parentnode = self.treewidget.currentItem() + count = parentnode.childCount() + for i in range(count): + for items in self.treewidget.selectedItems(): + items.removeChild(items.child(0)) + for files in filelistnew: + childnode= QtGui.QTreeWidgetItem(parentnode, [files, self.filePath+ '/'+ files]) + + self.obj_appconfig.project_explorer[self.filePath]= filelistnew json.dump(self.obj_appconfig.project_explorer, open(self.obj_appconfig.dictPath,'w'))
\ No newline at end of file |