diff options
25 files changed, 47 insertions, 310 deletions
diff --git a/src/configuration/Appconfig.pyc b/src/configuration/Appconfig.pyc Binary files differindex 23489e4b..2fd1570b 100644 --- a/src/configuration/Appconfig.pyc +++ b/src/configuration/Appconfig.pyc diff --git a/src/configuration/__init__.pyc b/src/configuration/__init__.pyc Binary files differindex 4997c274..9ba41f00 100644 --- a/src/configuration/__init__.pyc +++ b/src/configuration/__init__.pyc diff --git a/src/frontEnd/Application.py b/src/frontEnd/Application.py index a1560c9b..dd2e2264 100755 --- a/src/frontEnd/Application.py +++ b/src/frontEnd/Application.py @@ -29,9 +29,8 @@ import Workspace import sys import time import subprocess -from frontEnd import ProjectExplorer import DockArea - +from frontEnd import ProjectExplorer class Application(QtGui.QMainWindow): """ @@ -69,6 +68,7 @@ class Application(QtGui.QMainWindow): 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) @@ -129,8 +129,10 @@ class Application(QtGui.QMainWindow): if ok: self.projname = (str(text)) self.project = NewProjectInfo() - self.project.createProject(self.projname) - #self.setCentralWidget(self.obj_Mainview) + directory, filelist =self.project.createProject(self.projname) + + self.obj_Mainview.obj_projectExplorer.addTreeNode(directory, filelist) + #self.setCentralWidget(self.obj_Mainview.obj_projectExplorer) else: print "No project created" @@ -141,8 +143,12 @@ class Application(QtGui.QMainWindow): """ print "Open Project called" self.project = OpenProjectInfo() - self.project.body() - print "init main view in open proj" + + try: + directory, filelist = self.project.body() + self.obj_Mainview.obj_projectExplorer.addTreeNode(directory, filelist) + except: + pass #self.setCentralWidget(self.obj_Mainview) @@ -167,7 +173,6 @@ class Application(QtGui.QMainWindow): self.obj_Mainview.obj_dockarea.createTestEditor() - def testing(self): print "Success hit kicad button" @@ -189,7 +194,7 @@ class MainView(QtGui.QWidget): self.noteArea = QtGui.QTextEdit() self.obj_dockarea = DockArea.DockArea() self.obj_projectExplorer = ProjectExplorer.ProjectExplorer() - self.projectExplorer = self.obj_projectExplorer.maketree() + #Adding content to vertical middle Split. self.middleSplit.setOrientation(QtCore.Qt.Vertical) @@ -201,9 +206,9 @@ class MainView(QtGui.QWidget): self.middleContainer.setLayout(self.middleContainerLayout) #Adding content of left split - self.leftSplit.addWidget(self.projectExplorer) + self.leftSplit.addWidget(self.obj_projectExplorer) self.leftSplit.addWidget(self.middleContainer) - + #Adding to main Layout self.mainLayout.addWidget(self.leftSplit) diff --git a/src/frontEnd/ProjectExplorer.py b/src/frontEnd/ProjectExplorer.py deleted file mode 100644 index 282133cb..00000000 --- a/src/frontEnd/ProjectExplorer.py +++ /dev/null @@ -1,275 +0,0 @@ -from PyQt4 import QtCore, QtGui -from configuration.Appconfig import Appconfig -import os -import json - -class Node(object): - - def __init__(self, name, parent=None): - - self._name = name - self._children = [] - self._parent = parent - - if parent is not None: - parent.addChild(self) - - def typeInfo(self): - return self._typeInfo - - def settypeInfo(self,typeInfo): - self._typeInfo = typeInfo - - def addChild(self, child): - self._children.append(child) - - def name(self): - return self._name - - def setName(self, name): - self._name = name - - def child(self, row): - return self._children[row] - - def childCount(self): - return len(self._children) - - def parent(self): - return self._parent - - def row(self): - if self._parent is not None: - return self._parent._children.index(self) - - -class SceneGraphModel(QtCore.QAbstractItemModel): - - """INPUTS: Node, QObject""" - def __init__(self, root, parent=None): - super(SceneGraphModel, self).__init__(parent) - self._rootNode = root - - """INPUTS: QModelIndex""" - """OUTPUT: int""" - def rowCount(self, parent): - if not parent.isValid(): - parentNode = self._rootNode - else: - parentNode = parent.internalPointer() - - return parentNode.childCount() - - """INPUTS: QModelIndex""" - """OUTPUT: int""" - def columnCount(self, parent): - return 1 - - """INPUTS: QModelIndex, int""" - """OUTPUT: QVariant, strings are cast to QString which is a QVariant""" - def data(self, index, role): - - if not index.isValid(): - return None - - node = index.internalPointer() - - if role == QtCore.Qt.DisplayRole or role == QtCore.Qt.EditRole: - if index.column() == 0: - return node.name() - else: - return node.typeInfo() - - - - """INPUTS: QModelIndex, QVariant, int (flag)""" - def setData(self, index, value, role=QtCore.Qt.EditRole): - - if index.isValid(): - - if role == QtCore.Qt.EditRole: - - node = index.internalPointer() - node.setName(value) - - return True - return False - - - """INPUTS: int, Qt::Orientation, int""" - """OUTPUT: QVariant, strings are cast to QString which is a QVariant""" - def headerData(self, section, orientation, role): - if role == QtCore.Qt.DisplayRole: - if section == 0: - return "Project Explorer" - else: - return "FilePath" - - """INPUTS: QModelIndex""" - """OUTPUT: int (flag)""" - def flags(self, index): - return QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsSelectable - - """INPUTS: QModelIndex""" - """OUTPUT: QModelIndex""" - """Should return the parent of the node with the given QModelIndex""" - def parent(self, index): - - node = self.getNode(index) - parentNode = node.parent() - - if parentNode == self._rootNode: - return QtCore.QModelIndex() - - return self.createIndex(parentNode.row(), 0, parentNode) - - """INPUTS: int, int, QModelIndex""" - """OUTPUT: QModelIndex""" - """Should return a QModelIndex that corresponds to the given row, column and parent node""" - def index(self, row, column, parent): - - parentNode = self.getNode(parent) - - childItem = parentNode.child(row) - - - if childItem: - return self.createIndex(row, column, childItem) - else: - return QtCore.QModelIndex() - - - """CUSTOM""" - """INPUTS: QModelIndex""" - def getNode(self, index): - if index.isValid(): - node = index.internalPointer() - if node: - return node - - return self._rootNode - - - -class ProjectExplorer(QtGui.QWidget): - def __init__(self,parent=None): - QtGui.QWidget.__init__(self) - - returnwidget = self.maketree() - returnwidget.setStyleSheet(""" - .QWidget { - border: 3px solid gray; - border-radius: 40px; - background-color:white; - } - """) - - def maketree(self): - self.obj_appconfig = Appconfig() - self.root = Node("Projects") - currentpath= self.obj_appconfig.current_project["ProjectName"] - if currentpath == None: - pass - else: - self.children =[] - for dirct, subdir, files in os.walk(currentpath): - dirlist = dirct.split(os.sep) - self.parentof = dirlist[-1] - self.obj_appconfig.project_explorer[dirct]= files - json.dump(self.obj_appconfig.project_explorer, open(self.obj_appconfig.dictPath,'w')) - - for item, value in self.obj_appconfig.project_explorer.items(): - os.path.join(item) - pathlist= item.split(os.sep) - parentnode = Node(pathlist[-1], self.root) - parentnode.settypeInfo(item) - for projFiles in value: - childnode = Node(projFiles, parentnode) - childnode.settypeInfo (item+ '/' + projFiles) - - self.model = SceneGraphModel(self.root) - - self.treeView = QtGui.QTreeView() - self.treeView.doubleClicked.connect(self.openProject) - - self.treeView.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) - self.treeView.customContextMenuRequested.connect(self.openMenu) - self.treeView.show() - - self.treeView.setModel(self.model) - self.treeView.setStyleSheet(""" - .QWidget { - border: 3px solid gray; - border-radius: 40px; - background-color:white; - } - """) - return self.treeView - - def openMenu(self, position): - - indexes = self.treeView.selectedIndexes() - if len(indexes) > 0: - - level = 0 - index = indexes[0] - while index.parent().isValid(): - index = index.parent() - level += 1 - - menu = QtGui.QMenu() - if level == 0: - deleteproject = menu.addAction(self.tr("Remove Project")) - deleteproject.triggered.connect(self.removeProject) - elif level == 1: - openfile = menu.addAction(self.tr("Open")) - openfile.triggered.connect(self.openProject) - - menu.exec_(self.treeView.viewport().mapToGlobal(position)) - - def openProject(self): - self.indexItem =self.treeView.currentIndex() - filename= self.indexItem.data().toString() - self.filePath= self.indexItem.sibling(self.indexItem.row(), 1).data().toString() - - self.textwindow = QtGui.QWidget() - self.textwindow.setMinimumSize(600, 500) - self.textwindow.setWindowTitle(filename) - self.text = QtGui.QTextEdit() - #self.text.setMaximumSize(580, 450) - self.save = QtGui.QPushButton('Save and Exit') - self.save.setDisabled(True) - self.windowgrid = QtGui.QGridLayout() - if (os.path.isfile(str(self.filePath)))== True: - self.fopen = open(str(self.filePath), 'r') - lines = self.fopen.readlines() - for line in lines: - self.text.append(line) - - QtCore.QObject.connect(self.text,QtCore.SIGNAL("textChanged()"), self.enable_save) - - vbox_main = QtGui.QVBoxLayout(self.textwindow) - vbox_main.addWidget(self.text) - vbox_main.addWidget(self.save) - self.save.clicked.connect(self.save_data) - #self.connect(exit,QtCore.SIGNAL('close()'), self.onQuit) - - self.textwindow.show() - else: - pass - - def enable_save(self): - self.save.setEnabled(True) - - def save_data(self): - self.fopen=open(self.filePath, 'w') - self.fopen.write(self.text.toPlainText()) - self.fopen.close() - self.textwindow.close() - - def removeProject(self): - self.indexItem =self.treeView.currentIndex() - filename= self.indexItem.data().toString() - self.filePath= self.indexItem.sibling(self.indexItem.row(), 1).data().toString() - del self.obj_appconfig.project_explorer[str(self.filePath)] - json.dump(self.obj_appconfig.project_explorer, open(self.obj_appconfig.dictPath,'w')) diff --git a/src/frontEnd/ProjectExplorer.pyc b/src/frontEnd/ProjectExplorer.pyc Binary files differindex da647370..7906f8b0 100644 --- a/src/frontEnd/ProjectExplorer.pyc +++ b/src/frontEnd/ProjectExplorer.pyc diff --git a/src/frontEnd/ViewManagement.pyc b/src/frontEnd/ViewManagement.pyc Binary files differindex 3a562d99..eeef23a3 100644 --- a/src/frontEnd/ViewManagement.pyc +++ b/src/frontEnd/ViewManagement.pyc diff --git a/src/frontEnd/Workspace.pyc b/src/frontEnd/Workspace.pyc Binary files differindex 935ed8d5..7a5776b8 100644 --- a/src/frontEnd/Workspace.pyc +++ b/src/frontEnd/Workspace.pyc diff --git a/src/frontEnd/__init__.pyc b/src/frontEnd/__init__.pyc Binary files differindex 107c0b45..5ea864ab 100644 --- a/src/frontEnd/__init__.pyc +++ b/src/frontEnd/__init__.pyc diff --git a/src/kicadtoNgspice/Analysis.py b/src/kicadtoNgspice/Analysis.py index d2870532..ac633b82 100644 --- a/src/kicadtoNgspice/Analysis.py +++ b/src/kicadtoNgspice/Analysis.py @@ -137,9 +137,10 @@ class Analysis(QtGui.QWidget): self.start_fre_combo.addItem("THz") self.start_fre_combo.setMaximumWidth(150) self.acgrid.addWidget(self.start_fre_combo,2,2) - self.ac_parameter[self.parameter_cnt]= self.start_fre_combo.currentText() + self.ac_parameter[0]= "Hz" self.start_fre_combo.activated[str].connect(self.start_combovalue) + self.parameter_cnt=self.parameter_cnt + 1 self.stop_fre_combo = QtGui.QComboBox() self.stop_fre_combo.addItem("Hz") @@ -149,9 +150,10 @@ class Analysis(QtGui.QWidget): self.stop_fre_combo.addItem("THz") self.stop_fre_combo.setMaximumWidth(150) self.acgrid.addWidget(self.stop_fre_combo,3,2) - self.ac_parameter[self.parameter_cnt]= self.stop_fre_combo.currentText() + self.ac_parameter[1]= "Hz" self.stop_fre_combo.activated[str].connect(self.stop_combovalue) - + + self.track_obj.AC_entry_var["ITEMS"]=self.ac_entry_var self.track_obj.AC_Parameter["ITEMS"]=self.ac_parameter @@ -163,10 +165,10 @@ class Analysis(QtGui.QWidget): return self.acbox def start_combovalue(self, text): - self.ac_parameter[self.parameter_cnt]= str(text) + self.ac_parameter[0]= str(text) def stop_combovalue(self, text): - self.ac_parameter[self.parameter_cnt+1]= str(text) + self.ac_parameter[1]= str(text) def set_ac_type(self): self.parameter_cnt=0 @@ -178,7 +180,6 @@ class Analysis(QtGui.QWidget): self.track_obj.AC_type["ITEMS"]="oct" else: pass - print "AC type is ", self.Lin.isChecked def createDCgroup(self): self.dcbox = QtGui.QGroupBox() @@ -229,10 +230,10 @@ class Analysis(QtGui.QWidget): self.start_combo.addItem("nV or nA") self.start_combo.addItem("pV or pA") self.dcgrid.addWidget(self.start_combo,2,2) - self.dc_parameter[self.parameter_cnt]= self.start_combo.currentText() + self.dc_parameter[self.parameter_cnt]= "volts or Amperes" self.start_combo.activated[str].connect(self.start_changecombo) self.parameter_cnt= self.parameter_cnt+1 - + self.increment_combo=QtGui.QComboBox(self) self.increment_combo.setMaximumWidth(150) self.increment_combo.addItem("volts or Amperes") @@ -241,7 +242,7 @@ class Analysis(QtGui.QWidget): self.increment_combo.addItem("nV or nA") self.increment_combo.addItem("pV or pA") self.dcgrid.addWidget(self.increment_combo,3,2) - self.dc_parameter[self.parameter_cnt]= str(self.increment_combo.currentText()) + self.dc_parameter[self.parameter_cnt]= "volts or Amperes" self.increment_combo.activated[str].connect(self.increment_changecombo) self.parameter_cnt= self.parameter_cnt+1 @@ -254,7 +255,7 @@ class Analysis(QtGui.QWidget): self.stop_combo.addItem("pV or pA") self.dcgrid.addWidget(self.stop_combo,4,2) self.stop_combo.activated[str].connect(self.stop_changecombo) - self.dc_parameter[self.parameter_cnt]= str(self.stop_combo.currentText()) + self.dc_parameter[self.parameter_cnt]= "volts or Amperes" self.parameter_cnt= self.parameter_cnt+1 self.check=QtGui.QCheckBox('Operating Point Analysis',self) @@ -277,14 +278,13 @@ class Analysis(QtGui.QWidget): return self.dcbox def start_changecombo(self,text): - self.parameter_cnt=0 - self.dc_parameter[self.parameter_cnt]=text + self.dc_parameter[0]=str(text) def increment_changecombo(self,text): - self.dc_parameter[self.parameter_cnt+1]=text + self.dc_parameter[1]=str(text) def stop_changecombo(self,text): - self.dc_parameter[self.parameter_cnt+2]=text + self.dc_parameter[2]=str(text) def createTRANgroup(self): self.trbox = QtGui.QGroupBox() @@ -323,7 +323,7 @@ class Analysis(QtGui.QWidget): self.start_combobox.addItem("ns") self.start_combobox.addItem("ps") self.trgrid.addWidget(self.start_combobox,1,3) - self.tran_parameter[self.parameter_cnt]=self.start_combobox.currentText() + self.tran_parameter[self.parameter_cnt]= "Sec" self.start_combobox.activated[str].connect(self.start_combo_change) self.parameter_cnt= self.parameter_cnt+1 @@ -334,7 +334,7 @@ class Analysis(QtGui.QWidget): self.step_combobox.addItem("ns") self.step_combobox.addItem("ps") self.trgrid.addWidget(self.step_combobox,2,3) - self.tran_parameter[self.parameter_cnt]=self.step_combobox.currentText() + self.tran_parameter[self.parameter_cnt]= "Sec" self.step_combobox.activated[str].connect(self.step_combo_change) self.parameter_cnt= self.parameter_cnt+1 @@ -345,7 +345,7 @@ class Analysis(QtGui.QWidget): self.stop_combobox.addItem("ns") self.stop_combobox.addItem("ps") self.trgrid.addWidget(self.stop_combobox,3,3) - self.tran_parameter[self.parameter_cnt]=self.stop_combobox.currentText() + self.tran_parameter[self.parameter_cnt]= "Sec" self.stop_combobox.activated[str].connect(self.stop_combo_change) self.parameter_cnt= self.parameter_cnt+1 @@ -362,11 +362,10 @@ class Analysis(QtGui.QWidget): return self.trbox def start_combo_change(self,text): - self.parameter_cnt=0 - self.tran_parameter[self.parameter_cnt]=text + self.tran_parameter[0]=str(text) def step_combo_change(self,text): - self.tran_parameter[self.parameter_cnt+1]=text + self.tran_parameter[1]=str(text) def stop_combo_change(self,text): - self.tran_parameter[self.parameter_cnt+2]=text + self.tran_parameter[3]=str(text) diff --git a/src/kicadtoNgspice/Analysis.pyc b/src/kicadtoNgspice/Analysis.pyc Binary files differindex 0c64313d..31c7d222 100644 --- a/src/kicadtoNgspice/Analysis.pyc +++ b/src/kicadtoNgspice/Analysis.pyc diff --git a/src/kicadtoNgspice/Convert.py b/src/kicadtoNgspice/Convert.py index 20597651..d0420859 100644 --- a/src/kicadtoNgspice/Convert.py +++ b/src/kicadtoNgspice/Convert.py @@ -136,7 +136,6 @@ class Convert: (filepath, filemname)= os.path.split(self.direct) self.Fileopen = os.path.join(filepath, "analysis") self.writefile= open(self.Fileopen,"w") - if self.variable== 'AC': self.no=0 self.writefile.write(".ac"+' ' + self.ac_type + ' '+ str(self.defaultvalue(self.ac_entry_var[self.no+2].text()))+' ' + str(self.defaultvalue(self.ac_entry_var[self.no].text())) + self.ac_parameter[self.no]+ ' ' + str(self.defaultvalue(self.ac_entry_var[self.no+1].text())) + self.ac_parameter[self.no+1] ) diff --git a/src/kicadtoNgspice/Convert.pyc b/src/kicadtoNgspice/Convert.pyc Binary files differindex 59484751..bb1cffde 100644 --- a/src/kicadtoNgspice/Convert.pyc +++ b/src/kicadtoNgspice/Convert.pyc diff --git a/src/kicadtoNgspice/DeviceModel.pyc b/src/kicadtoNgspice/DeviceModel.pyc Binary files differindex becbe198..94e4054e 100644 --- a/src/kicadtoNgspice/DeviceModel.pyc +++ b/src/kicadtoNgspice/DeviceModel.pyc diff --git a/src/kicadtoNgspice/Model.pyc b/src/kicadtoNgspice/Model.pyc Binary files differindex dc8b5d45..4ed30220 100644 --- a/src/kicadtoNgspice/Model.pyc +++ b/src/kicadtoNgspice/Model.pyc diff --git a/src/kicadtoNgspice/Processing.pyc b/src/kicadtoNgspice/Processing.pyc Binary files differindex 14b281a3..1542143d 100644 --- a/src/kicadtoNgspice/Processing.pyc +++ b/src/kicadtoNgspice/Processing.pyc diff --git a/src/kicadtoNgspice/Source.pyc b/src/kicadtoNgspice/Source.pyc Binary files differindex a2f61eca..a3eb39eb 100644 --- a/src/kicadtoNgspice/Source.pyc +++ b/src/kicadtoNgspice/Source.pyc diff --git a/src/kicadtoNgspice/TrackWidget.pyc b/src/kicadtoNgspice/TrackWidget.pyc Binary files differindex b583491c..e23bacc4 100644 --- a/src/kicadtoNgspice/TrackWidget.pyc +++ b/src/kicadtoNgspice/TrackWidget.pyc diff --git a/src/projManagement/Kicad.pyc b/src/projManagement/Kicad.pyc Binary files differindex 3cb015de..b1bfec10 100644 --- a/src/projManagement/Kicad.pyc +++ b/src/projManagement/Kicad.pyc diff --git a/src/projManagement/Validation.pyc b/src/projManagement/Validation.pyc Binary files differindex a1bbf393..a32213f0 100644 --- a/src/projManagement/Validation.pyc +++ b/src/projManagement/Validation.pyc diff --git a/src/projManagement/Worker.pyc b/src/projManagement/Worker.pyc Binary files differindex 4f8652b7..af65ebc6 100644 --- a/src/projManagement/Worker.pyc +++ b/src/projManagement/Worker.pyc diff --git a/src/projManagement/__init__.pyc b/src/projManagement/__init__.pyc Binary files differindex 2f39d337..62020210 100644 --- a/src/projManagement/__init__.pyc +++ b/src/projManagement/__init__.pyc diff --git a/src/projManagement/newProject.py b/src/projManagement/newProject.py index 77c583d3..22f2c60c 100644 --- a/src/projManagement/newProject.py +++ b/src/projManagement/newProject.py @@ -77,7 +77,7 @@ class NewProjectInfo(QtGui.QWidget): self.obj_appconfig.project_explorer[self.projDir] = newprojlist json.dump(self.obj_appconfig.project_explorer, open(self.obj_appconfig.dictPath,'w')) - + return self.projDir, newprojlist elif self.reply == "CHECKEXIST": #print "Project already exist" diff --git a/src/projManagement/newProject.pyc b/src/projManagement/newProject.pyc Binary files differindex 2672dd49..bbb9924c 100644 --- a/src/projManagement/newProject.pyc +++ b/src/projManagement/newProject.pyc diff --git a/src/projManagement/openProject.py b/src/projManagement/openProject.py index 4112810c..83fc1a41 100644 --- a/src/projManagement/openProject.py +++ b/src/projManagement/openProject.py @@ -20,7 +20,8 @@ from PyQt4 import QtGui from Validation import Validation from configuration.Appconfig import Appconfig - +import os +import json class OpenProjectInfo(QtGui.QWidget): @@ -40,7 +41,15 @@ class OpenProjectInfo(QtGui.QWidget): #print "Pass open project test" self.obj_Appconfig = Appconfig() self.obj_Appconfig.current_project['ProjectName'] = str(self.projDir) - + if os.path.isdir(self.projDir): + print "true" + + for dirs, subdirs, filelist in os.walk(self.obj_Appconfig.current_project["ProjectName"]): + directory = dirs + files = filelist + self.obj_Appconfig.project_explorer[dirs] = filelist + json.dump(self.obj_Appconfig.project_explorer, open(self.obj_Appconfig.dictPath,'w')) + return dirs, filelist else: #print "Failed open project test" diff --git a/src/projManagement/openProject.pyc b/src/projManagement/openProject.pyc Binary files differindex 49ac9b28..395a8437 100644 --- a/src/projManagement/openProject.pyc +++ b/src/projManagement/openProject.pyc |