From 775f9c18568ad2f7c480fad271e281dbc235e796 Mon Sep 17 00:00:00 2001 From: fahim Date: Tue, 10 Feb 2015 14:51:07 +0530 Subject: Subject: Added few more gui component Description: Kicad button,converter button and Ngspice button. --- src/configuration/Appconfig.py | 8 +++++++ src/configuration/Appconfig.pyc | Bin 905 -> 1236 bytes src/configuration/__init__.pyc | Bin 144 -> 144 bytes src/frontEnd/Application.py | 34 ++++++++++++++++++++++-------- src/frontEnd/Application.pyc | Bin 0 -> 3277 bytes src/frontEnd/ViewManagement.py | 45 +++++++++++++++++++++++++++++++--------- src/frontEnd/ViewManagement.pyc | Bin 1638 -> 2287 bytes src/frontEnd/Workspace.py | 36 +++++++++++++++++++++++++------- src/frontEnd/Workspace.pyc | Bin 2916 -> 3433 bytes src/frontEnd/__init__.pyc | Bin 0 -> 139 bytes 10 files changed, 96 insertions(+), 27 deletions(-) create mode 100644 src/frontEnd/Application.pyc create mode 100644 src/frontEnd/__init__.pyc diff --git a/src/configuration/Appconfig.py b/src/configuration/Appconfig.py index d8156ab1..b9b619b1 100644 --- a/src/configuration/Appconfig.py +++ b/src/configuration/Appconfig.py @@ -18,6 +18,8 @@ from PyQt4 import QtGui +import os + class Appconfig(QtGui.QWidget): @@ -37,6 +39,12 @@ class Appconfig(QtGui.QWidget): 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 f5c9cccb..e44a1c38 100644 Binary files a/src/configuration/Appconfig.pyc and b/src/configuration/Appconfig.pyc differ diff --git a/src/configuration/__init__.pyc b/src/configuration/__init__.pyc index 11873a91..e99acbcf 100644 Binary files a/src/configuration/__init__.pyc and b/src/configuration/__init__.pyc differ diff --git a/src/frontEnd/Application.py b/src/frontEnd/Application.py index b77651be..7f783ff3 100755 --- a/src/frontEnd/Application.py +++ b/src/frontEnd/Application.py @@ -47,10 +47,8 @@ class Application(QtGui.QMainWindow): self.confObj.app_width, self.confObj.app_heigth) self.setWindowTitle(self.confObj._APPLICATION) - #Init Workspace self.work_space = Workspace.Workspace() - @@ -63,19 +61,19 @@ class Application(QtGui.QMainWindow): self.newproj = QtGui.QAction(QtGui.QIcon('../images/default.png'),'New Project',self) self.newproj.setShortcut('Ctrl+N') - self.newproj.triggered.connect(self.testfn) + self.newproj.triggered.connect(self.new_project) self.openproj = QtGui.QAction(QtGui.QIcon('../images/default.png'),'Open Project',self) self.openproj.setShortcut('Ctrl+O') - self.openproj.triggered.connect(self.testfn) + self.openproj.triggered.connect(self.open_project) self.exitproj = QtGui.QAction(QtGui.QIcon('../images/default.png'),'Exit',self) self.exitproj.setShortcut('Ctrl+X') - self.exitproj.triggered.connect(self.testfn) + self.exitproj.triggered.connect(self.exit_project) self.helpfile = QtGui.QAction(QtGui.QIcon('../images/default.png'),'Help',self) self.helpfile.setShortcut('Ctrl+H') - self.helpfile.triggered.connect(self.testfn) + self.helpfile.triggered.connect(self.help_project) self.mainToolbar = self.addToolBar('Top Navigation') self.mainToolbar.addAction(self.newproj) @@ -97,7 +95,16 @@ class Application(QtGui.QMainWindow): def new_project(self): print "New Project called" + + def open_project(self): + print "Open Project called" + + def exit_project(self): + print "Exit Project called" + def help_project(self): + print "Help is called" + def main(args): @@ -105,11 +112,20 @@ 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_()) - + sys.exit(app.exec_()) + """ + while 1: + print work_space.status_label.text() + if work_space.status_label.text() == 'OK': + print "OK" + appView.show() + break + else: + pass + + """ diff --git a/src/frontEnd/Application.pyc b/src/frontEnd/Application.pyc new file mode 100644 index 00000000..52649138 Binary files /dev/null and b/src/frontEnd/Application.pyc differ diff --git a/src/frontEnd/ViewManagement.py b/src/frontEnd/ViewManagement.py index dd24d13b..fac383bc 100755 --- a/src/frontEnd/ViewManagement.py +++ b/src/frontEnd/ViewManagement.py @@ -38,26 +38,51 @@ class ViewManagement(QtGui.QSplitter): def createView(self): #Adding view into views dictionary - self.addView(QtGui.QTextEdit, 'test1') + self.addView(QtGui.QTextEdit, 'Project Explorer') 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) + self.right = QtGui.QSplitter() + self.right.setOrientation(QtCore.Qt.Vertical) + + #Layout + self.grid = QtGui.QGridLayout() + + + #Button for QFrame + self.kicad_btn = QtGui.QPushButton() + self.kicad_btn.setIcon(QtGui.QIcon('../images/default.png')) + self.kicad_btn.setIconSize(QtCore.QSize(50,50)) + 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.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.grid.addWidget(self.ngspice_btn,0,2) + + + # bind the top level views into the framework - self.views['test1'].setParent(self) + self.views['Project Explorer'].setParent(self) + + self.views['test2'].setParent(self.right) + self.views['test2'].setLayout(self.grid) + self.views['test2'].setReadOnly(True) - right.setParent(self) + self.views['test3'].setParent(self.right) - self.views['test2'].setParent(right) - self.views['test3'].setParent(right) - right.setSizes([20, 5]) + self.right.setParent(self) + self.right.setSizes([20, 5]) self.setSizes([5, 20]) def addView(self, settype, name): diff --git a/src/frontEnd/ViewManagement.pyc b/src/frontEnd/ViewManagement.pyc index 5cd5dee7..b7023ebd 100644 Binary files a/src/frontEnd/ViewManagement.pyc and b/src/frontEnd/ViewManagement.pyc differ diff --git a/src/frontEnd/Workspace.py b/src/frontEnd/Workspace.py index e1cb365b..95c19942 100644 --- a/src/frontEnd/Workspace.py +++ b/src/frontEnd/Workspace.py @@ -15,9 +15,10 @@ # CREATED: Wednesday 05 February 2015 # REVISION: --- #=============================================================================== +from PyQt4 import QtCore, QtGui +from configuration.Appconfig import Appconfig + import os -from PyQt4 import QtGui -from PyQt4 import QtCore class Workspace(QtGui.QWidget): @@ -26,9 +27,12 @@ class Workspace(QtGui.QWidget): """ def __init__(self): super(Workspace, self).__init__() - #Home directory - self.home = os.path.expanduser("~")+"/Workspace" + #Button status lable + #self.status_label = QtGui.QLabel('NO') + + self.obj = Appconfig() + #Initializing Workspace directory for project self.initWorkspace() @@ -40,9 +44,9 @@ class Workspace(QtGui.QWidget): self.ledit = QtGui.QLineEdit(self) #Add text to text edit,label and line edit - self.tedit.append("Sample Text") + self.tedit.append(self.obj.workspace_text) self.label.setText("Workspace:") - self.ledit.setText(self.home) + self.ledit.setText(self.obj.home) #Buttons self.browsebtn = QtGui.QPushButton('Browse') @@ -80,17 +84,33 @@ class Workspace(QtGui.QWidget): self.setGeometry(QtCore.QRect(200,200,400,400)) self.setWindowTitle("Workspace Launcher") #self.setWindowIcon(QtGui.QIcon('logo.png')) + self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) self.tedit.setReadOnly(True) self.show() def defaultWorkspace(self): print "Default location selected" - + self.close() + def createWorkspace(self): - print "Create workspace is called" + print "Create workspace is called" + self.create_workspace = str(self.ledit.text()) + + if os.path.isdir(self.create_workspace): + pass + print "Already present" + self.obj.default_workspace["workspace"] = self.create_workspace + + else: + os.mkdir(self.create_workspace) + self.obj.default_workspace["workspace"] = self.create_workspace + def browseLocation(self): print "Browse Location called" + self.workspace_directory = QtGui.QFileDialog.getExistingDirectory() + print "Path file :", self.workspace_directory + self.ledit.setText(self.workspace_directory) \ No newline at end of file diff --git a/src/frontEnd/Workspace.pyc b/src/frontEnd/Workspace.pyc index eb470612..7492f39a 100644 Binary files a/src/frontEnd/Workspace.pyc and b/src/frontEnd/Workspace.pyc differ diff --git a/src/frontEnd/__init__.pyc b/src/frontEnd/__init__.pyc new file mode 100644 index 00000000..bc735777 Binary files /dev/null and b/src/frontEnd/__init__.pyc differ -- cgit