summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfahim2015-02-17 15:13:02 +0530
committerfahim2015-02-17 15:13:02 +0530
commit756ad7fcfe3e9cb7f1c90e0c773cfb46243a2496 (patch)
tree915c62da4d5df5d06f307c73e81defa976e02b46
parent74d560add00621421d366759bcc80900d8e14d8a (diff)
downloadeSim-756ad7fcfe3e9cb7f1c90e0c773cfb46243a2496.tar.gz
eSim-756ad7fcfe3e9cb7f1c90e0c773cfb46243a2496.tar.bz2
eSim-756ad7fcfe3e9cb7f1c90e0c773cfb46243a2496.zip
Subject: openProject and Validation
Description: Included openProject and Validation module
-rw-r--r--src/configuration/Appconfig.py29
-rw-r--r--src/configuration/Appconfig.pycbin1236 -> 1288 bytes
-rwxr-xr-xsrc/frontEnd/Application.py26
-rwxr-xr-xsrc/frontEnd/ViewManagement.py22
-rw-r--r--src/frontEnd/ViewManagement.pycbin2519 -> 2542 bytes
-rw-r--r--src/frontEnd/Workspace.py7
-rw-r--r--src/frontEnd/Workspace.pycbin3466 -> 3466 bytes
-rw-r--r--src/projManagement/Validation.py40
-rw-r--r--src/projManagement/newProject.py2
-rw-r--r--src/projManagement/openProject.py61
10 files changed, 148 insertions, 39 deletions
diff --git a/src/configuration/Appconfig.py b/src/configuration/Appconfig.py
index b9b619b1..811029ca 100644
--- a/src/configuration/Appconfig.py
+++ b/src/configuration/Appconfig.py
@@ -26,6 +26,14 @@ class Appconfig(QtGui.QWidget):
"""
All configuration goes here
"""
+ #Home directory
+ home = os.path.expanduser("~")+"/ecSim-Workspace"
+ default_workspace = {"workspace":home}
+ #Current Project detail
+ current_project = {"ProjectName":"None"}
+ #Workspace detail
+ workspace_text = '''ecSim stores your project in a folder called a workspace. You can choose a different workspace folder to use for this session.'''
+
def __init__(self):
super(Appconfig, self).__init__()
#Application Details
@@ -33,17 +41,18 @@ class Appconfig(QtGui.QWidget):
self._VERSION = 'v1.1'
self._AUTHOR = 'Fahim'
- #Application setting
- self.app_xpos = 100
- self.app_ypos = 100
- self.app_width = 600
- self.app_heigth = 400
+ #Application geometry setting
+ self._app_xpos = 100
+ self._app_ypos = 100
+ self._app_width = 600
+ self._app_heigth = 400
+
+
+
+
+
- #Workspace detail
- self.workspace_text = '''ecSim stores your project in a folder called a workspace. You can choose a different workspace folder to use for this session.'''
- #Home directory
- self.home = os.path.expanduser("~")+"/ecSim-Workspace"
- self.default_workspace = {"workspace":self.home}
+
diff --git a/src/configuration/Appconfig.pyc b/src/configuration/Appconfig.pyc
index e44a1c38..7d8c70a6 100644
--- a/src/configuration/Appconfig.pyc
+++ b/src/configuration/Appconfig.pyc
Binary files differ
diff --git a/src/frontEnd/Application.py b/src/frontEnd/Application.py
index ccc08248..a261d67c 100755
--- a/src/frontEnd/Application.py
+++ b/src/frontEnd/Application.py
@@ -20,16 +20,18 @@
from PyQt4 import QtGui, QtCore
from configuration.Appconfig import Appconfig
+from projManagement.openProject import ProjectInfo
+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
@@ -39,19 +41,15 @@ class Application(QtGui.QMainWindow):
#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.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()
@@ -95,15 +93,20 @@ class Application(QtGui.QMainWindow):
def new_project(self):
print "New Project called"
+
def open_project(self):
print "Open Project called"
+ self.project = ProjectInfo()
+ self.project.body()
def exit_project(self):
print "Exit Project called"
+ self.close()
def help_project(self):
print "Help is called"
+
@@ -114,6 +117,7 @@ def main(args):
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)
@@ -136,7 +140,7 @@ def main(args):
appView = Application()
appView.show()
sys.exit(app.exec_())
- """
+
diff --git a/src/frontEnd/ViewManagement.py b/src/frontEnd/ViewManagement.py
index 27d9ecba..7d6ca9cd 100755
--- a/src/frontEnd/ViewManagement.py
+++ b/src/frontEnd/ViewManagement.py
@@ -38,9 +38,9 @@ class ViewManagement(QtGui.QSplitter):
def createView(self):
#Adding view into views dictionary
- self.addView(QtGui.QTextEdit, 'Project Explorer')
- self.addView(QtGui.QTextEdit, 'test2')
- self.addView(QtGui.QTextEdit, 'test3')
+ 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
@@ -78,19 +78,17 @@ class ViewManagement(QtGui.QSplitter):
self.pcb_btn.setIcon(QtGui.QIcon('../images/default.png'))
self.pcb_btn.setIconSize(QtCore.QSize(50,50))
self.grid.addWidget(self.pcb_btn,1,1)
-
-
-
-
+
# bind the top level views into the framework
- self.views['Project Explorer'].setParent(self)
+ self.views['ProjectExplorer'].setParent(self)
- self.views['test2'].setParent(self.right)
- self.views['test2'].setLayout(self.grid)
- self.views['test2'].setReadOnly(True)
+ self.views['ProjectToolbar'].setParent(self.right)
+ self.views['ProjectToolbar'].setLayout(self.grid)
+ self.views['ProjectToolbar'].setReadOnly(True)
- self.views['test3'].setParent(self.right)
+ self.views['CurrentProject'].setParent(self.right)
+ self.views['CurrentProject'].setReadOnly(True)
self.right.setParent(self)
self.right.setSizes([20, 5])
diff --git a/src/frontEnd/ViewManagement.pyc b/src/frontEnd/ViewManagement.pyc
index d7b30b5e..4f31cfc2 100644
--- a/src/frontEnd/ViewManagement.pyc
+++ b/src/frontEnd/ViewManagement.pyc
Binary files differ
diff --git a/src/frontEnd/Workspace.py b/src/frontEnd/Workspace.py
index 0db3fbd7..fc41501d 100644
--- a/src/frontEnd/Workspace.py
+++ b/src/frontEnd/Workspace.py
@@ -27,12 +27,9 @@ class Workspace(QtGui.QWidget):
"""
def __init__(self):
super(Workspace, self).__init__()
-
- #Button status lable
- #self.status_label = QtGui.QLabel('NO')
-
+
self.obj = Appconfig()
-
+
#Initializing Workspace directory for project
self.initWorkspace()
diff --git a/src/frontEnd/Workspace.pyc b/src/frontEnd/Workspace.pyc
index 8da188bc..99d373d5 100644
--- a/src/frontEnd/Workspace.pyc
+++ b/src/frontEnd/Workspace.pyc
Binary files differ
diff --git a/src/projManagement/Validation.py b/src/projManagement/Validation.py
new file mode 100644
index 00000000..b53dfe49
--- /dev/null
+++ b/src/projManagement/Validation.py
@@ -0,0 +1,40 @@
+
+#===============================================================================
+#
+# FILE: Validation.py
+#
+# USAGE: ---
+#
+# DESCRIPTION: This module is use to create validation for openProject,newProject and other activity.
+#
+# OPTIONS: ---
+# REQUIREMENTS: ---
+# BUGS: ---
+# NOTES: ---
+# AUTHOR: Fahim Khan, fahim.elex@gmail.com
+# ORGANIZATION: ecSim team at FOSSEE, IIT Bombay.
+# CREATED: Wednesday 12 February 2015
+# REVISION: ---
+#===============================================================================
+import os
+
+
+class Validation:
+ def __init__(self):
+ pass
+
+ def validateOpenproj(self,proj_directory):
+ print "Valid open Proj called"
+ tempStr = proj_directory.split('/')
+ projName = tempStr[len(tempStr)-1]
+ if os.path.exists(proj_directory+"/"+projName+".proj"):
+ return True
+ else:
+ return False
+
+
+ def validateNewproj(self):
+ print "Valid new Proj called"
+
+
+ \ No newline at end of file
diff --git a/src/projManagement/newProject.py b/src/projManagement/newProject.py
index 59ece47d..1bbbbaf7 100644
--- a/src/projManagement/newProject.py
+++ b/src/projManagement/newProject.py
@@ -13,7 +13,7 @@
# NOTES: ---
# AUTHOR: Fahim Khan, fahim.elex@gmail.com
# ORGANIZATION: ecSim team at FOSSEE, IIT Bombay.
-# CREATED: Wednesday 04 February 2015
+# CREATED: Wednesday 12 February 2015
# REVISION: ---
#===============================================================================
diff --git a/src/projManagement/openProject.py b/src/projManagement/openProject.py
new file mode 100644
index 00000000..a5c8c323
--- /dev/null
+++ b/src/projManagement/openProject.py
@@ -0,0 +1,61 @@
+
+#===============================================================================
+#
+# FILE: openProject.py
+#
+# USAGE: ---
+#
+# DESCRIPTION: It is called whenever new project is being called.
+#
+# OPTIONS: ---
+# REQUIREMENTS: ---
+# BUGS: ---
+# NOTES: ---
+# AUTHOR: Fahim Khan, fahim.elex@gmail.com
+# ORGANIZATION: ecSim team at FOSSEE, IIT Bombay.
+# CREATED: Wednesday 12 February 2015
+# REVISION: ---
+#===============================================================================
+
+from PyQt4 import QtGui
+from Validation import Validation
+from configuration.Appconfig import Appconfig
+
+
+
+class ProjectInfo:
+ """
+ Class ProjectInfo accept model information from user
+
+ """
+ def __init__(self):
+ pass
+
+ def body(self):
+ print "Create Dialog box"
+ self.proj_directory = QtGui.QFileDialog.getExistingDirectory()
+ self.obj_validation = Validation()
+
+
+ if self.obj_validation.validateOpenproj(self.proj_directory) == True:
+ print "Pass open project test"
+ self.obj_Appconfig = Appconfig()
+ self.obj_Appconfig.current_project['ProjectName'] = self.proj_directory
+
+
+ else:
+ print "Failed open project test"
+ reply = QtGui.QMessageBox.critical(None, "Error Message",'''<b> Error: The project doesn't contain .proj file.</b><br/>
+ <b>Please select the proper project directory else you won't be able to perform any operation</b>''',QtGui.QMessageBox.Ok|QtGui.QMessageBox.Cancel)
+ if reply == QtGui.QMessageBox.Ok:
+ self.body()
+ elif reply == QtGui.QMessageBox.Cancel:
+ pass
+ else:
+ pass
+
+
+
+
+
+ \ No newline at end of file