summaryrefslogtreecommitdiff
path: root/src/frontEnd/ProjectExplorer.py
diff options
context:
space:
mode:
authorfahim2015-04-27 18:13:26 +0530
committerfahim2015-04-27 18:13:26 +0530
commit320ab0257341c029f5aa9333fe233a371309e802 (patch)
tree18a0726794e409dd32742ba9aabc2c4e72f58019 /src/frontEnd/ProjectExplorer.py
parent33784746e3116fb32c6b571e1495336013b3f5bb (diff)
downloadeSim-320ab0257341c029f5aa9333fe233a371309e802.tar.gz
eSim-320ab0257341c029f5aa9333fe233a371309e802.tar.bz2
eSim-320ab0257341c029f5aa9333fe233a371309e802.zip
Subject: Added ProjectExplorer
Description: Added ProjectExplorer by Komal
Diffstat (limited to 'src/frontEnd/ProjectExplorer.py')
-rwxr-xr-xsrc/frontEnd/ProjectExplorer.py73
1 files changed, 73 insertions, 0 deletions
diff --git a/src/frontEnd/ProjectExplorer.py b/src/frontEnd/ProjectExplorer.py
new file mode 100755
index 00000000..82c740fa
--- /dev/null
+++ b/src/frontEnd/ProjectExplorer.py
@@ -0,0 +1,73 @@
+import sys
+from PyQt4 import QtGui,QtCore
+from configuration.Appconfig import Appconfig
+
+class ProjectExplorer(QtGui.QWidget):
+ """
+ This Class create the project explorer windows of eSim-Workspace
+ """
+ def __init__(self,parent=None):
+ QtGui.QWidget.__init__(self)
+ #Creating object of AppConfig
+ self.obj_appconfig = Appconfig()
+
+ self.startpath = self.obj_appconfig.default_workspace["workspace"]
+
+ self.view = QtGui.QTreeView()
+
+ self.grid= QtGui.QGridLayout()
+ self.model = QtGui.QFileSystemModel()
+
+ self.view.setModel(self.model)
+ self.view.setRootIndex(self.model.setRootPath(self.startpath))
+ self.view.setHeaderHidden(True)
+ self.view.hideColumn(1)
+ self.view.hideColumn(2)
+ self.view.hideColumn(3)
+
+ self.view.doubleClicked.connect(self.on_clicked)
+ self.grid.addWidget(self.view)
+
+
+ self.setLayout(self.grid)
+ self.show()
+
+ def on_clicked(self,index):
+
+ self.indexItem = self.model.index(index.row(), 0, index.parent())
+
+ self.textwindow = QtGui.QWidget()
+ self.text = QtGui.QTextEdit()
+ self.save = QtGui.QPushButton('Save and Exit')
+ self.save.setDisabled(True)
+ self.windowgrid = QtGui.QGridLayout()
+
+ self.filePath = self.model.filePath(self.indexItem)
+
+
+ self.fopen = open(self.filePath, 'r')
+ lines = self.fopen.readlines()
+ for line in lines:
+ self.text.append(line)
+
+ QtCore.QObject.connect(self.text,QtCore.SIGNAL("textChanged()"), self.enable_save)
+ splitter_filelist = QtGui.QSplitter()
+ splitter_filelist.setOrientation(QtCore.Qt.Vertical)
+
+ vbox_main = QtGui.QVBoxLayout(self.textwindow)
+ vbox_main.addWidget(splitter_filelist)
+ vbox_main.addWidget(self.text)
+ vbox_main.addWidget(self.save)
+ self.save.clicked.connect(self.save_data)
+ #self.connect(exit,QtCore.SIGNAL('close()'), self.onQuit)
+
+ self.textwindow.show()
+
+ def enable_save(self):
+ self.save.setEnabled(True)
+
+ def save_data(self):
+ self.fopen=open(self.filePath, 'w')
+ self.fopen.write(self.text.toPlainText())
+ self.fopen.close()
+ self.textwindow.close() \ No newline at end of file