summaryrefslogtreecommitdiff
path: root/src/frontEnd
diff options
context:
space:
mode:
Diffstat (limited to 'src/frontEnd')
-rwxr-xr-xsrc/frontEnd/Application.py157
-rw-r--r--src/frontEnd/Application.pycbin0 -> 3277 bytes
-rwxr-xr-xsrc/frontEnd/ViewManagement.py124
-rw-r--r--src/frontEnd/ViewManagement.pycbin0 -> 3139 bytes
-rw-r--r--src/frontEnd/Workspace.py114
-rw-r--r--src/frontEnd/Workspace.pycbin0 -> 3469 bytes
-rw-r--r--src/frontEnd/__init__.py0
-rw-r--r--src/frontEnd/__init__.pycbin0 -> 139 bytes
8 files changed, 395 insertions, 0 deletions
diff --git a/src/frontEnd/Application.py b/src/frontEnd/Application.py
new file mode 100755
index 00000000..00c6312f
--- /dev/null
+++ b/src/frontEnd/Application.py
@@ -0,0 +1,157 @@
+
+#===============================================================================
+#
+# 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: eSim team at FOSSEE, IIT Bombay.
+# CREATED: Wednesday 21 January 2015
+# REVISION: ---
+#===============================================================================
+
+
+from PyQt4 import QtGui, QtCore
+from configuration.Appconfig import Appconfig
+from projManagement.openProject import OpenProjectInfo
+from projManagement.newProject import NewProjectInfo
+import os
+import ViewManagement
+import Workspace
+import sys
+import time
+
+
+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.obj_appconfig = Appconfig()
+ self.setGeometry(self.obj_appconfig._app_xpos,
+ self.obj_appconfig._app_ypos,
+ self.obj_appconfig._app_width,
+ self.obj_appconfig._app_heigth)
+ self.setWindowTitle(self.obj_appconfig._APPLICATION)
+ #Init Workspace
+ self.obj_workspace = Workspace.Workspace()
+
+ #Init necessary components in sequence
+ self.initActions()
+ self.initView()
+
+
+ def initActions(self):
+
+ self.newproj = QtGui.QAction(QtGui.QIcon('../images/newProject.svg'),'<b>New Project</b>',self)
+ self.newproj.setShortcut('Ctrl+N')
+ self.newproj.triggered.connect(self.new_project)
+
+ self.openproj = QtGui.QAction(QtGui.QIcon('../images/openProject.svg'),'<b>Open Project</b>',self)
+ self.openproj.setShortcut('Ctrl+O')
+ self.openproj.triggered.connect(self.open_project)
+
+ self.exitproj = QtGui.QAction(QtGui.QIcon('../images/closeProject.svg'),'<b>Exit</b>',self)
+ self.exitproj.setShortcut('Ctrl+X')
+ self.exitproj.triggered.connect(self.exit_project)
+
+ self.helpfile = QtGui.QAction(QtGui.QIcon('../images/default.png'),'<b>Help</b>',self)
+ self.helpfile.setShortcut('Ctrl+H')
+ self.helpfile.triggered.connect(self.help_project)
+
+ 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 new_project(self):
+ print "New Project called"
+ self.project = NewProjectInfo()
+ self.project.body()
+
+
+ def open_project(self):
+ print "Open Project called"
+ self.project = OpenProjectInfo()
+ self.project.body()
+
+ def exit_project(self):
+ print "Exit Project called"
+ self.close()
+
+ def help_project(self):
+ print "Help is called"
+ print "Current Project : ",self.obj_appconfig.current_project
+
+ def testing(self):
+ print "Sucess hit kicad button"
+
+
+
+
+def main(args):
+ """
+ It is main function of the module.It starts the application
+ """
+ print "Hello Main"
+ app = QtGui.QApplication(sys.argv)
+
+ """
+ splash_pix = QtGui.QPixmap('../images/FreeEDAlogo.jpg')
+ splash = QtGui.QSplashScreen(splash_pix,QtCore.Qt.WindowStaysOnTopHint)
+ progressBar = QtGui.QProgressBar(splash)
+ splash.setMask(splash_pix.mask())
+ splash.show()
+
+ for i in range(0, 100):
+ progressBar.setValue(i)
+ t = time.time()
+ while time.time() < t + 0.1:
+ app.processEvents()
+
+ time.sleep(2)
+
+ appView = Application()
+ appView.show()
+ splash.finish(appView)
+ sys.exit(app.exec_())
+ """
+ appView = Application()
+ #QtGui.QApplication.setStyle(QtGui.QStyleFactory.create("Cleanlooks"))
+ appView.show()
+ sys.exit(app.exec_())
+
+
+
+
+# Call main function
+if __name__ == '__main__':
+ # Create and display the splash screen
+ main(sys.argv)
+
+
+
diff --git a/src/frontEnd/Application.pyc b/src/frontEnd/Application.pyc
new file mode 100644
index 00000000..52649138
--- /dev/null
+++ b/src/frontEnd/Application.pyc
Binary files differ
diff --git a/src/frontEnd/ViewManagement.py b/src/frontEnd/ViewManagement.py
new file mode 100755
index 00000000..8264c033
--- /dev/null
+++ b/src/frontEnd/ViewManagement.py
@@ -0,0 +1,124 @@
+
+#===============================================================================
+#
+# 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: eSim team at FOSSEE, IIT Bombay.
+# CREATED: Wednesday 27 January 2015
+# REVISION: ---
+#===============================================================================
+
+
+
+from PyQt4 import QtCore
+from PyQt4 import QtGui
+from projManagement.Kicad import Kicad
+from kicadtoNgspice.KicadtoNgspice import *
+
+
+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 = {}
+
+ #Creating object of Kicad.py
+ self.obj_kicad = Kicad()
+
+ # 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, 'ProjectExplorer')
+ self.addView(QtGui.QTextEdit, 'ProjectToolbar')
+ self.addView(QtGui.QTextEdit, 'CurrentProject')
+
+ 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
+ self.right = QtGui.QSplitter()
+ self.right.setOrientation(QtCore.Qt.Vertical)
+
+ #Layout
+ self.grid = QtGui.QGridLayout()
+
+
+ #Button for Project Tool Bar
+ self.kicad_btn = QtGui.QPushButton()
+ self.kicad_btn.setIcon(QtGui.QIcon('../images/default.png'))
+ self.kicad_btn.setIconSize(QtCore.QSize(50,50))
+ self.kicad_btn.setToolTip('<b>Open Schematic</b>')
+ self.kicad_btn.clicked.connect(self.obj_kicad.openSchematic)
+ self.grid.addWidget(self.kicad_btn,0,0)
+
+ self.conversion_btn = QtGui.QPushButton()
+ self.conversion_btn.setIcon(QtGui.QIcon('../images/default.png'))
+ self.conversion_btn.setIconSize(QtCore.QSize(50,50))
+ self.conversion_btn.setToolTip('<b>Convert Kicad to Ngspice</b>')
+ self.conversion_btn.clicked.connect(self.obj_kicad.openKicadToNgspice)
+ self.grid.addWidget(self.conversion_btn,0,1)
+
+
+ self.ngspice_btn = QtGui.QPushButton()
+ self.ngspice_btn.setIcon(QtGui.QIcon('../images/default.png'))
+ self.ngspice_btn.setIconSize(QtCore.QSize(50,50))
+ self.ngspice_btn.setToolTip('<b>Simulation</b>')
+ self.grid.addWidget(self.ngspice_btn,0,2)
+
+ self.footprint_btn = QtGui.QPushButton()
+ self.footprint_btn.setIcon(QtGui.QIcon('../images/default.png'))
+ self.footprint_btn.setIconSize(QtCore.QSize(50,50))
+ self.footprint_btn.setToolTip('<b>Footprint Editor</b>')
+ self.footprint_btn.clicked.connect(self.obj_kicad.openFootprint)
+ self.grid.addWidget(self.footprint_btn,1,0)
+
+ self.pcb_btn = QtGui.QPushButton()
+ self.pcb_btn.setIcon(QtGui.QIcon('../images/default.png'))
+ self.pcb_btn.setIconSize(QtCore.QSize(50,50))
+ self.pcb_btn.setToolTip('<b>PCB Layout</b>')
+ self.pcb_btn.clicked.connect(self.obj_kicad.openLayout)
+ self.grid.addWidget(self.pcb_btn,1,1)
+
+
+ # bind the top level views into the framework
+ self.views['ProjectExplorer'].setParent(self)
+
+ self.views['ProjectToolbar'].setParent(self.right)
+ self.views['ProjectToolbar'].setLayout(self.grid)
+ self.views['ProjectToolbar'].setReadOnly(True)
+
+ self.views['CurrentProject'].setParent(self.right)
+ self.views['CurrentProject'].setReadOnly(True)
+
+ self.right.setParent(self)
+ self.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..9c1cdf20
--- /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..47d26d9b
--- /dev/null
+++ b/src/frontEnd/Workspace.py
@@ -0,0 +1,114 @@
+#===============================================================================
+#
+# FILE: Workspace.py
+#
+# USAGE: ---
+#
+# DESCRIPTION: This define all configuration used in Application.
+#
+# OPTIONS: ---
+# REQUIREMENTS: ---
+# BUGS: ---
+# NOTES: ---
+# AUTHOR: Fahim Khan, fahim.elex@gmail.com
+# ORGANIZATION: eSim team at FOSSEE, IIT Bombay.
+# CREATED: Wednesday 05 February 2015
+# REVISION: ---
+#===============================================================================
+from PyQt4 import QtCore, QtGui
+from configuration.Appconfig import Appconfig
+
+import os
+
+
+class Workspace(QtGui.QWidget):
+ """
+ Start workspace gui
+ """
+ def __init__(self):
+ super(Workspace, self).__init__()
+
+ self.obj_appconfig = Appconfig()
+
+ #Initializing Workspace directory for project
+ self.initWorkspace()
+
+
+ def initWorkspace(self):
+ print "Calling workspace"
+ self.note = QtGui.QTextEdit(self)
+ self.workspace_label = QtGui.QLabel(self)
+ self.worspace_loc = QtGui.QLineEdit(self)
+
+ #Add text to text edit,label and line edit
+ self.note.append(self.obj_appconfig.workspace_text)
+ self.workspace_label.setText("Workspace:")
+ self.worspace_loc.setText(self.obj_appconfig.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
+ #Need to set Geometry properly
+ self.note.setGeometry(QtCore.QRect(0, 0, 400, 100))
+ self.workspace_label.setGeometry(QtCore.QRect(10, 130, 81, 17))
+ self.worspace_loc.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.note)
+
+ self.grid = QtGui.QGridLayout()
+ self.grid.addChildLayout(self.hbox)
+
+
+ self.grid.addWidget(self.workspace_label,2,0)
+ self.grid.addWidget(self.worspace_loc, 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.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)
+ self.note.setReadOnly(True)
+ self.show()
+
+
+ def defaultWorkspace(self):
+ print "Default location selected"
+ self.close()
+
+ def createWorkspace(self):
+ print "Create workspace is called"
+ self.create_workspace = str(self.worspace_loc.text())
+ #Checking if Workspace already exist or not
+ if os.path.isdir(self.create_workspace):
+ print "Already present"
+ self.obj_appconfig.default_workspace["workspace"] = self.create_workspace
+
+ else:
+ os.mkdir(self.create_workspace)
+ self.obj_appconfig.default_workspace["workspace"] = self.create_workspace
+ self.close()
+
+
+
+ def browseLocation(self):
+ print "Browse Location called"
+ self.workspace_directory = QtGui.QFileDialog.getExistingDirectory()
+ print "Path file :", self.workspace_directory
+ self.worspace_loc.setText(self.workspace_directory)
+ \ No newline at end of file
diff --git a/src/frontEnd/Workspace.pyc b/src/frontEnd/Workspace.pyc
new file mode 100644
index 00000000..6e876bf3
--- /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
diff --git a/src/frontEnd/__init__.pyc b/src/frontEnd/__init__.pyc
new file mode 100644
index 00000000..bc735777
--- /dev/null
+++ b/src/frontEnd/__init__.pyc
Binary files differ