summaryrefslogtreecommitdiff
path: root/src/frontEnd
diff options
context:
space:
mode:
authorfahim2015-02-05 15:44:25 +0530
committerfahim2015-02-05 15:44:25 +0530
commite91a76c90a2ee829c337251e9adc33767c808b51 (patch)
treedba2698c0ff969a45778ab93332da38971c91f8b /src/frontEnd
downloadeSim-e91a76c90a2ee829c337251e9adc33767c808b51.tar.gz
eSim-e91a76c90a2ee829c337251e9adc33767c808b51.tar.bz2
eSim-e91a76c90a2ee829c337251e9adc33767c808b51.zip
Subject: First commit
Description: It incluse initial gui to be used in new flow of FreeEDA.
Diffstat (limited to 'src/frontEnd')
-rwxr-xr-xsrc/frontEnd/Application.py121
-rwxr-xr-xsrc/frontEnd/ViewManagement.py76
-rw-r--r--src/frontEnd/ViewManagement.pycbin0 -> 1638 bytes
-rw-r--r--src/frontEnd/Workspace.py96
-rw-r--r--src/frontEnd/Workspace.pycbin0 -> 2916 bytes
-rw-r--r--src/frontEnd/__init__.py0
6 files changed, 293 insertions, 0 deletions
diff --git a/src/frontEnd/Application.py b/src/frontEnd/Application.py
new file mode 100755
index 00000000..b77651be
--- /dev/null
+++ b/src/frontEnd/Application.py
@@ -0,0 +1,121 @@
+
+#===============================================================================
+#
+# FILE: Application.py
+#
+# USAGE: ---
+#
+# DESCRIPTION: This main file use to start the Application
+#
+# OPTIONS: ---
+# REQUIREMENTS: ---
+# BUGS: ---
+# NOTES: ---
+# AUTHOR: Fahim Khan, fahim.elex@gmail.com
+# ORGANIZATION: ecSim team at FOSSEE, IIT Bombay.
+# CREATED: Wednesday 21 January 2015
+# REVISION: ---
+#===============================================================================
+
+
+from PyQt4 import QtGui
+from configuration.Appconfig import Appconfig
+import ViewManagement
+import Workspace
+import sys
+
+
+class Application(QtGui.QMainWindow):
+ """
+ Its our main window of application
+ """
+
+ def __init__(self,*args):
+ """
+ Initialize main Application window
+ """
+ #Calling __init__ of super class
+ QtGui.QMainWindow.__init__(self,*args)
+
+
+ #Creating Application configuration object
+
+ self.confObj = Appconfig()
+
+ self.setGeometry(self.confObj.app_xpos,
+ self.confObj.app_ypos,
+ self.confObj.app_width,
+ self.confObj.app_heigth)
+ self.setWindowTitle(self.confObj._APPLICATION)
+
+ #Init Workspace
+ self.work_space = Workspace.Workspace()
+
+
+
+
+ #Init necessary components in sequence
+ self.initActions()
+ self.initView()
+
+
+ def initActions(self):
+
+ self.newproj = QtGui.QAction(QtGui.QIcon('../images/default.png'),'New Project',self)
+ self.newproj.setShortcut('Ctrl+N')
+ self.newproj.triggered.connect(self.testfn)
+
+ self.openproj = QtGui.QAction(QtGui.QIcon('../images/default.png'),'Open Project',self)
+ self.openproj.setShortcut('Ctrl+O')
+ self.openproj.triggered.connect(self.testfn)
+
+ self.exitproj = QtGui.QAction(QtGui.QIcon('../images/default.png'),'Exit',self)
+ self.exitproj.setShortcut('Ctrl+X')
+ self.exitproj.triggered.connect(self.testfn)
+
+ self.helpfile = QtGui.QAction(QtGui.QIcon('../images/default.png'),'Help',self)
+ self.helpfile.setShortcut('Ctrl+H')
+ self.helpfile.triggered.connect(self.testfn)
+
+ self.mainToolbar = self.addToolBar('Top Navigation')
+ self.mainToolbar.addAction(self.newproj)
+ self.mainToolbar.addAction(self.openproj)
+ self.mainToolbar.addAction(self.exitproj)
+ self.mainToolbar.addAction(self.helpfile)
+
+
+ def initView(self):
+ """
+ Create gui from the class Views and initialize it
+ """
+ self.view = ViewManagement.ViewManagement()
+ self.setCentralWidget(self.view)
+
+
+ def testfn(self):
+ print "Success hit :"
+
+ def new_project(self):
+ print "New Project called"
+
+
+
+def main(args):
+ """
+ It is main function of the module.It starts the application
+ """
+ app = QtGui.QApplication(args)
+
+ appView = Application()
+ appView.show()
+ sys.exit(app.exec_())
+
+
+
+
+# Call main function
+if __name__ == '__main__':
+ main(sys.argv)
+
+
+
diff --git a/src/frontEnd/ViewManagement.py b/src/frontEnd/ViewManagement.py
new file mode 100755
index 00000000..dd24d13b
--- /dev/null
+++ b/src/frontEnd/ViewManagement.py
@@ -0,0 +1,76 @@
+
+#===============================================================================
+#
+# FILE: ViewManagement.py
+#
+# USAGE: ---
+#
+# DESCRIPTION: It contain all the view for main Application
+#
+# OPTIONS: ---
+# REQUIREMENTS: ---
+# BUGS: ---
+# NOTES: ---
+# AUTHOR: Fahim Khan, fahim.elex@gmail.com
+# ORGANIZATION: ecSim team at FOSSEE, IIT Bombay.
+# CREATED: Wednesday 27 January 2015
+# REVISION: ---
+#===============================================================================
+
+
+
+from PyQt4 import QtCore
+from PyQt4 import QtGui
+
+
+class ViewManagement(QtGui.QSplitter):
+
+ def __init__(self, *args):
+ # call init method of superclass
+ QtGui.QSplitter.__init__(self, *args)
+ # Creating dictionary which hold all the views
+ self.views = {}
+
+ # define the basic framework of view areas for the
+ # application
+ self.createView()
+ self.setupView()
+
+ def createView(self):
+ #Adding view into views dictionary
+ self.addView(QtGui.QTextEdit, 'test1')
+ self.addView(QtGui.QTextEdit, 'test2')
+ self.addView(QtGui.QTextEdit, 'test3')
+
+ def setupView(self):
+
+ #setup views to define various areas, such as placement of individual views
+
+ # the right segment also is a splitter, but with vertical orientation
+ right = QtGui.QSplitter()
+ right.setOrientation(QtCore.Qt.Vertical)
+
+ # bind the top level views into the framework
+ self.views['test1'].setParent(self)
+
+ right.setParent(self)
+
+ self.views['test2'].setParent(right)
+ self.views['test3'].setParent(right)
+ right.setSizes([20, 5])
+ self.setSizes([5, 20])
+
+ def addView(self, settype, name):
+
+ #Adding views to dictionary
+ #parameters:
+ #settype <class>
+ #name <string>
+
+ self.views[name] = settype()
+
+
+
+
+
+
diff --git a/src/frontEnd/ViewManagement.pyc b/src/frontEnd/ViewManagement.pyc
new file mode 100644
index 00000000..5cd5dee7
--- /dev/null
+++ b/src/frontEnd/ViewManagement.pyc
Binary files differ
diff --git a/src/frontEnd/Workspace.py b/src/frontEnd/Workspace.py
new file mode 100644
index 00000000..e1cb365b
--- /dev/null
+++ b/src/frontEnd/Workspace.py
@@ -0,0 +1,96 @@
+#===============================================================================
+#
+# FILE: Workspace.py
+#
+# USAGE: ---
+#
+# DESCRIPTION: This define all configuration used in Application.
+#
+# OPTIONS: ---
+# REQUIREMENTS: ---
+# BUGS: ---
+# NOTES: ---
+# AUTHOR: Fahim Khan, fahim.elex@gmail.com
+# ORGANIZATION: ecSim team at FOSSEE, IIT Bombay.
+# CREATED: Wednesday 05 February 2015
+# REVISION: ---
+#===============================================================================
+import os
+from PyQt4 import QtGui
+from PyQt4 import QtCore
+
+
+class Workspace(QtGui.QWidget):
+ """
+ Start workspace gui
+ """
+ def __init__(self):
+ super(Workspace, self).__init__()
+ #Home directory
+ self.home = os.path.expanduser("~")+"/Workspace"
+
+ #Initializing Workspace directory for project
+ self.initWorkspace()
+
+
+ def initWorkspace(self):
+ print "Calling workspace"
+ self.tedit = QtGui.QTextEdit(self)
+ self.label = QtGui.QLabel(self)
+ self.ledit = QtGui.QLineEdit(self)
+
+ #Add text to text edit,label and line edit
+ self.tedit.append("Sample Text")
+ self.label.setText("Workspace:")
+ self.ledit.setText(self.home)
+
+ #Buttons
+ self.browsebtn = QtGui.QPushButton('Browse')
+ self.browsebtn.clicked.connect(self.browseLocation)
+ self.okbtn = QtGui.QPushButton('OK')
+ self.okbtn.clicked.connect(self.createWorkspace)
+ self.cancelbtn = QtGui.QPushButton('Cancel')
+ self.cancelbtn.clicked.connect(self.defaultWorkspace)
+
+ #Set Geometry
+ self.tedit.setGeometry(QtCore.QRect(0, 0, 400, 100))
+ self.label.setGeometry(QtCore.QRect(10, 130, 81, 17))
+ self.ledit.setGeometry(QtCore.QRect(100, 150, 200, 100))
+ self.browsebtn.setGeometry(QtCore.QRect(290, 120, 98, 27))
+ self.okbtn.setGeometry(QtCore.QRect(290, 250, 98, 27))
+ self.cancelbtn.setGeometry(QtCore.QRect(180, 250, 98, 27))
+
+
+
+ #Layout
+ self.hbox = QtGui.QHBoxLayout()
+ self.hbox.addWidget(self.tedit)
+
+ self.grid = QtGui.QGridLayout()
+ self.grid.addChildLayout(self.hbox)
+
+
+ self.grid.addWidget(self.label,2,0)
+ self.grid.addWidget(self.ledit, 2, 1)
+ self.grid.addWidget(self.browsebtn, 2, 2)
+ self.grid.addWidget(self.okbtn,3,2)
+ self.grid.addWidget(self.cancelbtn,3,3)
+ self.setLayout(self.grid)
+
+ self.setGeometry(QtCore.QRect(200,200,400,400))
+ self.setWindowTitle("Workspace Launcher")
+ #self.setWindowIcon(QtGui.QIcon('logo.png'))
+ self.tedit.setReadOnly(True)
+ self.show()
+
+
+ def defaultWorkspace(self):
+ print "Default location selected"
+
+ def createWorkspace(self):
+ print "Create workspace is called"
+
+
+ def browseLocation(self):
+ print "Browse Location called"
+ \ No newline at end of file
diff --git a/src/frontEnd/Workspace.pyc b/src/frontEnd/Workspace.pyc
new file mode 100644
index 00000000..eb470612
--- /dev/null
+++ b/src/frontEnd/Workspace.pyc
Binary files differ
diff --git a/src/frontEnd/__init__.py b/src/frontEnd/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/frontEnd/__init__.py