summaryrefslogtreecommitdiff
path: root/src/frontEnd
diff options
context:
space:
mode:
authormaddy-22019-05-27 12:32:49 +0530
committernilshah982019-06-07 11:03:14 +0530
commit28d8fd378bf717e8daba8a564708856769f24b98 (patch)
treeee8cc6592c690708d5f35cb5304feeae3d014c97 /src/frontEnd
parent7e7b6d372aac718f857fcad5c49faf019ff83bb4 (diff)
downloadeSim-28d8fd378bf717e8daba8a564708856769f24b98.tar.gz
eSim-28d8fd378bf717e8daba8a564708856769f24b98.tar.bz2
eSim-28d8fd378bf717e8daba8a564708856769f24b98.zip
initialise pep8 compliance, using autopep8
Diffstat (limited to 'src/frontEnd')
-rwxr-xr-xsrc/frontEnd/Application.py369
-rw-r--r--src/frontEnd/DockArea.py305
-rw-r--r--src/frontEnd/ProjectExplorer.py104
-rw-r--r--src/frontEnd/Workspace.py94
-rw-r--r--src/frontEnd/pathmagic.py6
5 files changed, 491 insertions, 387 deletions
diff --git a/src/frontEnd/Application.py b/src/frontEnd/Application.py
index dd4cb740..f69eed5c 100755
--- a/src/frontEnd/Application.py
+++ b/src/frontEnd/Application.py
@@ -1,26 +1,26 @@
-#===============================================================================
+#=========================================================================
#
# FILE: Application.py
-#
-# USAGE: ---
-#
+#
+# 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
+# CREATED: Wednesday 21 January 2015
# REVISION: ---
-#===============================================================================
+#=========================================================================
import os
import sys
-#Setting PYTHONPATH
+# Setting PYTHONPATH
cwd = os.getcwd()
-(setPath,fronEnd) = os.path.split(cwd)
+(setPath, fronEnd) = os.path.split(cwd)
sys.path.append(setPath)
from PyQt4 import QtGui, QtCore
@@ -38,105 +38,146 @@ from PyQt4.Qt import QSize
class Application(QtGui.QMainWindow):
- global project_name
+ global project_name
"""
Its our main window of application
"""
- def __init__(self,*args):
+
+ def __init__(self, *args):
"""
Initialize main Application window
"""
- #Calling __init__ of super class
- QtGui.QMainWindow.__init__(self,*args)
-
- #Creating require Object
+ # Calling __init__ of super class
+ QtGui.QMainWindow.__init__(self, *args)
+
+ # Creating require Object
self.obj_workspace = Workspace.Workspace()
self.obj_Mainview = MainView()
self.obj_kicad = Kicad(self.obj_Mainview.obj_dockarea)
- self.obj_appconfig = Appconfig()
+ self.obj_appconfig = Appconfig()
self.obj_validation = Validation()
- #Initialize all widget
+ # Initialize all widget
self.setCentralWidget(self.obj_Mainview)
self.initToolBar()
-
+
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)
+ self.setWindowTitle(self.obj_appconfig._APPLICATION)
self.showMaximized()
self.setWindowIcon(QtGui.QIcon('../../images/logo.png'))
- #self.show()
+ # self.show()
self.systemTrayIcon = QtGui.QSystemTrayIcon(self)
self.systemTrayIcon.setIcon(QtGui.QIcon('../../images/logo.png'))
self.systemTrayIcon.setVisible(True)
-
-
+
def initToolBar(self):
"""
This function initialize Tool Bar
"""
- #Top Tool bar
- self.newproj = QtGui.QAction(QtGui.QIcon('../../images/newProject.png'),'<b>New Project</b>',self)
+ # Top Tool bar
+ self.newproj = QtGui.QAction(
+ QtGui.QIcon('../../images/newProject.png'),
+ '<b>New Project</b>',
+ self)
self.newproj.setShortcut('Ctrl+N')
self.newproj.triggered.connect(self.new_project)
- #self.newproj.connect(self.newproj,QtCore.SIGNAL('triggered()'),self,QtCore.SLOT(self.new_project()))
-
- self.openproj = QtGui.QAction(QtGui.QIcon('../../images/openProject.png'),'<b>Open Project</b>',self)
+ # self.newproj.connect(self.newproj,QtCore.SIGNAL('triggered()'),self,QtCore.SLOT(self.new_project()))
+
+ self.openproj = QtGui.QAction(
+ QtGui.QIcon('../../images/openProject.png'),
+ '<b>Open Project</b>',
+ self)
self.openproj.setShortcut('Ctrl+O')
self.openproj.triggered.connect(self.open_project)
-
- self.closeproj = QtGui.QAction(QtGui.QIcon('../../images/closeProject.png'),'<b>Close Project</b>',self)
+
+ self.closeproj = QtGui.QAction(
+ QtGui.QIcon('../../images/closeProject.png'),
+ '<b>Close Project</b>',
+ self)
self.closeproj.setShortcut('Ctrl+X')
self.closeproj.triggered.connect(self.close_project)
-
- self.helpfile = QtGui.QAction(QtGui.QIcon('../../images/helpProject.png'),'<b>Help</b>',self)
+
+ self.helpfile = QtGui.QAction(
+ QtGui.QIcon('../../images/helpProject.png'), '<b>Help</b>', self)
self.helpfile.setShortcut('Ctrl+H')
self.helpfile.triggered.connect(self.help_project)
-
+
self.topToolbar = self.addToolBar('Top Tool Bar')
self.topToolbar.addAction(self.newproj)
self.topToolbar.addAction(self.openproj)
-
+
self.topToolbar.addAction(self.closeproj)
self.topToolbar.addAction(self.helpfile)
-
+
self.spacer = QtGui.QWidget()
- self.spacer.setSizePolicy(QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Expanding)
+ self.spacer.setSizePolicy(
+ QtGui.QSizePolicy.Expanding,
+ QtGui.QSizePolicy.Expanding)
self.topToolbar.addWidget(self.spacer)
self.logo = QtGui.QLabel()
- self.logopic = QtGui.QPixmap(os.path.join(os.path.abspath('../..'),'images','fosseeLogo.png'))
- self.logopic = self.logopic.scaled(QSize(150,150),QtCore.Qt.KeepAspectRatio)
+ self.logopic = QtGui.QPixmap(
+ os.path.join(
+ os.path.abspath('../..'),
+ 'images',
+ 'fosseeLogo.png'))
+ self.logopic = self.logopic.scaled(
+ QSize(150, 150), QtCore.Qt.KeepAspectRatio)
self.logo.setPixmap(self.logopic)
self.logo.setStyleSheet("padding:0 15px 0 0;")
self.topToolbar.addWidget(self.logo)
-
- #Left Tool bar Action Widget
- self.kicad = QtGui.QAction(QtGui.QIcon('../../images/kicad.png'),'<b>Open Schematic</b>',self)
+
+ # Left Tool bar Action Widget
+ self.kicad = QtGui.QAction(
+ QtGui.QIcon('../../images/kicad.png'),
+ '<b>Open Schematic</b>',
+ self)
self.kicad.triggered.connect(self.obj_kicad.openSchematic)
-
- self.conversion = QtGui.QAction(QtGui.QIcon('../../images/ki-ng.png'),'<b>Convert Kicad to Ngspice</b>',self)
+
+ self.conversion = QtGui.QAction(
+ QtGui.QIcon('../../images/ki-ng.png'),
+ '<b>Convert Kicad to Ngspice</b>',
+ self)
self.conversion.triggered.connect(self.obj_kicad.openKicadToNgspice)
-
- self.ngspice = QtGui.QAction(QtGui.QIcon('../../images/ngspice.png'), '<b>Simulation</b>', self)
+
+ self.ngspice = QtGui.QAction(
+ QtGui.QIcon('../../images/ngspice.png'),
+ '<b>Simulation</b>',
+ self)
self.ngspice.triggered.connect(self.open_ngspice)
-
- self.model = QtGui.QAction(QtGui.QIcon('../../images/model.png'),'<b>Model Editor</b>',self)
- self.model.triggered.connect(self.open_modelEditor)
-
- self.subcircuit=QtGui.QAction(QtGui.QIcon('../../images/subckt.png'),'<b>Subcircuit</b>',self)
+
+ self.model = QtGui.QAction(
+ QtGui.QIcon('../../images/model.png'),
+ '<b>Model Editor</b>',
+ self)
+ self.model.triggered.connect(self.open_modelEditor)
+
+ self.subcircuit = QtGui.QAction(
+ QtGui.QIcon('../../images/subckt.png'),
+ '<b>Subcircuit</b>',
+ self)
self.subcircuit.triggered.connect(self.open_subcircuit)
- self.nghdl = QtGui.QAction(QtGui.QIcon('../../images/nghdl.png'), '<b>Nghdl</b>', self)
+ self.nghdl = QtGui.QAction(
+ QtGui.QIcon('../../images/nghdl.png'),
+ '<b>Nghdl</b>',
+ self)
self.nghdl.triggered.connect(self.open_nghdl)
-
- self.omedit = QtGui.QAction(QtGui.QIcon('../../images/omedit.png'),'<b>Modelica Converter</b>',self)
- self.omedit.triggered.connect(self.open_OMedit)
-
- self.omoptim=QtGui.QAction(QtGui.QIcon('../../images/omoptim.png'),'<b>OM Optimisation</b>',self)
+
+ self.omedit = QtGui.QAction(
+ QtGui.QIcon('../../images/omedit.png'),
+ '<b>Modelica Converter</b>',
+ self)
+ self.omedit.triggered.connect(self.open_OMedit)
+
+ self.omoptim = QtGui.QAction(
+ QtGui.QIcon('../../images/omoptim.png'),
+ '<b>OM Optimisation</b>',
+ self)
self.omoptim.triggered.connect(self.open_OMoptim)
-
- #Adding Action Widget to tool bar
+
+ # Adding Action Widget to tool bar
self.lefttoolbar = QtGui.QToolBar('Left ToolBar')
self.addToolBar(QtCore.Qt.LeftToolBarArea, self.lefttoolbar)
self.lefttoolbar.addAction(self.kicad)
@@ -148,124 +189,130 @@ class Application(QtGui.QMainWindow):
self.lefttoolbar.addAction(self.omedit)
self.lefttoolbar.addAction(self.omoptim)
self.lefttoolbar.setOrientation(QtCore.Qt.Vertical)
- self.lefttoolbar.setIconSize(QSize(40,40))
-
+ self.lefttoolbar.setIconSize(QSize(40, 40))
+
def closeEvent(self, event):
exit_msg = "Are you sure you want to exit the program ? All unsaved data will be lost."
reply = QtGui.QMessageBox.question(self, 'Message',
exit_msg, QtGui.QMessageBox.Yes, QtGui.QMessageBox.No)
-
- if reply == QtGui.QMessageBox.Yes:
+
+ if reply == QtGui.QMessageBox.Yes:
for proc in self.obj_appconfig.procThread_list:
- try:
- proc.terminate()
- except:
- pass
- try:
+ try:
+ proc.terminate()
+ except BaseException:
+ pass
+ try:
for process_object in self.obj_appconfig.process_obj:
try:
process_object.close()
- except:
- pass
- except:
+ except BaseException:
+ pass
+ except BaseException:
pass
- ##Just checking if open project and New project window is open. If yes just close it when application is closed
+ # Just checking if open project and New project window is open. If
+ # yes just close it when application is closed
try:
self.project.close()
- except:
+ except BaseException:
pass
event.accept()
self.systemTrayIcon.showMessage('Exit', 'eSim is Closed.')
-
+
elif reply == QtGui.QMessageBox.No:
event.ignore()
-
-
+
def close_project(self):
print("Function : Close Project")
current_project = self.obj_appconfig.current_project['ProjectName']
- if current_project==None:
+ if current_project is None:
pass
else:
for pid in self.obj_appconfig.proc_dict[self.obj_appconfig.current_project['ProjectName']]:
try:
os.kill(pid, 9)
- except:
+ except BaseException:
pass
self.obj_Mainview.obj_dockarea.closeDock()
self.obj_appconfig.current_project['ProjectName'] = None
- self.systemTrayIcon.showMessage('Close', 'Current project '+os.path.basename(current_project)+' is Closed.')
-
+ self.systemTrayIcon.showMessage(
+ 'Close',
+ 'Current project ' +
+ os.path.basename(current_project) +
+ ' is Closed.')
+
def new_project(self):
"""
This function call New Project Info class.
"""
- text, ok = QtGui.QInputDialog.getText(self, 'New Project Info','Enter Project Name:')
+ text, ok = QtGui.QInputDialog.getText(
+ self, 'New Project Info', 'Enter Project Name:')
if ok:
self.projname = (str(text))
self.project = NewProjectInfo()
- directory, filelist =self.project.createProject(self.projname)
-
- self.obj_Mainview.obj_projectExplorer.addTreeNode(directory, filelist)
-
+ directory, filelist = self.project.createProject(self.projname)
+
+ self.obj_Mainview.obj_projectExplorer.addTreeNode(
+ directory, filelist)
+
else:
print("No new project created")
self.obj_appconfig.print_info('No new project created')
try:
- self.obj_appconfig.print_info('Current project is : ' + self.obj_appconfig.current_project["ProjectName"])
- except:
+ self.obj_appconfig.print_info(
+ 'Current project is : ' +
+ self.obj_appconfig.current_project["ProjectName"])
+ except BaseException:
pass
-
+
def open_project(self):
"""
This project call Open Project Info class
"""
print("Function : Open Project")
self.project = OpenProjectInfo()
-
+
try:
directory, filelist = self.project.body()
- self.obj_Mainview.obj_projectExplorer.addTreeNode(directory, filelist)
- except:
+ self.obj_Mainview.obj_projectExplorer.addTreeNode(
+ directory, filelist)
+ except BaseException:
pass
-
-
-
-
+
def help_project(self):
print("Function : Help")
self.obj_appconfig.print_info('Help is called')
- print("Current Project is : ",self.obj_appconfig.current_project)
- self.obj_Mainview.obj_dockarea.usermanual()
-
-
+ print("Current Project is : ", self.obj_appconfig.current_project)
+ self.obj_Mainview.obj_dockarea.usermanual()
+
def open_ngspice(self):
"""
This Function execute ngspice on current project
"""
-
+
self.projDir = self.obj_appconfig.current_project["ProjectName"]
-
- if self.projDir != None:
+
+ if self.projDir is not None:
self.obj_Mainview.obj_dockarea.ngspiceEditor(self.projDir)
- time.sleep(2) #Need permanent solution
- #Calling Python Plotting
-
+ time.sleep(2) # Need permanent solution
+ # Calling Python Plotting
+
try:
self.obj_Mainview.obj_dockarea.plottingEditor()
except Exception as e:
self.msg = QtGui.QErrorMessage(None)
self.msg.showMessage('Error while opening python plotting Editor.\
Please look at console for more details ')
- print("Exception Message:",str(e))
+ print("Exception Message:", str(e))
self.obj_appconfig.print_error('Exception Message : ' + str(e))
self.msg.setWindowTitle("Error Message")
-
+
else:
self.msg = QtGui.QErrorMessage()
- self.msg.showMessage('Please select the project first. You can either create new project or open existing project')
+ self.msg.showMessage(
+ 'Please select the project first. You can either create new project or open existing project')
self.msg.setWindowTitle("Error Message")
-
+
def open_subcircuit(self):
print("Function : Subcircuit editor")
self.obj_appconfig.print_info('Subcircuit editor is called')
@@ -282,38 +329,40 @@ class Application(QtGui.QMainWindow):
else:
self.msg = QtGui.QErrorMessage(None)
- self.msg.showMessage('Error while opening nghdl. Please make sure nghdl is installed')
- self.obj_appconfig.print_error('Error while opening nghdl. Please make sure nghdl is installed')
+ self.msg.showMessage(
+ 'Error while opening nghdl. Please make sure nghdl is installed')
+ self.obj_appconfig.print_error(
+ 'Error while opening nghdl. Please make sure nghdl is installed')
self.msg.setWindowTitle('nghdl Error Message')
-
-
+
def open_modelEditor(self):
print("Function : Model editor")
self.obj_appconfig.print_info('Model editor is called')
self.obj_Mainview.obj_dockarea.modelEditor()
-
def open_OMedit(self):
"""
This function call ngspice to OM edit converter and then launch OM edit.
"""
self.obj_appconfig.print_info('OM edit is called')
self.projDir = self.obj_appconfig.current_project["ProjectName"]
-
- if self.projDir != None:
+
+ if self.projDir is not None:
if self.obj_validation.validateCirOut(self.projDir):
self.projName = os.path.basename(self.projDir)
- self.ngspiceNetlist = os.path.join(self.projDir,self.projName+".cir.out")
- self.modelicaNetlist = os.path.join(self.projDir,self.projName+".mo")
-
+ self.ngspiceNetlist = os.path.join(
+ self.projDir, self.projName + ".cir.out")
+ self.modelicaNetlist = os.path.join(
+ self.projDir, self.projName + ".mo")
+
"""
try:
#Creating a command for Ngspice to Modelica converter
self.cmd1 = "python ../ngspicetoModelica/NgspicetoModelica.py "+self.ngspiceNetlist
self.obj_workThread1 = Worker.WorkerThread(self.cmd1)
self.obj_workThread1.start()
-
-
+
+
if self.obj_validation.validateTool("OMEdit"):
#Creating command to run OMEdit
self.cmd2 = "OMEdit "+self.modelicaNetlist
@@ -330,7 +379,7 @@ class Application(QtGui.QMainWindow):
self.msg.setWindowTitle("Missing OpenModelica")
self.obj_appconfig.print_info(self.msgContent)
self.msg.exec_()
-
+
except Exception as e:
self.msg = QtGui.QErrorMessage()
self.msg.showMessage('Unable to convert NgSpice netlist to Modelica netlist :'+str(e))
@@ -339,23 +388,24 @@ class Application(QtGui.QMainWindow):
"""
self.obj_Mainview.obj_dockarea.modelicaEditor(self.projDir)
-
+
else:
self.msg = QtGui.QErrorMessage()
- self.msg.showMessage('Current project does not contain any ngspice file. Please create ngspice file with extension .cir.out')
+ self.msg.showMessage(
+ 'Current project does not contain any ngspice file. Please create ngspice file with extension .cir.out')
self.msg.setWindowTitle("Missing Ngspice netlist")
else:
self.msg = QtGui.QErrorMessage()
- self.msg.showMessage('Please select the project first. You can either create new project or open existing project')
+ self.msg.showMessage(
+ 'Please select the project first. You can either create new project or open existing project')
self.msg.setWindowTitle("Error Message")
-
-
+
def open_OMoptim(self):
- print("Function : OM Optim")
+ print("Function : OM Optim")
self.obj_appconfig.print_info('OM Optim is called')
- #Check if OMOptim is installed
+ # Check if OMOptim is installed
if self.obj_validation.validateTool("OMOptim"):
- #Creating a command to run
+ # Creating a command to run
self.cmd = "OMOptim"
self.obj_workThread = Worker.WorkerThread(self.cmd)
self.obj_workThread.start()
@@ -371,60 +421,62 @@ class Application(QtGui.QMainWindow):
self.obj_appconfig.print_info(self.msgContent)
self.msg.exec_()
+
class MainView(QtGui.QWidget):
"""
This class initialize the Main View of Application
"""
+
def __init__(self, *args):
# call init method of superclass
QtGui.QWidget.__init__(self, *args)
-
+
self.obj_appconfig = Appconfig()
-
+
self.leftSplit = QtGui.QSplitter()
self.middleSplit = QtGui.QSplitter()
-
+
self.mainLayout = QtGui.QVBoxLayout()
- #Intermediate Widget
+ # Intermediate Widget
self.middleContainer = QtGui.QWidget()
self.middleContainerLayout = QtGui.QVBoxLayout()
-
- #Area to be included in MainView
+
+ # Area to be included in MainView
self.noteArea = QtGui.QTextEdit()
self.noteArea.setReadOnly(True)
self.obj_appconfig.noteArea['Note'] = self.noteArea
- self.obj_appconfig.noteArea['Note'].append(' eSim Started......')
+ self.obj_appconfig.noteArea['Note'].append(
+ ' eSim Started......')
self.obj_appconfig.noteArea['Note'].append('Project Selected : None')
self.obj_appconfig.noteArea['Note'].append('\n')
-
- #CSS
+
+ # CSS
self.noteArea.setStyleSheet(" \
QWidget { border-radius: 15px; border: 1px solid gray; padding: 5px; } \
")
-
+
self.obj_dockarea = DockArea.DockArea()
self.obj_projectExplorer = ProjectExplorer.ProjectExplorer()
-
- #Adding content to vertical middle Split.
+
+ # Adding content to vertical middle Split.
self.middleSplit.setOrientation(QtCore.Qt.Vertical)
self.middleSplit.addWidget(self.obj_dockarea)
self.middleSplit.addWidget(self.noteArea)
-
- #Adding middle split to Middle Container Widget
+
+ # Adding middle split to Middle Container Widget
self.middleContainerLayout.addWidget(self.middleSplit)
self.middleContainer.setLayout(self.middleContainerLayout)
-
- #Adding content of left split
+
+ # Adding content of left split
self.leftSplit.addWidget(self.obj_projectExplorer)
self.leftSplit.addWidget(self.middleContainer)
-
-
- #Adding to main Layout
+
+ # Adding to main Layout
self.mainLayout.addWidget(self.leftSplit)
- self.leftSplit.setSizes([self.width()/4.5,self.height()])
- self.middleSplit.setSizes([self.width(),self.height()/2])
+ self.leftSplit.setSizes([self.width() / 4.5, self.height()])
+ self.middleSplit.setSizes([self.width(), self.height() / 2])
self.setLayout(self.mainLayout)
-
+
def main(args):
"""
@@ -432,24 +484,21 @@ def main(args):
"""
print("Starting eSim......")
app = QtGui.QApplication(args)
-
+
splash_pix = QtGui.QPixmap('../../images/splash_screen_esim.png')
- splash = QtGui.QSplashScreen(splash_pix,QtCore.Qt.WindowStaysOnTopHint)
+ splash = QtGui.QSplashScreen(splash_pix, QtCore.Qt.WindowStaysOnTopHint)
splash.setMask(splash_pix.mask())
splash.show()
appView = Application()
- appView.splash=splash
+ appView.splash = splash
appView.obj_workspace.returnWhetherClickedOrNot(appView)
appView.hide()
- appView.obj_workspace.show()
+ appView.obj_workspace.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/DockArea.py b/src/frontEnd/DockArea.py
index 7ae3607c..b60a6720 100644
--- a/src/frontEnd/DockArea.py
+++ b/src/frontEnd/DockArea.py
@@ -1,4 +1,4 @@
-from PyQt4 import QtGui,QtCore
+from PyQt4 import QtGui, QtCore
from ngspiceSimulation.pythonPlotting import plotWindow
from ngspiceSimulation.NgspiceWidget import NgspiceWidget
from configuration.Appconfig import Appconfig
@@ -14,6 +14,7 @@ dockList = ['Welcome']
count = 1
dock = {}
+
class DockArea(QtGui.QMainWindow):
def __init__(self):
@@ -24,18 +25,18 @@ class DockArea(QtGui.QMainWindow):
dock[dockName] = QtGui.QDockWidget(dockName)
self.welcomeWidget = QtGui.QWidget()
self.welcomeLayout = QtGui.QVBoxLayout()
- self.welcomeLayout.addWidget(Welcome()) ##Call browser
-
- #Adding to main Layout
+ self.welcomeLayout.addWidget(Welcome()) # Call browser
+
+ # Adding to main Layout
self.welcomeWidget.setLayout(self.welcomeLayout)
dock[dockName].setWidget(self.welcomeWidget)
- #CSS
+ # CSS
dock[dockName].setStyleSheet(" \
QWidget { border-radius: 15px; border: 1px solid gray; padding: 5px; width: 200px; height: 150px; } \
- ")
- self.addDockWidget(QtCore.Qt.TopDockWidgetArea, dock[dockName])
-
- #self.tabifyDockWidget(dock['Notes'],dock['Blank'])
+ ")
+ self.addDockWidget(QtCore.Qt.TopDockWidgetArea, dock[dockName])
+
+ # self.tabifyDockWidget(dock['Notes'],dock['Blank'])
self.show()
'''
@@ -68,31 +69,33 @@ class DockArea(QtGui.QMainWindow):
self.testArea = QtGui.QTextEdit()
self.testLayout = QtGui.QVBoxLayout()
self.testLayout.addWidget(self.testArea)
-
- #Adding to main Layout
+
+ # Adding to main Layout
self.testWidget.setLayout(self.testLayout)
- dock['Tips-'+str(count)] = QtGui.QDockWidget('Tips-'+str(count))
- dock['Tips-'+str(count)].setWidget(self.testWidget)
- self.addDockWidget(QtCore.Qt.TopDockWidgetArea, dock['Tips-'+str(count)])
- self.tabifyDockWidget(dock['Welcome'],dock['Tips-'+str(count)])
-
+ dock['Tips-' + str(count)] = QtGui.QDockWidget('Tips-' + str(count))
+ dock['Tips-' + str(count)].setWidget(self.testWidget)
+ self.addDockWidget(QtCore.Qt.TopDockWidgetArea,
+ dock['Tips-' + str(count)])
+ self.tabifyDockWidget(dock['Welcome'], dock['Tips-' + str(count)])
+
"""
#CSS
dock['Tips-'+str(count)].setStyleSheet(" \
.QWidget { border-radius: 15px; border: 1px solid gray; padding: 5px; width: 200px; height: 150px; } \
")
"""
-
- dock['Tips-'+str(count)].setVisible(True)
- dock['Tips-'+str(count)].setFocus()
+
+ dock['Tips-' + str(count)].setVisible(True)
+ dock['Tips-' + str(count)].setFocus()
"""
dock['Tips-'+str(count)].setStyleSheet(" \
:hover { background-color: yellow; } \
")
"""
- dock['Tips-'+str(count)].raise_()
+ dock['Tips-' + str(count)].raise_()
- self.obj_appconfig.dock_dict[self.obj_appconfig.current_project['ProjectName']].append(dock['Tips-'+str(count)])
+ self.obj_appconfig.dock_dict[self.obj_appconfig.current_project['ProjectName']].append(
+ dock['Tips-' + str(count)])
count = count + 1
def plottingEditor(self):
@@ -102,149 +105,165 @@ class DockArea(QtGui.QMainWindow):
self.projDir = self.obj_appconfig.current_project["ProjectName"]
self.projName = os.path.basename(self.projDir)
#self.project = os.path.join(self.projDir,self.projName)
-
-
global count
self.plottingWidget = QtGui.QWidget()
self.plottingLayout = QtGui.QVBoxLayout()
- self.plottingLayout.addWidget(plotWindow(self.projDir,self.projName))
-
- #Adding to main Layout
+ self.plottingLayout.addWidget(plotWindow(self.projDir, self.projName))
+
+ # Adding to main Layout
self.plottingWidget.setLayout(self.plottingLayout)
- dock['Plotting-'+str(count)] = QtGui.QDockWidget('Plotting-'+str(count))
- dock['Plotting-'+str(count)].setWidget(self.plottingWidget)
- self.addDockWidget(QtCore.Qt.TopDockWidgetArea, dock['Plotting-'+str(count)])
- self.tabifyDockWidget(dock['Welcome'],dock['Plotting-'+str(count)])
-
+ dock['Plotting-' + str(count)
+ ] = QtGui.QDockWidget('Plotting-' + str(count))
+ dock['Plotting-' + str(count)].setWidget(self.plottingWidget)
+ self.addDockWidget(QtCore.Qt.TopDockWidgetArea,
+ dock['Plotting-' + str(count)])
+ self.tabifyDockWidget(dock['Welcome'], dock['Plotting-' + str(count)])
+
"""
#CSS
dock['Plotting-'+str(count)].setStyleSheet(" \
.QWidget { border-radius: 15px; border: 1px solid gray; padding: 5px; width: 200px; height: 150px; } \
")
"""
- dock['Plotting-'+str(count)].setVisible(True)
- dock['Plotting-'+str(count)].setFocus()
- dock['Plotting-'+str(count)].raise_()
+ dock['Plotting-' + str(count)].setVisible(True)
+ dock['Plotting-' + str(count)].setFocus()
+ dock['Plotting-' + str(count)].raise_()
- self.obj_appconfig.dock_dict[self.obj_appconfig.current_project['ProjectName']].append(dock['Plotting-'+str(count)])
+ self.obj_appconfig.dock_dict[self.obj_appconfig.current_project['ProjectName']].append(
+ dock['Plotting-' + str(count)])
count = count + 1
-
- def ngspiceEditor(self,projDir):
+
+ def ngspiceEditor(self, projDir):
"""
This function creates widget for NgSpice window
"""
-
-
+
self.projDir = projDir
self.projName = os.path.basename(self.projDir)
- self.ngspiceNetlist = os.path.join(self.projDir,self.projName+".cir.out")
-
-
-
+ self.ngspiceNetlist = os.path.join(
+ self.projDir, self.projName + ".cir.out")
+
global count
self.ngspiceWidget = QtGui.QWidget()
self.ngspiceLayout = QtGui.QVBoxLayout()
- self.ngspiceLayout.addWidget(NgspiceWidget(self.ngspiceNetlist,self.projDir))
-
- #Adding to main Layout
+ self.ngspiceLayout.addWidget(
+ NgspiceWidget(
+ self.ngspiceNetlist,
+ self.projDir))
+
+ # Adding to main Layout
self.ngspiceWidget.setLayout(self.ngspiceLayout)
- dock['NgSpice-'+str(count)] = QtGui.QDockWidget('NgSpice-'+str(count))
- dock['NgSpice-'+str(count)].setWidget(self.ngspiceWidget)
- self.addDockWidget(QtCore.Qt.TopDockWidgetArea, dock['NgSpice-'+str(count)])
- self.tabifyDockWidget(dock['Welcome'],dock['NgSpice-'+str(count)])
+ dock['NgSpice-' + str(count)
+ ] = QtGui.QDockWidget('NgSpice-' + str(count))
+ dock['NgSpice-' + str(count)].setWidget(self.ngspiceWidget)
+ self.addDockWidget(QtCore.Qt.TopDockWidgetArea,
+ dock['NgSpice-' + str(count)])
+ self.tabifyDockWidget(dock['Welcome'], dock['NgSpice-' + str(count)])
- #CSS
- dock['NgSpice-'+str(count)].setStyleSheet(" \
+ # CSS
+ dock['NgSpice-' + str(count)].setStyleSheet(" \
.QWidget { border-radius: 15px; border: 1px solid gray; padding: 0px; width: 200px; height: 150px; } \
")
-
- dock['NgSpice-'+str(count)].setVisible(True)
- dock['NgSpice-'+str(count)].setFocus()
- dock['NgSpice-'+str(count)].raise_()
- self.obj_appconfig.dock_dict[self.obj_appconfig.current_project['ProjectName']].append(dock['NgSpice-'+str(count)])
+
+ dock['NgSpice-' + str(count)].setVisible(True)
+ dock['NgSpice-' + str(count)].setFocus()
+ dock['NgSpice-' + str(count)].raise_()
+ self.obj_appconfig.dock_dict[self.obj_appconfig.current_project['ProjectName']].append(
+ dock['NgSpice-' + str(count)])
count = count + 1
- def modelEditor(self):
- print("in model editor")
- global count
- self.modelwidget = QtGui.QWidget()
-
- self.modellayout = QtGui.QVBoxLayout()
- self.modellayout.addWidget(ModelEditorclass())
-
- #Adding to main Layout
- self.modelwidget.setLayout(self.modellayout)
-
- dock['Model Editor-'+str(count)] = QtGui.QDockWidget('Model Editor-'+str(count))
- dock['Model Editor-'+str(count)].setWidget(self.modelwidget)
- self.addDockWidget(QtCore.Qt.TopDockWidgetArea, dock['Model Editor-'+str(count)])
- self.tabifyDockWidget(dock['Welcome'],dock['Model Editor-'+str(count)])
-
- #CSS
- dock['Model Editor-'+str(count)].setStyleSheet(" \
+ def modelEditor(self):
+ print("in model editor")
+ global count
+ self.modelwidget = QtGui.QWidget()
+
+ self.modellayout = QtGui.QVBoxLayout()
+ self.modellayout.addWidget(ModelEditorclass())
+
+ # Adding to main Layout
+ self.modelwidget.setLayout(self.modellayout)
+
+ dock['Model Editor-' +
+ str(count)] = QtGui.QDockWidget('Model Editor-' + str(count))
+ dock['Model Editor-' + str(count)].setWidget(self.modelwidget)
+ self.addDockWidget(QtCore.Qt.TopDockWidgetArea,
+ dock['Model Editor-' + str(count)])
+ self.tabifyDockWidget(dock['Welcome'],
+ dock['Model Editor-' + str(count)])
+
+ # CSS
+ dock['Model Editor-' + str(count)].setStyleSheet(" \
.QWidget { border-radius: 15px; border: 1px solid gray; padding: 5px; width: 200px; height: 150px; } \
")
-
- dock['Model Editor-'+str(count)].setVisible(True)
- dock['Model Editor-'+str(count)].setFocus()
- dock['Model Editor-'+str(count)].raise_()
- self.obj_appconfig.dock_dict[self.obj_appconfig.current_project['ProjectName']].append(dock['Model Editor-'+str(count)])
- count = count + 1
-
- def kicadToNgspiceEditor(self,clarg1,clarg2=None):
+ dock['Model Editor-' + str(count)].setVisible(True)
+ dock['Model Editor-' + str(count)].setFocus()
+ dock['Model Editor-' + str(count)].raise_()
+
+ self.obj_appconfig.dock_dict[self.obj_appconfig.current_project['ProjectName']].append(
+ dock['Model Editor-' + str(count)])
+ count = count + 1
+
+ def kicadToNgspiceEditor(self, clarg1, clarg2=None):
global count
- self.kicadToNgspiceWidget=QtGui.QWidget()
- self.kicadToNgspiceLayout=QtGui.QVBoxLayout()
- self.kicadToNgspiceLayout.addWidget(MainWindow(clarg1,clarg2))
-
+ self.kicadToNgspiceWidget = QtGui.QWidget()
+ self.kicadToNgspiceLayout = QtGui.QVBoxLayout()
+ self.kicadToNgspiceLayout.addWidget(MainWindow(clarg1, clarg2))
+
self.kicadToNgspiceWidget.setLayout(self.kicadToNgspiceLayout)
- dock['kicadToNgspice-'+str(count)] = QtGui.QDockWidget('kicadToNgspice-'+str(count))
- dock['kicadToNgspice-'+str(count)].setWidget(self.kicadToNgspiceWidget)
- self.addDockWidget(QtCore.Qt.TopDockWidgetArea, dock['kicadToNgspice-'+str(count)])
- self.tabifyDockWidget(dock['Welcome'],dock['kicadToNgspice-'+str(count)])
-
- #CSS
- dock['kicadToNgspice-'+str(count)].setStyleSheet(" \
+ dock['kicadToNgspice-' +
+ str(count)] = QtGui.QDockWidget('kicadToNgspice-' + str(count))
+ dock['kicadToNgspice-' +
+ str(count)].setWidget(self.kicadToNgspiceWidget)
+ self.addDockWidget(QtCore.Qt.TopDockWidgetArea,
+ dock['kicadToNgspice-' + str(count)])
+ self.tabifyDockWidget(dock['Welcome'],
+ dock['kicadToNgspice-' + str(count)])
+
+ # CSS
+ dock['kicadToNgspice-' + str(count)].setStyleSheet(" \
.QWidget { border-radius: 15px; border: 1px solid gray; padding: 5px; width: 200px; height: 150px; } \
")
-
- dock['kicadToNgspice-'+str(count)].setVisible(True)
- dock['kicadToNgspice-'+str(count)].setFocus()
- dock['kicadToNgspice-'+str(count)].raise_()
- self.obj_appconfig.dock_dict[self.obj_appconfig.current_project['ProjectName']].append(dock['kicadToNgspice-'+str(count)])
+ dock['kicadToNgspice-' + str(count)].setVisible(True)
+ dock['kicadToNgspice-' + str(count)].setFocus()
+ dock['kicadToNgspice-' + str(count)].raise_()
+
+ self.obj_appconfig.dock_dict[self.obj_appconfig.current_project['ProjectName']].append(
+ dock['kicadToNgspice-' + str(count)])
count = count + 1
-
-
def subcircuiteditor(self):
"""
This function creates a widget for different subcircuit options
"""
global count
- self.subcktWidget=QtGui.QWidget()
- self.subcktLayout=QtGui.QVBoxLayout()
+ self.subcktWidget = QtGui.QWidget()
+ self.subcktLayout = QtGui.QVBoxLayout()
self.subcktLayout.addWidget(Subcircuit(self))
self.subcktWidget.setLayout(self.subcktLayout)
- dock['Subcircuit-'+str(count)] = QtGui.QDockWidget('Subcircuit-'+str(count))
- dock['Subcircuit-'+str(count)].setWidget(self.subcktWidget)
- self.addDockWidget(QtCore.Qt.TopDockWidgetArea, dock['Subcircuit-'+str(count)])
- self.tabifyDockWidget(dock['Welcome'],dock['Subcircuit-'+str(count)])
-
- #CSS
- dock['Subcircuit-'+str(count)].setStyleSheet(" \
+ dock['Subcircuit-' +
+ str(count)] = QtGui.QDockWidget('Subcircuit-' + str(count))
+ dock['Subcircuit-' + str(count)].setWidget(self.subcktWidget)
+ self.addDockWidget(QtCore.Qt.TopDockWidgetArea,
+ dock['Subcircuit-' + str(count)])
+ self.tabifyDockWidget(dock['Welcome'],
+ dock['Subcircuit-' + str(count)])
+
+ # CSS
+ dock['Subcircuit-' + str(count)].setStyleSheet(" \
.QWidget { border-radius: 15px; border: 1px solid gray; padding: 5px; width: 200px; height: 150px; } \
")
-
- dock['Subcircuit-'+str(count)].setVisible(True)
- dock['Subcircuit-'+str(count)].setFocus()
- dock['Subcircuit-'+str(count)].raise_()
- self.obj_appconfig.dock_dict[self.obj_appconfig.current_project['ProjectName']].append(dock['Subcircuit-'+str(count)])
+ dock['Subcircuit-' + str(count)].setVisible(True)
+ dock['Subcircuit-' + str(count)].setFocus()
+ dock['Subcircuit-' + str(count)].raise_()
+
+ self.obj_appconfig.dock_dict[self.obj_appconfig.current_project['ProjectName']].append(
+ dock['Subcircuit-' + str(count)])
count = count + 1
def usermanual(self):
@@ -253,25 +272,28 @@ class DockArea(QtGui.QMainWindow):
"""
global count
- self.usermanualWidget=QtGui.QWidget()
- self.usermanualLayout=QtGui.QVBoxLayout()
+ self.usermanualWidget = QtGui.QWidget()
+ self.usermanualLayout = QtGui.QVBoxLayout()
self.usermanualLayout.addWidget(UserManual())
self.usermanualWidget.setLayout(self.usermanualLayout)
- dock['User Manual-'+str(count)] = QtGui.QDockWidget('User Manual-'+str(count))
- dock['User Manual-'+str(count)].setWidget(self.usermanualWidget)
- self.addDockWidget(QtCore.Qt.TopDockWidgetArea, dock['User Manual-'+str(count)])
- self.tabifyDockWidget(dock['Welcome'],dock['User Manual-'+str(count)])
-
- #CSS
- dock['User Manual-'+str(count)].setStyleSheet(" \
+ dock['User Manual-' +
+ str(count)] = QtGui.QDockWidget('User Manual-' + str(count))
+ dock['User Manual-' + str(count)].setWidget(self.usermanualWidget)
+ self.addDockWidget(QtCore.Qt.TopDockWidgetArea,
+ dock['User Manual-' + str(count)])
+ self.tabifyDockWidget(dock['Welcome'],
+ dock['User Manual-' + str(count)])
+
+ # CSS
+ dock['User Manual-' + str(count)].setStyleSheet(" \
.QWidget { border-radius: 15px; border: 1px solid gray; padding: 5px; width: 200px; height: 150px; } \
")
-
- dock['User Manual-'+str(count)].setVisible(True)
- dock['User Manual-'+str(count)].setFocus()
- dock['User Manual-'+str(count)].raise_()
-
+
+ dock['User Manual-' + str(count)].setVisible(True)
+ dock['User Manual-' + str(count)].setFocus()
+ dock['User Manual-' + str(count)].raise_()
+
count = count + 1
def modelicaEditor(self, projDir):
@@ -285,24 +307,27 @@ class DockArea(QtGui.QMainWindow):
self.modelicaLayout.addWidget(OpenModelicaEditor(projDir))
self.modelicaWidget.setLayout(self.modelicaLayout)
- dock['Modelica-'+str(count)] = QtGui.QDockWidget('Modelica-'+str(count))
- dock['Modelica-'+str(count)].setWidget(self.modelicaWidget)
- self.addDockWidget(QtCore.Qt.TopDockWidgetArea, dock['Modelica-'+str(count)])
- self.tabifyDockWidget(dock['Welcome'],dock['Modelica-'+str(count)])
+ dock['Modelica-' + str(count)
+ ] = QtGui.QDockWidget('Modelica-' + str(count))
+ dock['Modelica-' + str(count)].setWidget(self.modelicaWidget)
+ self.addDockWidget(QtCore.Qt.TopDockWidgetArea,
+ dock['Modelica-' + str(count)])
+ self.tabifyDockWidget(dock['Welcome'], dock['Modelica-' + str(count)])
- dock['Modelica-'+str(count)].setVisible(True)
- dock['Modelica-'+str(count)].setFocus()
- dock['Modelica-'+str(count)].raise_()
+ dock['Modelica-' + str(count)].setVisible(True)
+ dock['Modelica-' + str(count)].setFocus()
+ dock['Modelica-' + str(count)].raise_()
- #CSS
- dock['Modelica-'+str(count)].setStyleSheet(" \
+ # CSS
+ dock['Modelica-' + str(count)].setStyleSheet(" \
.QWidget { border-radius: 15px; border: 1px solid gray; padding: 5px; width: 200px; height: 150px; } \
")
- self.obj_appconfig.dock_dict[self.obj_appconfig.current_project['ProjectName']].append(dock['Modelica-'+str(count)])
+ self.obj_appconfig.dock_dict[self.obj_appconfig.current_project['ProjectName']].append(
+ dock['Modelica-' + str(count)])
count = count + 1
- def closeDock (self):
+ def closeDock(self):
for dockwidget in self.obj_appconfig.dock_dict[self.obj_appconfig.current_project['ProjectName']]:
dockwidget.close()
diff --git a/src/frontEnd/ProjectExplorer.py b/src/frontEnd/ProjectExplorer.py
index 7e03d399..677d934a 100644
--- a/src/frontEnd/ProjectExplorer.py
+++ b/src/frontEnd/ProjectExplorer.py
@@ -1,4 +1,4 @@
-from PyQt4 import QtGui,QtCore
+from PyQt4 import QtGui, QtCore
import os
import json
from configuration.Appconfig import Appconfig
@@ -9,12 +9,12 @@ class ProjectExplorer(QtGui.QWidget):
QtGui.QWidget.__init__(self)
self.obj_appconfig = Appconfig()
self.treewidget = QtGui.QTreeWidget()
- self.window= QtGui.QVBoxLayout()
- header = QtGui.QTreeWidgetItem(["Projects","path"])
+ self.window = QtGui.QVBoxLayout()
+ header = QtGui.QTreeWidgetItem(["Projects", "path"])
self.treewidget.setHeaderItem(header)
- self.treewidget.setColumnHidden(1,True)
+ self.treewidget.setColumnHidden(1, True)
- #CSS
+ # CSS
self.treewidget.setStyleSheet(" \
QTreeView { border-radius: 15px; border: 1px solid gray; padding: 5px; width: 200px; height: 150px; } \
QTreeView::branch:has-siblings:!adjoins-item { border-image: url(../../images/vline.png) 0; } \
@@ -26,13 +26,16 @@ class ProjectExplorer(QtGui.QWidget):
QTreeView::branch:open:has-children:has-siblings { border-image: none; image: url(../../images/branch-open.png); } \
")
- for parents, children in list(self.obj_appconfig.project_explorer.items()):
+ for parents, children in list(
+ self.obj_appconfig.project_explorer.items()):
os.path.join(parents)
if os.path.exists(parents):
- pathlist= parents.split(os.sep)
- parentnode = QtGui.QTreeWidgetItem(self.treewidget, [pathlist[-1],parents])
+ pathlist = parents.split(os.sep)
+ parentnode = QtGui.QTreeWidgetItem(
+ self.treewidget, [pathlist[-1], parents])
for files in children:
- childnode = QtGui.QTreeWidgetItem(parentnode, [files, os.path.join(parents,files)])
+ childnode = QtGui.QTreeWidgetItem(
+ parentnode, [files, os.path.join(parents, files)])
self.window.addWidget(self.treewidget)
self.treewidget.doubleClicked.connect(self.openProject)
@@ -43,12 +46,16 @@ class ProjectExplorer(QtGui.QWidget):
def addTreeNode(self, parents, children):
os.path.join(parents)
- pathlist= parents.split(os.sep)
- parentnode = QtGui.QTreeWidgetItem(self.treewidget, [pathlist[-1], parents])
+ pathlist = parents.split(os.sep)
+ parentnode = QtGui.QTreeWidgetItem(
+ self.treewidget, [pathlist[-1], parents])
for files in children:
- childnode = QtGui.QTreeWidgetItem(parentnode, [files, os.path.join(parents,files)])
- self.obj_appconfig.proc_dict[self.obj_appconfig.current_project['ProjectName']] = []
- self.obj_appconfig.dock_dict[self.obj_appconfig.current_project['ProjectName']] = []
+ childnode = QtGui.QTreeWidgetItem(
+ parentnode, [files, os.path.join(parents, files)])
+ self.obj_appconfig.proc_dict[self.obj_appconfig.current_project['ProjectName']] = [
+ ]
+ self.obj_appconfig.dock_dict[self.obj_appconfig.current_project['ProjectName']] = [
+ ]
def openMenu(self, position):
@@ -65,7 +72,7 @@ class ProjectExplorer(QtGui.QWidget):
if level == 0:
deleteproject = menu.addAction(self.tr("Remove Project"))
deleteproject.triggered.connect(self.removeProject)
- refreshproject= menu.addAction(self.tr("Refresh"))
+ refreshproject = menu.addAction(self.tr("Refresh"))
refreshproject.triggered.connect(self.refreshProject)
elif level == 1:
openfile = menu.addAction(self.tr("Open"))
@@ -74,26 +81,33 @@ class ProjectExplorer(QtGui.QWidget):
menu.exec_(self.treewidget.viewport().mapToGlobal(position))
def openProject(self):
- self.indexItem =self.treewidget.currentIndex()
- filename= self.indexItem.data()
- self.filePath= self.indexItem.sibling(self.indexItem.row(), 1).data()
- self.obj_appconfig.print_info('The current project is ' + self.filePath)
+ self.indexItem = self.treewidget.currentIndex()
+ filename = str(self.indexItem.data())
+ self.filePath = str(
+ self.indexItem.sibling(
+ self.indexItem.row(),
+ 1).data())
+ self.obj_appconfig.print_info(
+ 'The current project is ' + self.filePath)
self.textwindow = QtGui.QWidget()
self.textwindow.setMinimumSize(600, 500)
- self.textwindow.setGeometry(QtCore.QRect(400,150,400,400))
+ self.textwindow.setGeometry(QtCore.QRect(400, 150, 400, 400))
self.textwindow.setWindowTitle(filename)
self.text = QtGui.QTextEdit()
self.save = QtGui.QPushButton('Save and Exit')
self.save.setDisabled(True)
self.windowgrid = QtGui.QGridLayout()
- if (os.path.isfile(str(self.filePath)))== True:
+ if (os.path.isfile(str(self.filePath))) == True:
self.fopen = open(str(self.filePath), 'r')
lines = self.fopen.read()
self.text.setText(lines)
- QtCore.QObject.connect(self.text,QtCore.SIGNAL("textChanged()"), self.enable_save)
+ QtCore.QObject.connect(
+ self.text,
+ QtCore.SIGNAL("textChanged()"),
+ self.enable_save)
vbox_main = QtGui.QVBoxLayout(self.textwindow)
vbox_main.addWidget(self.text)
@@ -103,24 +117,30 @@ class ProjectExplorer(QtGui.QWidget):
self.textwindow.show()
else:
- self.obj_appconfig.current_project["ProjectName"]= str(self.filePath)
- self.obj_appconfig.proc_dict[self.obj_appconfig.current_project['ProjectName']] = []
+ self.obj_appconfig.current_project["ProjectName"] = str(
+ self.filePath)
+ self.obj_appconfig.proc_dict[self.obj_appconfig.current_project['ProjectName']] = [
+ ]
if self.obj_appconfig.current_project['ProjectName'] not in self.obj_appconfig.dock_dict:
- self.obj_appconfig.dock_dict[self.obj_appconfig.current_project['ProjectName']] = []
+ self.obj_appconfig.dock_dict[self.obj_appconfig.current_project['ProjectName']] = [
+ ]
def enable_save(self):
self.save.setEnabled(True)
def save_data(self):
- self.fopen=open(self.filePath, 'w')
+ self.fopen = open(self.filePath, 'w')
self.fopen.write(self.text.toPlainText())
self.fopen.close()
self.textwindow.close()
def removeProject(self):
- self.indexItem =self.treewidget.currentIndex()
- filename= self.indexItem.data()
- self.filePath= self.indexItem.sibling(self.indexItem.row(), 1).data()
+ self.indexItem = self.treewidget.currentIndex()
+ filename = str(self.indexItem.data())
+ self.filePath = str(
+ self.indexItem.sibling(
+ self.indexItem.row(),
+ 1).data())
self.int = self.indexItem.row()
self.treewidget.takeTopLevelItem(self.int)
@@ -128,20 +148,28 @@ class ProjectExplorer(QtGui.QWidget):
self.obj_appconfig.current_project["ProjectName"] = None
del self.obj_appconfig.project_explorer[str(self.filePath)]
- json.dump(self.obj_appconfig.project_explorer, open(self.obj_appconfig.dictPath,'w'))
+ json.dump(self.obj_appconfig.project_explorer,
+ open(self.obj_appconfig.dictPath, 'w'))
def refreshProject(self):
- self.indexItem =self.treewidget.currentIndex()
- filename= self.indexItem.data()
- self.filePath= str(self.indexItem.sibling(self.indexItem.row(), 1).data())
- filelistnew= os.listdir(os.path.join(self.filePath))
+ self.indexItem = self.treewidget.currentIndex()
+ filename = str(self.indexItem.data())
+ self.filePath = str(
+ self.indexItem.sibling(
+ self.indexItem.row(),
+ 1).data())
+ filelistnew = os.listdir(os.path.join(self.filePath))
parentnode = self.treewidget.currentItem()
count = parentnode.childCount()
for i in range(count):
for items in self.treewidget.selectedItems():
items.removeChild(items.child(0))
for files in filelistnew:
- childnode= QtGui.QTreeWidgetItem(parentnode, [files, os.path.join(self.filePath,files)])
-
- self.obj_appconfig.project_explorer[self.filePath]= filelistnew
- json.dump(self.obj_appconfig.project_explorer, open(self.obj_appconfig.dictPath,'w'))
+ childnode = QtGui.QTreeWidgetItem(
+ parentnode, [
+ files, os.path.join(
+ self.filePath, files)])
+
+ self.obj_appconfig.project_explorer[self.filePath] = filelistnew
+ json.dump(self.obj_appconfig.project_explorer,
+ open(self.obj_appconfig.dictPath, 'w'))
diff --git a/src/frontEnd/Workspace.py b/src/frontEnd/Workspace.py
index 431d49bb..ddad7f5a 100644
--- a/src/frontEnd/Workspace.py
+++ b/src/frontEnd/Workspace.py
@@ -1,20 +1,20 @@
-#===============================================================================
+#=========================================================================
#
# FILE: Workspace.py
-#
-# USAGE: ---
-#
-# DESCRIPTION: This define all configuration used in Application.
-#
+#
+# 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
+# CREATED: Wednesday 05 February 2015
# REVISION: ---
-#===============================================================================
+#=========================================================================
from PyQt4 import QtCore, QtGui
from configuration.Appconfig import Appconfig
import time
@@ -25,46 +25,46 @@ class Workspace(QtGui.QWidget):
"""
This class creates Workspace GUI.
"""
- def __init__(self,parent=None):
+
+ def __init__(self, parent=None):
super(Workspace, self).__init__()
self.obj_appconfig = Appconfig()
-
- #Initializing Workspace directory for project
+
+ # Initializing Workspace directory for project
self.initWorkspace()
-
-
+
def initWorkspace(self):
#print "Calling workspace"
-
+
self.mainwindow = QtGui.QVBoxLayout()
self.split = QtGui.QSplitter()
self.split.setOrientation(QtCore.Qt.Vertical)
-
+
self.grid = QtGui.QGridLayout()
self.note = QtGui.QTextEdit(self)
self.workspace_label = QtGui.QLabel(self)
self.workspace_loc = QtGui.QLineEdit(self)
-
+
self.note.append(self.obj_appconfig.workspace_text)
self.workspace_label.setText("Workspace:")
self.workspace_loc.setText(self.obj_appconfig.home)
-
- #Buttons
+
+ # 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)
- #Layout
- self.grid.addWidget(self.note, 0,0,1,15)
- self.grid.addWidget(self.workspace_label, 2,1)
- self.grid.addWidget(self.workspace_loc,2,2,2,12)
- self.grid.addWidget(self.browsebtn, 2,14)
- self.grid.addWidget(self.okbtn, 4,13)
- self.grid.addWidget(self.cancelbtn, 4,14)
-
- self.setGeometry(QtCore.QRect(500,250,400,400))
+ # Layout
+ self.grid.addWidget(self.note, 0, 0, 1, 15)
+ self.grid.addWidget(self.workspace_label, 2, 1)
+ self.grid.addWidget(self.workspace_loc, 2, 2, 2, 12)
+ self.grid.addWidget(self.browsebtn, 2, 14)
+ self.grid.addWidget(self.okbtn, 4, 13)
+ self.grid.addWidget(self.cancelbtn, 4, 14)
+
+ self.setGeometry(QtCore.QRect(500, 250, 400, 400))
self.setMaximumSize(4000, 200)
self.setWindowTitle("eSim")
self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)
@@ -72,50 +72,46 @@ class Workspace(QtGui.QWidget):
self.setWindowIcon(QtGui.QIcon('../../images/logo.png'))
self.setLayout(self.grid)
self.show()
-
-
+
def defaultWorkspace(self):
- print("Default workspace selected : "+self.obj_appconfig.default_workspace["workspace"])
- self.imp_var=1
- self.obj_appconfig.print_info('Default workspace selected : ' + self.obj_appconfig.default_workspace["workspace"])
+ print("Default workspace selected : " +
+ self.obj_appconfig.default_workspace["workspace"])
+ self.imp_var = 1
+ self.obj_appconfig.print_info(
+ 'Default workspace selected : ' +
+ self.obj_appconfig.default_workspace["workspace"])
self.close()
var_appView.show()
time.sleep(1)
var_appView.splash.close()
-
-
-
def close(self, *args, **kwargs):
- self.window_open_close=1
- self.close_var=1
+ self.window_open_close = 1
+ self.close_var = 1
return QtGui.QWidget.close(self, *args, **kwargs)
-
- def returnWhetherClickedOrNot(self,appView):
+ def returnWhetherClickedOrNot(self, appView):
global var_appView
- var_appView=appView
+ var_appView = appView
-
def createWorkspace(self):
print("Function : Create workspace")
self.create_workspace = str(self.workspace_loc.text())
self.obj_appconfig.print_info('Workspace : ' + self.create_workspace)
- #Checking if Workspace already exist or not
- if os.path.isdir(self.create_workspace):
+ # Checking if Workspace already exist or not
+ if os.path.isdir(self.create_workspace):
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.imp_var=1
- self.close()
+ self.imp_var = 1
+ self.close()
var_appView.show()
time.sleep(1)
var_appView.splash.close()
-
-
+
def browseLocation(self):
print("Function : Browse Location")
- self.workspace_directory = QtGui.QFileDialog.getExistingDirectory(self, "Browse Location",os.path.expanduser("~"))
+ self.workspace_directory = QtGui.QFileDialog.getExistingDirectory(
+ self, "Browse Location", os.path.expanduser("~"))
self.workspace_loc.setText(self.workspace_directory)
- \ No newline at end of file
diff --git a/src/frontEnd/pathmagic.py b/src/frontEnd/pathmagic.py
new file mode 100644
index 00000000..92a5e6e2
--- /dev/null
+++ b/src/frontEnd/pathmagic.py
@@ -0,0 +1,6 @@
+import os
+import sys
+# Setting PYTHONPATH
+cwd = os.getcwd()
+(setPath, fronEnd) = os.path.split(cwd)
+sys.path.append(setPath) \ No newline at end of file