From a31c044d8d8307060664e2b0025054ca0584016d Mon Sep 17 00:00:00 2001
From: fahim
Date: Wed, 13 May 2015 18:02:14 +0530
Subject: Subject: Added python plotting as dock widget

Description: Added python plotting as dock widget
---
 src/configuration/Appconfig.pyc          | Bin 1580 -> 1577 bytes
 src/configuration/__init__.pyc           | Bin 144 -> 143 bytes
 src/frontEnd/Application.py              |   3 +-
 src/frontEnd/DockArea.py                 |  83 ++--
 src/frontEnd/ProjectExplorer.pyc         | Bin 5058 -> 5049 bytes
 src/frontEnd/ViewManagement.pyc          | Bin 2847 -> 2841 bytes
 src/frontEnd/Workspace.pyc               | Bin 3401 -> 3394 bytes
 src/frontEnd/__init__.pyc                | Bin 139 -> 138 bytes
 src/ngspiceSimulation/__init__.py        |   0
 src/ngspiceSimulation/__init__.pyc       | Bin 0 -> 147 bytes
 src/ngspiceSimulation/pythonPlotting.py  | 654 +++++++++++++++++++++++++++++++
 src/ngspiceSimulation/pythonPlotting.pyc | Bin 0 -> 17155 bytes
 src/projManagement/Kicad.pyc             | Bin 4309 -> 4302 bytes
 src/projManagement/Validation.pyc        | Bin 2404 -> 2397 bytes
 src/projManagement/Worker.pyc            | Bin 1507 -> 1501 bytes
 src/projManagement/__init__.pyc          | Bin 145 -> 144 bytes
 src/projManagement/newProject.pyc        | Bin 2983 -> 2978 bytes
 src/projManagement/openProject.pyc       | Bin 2136 -> 2132 bytes
 18 files changed, 701 insertions(+), 39 deletions(-)
 create mode 100644 src/ngspiceSimulation/__init__.py
 create mode 100644 src/ngspiceSimulation/__init__.pyc
 create mode 100644 src/ngspiceSimulation/pythonPlotting.py
 create mode 100644 src/ngspiceSimulation/pythonPlotting.pyc

(limited to 'src')

diff --git a/src/configuration/Appconfig.pyc b/src/configuration/Appconfig.pyc
index 2fd1570b..f6493b0d 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 9ba41f00..abf5ea2d 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 dd2e2264..879c841f 100755
--- a/src/frontEnd/Application.py
+++ b/src/frontEnd/Application.py
@@ -59,6 +59,7 @@ class Application(QtGui.QMainWindow):
                          self.obj_appconfig._app_width,
                          self.obj_appconfig._app_heigth)
         self.setWindowTitle(self.obj_appconfig._APPLICATION) 
+        self.showMaximized()
         self.show()
               
         
@@ -170,7 +171,7 @@ class Application(QtGui.QMainWindow):
     def help_project(self):
         print "Help is called"
         print "Current Project : ",self.obj_appconfig.current_project  
-        self.obj_Mainview.obj_dockarea.createTestEditor()
+        self.obj_Mainview.obj_dockarea.plottingEditor()
     
         
     def testing(self):
diff --git a/src/frontEnd/DockArea.py b/src/frontEnd/DockArea.py
index a34d1cda..e9755302 100644
--- a/src/frontEnd/DockArea.py
+++ b/src/frontEnd/DockArea.py
@@ -1,11 +1,15 @@
 from PyQt4 import QtGui,QtCore
+from ngspiceSimulation.pythonPlotting import plotWindow
 #from configuration.Appconfig import Appconfig
 
-dockList = ['Blank','Notes']
+
+dockList = ['Blank']
+count = 1 
 dock = {}
 
 class DockArea(QtGui.QMainWindow):
     
+    
     def __init__(self):
         QtGui.QMainWindow.__init__(self)
         
@@ -15,59 +19,62 @@ class DockArea(QtGui.QMainWindow):
                         
             self.addDockWidget(QtCore.Qt.TopDockWidgetArea, dock[dockName])  
                     
-        self.tabifyDockWidget(dock['Notes'],dock['Blank'])
+        #self.tabifyDockWidget(dock['Notes'],dock['Blank'])
         self.show()
     
-    def createDockArea(self):
+             
+    def createTestEditor(self):
         """
-        This function creates Dock Area
+        This function create widget for Library Editor
         """
-        self.mainWindow = QtGui.QMainWindow()
+        global count
+                
+        self.testWidget = QtGui.QWidget()
+        self.testArea = QtGui.QTextEdit()
+        self.testLayout = QtGui.QVBoxLayout()
+        self.testLayout.addWidget(self.testArea)
         
-               
-        for dockName in dockList:
-            dock[dockName] = QtGui.QDockWidget(dockName)
-            dock[dockName].setWidget(QtGui.QTextEdit())
-                        
-            self.mainWindow.addDockWidget(QtCore.Qt.TopDockWidgetArea, dock[dockName])  
-            
+        #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['Blank'],dock['Tips-'+str(count)])
         
-       
-        self.mainWindow.tabifyDockWidget(dock['Notes'],dock['Blank'])
-        self.mainWindow.tabifyDockWidget(dock['Blank'],dock['Tips'])
+        dock['Tips-'+str(count)].setVisible(True)
+        dock['Tips-'+str(count)].setFocus()
+        dock['Tips-'+str(count)].raise_()
         
+        count = count + 1
+        
+    def plottingEditor(self):
         """
-        if len(dockList) > 1:
-            for index in range(0, len(dockList) - 1):
-                self.mainWindow.tabifiedDockWidgets(dockList[index]),dockList[index + 1])
+        This function create widget for Library Editor
         """
+        global count
+        self.plottingWidget = QtGui.QWidget()
+        #self.plottingArea = QtGui.QTextEdit()
         
         
-           
-        self.mainWindow.show()
+        self.plottingLayout = QtGui.QVBoxLayout()
+        #self.plottingLayout.addWidget(self.plottingArea)
+        self.plottingLayout.addWidget(plotWindow())
         
+        #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['Blank'],dock['Plotting-'+str(count)])
         
-        return self.mainWindow
-     
+        dock['Plotting-'+str(count)].setVisible(True)
+        dock['Plotting-'+str(count)].setFocus()
+        dock['Plotting-'+str(count)].raise_()
+        
+        count = count + 1
         
-    def createTestEditor(self):
-        """
-        This function create widget for Library Editor
-        """
         
-        self.testWidget = QtGui.QWidget()
-        self.testArea = QtGui.QTextEdit()
-        self.testLayout = QtGui.QVBoxLayout()
-        self.testLayout.addWidget(self.testArea)
-         
-        #Adding to main Layout
-        self.testWidget.setLayout(self.testLayout)
         
-        dock['Tips'] = QtGui.QDockWidget('Tips')
-        dock['Tips'].setWidget(self.testWidget)
-            
-
-        self.tabifyDockWidget(dock['Blank'],dock['Tips'])
                 
         
                      
diff --git a/src/frontEnd/ProjectExplorer.pyc b/src/frontEnd/ProjectExplorer.pyc
index 7906f8b0..4be2d8b1 100644
Binary files a/src/frontEnd/ProjectExplorer.pyc and b/src/frontEnd/ProjectExplorer.pyc differ
diff --git a/src/frontEnd/ViewManagement.pyc b/src/frontEnd/ViewManagement.pyc
index eeef23a3..efc44372 100644
Binary files a/src/frontEnd/ViewManagement.pyc and b/src/frontEnd/ViewManagement.pyc differ
diff --git a/src/frontEnd/Workspace.pyc b/src/frontEnd/Workspace.pyc
index e1072b0e..b5484f93 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
index 5ea864ab..69f75f53 100644
Binary files a/src/frontEnd/__init__.pyc and b/src/frontEnd/__init__.pyc differ
diff --git a/src/ngspiceSimulation/__init__.py b/src/ngspiceSimulation/__init__.py
new file mode 100644
index 00000000..e69de29b
diff --git a/src/ngspiceSimulation/__init__.pyc b/src/ngspiceSimulation/__init__.pyc
new file mode 100644
index 00000000..470f6f23
Binary files /dev/null and b/src/ngspiceSimulation/__init__.pyc differ
diff --git a/src/ngspiceSimulation/pythonPlotting.py b/src/ngspiceSimulation/pythonPlotting.py
new file mode 100644
index 00000000..c7a82851
--- /dev/null
+++ b/src/ngspiceSimulation/pythonPlotting.py
@@ -0,0 +1,654 @@
+from __future__ import division         # Used for decimal division eg 2/3=0.66 and not '0' 6/2=3.0 and 6//2=3
+import sys, os
+from PyQt4 import QtGui, uic, QtCore
+from decimal import *
+import matplotlib
+from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
+from matplotlib.backends.backend_qt4agg import NavigationToolbar2QTAgg as NavigationToolbar
+from matplotlib.figure import Figure
+import tkMessageBox
+
+
+from configuration.Appconfig import Appconfig
+
+class plotWindow(QtGui.QMainWindow):
+    def __init__(self):
+        QtGui.QMainWindow.__init__(self)
+        #Creating App config object
+        #self.obj_appconfig = Appconfig()
+        self.fpath = "/home/fahim/Installed-Software/FreeEDA/Examples/RC"
+        self.projName = "RC"
+        self.createMainFrame()
+        self.combo = []
+        self.combo1 = []
+        self.combo1_rev = []
+        
+    def createMainFrame(self):
+        self.main_frame = QtGui.QWidget()
+        self.dpi = 100
+        self.fig = Figure((7.0, 7.0), dpi=self.dpi)
+        self.canvas = FigureCanvas(self.fig)
+        self.canvas.setParent(self.main_frame)
+        self.axes = self.fig.add_subplot(111)
+        self.mpl_toolbar = NavigationToolbar(self.canvas, self.main_frame)
+    
+        left_vbox = QtGui.QVBoxLayout()
+        left_vbox.addWidget(self.mpl_toolbar)
+        left_vbox.addWidget(self.canvas)
+
+        right_vbox = QtGui.QVBoxLayout()
+        right_grid = QtGui.QGridLayout()
+        top_grid = QtGui.QGridLayout()
+
+        self.fobj = File_data()
+        plot_type = self.fobj.openFile(self.fpath)
+        #print "hi:",plot_type
+        self.fobj.computeAxes()
+        self.chkbox=[]
+        self.a = self.fobj.numVals()
+
+        ########### Generating list of colours :
+        self.full_colors = ['r','b','g','y','c','m','k']#,(0.4,0.5,0.2),(0.1,0.4,0.9),(0.4,0.9,0.2),(0.9,0.4,0.9)]
+        self.color = []
+        for i in range(0,self.a[0]-1):
+            if i%7 == 0:
+                self.color.append(self.full_colors[0])
+            elif (i-1)%7 == 0:
+                self.color.append(self.full_colors[1])
+            elif (i-2)%7 == 0:
+                self.color.append(self.full_colors[2])
+            elif (i-3)%7 == 0:
+                self.color.append(self.full_colors[3])
+            elif (i-4)%7 == 0:
+                self.color.append(self.full_colors[4])
+            elif (i-5)%7 == 0:
+                self.color.append(self.full_colors[5])
+            elif (i-6)%7 == 0:
+                self.color.append(self.full_colors[6])
+
+        ###########
+                
+        self.volts_length = self.a[1]
+        #print "I'm Volts length:",self.volts_length
+        self.heading1 = QtGui.QLabel()
+        top_grid.addWidget(self.heading1,1,0)
+        self.heading2 = QtGui.QLabel()
+        top_grid.addWidget(self.heading2,self.a[1]+2,0)
+        for i in range(0,self.a[1]):#a[0]-1
+            self.chkbox.append(QtGui.QCheckBox(self.fobj.butnames[i]))
+            self.chkbox[i].setToolTip('<b>Tick Me!</b>' )
+            top_grid.addWidget(self.chkbox[i],i+2,0)
+
+        for i in range(self.a[1],self.a[0]-1):#a[0]-1
+            self.chkbox.append(QtGui.QCheckBox(self.fobj.butnames[i]))
+            self.chkbox[i].setToolTip('<b>Tick Me!</b>' )
+            top_grid.addWidget(self.chkbox[i],i+3,0)
+    
+        self.clear = QtGui.QPushButton("Clear")
+        self.Note = QtGui.QLabel()
+        self.Note1 = QtGui.QLabel()
+        self.Note2 = QtGui.QLabel()
+    
+        self.btn = QtGui.QPushButton("Plot")
+        self.btn.setToolTip('<b>Press</b> to Plot' )
+        self.text = QtGui.QLineEdit()
+        self.funcLabel = QtGui.QLabel()
+        self.palette1 = QtGui.QPalette()
+        self.palette2 = QtGui.QPalette()
+        self.btn1 = QtGui.QPushButton("Plot Function")
+        self.btn1.setToolTip('<b>Press</b> to Plot the function' )
+
+        self.palette1.setColor(QtGui.QPalette.Foreground,QtCore.Qt.blue)
+        self.palette2.setColor(QtGui.QPalette.Foreground,QtCore.Qt.red)
+        self.Note1.setPalette(self.palette1)
+        self.Note2.setPalette(self.palette2)
+
+        right_vbox.addLayout(top_grid)
+        right_vbox.addWidget(self.btn)
+    
+        right_grid.addWidget(self.funcLabel,1,0)
+        right_grid.addWidget(self.text,1,1)
+        right_grid.addWidget(self.btn1,2,1)    
+        right_grid.addWidget(self.clear,2,0)
+        right_grid.addWidget(self.Note,3,0)
+        right_grid.addWidget(self.Note1,4,0)
+        right_grid.addWidget(self.Note2,4,1)
+    
+        right_vbox.addLayout(right_grid)
+
+        netlist = QtGui.QTextEdit()
+        with open (self.fpath+"/"+self.projName+'.cir.out') as f2:
+            fdata = f2.read()
+        netlist.setText(fdata)
+        netlist.setReadOnly(True)
+
+    
+        left_vbox.addWidget(netlist)
+        
+        hbox = QtGui.QHBoxLayout()
+        hbox.addLayout(left_vbox)
+        hbox.addLayout(right_vbox)
+
+        widget = QtGui.QWidget()
+        widget.setLayout(hbox)#finalvbox
+        self.scrollArea = QtGui.QScrollArea()
+        self.scrollArea.setWidgetResizable(True)
+        self.scrollArea.setWidget(widget)
+
+        finalhbox = QtGui.QHBoxLayout()
+        finalhbox.addWidget(self.scrollArea)
+        self.main_frame.setLayout(finalhbox)
+
+        self.showMaximized()
+    
+        self.heading1.setText("<font color='indigo'>List of Nodes:</font>")
+
+        self.heading2.setText("<font color='indigo'>List of Branches:</font>")    
+
+        self.funcLabel.setText("<font color='indigo'>Function:</font>")
+    
+        self.Note1.setText("<font color='indigo'>Examples:</font>\
+        <br><br>Addition:<br>Subtraction:<br>Multiplication:<br>Division:<br>Comparison:")
+
+        self.Note2.setText("\n\n"+self.fobj.butnames[0]+" + "+self.fobj.butnames[1]+"\n"+self.fobj.butnames[0]+" - "+self.fobj.butnames[1]+ \
+                           "\n"+self.fobj.butnames[0]+" * "+self.fobj.butnames[1]+"\n"+self.fobj.butnames[0]+" / "+self.fobj.butnames[1]+ \
+                           "\n"+self.fobj.butnames[0]+" vs "+self.fobj.butnames[1])
+    
+
+        self.connect(self.clear,QtCore.SIGNAL('clicked()'),self.pushedClear)
+
+        self.connect(self.btn1,QtCore.SIGNAL('clicked()'), self.pushedPlotFunc)
+
+        if plot_type[0]==0:
+            self.setWindowTitle('AC Analysis')
+            if plot_type[1]==1:
+                self.connect(self.btn,QtCore.SIGNAL('clicked()'), self.onPush_decade)
+            else:
+                self.connect(self.btn,QtCore.SIGNAL('clicked()'), self.onPush_ac)
+
+        elif plot_type[0]==1:
+
+            self.setWindowTitle('Transient Analysis')
+            self.connect(self.btn,QtCore.SIGNAL('clicked()'), self.onPush_trans)
+        else:
+            self.setWindowTitle('DC Analysis')
+            self.connect(self.btn,QtCore.SIGNAL('clicked()'), self.onPush_dc)
+    
+        self.setCentralWidget(self.main_frame)    
+    
+
+    def pushedPlotFunc(self):
+        self.parts = str(self.text.text())
+        self.parts = self.parts.split(" ")
+        #print self.parts
+        if self.parts[len(self.parts)-1] == '':
+            self.parts = self.parts[0:-1]
+        #print self.parts
+        self.values = self.parts
+        self.comboAll = []
+        self.axes.cla()
+        plot_type2 = self.fobj.openFile(self.fpath)
+
+        if len(self.parts) <= 2:
+            self.Note.setText("Too few arguments!\nRefer syntax below!")
+            QtGui.QMessageBox.about(self, "Warning!!", "Too Few Arguments/SYNTAX Error!\n Refer Examples")
+        else:
+            self.Note.setText("")
+
+        a = []
+        finalResult  = []
+        p = 0
+        #print "values:",self.values
+        #print "parts:",self.parts
+
+        for i in range(len(self.parts)):
+            #print "hello"
+            if i%2 == 0:
+                #print "I'm in:"
+                for j in range(len(self.fobj.butnames)):
+                    if self.parts[i]==self.fobj.butnames[j]:
+                        #print "I got you:",i
+                        a.append(j)
+
+        #print "positions",a
+
+        if len(a) != len(self.parts)//2 + 1:
+            QtGui.QMessageBox.about(self, "Warning!!", "One of the operands doesn't belong to the above list!!")        
+
+        for i in a:
+            self.comboAll.append(self.fobj.y[i])
+
+        #print self.comboAll        
+
+        for i in range(len(a)):
+            if a[i] == len(self.fobj.butnames):
+                QtGui.QMessageBox.about(self, "Warning!!", "One of the operands doesn't belong to the above list!!")
+                self.Note.setText("<font color='red'>To Err Is Human!<br>One of the operands doesn't belong to the above list!!</font>")
+
+        if self.parts[1] == 'vs':
+            if len(self.parts) > 3:
+                self.Note.setText("Enter two operands only!!")
+                QtGui.QMessageBox.about(self, "Warning!!", "Recheck the expression syntax!")
+            else:
+                self.axes.cla()
+                #print "plotting wait"
+                for i in range(len(self.fobj.y[a[0]])):
+                    self.combo.append(self.fobj.y[a[0]][i]) 
+                    self.combo1.append(self.fobj.y[a[1]][i])
+            
+                '''for i in reversed(self.combo1):
+                    self.combo1_rev.append(i)'''     
+                #print self.combo
+                #print "\ncombo1_rev\n",self.combo1_rev
+                self.axes.plot(self.combo,self.combo1,c=self.color[1],label=str(2))#_rev
+                if max(a) < self.volts_length:
+                    self.axes.set_ylabel('Voltage(V)-->')
+                    self.axes.set_xlabel('Voltage(V)-->')
+                else:
+                    self.axes.set_ylabel('Current(I)-->')
+                    self.axes.set_ylabel('Current(I)-->')        
+
+
+        elif max(a) >= self.volts_length and min(a) < self.volts_length:
+            QtGui.QMessageBox.about(self, "Warning!!", "Do not combine Voltage and Current!!")
+
+        else:
+
+            for j in range(len(self.comboAll[0])):
+                for i in range(len(self.values)):
+                    if i%2==0:
+                        self.values[i] = str(self.comboAll[i//2][j])
+                        re = " ".join(self.values[:])
+                    #print re
+            try:
+                finalResult.append(eval(re))
+            except ArithmeticError:
+                QtGui.QMessageBox.about(self, "Warning!!", "Dividing by zero!!")
+        ############################################
+            if plot_type2[0]==0:
+                self.setWindowTitle('AC Analysis')
+                if plot_type2[1]==1:
+                    self.axes.semilogx(self.fobj.x,finalResult,c=self.color[0],label=str(1))
+        
+                else:
+    
+                    self.axes.plot(self.fobj.x,finalResult,c=self.color[0],label=str(1))        
+                self.axes.set_xlabel('freq-->')
+                if max(a) < self.volts_length:
+                    self.axes.set_ylabel('Voltage(V)-->')
+                else:
+                    self.axes.set_ylabel('Current(I)-->')        
+
+
+            elif plot_type2[0]==1:
+                self.setWindowTitle('Transient Analysis')
+                self.axes.plot(self.fobj.x,finalResult,c=self.color[0],label=str(1))    
+                self.axes.set_xlabel('time-->')
+                if max(a) < self.volts_length:
+                    self.axes.set_ylabel('Voltage(V)-->')
+                else:
+                    self.axes.set_ylabel('Current(I)-->')        
+    
+
+            else:
+
+                self.setWindowTitle('DC Analysis')
+                self.axes.plot(self.fobj.x,finalResult,c=self.color[0],label=str(1))
+                self.axes.set_xlabel('I/P Voltage-->')
+                if max(a) < self.volts_length:
+                    self.axes.set_ylabel('Voltage(V)-->')
+                else:
+                    self.axes.set_ylabel('Current(I)-->')        
+        
+               
+
+
+        self.axes.grid(True)
+        self.canvas.draw()
+        self.combo = []
+        self.combo1 = []
+        self.combo1_rev = []
+        #print "succes:",self.parts
+
+    def pushedClear(self):
+
+        self.text.clear()
+        self.axes.cla()
+        self.canvas.draw()
+        QtCore.SLOT('quit()')
+
+    def onPush_ac(self):
+        self.axes.cla()
+        boxCheck = 0
+        for i,j in zip(self.chkbox,range(len(self.chkbox))):
+            if i.isChecked():
+                boxCheck += 1
+                self.axes.plot(self.fobj.x,self.fobj.y[j],c=self.color[j],label=str(j+1))
+                self.axes.set_xlabel('freq-->')
+                if j < self.volts_length:
+                    self.axes.set_ylabel('Voltage(V)-->')
+                else:
+                    self.axes.set_ylabel('Current(I)-->')
+                self.axes.grid(True)
+        if boxCheck == 0:
+            QtGui.QMessageBox.about(self, "Warning!!","Please select atleast one Node OR Branch")
+        self.canvas.draw()
+                     
+
+    def onPush_decade(self):
+        boxCheck = 0
+        self.axes.cla()
+
+        for i,j in zip(self.chkbox,range(len(self.chkbox))):
+            if i.isChecked():
+                boxCheck += 1
+                self.axes.semilogx(self.fobj.x,self.fobj.y[j],c=self.color[j],label=str(j+1))
+                if j < self.volts_length:
+                    self.axes.set_ylabel('Voltage(V)-->')
+                else:
+                    self.axes.set_ylabel('Current(I)-->')
+                self.axes.set_xlabel('freq-->')
+                self.axes.grid(True)
+        if boxCheck == 0:
+            QtGui.QMessageBox.about(self, "Warning!!","Please select atleast one Node OR Branch")        
+        self.canvas.draw()
+
+    def onPush_trans(self):
+        boxCheck = 0
+        self.axes.cla()
+        for i,j in zip(self.chkbox,range(len(self.chkbox))):
+            if i.isChecked():
+                boxCheck += 1
+                #print self.fobj.y[j]
+                self.axes.plot(self.fobj.x,self.fobj.y[j],c=self.color[j],label=str(j+1))
+                self.axes.set_xlabel('time-->')
+
+            if j < self.volts_length:
+                self.axes.set_ylabel('Voltage(V)-->')
+
+            else:
+                self.axes.set_ylabel('Current(I)-->')
+            self.axes.grid(True)
+        if boxCheck == 0:
+            QtGui.QMessageBox.about(self,"Warning!!", "Please select atleast one Node OR Branch")
+        self.canvas.draw()
+
+    def onPush_dc(self):
+        boxCheck = 0
+        self.axes.cla()    
+        for i,j in zip(self.chkbox,range(len(self.chkbox))):
+            if i.isChecked():
+                boxCheck += 1
+                self.axes.plot(self.fobj.x,self.fobj.y[j],c=self.color[j],label=str(j+1))
+                self.axes.set_xlabel('Voltage Sweep(V)-->')
+
+            if j < self.volts_length:
+                self.axes.set_ylabel('Voltage(V)-->')
+            else:
+                self.axes.set_ylabel('Current(I)-->')
+            self.axes.grid(True)
+        if boxCheck == 0:
+            QtGui.QMessageBox.about(self,"Warning!!", "Please select atleast one Node OR Branch")
+        self.canvas.draw() 
+        
+class File_data:
+    def __init__(self,parent=None):
+        self.data=[]        #consists of all the columns of data belonging to nodes and branches
+        self.y=[]        #stores y-axis data
+        self.x=[]        #stores x-axis data
+
+    def numberFinder(self,fpath):
+        """
+        New function for finding no of points to be plotted
+        """
+        with open (fpath+"/analysis") as f3:
+            info = f3.read()
+            
+        with open (fpath+"/plot_data_v.txt") as f2:
+            ilines = f2.read()
+            
+        p = l = vnumber = inumber = 0
+        ilines = ilines.split("\n")
+        
+        for i in ilines[3:]:
+            if "V(" in i or "x1" in i or "u3" in i:    #it has possible names of voltage nodes in ngspice
+                vnumber+=1    
+                
+        # for finding no of branches:
+        with open (fpath+"/plot_data_i.txt") as f2:
+            current = f2.read()
+        
+        current = current.split("\n")
+        
+        for i in current[3:]:
+            if "#branch" in i:
+                inumber+=1    
+                #print "current no:",inumber
+    
+        dec = 0 
+        
+        # For AC:
+        if info[0][-3:]==".ac":
+            if "dec" in info:
+                dec = 1
+
+            for i in ilines[3:]:
+                p+=1            #'p' gives no. of lines of data for each node/branch 
+                if "Index" in i:      
+                    l+=1        # 'l' gives the no of partitions for a single voltage node
+                #print "l:",l
+                if "AC" in i:    #DC for dc files and AC for ac ones
+                    break
+            analysis_type = 0
+
+        elif ".tran" in info:
+            analysis_type = 1
+            for i in ilines[3:]:
+                p+=1
+                if "Index" in i:      
+                    l+=1        # 'l' gives the no of partitions for a single voltage node
+                #print "l:",l
+                if "Transient" in i:    #DC for dc files and AC for ac ones
+                    break
+
+
+        # For DC:
+        else:
+            for i in ilines[3:]:
+                p+=1
+                if "Index" in i:      
+                    l+=1        # 'l' gives the no of partitions for a single voltage node
+                #print "l:",l
+                if "DC" in i:    #DC for dc files and AC for ac ones
+                    break
+            analysis_type = 2
+            
+        #if ac!=1:
+        vnumber = vnumber//l        #vnumber gives the no of voltage nodes
+        inumber  = inumber//l        #inumber gives the no of branches
+        #print "i'm p:",p
+        p=[p,vnumber,analysis_type,dec,inumber]
+        #print p
+        return p
+    
+    
+    def openFile(self,fpath):
+        # For Current:
+        try:
+            with open (fpath+"/plot_data_i.txt") as f2:       #Checking whether the files Plot_data_i.txt
+                I = f2.read()                    #  and plot_data_v.txt are present or not
+            I = I.split("\n")
+            self.butnamesi = []
+
+            with open (fpath+"/plot_data_v.txt") as f1:
+                idata = f1.read()
+
+        except:
+            tkMessageBox.showinfo("Warning!!", "Click on KI->Ng button before simulation ")
+            exit(1)
+    
+        try:
+            for l in I[3].split(" "):
+                if len(l)>0:
+                    self.butnamesi.append(l)
+            self.butnamesi=self.butnamesi[2:]
+            len_bnamesi = len(self.butnamesi)
+            #print "length_new",len_bnamesi
+            #print self.butnamesi
+        except:
+            tkMessageBox.showinfo("Warning!!", "Error in Analysis File")    
+            
+   
+        d = self.numberFinder(fpath)
+        d1 = int(d[0] + 1)
+        #print "I'm D1:", d1  #for debugging
+        d2 = int(d[1])
+        d3 = d[2]
+        d4 = d[4]
+        #print "I'm D4:", d4  #for debugging
+        dec = [d3,d[3]]
+        #print "No. of Nodes:", d2
+        self.butnames=[]
+        idata=idata.split("\n")
+        
+        for l in idata[3].split(" "):
+            if len(l)>0:
+                self.butnames.append(l)
+        self.butnames=self.butnames[2:]
+        len_bnames = len(self.butnames)
+        #print len_bnames
+        #print self.butnames
+
+        ivals=[]
+        inum = len(idata[5].split("\t"))
+        inum_i = len(I[5].split("\t"))
+        #print inum
+    
+        full_data = []
+        
+        # Creating list of data:
+        if d3 < 3 :
+            for i in range(1,d2):
+                for l in idata[3+i*d1].split(" "):
+                    if len(l)>0:
+                        self.butnames.append(l)
+                self.butnames.pop(len_bnames)
+                self.butnames.pop(len_bnames)
+                len_bnames = len(self.butnames)
+                #print "volts:",self.butnames
+
+            for n in range(1,d4):
+                for l in I[3+n*d1].split(" "):
+                    if len(l)>0:
+                        self.butnamesi.append(l)
+                #print "names:",self.butnamesi
+                self.butnamesi.pop(len_bnamesi)
+                self.butnamesi.pop(len_bnamesi)
+                len_bnamesi = len(self.butnamesi)
+                #print "current",self.butnamesi
+            
+            p=0
+            k = 0
+            m=0
+
+            for i in I[5:d1-1]:
+                #print "hello:"
+                if len(i.split("\t"))==inum_i:
+                    j2=i.split("\t")
+                    #print j2
+                    j2.pop(0)
+                    j2.pop(0)
+                    j2.pop()
+                    if d3 == 0:       #not in trans
+                        j2.pop()
+                    #print j2
+
+                    for l in range(1,d4):
+                        j3 = I[5+l*d1+k].split("\t")
+                        j3.pop(0)
+                        j3.pop(0)
+                        if d3==0:
+                            j3.pop()     #not required for dc
+                            j3.pop()
+                            j2 = j2 + j3
+                            #print j2
+                    full_data.append(j2)
+                k+=1
+                #print full_data        
+        
+
+            for i in idata[5:d1-1]:
+                if len(i.split("\t"))==inum:
+                    j=i.split("\t")
+                    j.pop()
+                    if d3==0:
+                        j.pop()
+
+                    for l in range(1,d2):
+                        j1 = idata[5+l*d1+p].split("\t")
+                        j1.pop(0)
+                        j1.pop(0)
+                        if d3==0:
+                            j1.pop()     #not required for dc
+                        if self.butnames[len(self.butnames)-1] == 'v-sweep':
+                            self.butnames.pop()
+                            j1.pop()
+                        #if l==d2-1 and d3==2:
+                            #j1.pop()
+                        j1.pop()
+                        j = j + j1 
+                    #self.volts_length = len(j)-2        
+                    j = j + full_data[m]
+                    #print j
+                    m+=1
+                    #print j[:20]            
+                    j = "\t".join(j[1:])
+                    j = j.replace(",","")
+                    ivals.append(j)
+
+                p+=1
+
+            self.data = ivals
+            #print self.data
+
+        #print "volts:",self.butnames
+        self.volts_length = len(self.butnames)
+        #print "volts_length:",self.volts_length
+        self.butnames = self.butnames + self.butnamesi
+        #print "new butnames:",self.butnames 
+    
+        #print self.data    
+        return dec
+
+
+    def numVals(self):
+        a = self.volts_length        # No of voltage nodes
+        b = len(self.data[0].split("\t"))
+        #print "numvals:",b
+        return [b,a]
+    
+    def computeAxes(self):
+        nums = len(self.data[0].split("\t"))
+        #print "i'm nums:",nums
+        self.y=[]
+        var=self.data[0].split("\t")
+        for i in range(1,nums):
+            self.y.append([Decimal(var[i])])
+        #print self.y
+        #print y,nums
+        for i in self.data[1:]:
+            temp=i.split("\t")
+            for j in range(1,nums):
+                self.y[j-1].append(Decimal(temp[j]))
+        #print len(self.y)
+        #print self.y[3]
+
+        for i in self.data:
+            temp=i.split("\t")
+            self.x.append(Decimal(temp[0]))
+"""
+app = QtGui.QApplication(sys.argv)
+main = plotWindow()
+main.show()
+sys.exit(app.exec_())
+"""
\ No newline at end of file
diff --git a/src/ngspiceSimulation/pythonPlotting.pyc b/src/ngspiceSimulation/pythonPlotting.pyc
new file mode 100644
index 00000000..864fa3a6
Binary files /dev/null and b/src/ngspiceSimulation/pythonPlotting.pyc differ
diff --git a/src/projManagement/Kicad.pyc b/src/projManagement/Kicad.pyc
index b1bfec10..78351af9 100644
Binary files a/src/projManagement/Kicad.pyc and b/src/projManagement/Kicad.pyc differ
diff --git a/src/projManagement/Validation.pyc b/src/projManagement/Validation.pyc
index a32213f0..9da8c0fe 100644
Binary files a/src/projManagement/Validation.pyc and b/src/projManagement/Validation.pyc differ
diff --git a/src/projManagement/Worker.pyc b/src/projManagement/Worker.pyc
index af65ebc6..3e44fe79 100644
Binary files a/src/projManagement/Worker.pyc and b/src/projManagement/Worker.pyc differ
diff --git a/src/projManagement/__init__.pyc b/src/projManagement/__init__.pyc
index 62020210..4b011bef 100644
Binary files a/src/projManagement/__init__.pyc and b/src/projManagement/__init__.pyc differ
diff --git a/src/projManagement/newProject.pyc b/src/projManagement/newProject.pyc
index bbb9924c..bc56623a 100644
Binary files a/src/projManagement/newProject.pyc and b/src/projManagement/newProject.pyc differ
diff --git a/src/projManagement/openProject.pyc b/src/projManagement/openProject.pyc
index 395a8437..b65ddb70 100644
Binary files a/src/projManagement/openProject.pyc and b/src/projManagement/openProject.pyc differ
-- 
cgit