summaryrefslogtreecommitdiff
path: root/OSCAD/forntEnd
diff options
context:
space:
mode:
Diffstat (limited to 'OSCAD/forntEnd')
-rwxr-xr-xOSCAD/forntEnd/my_oscad.py301
-rwxr-xr-xOSCAD/forntEnd/newProject.py362
-rwxr-xr-xOSCAD/forntEnd/openProject.py57
-rwxr-xr-xOSCAD/forntEnd/oscad.py184
-rwxr-xr-xOSCAD/forntEnd/pythonPlotting.py696
-rwxr-xr-xOSCAD/forntEnd/selectOption.py55
-rwxr-xr-xOSCAD/forntEnd/setPath.py2
-rwxr-xr-xOSCAD/forntEnd/template.py117
-rwxr-xr-xOSCAD/forntEnd/test.py35
-rwxr-xr-xOSCAD/forntEnd/toolTip.py48
10 files changed, 0 insertions, 1857 deletions
diff --git a/OSCAD/forntEnd/my_oscad.py b/OSCAD/forntEnd/my_oscad.py
deleted file mode 100755
index b83dd41..0000000
--- a/OSCAD/forntEnd/my_oscad.py
+++ /dev/null
@@ -1,301 +0,0 @@
-from setPath import OSCAD_HOME
-from Tkinter import *
-import thread
-import ttk
-import template
-import tkMessageBox
-import os.path
-import os
-import toolTip
-import selectOption
-from string import maketrans
-from PIL import Image, ImageTk
-import tkFileDialog
-import os
-import Image
-import ImageTk
-
-def new_Project(e=None):
- text.insert(END,"Select the directory to save the project\n")
- directory=tkFileDialog.askdirectory()
- if directory:
- try:
- os.chdir(directory)
- text.insert(END, "Changing directory to "+directory+"\n\n")
- text.yview(END)
- except OSError, msg:
- tkMessageBox.showerror("Change Directory Failed",msg)
- else:
- tkMessageBox.showwarning("Bad input","Directory is not specified, please try again")
- text.insert(END, "In Main window:\n")
- text.insert(END, "Please select the proper option from File Menu\n")
- text.yview(END)
- text.insert(END, "Please enter a project Name\n")
- text.yview(END)
-# Read project information (name)
- project= newProject.ProjectInfo(root,text)
-# Create project files
- if project.status:
- projectParam = newProject.ProjectParam(root,text,project.projectName)
-
-# Open an existing model
-def open_Project(e=None):
-# Read project information (name)
- text.insert(END, "Please enter the project Name\n")
- text.yview(END)
- project= openProject.ProjectInfo(root,text)
-# Open model file
- if project.status:
- projectParam = newProject.ProjectParam(root,text,project.projectName)
- text.insert(END, "In Main window:\n")
- text.insert(END, "Please select the proper option from File Menu\n")
-
-# Change the current directory to new directory
-def changeDirectory(event=None):
- folderName=tkFileDialog.askdirectory()
- if folderName:
- try:
- os.chdir(folderName)
- text.insert(END, "Changing directory to "+folderName+"\n\n")
- text.yview(END)
- open_Project()
- except OSError, msg:
- tkMessageBox.showerror("Change Directory Failed",msg)
- else:
- tkMessageBox.showwarning("Bad input","Directory is not specified, please try again")
- text.insert(END, "In Main window:\n")
- text.insert(END, "Please select the proper option from File Menu\n")
- text.yview(END)
-
-def exit_Project(e=None):
- if tkMessageBox.askokcancel("QUIT","Do you really wish to quit?"):
- text.insert(END, "Bye Bye......\n")
- root.destroy()
-
-# Display help content
-def help_Project(e=None):
- pass
-
-# Display help content
-def about_Project():
- tkMessageBox.showinfo("About Editor","Created by Yogesh Dilip Save")
-
-def createButtonForCommand(frameName,commandName,imagePath,textlabel):
- # Open images
- im = Image.open(imagePath)
- photo = ImageTk.PhotoImage(im)
-
- # Create button and set label for tools
- w = Button(frameName, image=photo, width=20, height=14, command=commandName, default=ACTIVE)
- w.image=photo
- w.pack(side=TOP, padx=1, pady=1)
- toolTip.createToolTip(w,textlabel)
-
-def call_system(command):
- os.system(command)
-
-def openSchematic(e=None):
- text.insert(END, " Opening schematic editor .........\n")
- text.yview(END)
- # Call all pending idle tasks, without processing any other events.
- #update_idletasks()
- command="eeschema "+self.projectName+".sch "
- try:
- thread.start_new_thread(self.call_system,(command,))
- except Exception,err:
- print err
- text.insert(END, "Select a tool from tool menu\n")
- text.yview(END)
-
-def openFootprint(e=None):
- text.insert(END, " Opening footprint editor .........\n")
- text.yview(END)
- # Call all pending idle tasks, without processing any other events.
- update_idletasks()
- command="cvpcb "+self.projectName+".net "
- try:
- thread.start_new_thread(self.call_system,(command,))
- except Exception,err:
- print err
- text.insert(END, "Select a tool from tool menu\n")
- text.yview(END)
-
-def openLayout(e=None):
- text.insert(END, " Opening layout editor .........\n")
- text.yview(END)
- # Call all pending idle tasks, without processing any other events.
- update_idletasks()
- command="pcbnew "+self.projectName+".net "
- try:
- thread.start_new_thread(self.call_system,(command,))
- except Exception,err:
- print err
- text.insert(END, "Select a tool from tool menu\n")
- text.yview(END)
-
-def openNetConverter(e=None):
- text.insert(END, " Running netlist converter .........\n")
- text.yview(END)
- # Call all pending idle tasks, without processing any other events.
- update_idletasks()
- command="xterm -e \""+self.OSCAD_HOME+"/kicadtoNgspice/KicadtoNgspice.py "+self.projectName+".cir 1\""
- try:
- thread.start_new_thread(self.call_system,(command,))
- except Exception,err:
- print err
- text.insert(END, "Select a tool from tool menu\n")
- text.yview(END)
-
-def openAnalysisInserter(e=None):
- text.insert(END, " Opening analysis inserter .........\n")
- text.yview(END)
- # Call all pending idle tasks, without processing any other events.
- update_idletasks()
- command=self.OSCAD_HOME+"/analysisInserter/convertgui.py"
- try:
- thread.start_new_thread(self.call_system,(command,))
- except Exception,err:
- print err
- text.insert(END, "Select a tool from tool menu\n")
- text.yview(END)
-
-def openModelBuilder(e=None):
- text.insert(END, " Opening model editor .........\n")
- text.yview(END)
- # Call all pending idle tasks, without processing any other events.
- update_idletasks()
- command=self.OSCAD_HOME+"/modelEditor/modelEditor.py " +self.projectName+".cir "
- try:
- thread.start_new_thread(self.call_system,(command,))
- except Exception,err:
- print err
- text.insert(END, "Select a tool from tool menu\n")
- text.yview(END)
-
-def openSubcircuitBuilder(e=None):
- text.insert(END, " Opening Sub-circuit editor ................\n")
- text.yview(END)
- # Call all pending idle tasks, without processing any other events.
- update_idletasks()
- command=self.OSCAD_HOME+"/subcktEditor/subcktEditor.py " +self.projectName+".cir "
- try:
- thread.start_new_thread(self.call_system,(command,))
- except Exception,err:
- print err
- text.insert(END, "Select a tool from tool menu\n")
- text.yview(END)
-
-def openNgspice(e=None):
- text.insert(END, " Running ngspice circuit simulator .........\n")
- text.yview(END)
- # Call all pending idle tasks, without processing any other events.
- update_idletasks()
- command="xterm -e \"ngspice "+self.projectName+".cir.out \""
- try:
- thread.start_new_thread(self.call_system,(command,))
- except Exception,err:
- print err
- text.insert(END, "Select a tool from tool menu\n")
- text.yview(END)
-
-def openSMCSim(e=None):
- text.insert(END, " Running scilab based circuit simulator .........\n")
- text.yview(END)
- # Call all pending idle tasks, without processing any other events.
- update_idletasks()
- Option=selectOption.SelectOption(self,self.text,"LPCSim")
- command=self.OSCAD_HOME+"/bin/scilab54 -f " +self.OSCAD_HOME+"/LPCSim/LPCSim/Main.sci -args "+self.projectName+".cir.ckt "
- try:
- thread.start_new_thread(self.call_system,(command,))
- except Exception,err:
- print err
- text.insert(END, "Select a tool from tool menu\n")
- text.yview(END)
-
-
-# Create and configure a graphical window
-root = Tk()
-root.title("OSCAD for Electronics and Electrical Engineers")
-
-# make it cover the entire screen
-w, h = root.winfo_screenwidth(), root.winfo_screenheight()
-root.geometry("%dx%d" % (0.65*w, 0.65*h))
-root.focus_set()
-
-# Create and configure a menu
-menu = Menu(root)
-root.config(menu=menu)
-
-# Create File menu
-filemenu= Menu(menu)
-menu.add_cascade(label="File", menu=filemenu)
-filemenu.add_command(label="New F2", command=new_Project)
-filemenu.add_command(label="Open F3", command=changeDirectory)
-filemenu.add_separator()
-filemenu.add_command(label="Exit F4", command=exit_Project)
-
-# Create help menu
-helpmenu=Menu(menu)
-menu.add_cascade(label="Help", menu=helpmenu)
-helpmenu.add_command(label="Help F1",command=help_Project)
-helpmenu.add_command(label="About...",command=about_Project)
-
-# Protocol for deletion of main window
-root.protocol("WM_DELETE_WINDOW",exit_Project)
-
-# Create shortcut keys
-root.bind("<F2>", new_Project)
-root.bind("<F3>", open_Project)
-root.bind("<F4>", exit_Project)
-root.bind("<F1>", help_Project)
-root.bind("<F5>", changeDirectory)
-
-mainWindow = LabelFrame(root, bd=4, relief=SUNKEN,text="Main Window", bg='lightblue')
-mainWindow.pack(side=TOP,fill="both", padx=5, pady=5,expand="Y")
-mainWindow.place(relheight=0.85, relwidth=0.99, rely=0.0)
-
-c = Canvas(mainWindow, bg='white',width=745, height=320)
-c.pack()
-im = Image.open(OSCAD_HOME+"/images/OSCADlogo.jpeg")
-tkim = ImageTk.PhotoImage(im)
-c.create_image(375, 150, image=tkim)
-
-buttonWindow = Frame(root, bd=4, relief=SUNKEN)
-buttonWindow.pack(side=RIGHT,fill="both", padx=2, pady=2,expand="Y")
-buttonWindow.place(relheight=0.6, relwidth=0.06, rely=0.04, relx=0.01)
-
-createButtonForCommand(buttonWindow,openSchematic,OSCAD_HOME+"/images/seLogo.jpg","Schematic Editor")
-createButtonForCommand(buttonWindow,openFootprint,OSCAD_HOME+"/images/feLogo.jpg","Footprint Editor")
-createButtonForCommand(buttonWindow,openLayout,OSCAD_HOME+"/images/leLogo.jpg","Layout Editor")
-createButtonForCommand(buttonWindow,openAnalysisInserter,OSCAD_HOME+"/images/anLogo.jpg","Analysis Insertor")
-createButtonForCommand(buttonWindow,openModelBuilder,OSCAD_HOME+"/images/mbLogo.jpg","Model builder")
-createButtonForCommand(buttonWindow,openSubcircuitBuilder,OSCAD_HOME+"/images/sbLogo.jpg","Subcircuit builder")
-createButtonForCommand(buttonWindow,openNetConverter,OSCAD_HOME+"/images/knLogo.jpg","NetList Converter")
-createButtonForCommand(buttonWindow,openNgspice,OSCAD_HOME+"/images/ngLogo.jpg","Ngspice")
-createButtonForCommand(buttonWindow,openSMCSim,OSCAD_HOME+"/images/slLogo.jpg","SMCSim")
-
-reportWindow = LabelFrame(root, bd=4, relief=SUNKEN,text="Report Window")
-reportWindow.pack(side=BOTTOM,fill="both", padx=5, pady=5,expand="Y")
-reportWindow.place(relheight=0.35, relwidth=0.99, rely=0.65)
-
-text = Text(reportWindow)
-text.insert(INSERT, "Welcome.....\n")
-text.insert(END, "First select project working directory using File Menu\n")
-text.insert(END, "Then select the proper option in File Menu\n")
-text.focus_set()
-text.pack()
-text.place(relheight=0.98, relwidth=0.99, rely=0.02)
-text.config(borderwidth=5)
-
-scrollY = Scrollbar(reportWindow,orient=VERTICAL,command=text.yview)
-scrollY.pack(fill=Y)
-scrollY.place(relheight=0.98,relwidth=0.01, rely=0.02, relx=0.99)
-text.config(yscrollcommand=scrollY.set)
-scrollY.set(0,0.5)
-
-
-def execute(event):
- print "yogesh"
-
-text.bind("<Return>",execute)
-mainloop()
diff --git a/OSCAD/forntEnd/newProject.py b/OSCAD/forntEnd/newProject.py
deleted file mode 100755
index f4987f1..0000000
--- a/OSCAD/forntEnd/newProject.py
+++ /dev/null
@@ -1,362 +0,0 @@
-#!/usr/bin/python
-# newProject.py is a python script to create a new project. It is developed for OSCAD software. It is written by Yogesh Dilip Save (yogessave@gmail.com).
-# Copyright (C) 2012 Yogesh Dilip Save, FOSS Project, IIT Bombay.
-# This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
-# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-# You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-
-from setPath import OSCAD_HOME
-from Tkinter import *
-import thread
-import ttk
-import sys
-import subprocess, time
-import template
-import tkMessageBox
-import os.path
-import os
-import toolTip
-import selectOption
-from string import maketrans
-from PIL import Image, ImageTk
-
-class ProjectInfo(template.MyTemplate):
- """ Class for accept model information from user """
- def body(self, master):
- # Ask for project name
- try:
- Label(master, text="Enter Project name:").grid(row=0)
- self.e1 = Entry(master)
- self.e1.grid(row=0, column=1,pady=10,columnspan=2)
- except:
- print "error"
-# Collect project information
- def apply(self):
- """ a method for writing project information to the file"""
- self.text.insert(END, "Creating new project " + self.projectName+" ...... \n")
- self.text.yview(END)
- # Cerate directory for the project
- try:
- os.mkdir(self.projectName)
- except:
- tkMessageBox.showwarning("Error","Directory already exists")
- self.text.insert(END, " The project directory "+self.projectName+"has been created.\n")
- self.text.yview(END)
- os.chdir(self.projectName)
- self.text.insert(END, " Entered into the project directory "+self.projectName+"\n")
- self.text.yview(END)
- # Create model file for writing
- try:
- f = open(self.projectName+".proj","w")
- except :
- tkMessageBox.showwarning("Error","Project information file can not be wriiten. please check the file system permission")
- return 0
- f.write("schematicFile " + self.projectName+".sch\n")
- f.close()
- self.text.insert(END, "Successfully Created new project " + self.projectName+". \n")
- self.text.yview(END)
- return 1
-
-# Validate the model information
- def validate(self):
- # Remove trailing and leading spaces from modelName
- self.projectName=self.e1.get().strip()
- if len(self.projectName):
- if os.path.exists(self.projectName+".proj"):
- tkMessageBox.showwarning("Bad input","Project already exists, please try again")
- return 0
- return 1
- else:
- tkMessageBox.showwarning("Bad input","Project Name is not specified, please try again")
- return 0
-
-class ProjectParam(template.MyTemplate):
- """Class for specifying parameter of the model"""
- def __init__(self,parent,text,name):
- # Collect model information
- self.projectName=name
- try:
- self.OSCAD_HOME=OSCAD_HOME
- except NameError:
- try:
- self.OSCAD_HOME=os.environ["OSCAD_HOME"]
- except KeyError:
- tkMessageBox.showerror("Error OSCAD_HOME is not set","Please set OSCAD_HOME variable in .bashrc\n\nStep to set OSCAD_HOME variable:\n 1) Open ~/.bashrc using text editor (vi ~/.bash).\n 2) Add the line \"Export OSCAD_HOME=<path_of_oscad>\" to it.\n 3) source ~/.bashrc")
- exit(0)
-
- # Call base class MyTemplate
- template.MyTemplate.__init__(self,parent,text,name, buttonbox=False)
-
- def body(self, master):
- w, h = master.winfo_screenwidth(), master.winfo_screenheight()
- self.geometry("%dx%d" % (0.075*w, 0.6*h))
- self.resizable(0,0)
- self.attributes("-topmost",True)
-
- # Create and configure a menu
- """menu = Menu(self)
- self.config(menu=menu)
-
- # Create File menu
- toolmenu= Menu(menu)
- menu.add_cascade(label="Tool", menu=toolmenu)
- toolmenu.add_command(label="Schematic Editor F2", command=self.openSchematic)
- toolmenu.add_separator()
- toolmenu.add_command(label="Footprint Editor F3", command=self.openFootprint)
- toolmenu.add_command(label="Layout Editor F4", command=self.openLayout)
- toolmenu.add_separator()
- toolmenu.add_command(label="Analysis Insertor F5", command=self.openAnalysisInserter)
- toolmenu.add_command(label="Model builder F6", command=self.openModelBuilder)
- toolmenu.add_command(label="Subcircuit builder F7", command=self.openSubcircuitBuilder)
- toolmenu.add_separator()
- toolmenu.add_command(label="NetList Converter F8", command=self.openNetConverter)
- toolmenu.add_separator()
- toolmenu.add_command(label="Ngspice F9", command=self.openNgspice)
- toolmenu.add_command(label="SMCSim F10", command=self.openSMCSim)
- toolmenu.add_separator()
- toolmenu.add_command(label="Exit F11", command=self.exitProject)
-
- # Create help menu
- helpmenu=Menu(menu)
- menu.add_cascade(label="Help", menu=helpmenu)
- helpmenu.add_command(label="Help F1",command=self.helpProject)
- helpmenu.add_command(label="About...",command=self.aboutProjectManager)
-
-
-
- self.mainWindow = LabelFrame(self, bd=4, relief=SUNKEN,text="Tool Window",bg="lightblue")
- self.mainWindow.pack(side=TOP,fill="both", padx=5, pady=5, expand="Y")
- self.mainWindow.place(relheight=0.85, relwidth=0.99)"""
-
- # Set frame for command buttons
- buttonWindow = Frame(self, bd=4, relief=SUNKEN)
- buttonWindow.pack(side=LEFT,fill="both", padx=2, pady=2,expand="Y")
- buttonWindow.place(relheight=0.95, relwidth=0.87, rely=0.02, relx=0.07)
-
- """buttonWindow1 = Frame(self, bd=4, relief=SUNKEN)
- buttonWindow1.pack(side=TOP,fill="both", padx=2, pady=2,expand="Y")
- buttonWindow1.place(relheight=0.9, relwidth=0.25, rely=0.02, relx=0.37)
-
- buttonWindow2 = Frame(self, bd=4, relief=SUNKEN)
- buttonWindow2.pack(side=BOTTOM,fill="both", padx=2, pady=2,expand="Y")
- buttonWindow2.place(relheight=0.9, relwidth=0.25, rely=0.02, relx=0.67)"""
-
- def createToolboxWithScilab():
- self.createButtonForCommandWithScilab(buttonWindow,self.openSchematic,self.OSCAD_HOME+"/images/se.png","Schematic Editor")
- self.createButtonForCommandWithScilab(buttonWindow,self.openAnalysisInserter,self.OSCAD_HOME+"/images/an.png","Analysis Insertor")
- self.createButtonForCommandWithScilab(buttonWindow,self.openNetConverter,self.OSCAD_HOME+"/images/kn.png","NetList Converter")
- self.createButtonForCommandWithScilab(buttonWindow,self.openNgspice,self.OSCAD_HOME+"/images/ng.png","Ngspice")
- self.createButtonForCommandWithScilab(buttonWindow,self.openFootprint,self.OSCAD_HOME+"/images/fp.png","Footprint Editor")
- self.createButtonForCommandWithScilab(buttonWindow,self.openLayout,self.OSCAD_HOME+"/images/lout.png","Layout Editor")
- self.createButtonForCommandWithScilab(buttonWindow,self.openSMCSim,self.OSCAD_HOME+"/images/sci.png","SMCSim")
- self.createButtonForCommandWithScilab(buttonWindow,self.openModelBuilder,self.OSCAD_HOME+"/images/mb.png","Model builder")
- self.createButtonForCommandWithScilab(buttonWindow,self.openSubcircuitBuilder,self.OSCAD_HOME+"/images/sub.png","Subcircuit builder")
-
- def createToolboxWithoutScilab():
- self.createButtonForCommandWithoutScilab(buttonWindow,self.openSchematic,self.OSCAD_HOME+"/images/se.png","Schematic Editor")
- self.createButtonForCommandWithoutScilab(buttonWindow,self.openAnalysisInserter,self.OSCAD_HOME+"/images/an.png","Analysis Insertor")
- self.createButtonForCommandWithoutScilab(buttonWindow,self.openNetConverter,self.OSCAD_HOME+"/images/kn.png","NetList Converter")
- self.createButtonForCommandWithoutScilab(buttonWindow,self.openNgspice,self.OSCAD_HOME+"/images/ng.png","Ngspice")
- self.createButtonForCommandWithoutScilab(buttonWindow,self.openFootprint,self.OSCAD_HOME+"/images/fp.png","Footprint Editor")
- self.createButtonForCommandWithoutScilab(buttonWindow,self.openLayout,self.OSCAD_HOME+"/images/lout.png","Layout Editor")
- self.createButtonForCommandWithoutScilab(buttonWindow,self.openModelBuilder,self.OSCAD_HOME+"/images/mb.png","Model builder")
- self.createButtonForCommandWithoutScilab(buttonWindow,self.openSubcircuitBuilder,self.OSCAD_HOME+"/images/sub.png","Subcircuit builder")
-
- if os.path.isfile(OSCAD_HOME + "/bin/scilab54"):
- createToolboxWithScilab()
- else:
- createToolboxWithoutScilab()
-
- # Protocol for deletion of main window
- self.protocol("WM_DELETE_WINDOW",self.exitProject)
-
- # Create shortcut keys
- """self.bind("<F2>", self.openSchematic)
- self.bind("<F3>", self.openFootprint)
- self.bind("<F4>", self.openLayout)
- self.bind("<F5>", self.openAnalysisInserter)
- self.bind("<F6>", self.openModelBuilder)
- self.bind("<F7>", self.openSubcircuitBuilder)
- self.bind("<F8>", self.openNetConverter)
- self.bind("<F9>", self.openNgspice)
- self.bind("<F10>",self.openSMCSim)
- self.bind("<F11>",self.exitProject)
- self.bind("<F1>", self.helpProject)
- self.focus_set()"""
-
- def createButtonForCommandWithScilab(self,frameName,commandName,imagePath,textlabel):
- # Open images
- im = Image.open(imagePath)
- photo = ImageTk.PhotoImage(im)
-
- # Create button and set label for tools
- w = Button(frameName, image=photo, width=45, height=30, command=commandName, default=ACTIVE)
- w.image=photo
- w.pack(side=TOP, padx=1, pady=1)
- toolTip.createToolTip(w,textlabel)
-
- def createButtonForCommandWithoutScilab(self,frameName,commandName,imagePath,textlabel):
- # Open images
- im = Image.open(imagePath)
- photo = ImageTk.PhotoImage(im)
-
- # Create button and set label for tools
- w = Button(frameName, image=photo, width=45, height=35, command=commandName, default=ACTIVE)
- w.image=photo
- w.pack(side=TOP, padx=1, pady=1)
- toolTip.createToolTip(w,textlabel)
-
- def call_system(self,command):
- os.system(command)
-
- def openSchematic(self,e=None):
- self.text.insert(END, " Opening schematic editor .........\n")
- self.text.yview(END)
- # Call all pending idle tasks, without processing any other events.
- self.update_idletasks()
- command="eeschema "+self.projectName+".sch "
- try:
- thread.start_new_thread(self.call_system,(command,))
- except Exception,err:
- print err
- self.text.insert(END, "Select a tool from tool menu\n")
- self.text.yview(END)
-
- def openFootprint(self,e=None):
- self.text.insert(END, " Opening footprint editor .........\n")
- self.text.yview(END)
- # Call all pending idle tasks, without processing any other events.
- self.update_idletasks()
- command="cvpcb "+self.projectName+".net "
- try:
- thread.start_new_thread(self.call_system,(command,))
- except Exception,err:
- print err
- self.text.insert(END, "Select a tool from tool menu\n")
- self.text.yview(END)
-
- def openLayout(self,e=None):
- self.text.insert(END, " Opening layout editor .........\n")
- self.text.yview(END)
- # Call all pending idle tasks, without processing any other events.
- self.update_idletasks()
- command="pcbnew "+self.projectName+".net "
- try:
- thread.start_new_thread(self.call_system,(command,))
- except Exception,err:
- print err
- self.text.insert(END, "Select a tool from tool menu\n")
- self.text.yview(END)
-
- def openNetConverter(self,e=None):
- self.text.insert(END, " Running netlist converter .........\n")
- self.text.yview(END)
- # Call all pending idle tasks, without processing any other events.
- self.update_idletasks()
- command="xterm -e python "+self.OSCAD_HOME+"/kicadtoNgspice/KicadtoNgspice.py "+self.projectName+".cir 1"
- #command=self.OSCAD_HOME+"/kicadtoNgspice/KicadtoNgspice.py "+self.projectName+".cir 1\""
- try:
- thread.start_new_thread(self.call_system,(command,))
- except Exception,err:
- print err
- self.text.insert(END, "Select a tool from tool menu\n")
- self.text.yview(END)
-
- def openAnalysisInserter(self,e=None):
- self.text.insert(END, " Opening analysis inserter .........\n")
- self.text.yview(END)
- # Call all pending idle tasks, without processing any other events.
- self.update_idletasks()
- command=self.OSCAD_HOME+"/analysisInserter/convertgui.py"
- try:
- thread.start_new_thread(self.call_system,(command,))
- except Exception,err:
- print err
- self.text.insert(END, "Select a tool from tool menu\n")
- self.text.yview(END)
-
- def openModelBuilder(self,e=None):
- self.text.insert(END, " Opening model editor .........\n")
- self.text.yview(END)
- # Call all pending idle tasks, without processing any other events.
- self.update_idletasks()
- #command="xterm -e \""+self.OSCAD_HOME+"/modelEditor/modelEditor.py " +self.projectName+".cir 1\""
- command=self.OSCAD_HOME+"/modelEditor/modelEditor.py "+self.projectName+".cir 1"
- try:
- thread.start_new_thread(self.call_system,(command,))
- except Exception,err:
- print err
- self.text.insert(END, "Select a tool from tool menu\n")
- self.text.yview(END)
-
- def openSubcircuitBuilder(self,e=None):
- self.text.insert(END, " Opening Sub-circuit editor ................\n")
- self.text.yview(END)
- # Call all pending idle tasks, without processing any other events.
- self.update_idletasks()
- command=self.OSCAD_HOME+"/subcktEditor/subcktEditor.py " +self.projectName+".cir "
- try:
- thread.start_new_thread(self.call_system,(command,))
- except Exception,err:
- print err
- self.text.insert(END, "Select a tool from tool menu\n")
- self.text.yview(END)
-
- def openNgspice(self,e=None):
- self.text.insert(END, " Running ngspice circuit simulator .........\n")
- self.text.yview(END)
- # Call all pending idle tasks, without processing any other events.
- self.update_idletasks()
- command="xterm -e \"ngspice "+self.projectName+".cir.out \""
- try:
- thread.start_new_thread(self.call_system,(command,))
- except Exception,err:
- print err
- self.text.insert(END, "Select a tool from tool menu\n")
- self.text.yview(END)
-
- # opening pythonplotting:
- command ="python " + self.OSCAD_HOME+"/forntEnd/pythonPlotting.py "+os.getcwd()+" "+self.projectName
-
- try:
- thread.start_new_thread(self.call_system,(command,))
- except Exception,err:
- print err
-
-
-
- def openSMCSim(self,e=None):
- self.text.insert(END, " Running scilab based circuit simulator .........\n")
- self.text.yview(END)
- # Call all pending idle tasks, without processing any other events.
- self.update_idletasks()
- Option=selectOption.SelectOption(self,self.text,"LPCSim")
- command=self.OSCAD_HOME+"/bin/scilab54 -f " +self.OSCAD_HOME+"/LPCSim/LPCSim/Main.sci -args "+self.projectName+".cir.ckt "
- try:
- thread.start_new_thread(self.call_system,(command,))
- except Exception,err:
- print err
- self.text.insert(END, "Select a tool from tool menu\n")
- self.text.yview(END)
-
- def helpProject(self,e=None):
- pass
-
-# Display help content
- def aboutProjectManager(self,e=None):
- tkMessageBox.showinfo("About Project Manager","Created by Yogesh Dilip Save")
-
-# Exit an Project Manager
- def exitProject(self):
- if tkMessageBox.askokcancel("QUIT","Do you really wish to quit?"):
- self.destroy()
-
- def apply(self):
- pass
-
-if __name__=='__main__':
- root = Tk()
- project= ProjectInfo(root)
- projectParam = ProjectParam(root,project.modelName,project.modelType)
- mainloop()
diff --git a/OSCAD/forntEnd/openProject.py b/OSCAD/forntEnd/openProject.py
deleted file mode 100755
index 6625229..0000000
--- a/OSCAD/forntEnd/openProject.py
+++ /dev/null
@@ -1,57 +0,0 @@
-#!/usr/bin/python
-# openProject.py is a python script to open an existing project. It is developed for OSCAD software. It is written by Yogesh Dilip Save (yogessave@gmail.com).
-# Copyright (C) 2012 Yogesh Dilip Save, FOSS Project, IIT Bombay.
-# This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
-# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-# You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-from Tkinter import *
-import template
-import tkMessageBox
-import os.path
-from string import maketrans
-
-class ProjectInfo(template.MyTemplate):
- """ Class for accept model information from user """
- def body(self, master):
- # Ask for compoent name
- Label(master, text="Enter Project name:").grid(row=0)
- self.e1 = Entry(master)
- self.e1.grid(row=0, column=1,pady=10,columnspan=2)
- tempStr=os.getcwd()
- tempStr2=tempStr.split('/')
- self.e1.insert(0,tempStr2[len(tempStr2)-1])
-
-# Collect project information
- def apply(self):
- """ a method for writing project information to the file"""
- self.text.insert(END, "Successfully opened project " + self.projectName+". \n")
- self.text.yview(END)
- pass
-
-# Validate the model information
- def validate(self):
- # Remove trailing and leading spaces from modelName
- self.projectName=self.e1.get().strip()
- if len(self.projectName):
- self.text.insert(END, "Opening project " + self.projectName+" ...... \n")
- self.text.yview(END)
- # Read project file
- try:
- self.text.insert(END, " Checking project information file " + self.projectName+".proj. ...... \n")
- self.text.yview(END)
- f = open(self.projectName+".proj","r")
- except :
- tkMessageBox.showwarning("Error","Project information file does not exist, Try again")
- return 0
- f.close()
- return 1
- else:
- tkMessageBox.showwarning("Bad input","Project Name is not specified, please try again")
- return 0
-
-if __name__=='__main__':
- root=Tk()
- project= ProjectInfo(root)
- mainloop()
-
diff --git a/OSCAD/forntEnd/oscad.py b/OSCAD/forntEnd/oscad.py
deleted file mode 100755
index 5015e0c..0000000
--- a/OSCAD/forntEnd/oscad.py
+++ /dev/null
@@ -1,184 +0,0 @@
-#!/usr/bin/python
-# oscad.py is a python script to create fornt end for OSCAD software. It is written by Yogesh Dilip Save (yogessave@gmail.com).
-# Copyright (C) 2012 Yogesh Dilip Save, FOSS Project, IIT Bombay.
-# This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
-# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-# You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-from setPath import OSCAD_HOME
-from Tkinter import *
-import ttk
-import tkMessageBox
-import tkFileDialog
-import newProject
-import openProject
-import os
-import Image
-import ImageTk
-import os
-import sys
-# T=os.popen("ls -l").read()
-# text.insert(END, T)
-
-# Create a new model
-def new_Project(e=None):
- #text.insert(END,"Select the directory to save the project\n")
- directory=tkFileDialog.askdirectory()
- if directory:
- try:
- os.chdir(directory)
- text.insert(END, "Changing directory to "+directory+"\n\n")
- text.yview(END)
- project= newProject.ProjectInfo(root,text)
- except msg:
- tkMessageBox.showerror("Change Directory Failed",msg)
- else:
- tkMessageBox.showwarning("Bad input","Directory is not specified, please try again")
-# Create project files
- try:
- if project.status:
- projectParam = newProject.ProjectParam(root,text,project.projectName)
- except:
- pass
-
-# Open an existing model
-def open_Project(e=None):
-# Read project information (name)
- text.insert(END, "Please enter the project Name\n")
- text.yview(END)
- project= openProject.ProjectInfo(root,text)
-# Open model file
- if project.status:
- projectParam = newProject.ProjectParam(root,text,project.projectName)
- #text.insert(END, "In Main window:\n")
- #text.insert(END, "Please select the proper option from File Menu\n")
-
-# Change the current directory to new directory
-def changeDirectory(event=None):
- folderName=tkFileDialog.askdirectory()
- if folderName:
- try:
- os.chdir(folderName)
- text.insert(END, "Changing directory to "+folderName+"\n\n")
- text.yview(END)
- open_Project()
- except OSError, msg:
- tkMessageBox.showerror("Change Directory Failed",msg)
- else:
- tkMessageBox.showwarning("Bad input","Directory is not specified, please try again")
-
-# Exit an model editor
-def exit_Project(e=None):
- if tkMessageBox.askokcancel("QUIT","Do you really wish to quit, this will close all OSCAD projects that are running ?"):
- text.insert(END, "Good Bye !!\n")
- root.destroy()
-
-# Display help content
-def help_Project(e=None):
- pass
-
-# Display help content
-def about_Project():
- tkMessageBox.showinfo("About Oscad","Oscad is a free & open source CAD tool for\
- Electronics & Electrical Engineers.\n \
- \nDeveloped by putting together open source soft like:\neeschema(kicad), \nPCB layout editor (kicad), \nNGSpice, \nScilab.\n\
- \nDeveloped at IIT Bombay by FOSSEE team")
-
-# Create and configure a graphical window
-root = Tk()
-root.title("Oscad")
-"""img = PhotoImage(file="an.jpg")
-root.tk.call('wm', 'iconphoto', root._w, img)"""
-
-# make it cover the entire screen
-w, h = root.winfo_screenwidth(), root.winfo_screenheight()
-root.geometry("%dx%d" % (0.15*w, 0.25*h))
-root.focus_set()
-root.resizable(0,0)
-
-"""mainWindow = Frame(root)
-
-b1 = Button(mainWindow, text="New", width=18, command=new_Project)
-b1.pack()
-b2 = Button(mainWindow, text="Open", width=18, command=changeDirectory)
-b2.pack()
-b3 = Button(mainWindow, text="Exit", width=18, command=exit_Project)
-b3.pack()
-
-mainWindow.pack()"""
-
-"""c = Canvas(root, bg='lightblue')
-c.pack(side=LEFT)
-c.place(relheight=0.99, relwidth=0.99, rely=0.0,relx=0.2)
-im = Image.open(OSCAD_HOME+"/images/logo.png")
-tkim = ImageTk.PhotoImage(im)
-c.create_image(75, 75, image=tkim)"""
-
-img = ImageTk.PhotoImage(Image.open(OSCAD_HOME+"/images/logo.png"))
-panel = Label(root, image = img)
-panel.place(relheight=0.8,relwidth=0.8,rely=0.0,relx=0.1)
-panel.pack()
-
-# Create and configure a menu
-menu = Menu(root)
-root.config(menu=menu)
-
-# Create File menu
-filemenu= Menu(menu)
-menu.add_cascade(label="Project", menu=filemenu)
-filemenu.add_command(label="New F2", command=new_Project)
-filemenu.add_command(label="Open F3", command=changeDirectory)
-filemenu.add_separator()
-filemenu.add_command(label="Exit F4", command=exit_Project)
-
-# Create help menu
-helpmenu=Menu(menu)
-menu.add_cascade(label="Help", menu=helpmenu)
-helpmenu.add_command(label="Help F1",command=help_Project)
-helpmenu.add_command(label="About...",command=about_Project)
-
-# Protocol for deletion of main window
-
-
-# Create shortcut keys
-root.bind("<F2>", new_Project)
-root.bind("<F3>", changeDirectory)
-root.bind("<F4>", exit_Project)
-root.bind("<F1>", help_Project)
-
-"""mainWindow = LabelFrame(root, bd=4, relief=SUNKEN,text="Main Window", bg='lightblue')
-mainWindow.pack(side=TOP,fill="both", padx=5, pady=5,expand="Y")
-mainWindow.place(relheight=0.85, relwidth=0.99, rely=0.0)
-
-c = Canvas(mainWindow, bg='white',width=750, height=325)
-c.pack()
-im = Image.open(OSCAD_HOME+"/images/OSCADlogo.jpeg")
-tkim = ImageTk.PhotoImage(im)
-c.create_image(375, 150, image=tkim)"""
-
-reportWindow = LabelFrame(root, bd=4, relief=SUNKEN,text="Report Window")
-#reportWindow.pack(side=BOTTOM,fill="both", padx=5, pady=5,expand="Y")
-#reportWindow.place(relheight=0.52, relwidth=0.98, rely=0.47)
-
-text = Text(reportWindow)
-"""text.insert(INSERT, "Welcome !!\n")
-text.insert(END, "New: Create a New Project\n")
-text.insert(END, "Open: Open an Exising Project\n")
-text.focus_set()
-text.pack()
-text.place(relheight=0.99, relwidth=0.99)
-text.config(borderwidth=5)
-
-scrollY = Scrollbar(reportWindow,orient=VERTICAL,command=text.yview)
-scrollY.pack(fill=Y)
-scrollY.place(relheight=0.98,relwidth=0.01, rely=0.02, relx=0.99)
-text.config(yscrollcommand=scrollY.set)
-scrollY.set(0,0.5)"""
-
-root.protocol("WM_DELETE_WINDOW",exit_Project)
-
-def execute(event):
- print "yogesh"
-
-#text.bind("<Return>",execute)
-mainloop()
diff --git a/OSCAD/forntEnd/pythonPlotting.py b/OSCAD/forntEnd/pythonPlotting.py
deleted file mode 100755
index 3564aab..0000000
--- a/OSCAD/forntEnd/pythonPlotting.py
+++ /dev/null
@@ -1,696 +0,0 @@
-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.QtCore import *
-from PyQt4.QtGui import *
-from PyQt4 import QtGui, uic
-from PyQt4 import 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
-
-
-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
-
-#new function for finding no of points to be plotted:
-
- def numberFinder(self,fpath):
-
- with open (fpath+"/analysis") as f3:
- info = f3.read()
-
- info = info.split(" ")
- #info[0] = info[0][-3:]
- #print info
-
- 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
- #print "vno:",vnumber
-
- # 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]))
-
-
-class Window(QMainWindow):
- def __init__(self,fpath,projName, parent=None):
- super(Window, self).__init__(parent)
- #self.setWindowTitle('AC Analysis')
- self.fpath=fpath
- self.projName=projName
- self.createMainFrame()
- self.combo = []
- self.combo1 = []
- self.combo1_rev = []
-
- def createMainFrame(self):
-
- self.main_frame = 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 = QVBoxLayout()
- left_vbox.addWidget(self.mpl_toolbar)
- left_vbox.addWidget(self.canvas)
-
- right_vbox = QVBoxLayout()
- right_grid = QGridLayout()
- top_grid = 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 = QLabel()
- top_grid.addWidget(self.heading1,1,0)
- self.heading2 = 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(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(QCheckBox(self.fobj.butnames[i]))
- self.chkbox[i].setToolTip('<b>Tick Me!</b>' )
- top_grid.addWidget(self.chkbox[i],i+3,0)
-
- self.clear = QPushButton("Clear")
- self.Note = QLabel()
- self.Note1 = QLabel()
- self.Note2 = QLabel()
-
- self.btn = QPushButton("Plot")
- self.btn.setToolTip('<b>Press</b> to Plot' )
- self.text = QLineEdit()
- self.funcLabel = QLabel()
- self.palette1 = QPalette()
- self.palette2 = QPalette()
- self.btn1 = 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 = QTextEdit()
- with open (self.fpath+"/"+self.projName+'.cir.out') as f2:
- fdata = f2.read()
- netlist.setText(fdata)
- netlist.setReadOnly(True)
-
- '''down_box = QHBoxLayout()
- down_box.addWidget(netlist)
-
- left_vbox.addLayout(down_box)'''
- left_vbox.addWidget(netlist)
-
- hbox = QHBoxLayout()
- hbox.addLayout(left_vbox)
- hbox.addLayout(right_vbox)
-
- '''finalvbox = QVBoxLayout()
- finalvbox.addLayout(hbox)'''
-
- widget = QWidget()
- widget.setLayout(hbox)#finalvbox
- self.scrollArea = QScrollArea()
- self.scrollArea.setWidgetResizable(True)
- self.scrollArea.setWidget(widget)
-
- finalhbox = 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,SIGNAL('clicked()'),self.pushedClear)
-
- self.connect(self.btn1,SIGNAL('clicked()'), self.pushedPlotFunc)
-
- if plot_type[0]==0:
-
- self.setWindowTitle('AC Analysis')
- if plot_type[1]==1:
-
- self.connect(self.btn, SIGNAL('clicked()'), self.onPush_decade)
-
- else:
-
- self.connect(self.btn, SIGNAL('clicked()'), self.onPush_ac)
-
- elif plot_type[0]==1:
-
- self.setWindowTitle('Transient Analysis')
- self.connect(self.btn, SIGNAL('clicked()'), self.onPush_trans)
-
- else:
-
- self.setWindowTitle('DC Analysis')
- self.connect(self.btn, 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!")
- 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:
- 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):
- 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!!")
- 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:
- 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:
- 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.plot(self.fobj.x,finalResult,c=self.color[0],label=str(1))
-
-
- 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:
- 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:
- 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:
- 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:
- QMessageBox.about(self,"Warning!!", "Please select atleast one Node OR Branch")
- self.canvas.draw()
-
-if __name__=="__main__":
- app = QtGui.QApplication(sys.argv)
- fpath = sys.argv[1]
- projName = sys.argv[2]
- global main
- main = Window(fpath,projName)
- main.show()
- sys.exit(app.exec_())
diff --git a/OSCAD/forntEnd/selectOption.py b/OSCAD/forntEnd/selectOption.py
deleted file mode 100755
index 447179b..0000000
--- a/OSCAD/forntEnd/selectOption.py
+++ /dev/null
@@ -1,55 +0,0 @@
-#!/usr/bin/python
-# selectOption.py is a python script to select option for Scilab based circuit simulator. It is developed for OSCAD software. It is written by Yogesh Dilip Save (yogessave@gmail.com).
-# Copyright (C) 2012 Yogesh Dilip Save, FOSS Project, IIT Bombay.
-# This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
-# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-# You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-from setPath import OSCAD_HOME
-from Tkinter import *
-import template
-import tkMessageBox
-import os.path
-from string import maketrans
-
-class SelectOption(template.MyTemplate):
- """ Class for accept model information from user """
- def body(self, master):
- # Define default mode type and set it to symbolic
- self.option = StringVar()
- self.option.set("1")
-
- # Ask for scilab option
- Label(master, text="Enter mode for scilab based circuit simulator:").grid(row=1)
- Radiobutton(master, text="Normal", variable=self.option, value="0").grid(row=2,column=0,columnspan=2,sticky=W)
- Radiobutton(master, text="Symbolic", variable=self.option, value="1").grid(row=3,column=0,columnspan=2,sticky=W)
- Radiobutton(master, text="Matrix", variable=self.option, value="2").grid(row=4,column=0,columnspan=2,sticky=W)
-
-# Collect model information
- def apply(self):
- self.mode=self.option.get()
- try:
- self.OSCAD_HOME=OSCAD_HOME
- except NameError:
- try:
- self.OSCAD_HOME=os.environ["OSCAD_HOME"]
- except KeyError:
- tkMessageBox.showerror("Error OSCAD_HOME is not set","Please set OSCAD_HOME variable in .bashrc\n\nStep to set OSCAD_HOME variable:\n 1) Open ~/.bashrc using text editor (vi ~/.bash).\n 2) Add the line \"Export OSCAD_HOME=<path_of_oscad>\" to it.\n 3) source ~/.bashrc")
- exit(0)
- HOME=self.OSCAD_HOME+"/LPCSim/LPCSim/"
- # Open file for writing option
- fileName=HOME+"option"
- os.system("rm -rf "+ fileName)
- # Create model file for writing
- try:
- f = open(fileName,"w")
- except :
- tkMessageBox.showwarning("Error","Model file can not be wriiten. please check the file system permission")
- f.write(self.mode)
- f.close()
-
-if __name__=='__main__':
- root=Tk()
- model= SelectOption(root)
- mainloop()
-
diff --git a/OSCAD/forntEnd/setPath.py b/OSCAD/forntEnd/setPath.py
deleted file mode 100755
index 778e6f3..0000000
--- a/OSCAD/forntEnd/setPath.py
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/usr/bin/python
-OSCAD_HOME="/home/hardik/OSCAD"
diff --git a/OSCAD/forntEnd/template.py b/OSCAD/forntEnd/template.py
deleted file mode 100755
index e5f843b..0000000
--- a/OSCAD/forntEnd/template.py
+++ /dev/null
@@ -1,117 +0,0 @@
-#!/usr/bin/python
-from Tkinter import *
-import os
-
-class MyTemplate(Toplevel):
- """Template to construct new window"""
-# Define constructor
- def __init__(self, parent, text=None, title=None, buttonbox=True):
- # Set new window properties same as parent
- Toplevel.__init__(self, parent)
-
- # Set report window
- if text:
- self.text=text
-
- # Create a new window on top of the parent such that don't appear in taskbar
- self.transient(parent)
-
- # Set the title
- if title:
- self.title("Tools")
- # Set Parent of active window
- self.parent =parent
-
- # Create a new frame
- body =Frame (self)
- # Call body method
- self.initial_focus = self.body(body)
- # Display body
- body.pack(padx=5, pady=5)
- # Create buttons
- if buttonbox:
- self.buttonbox()
- # Create status bar
- self.statusBar()
- # Take control of all the events
- self.grab_set()
-
- # Take control of all the keyboard events
- if not self.initial_focus:
- self.initial_focus=self
-
- # Protocol when window is deleted.
- self.protocol("WM_DELETE_WINDOW",self.cancel)
-
- # Position the geometry respect to main window
- self.geometry("+%d+%d" % (parent.winfo_rootx()+10,parent.winfo_rooty()+22))
- self.initial_focus.focus_set()
-
- # Wait for widget to be destroyed
- self.wait_window(self)
-
-# Construction of body of the window
- def body(self, master):
- # Create dialog body. This method should be overridden
- pass
-
-# Add standard button box (OK, Cancel). Override if you don't want the standard buttons
- def buttonbox(self):
- # Construct a new frame
- box = Frame(self)
- # Create buttons
- w = Button(box, text="OK", width=10, command=self.ok, default=ACTIVE)
- w.pack(side=LEFT, padx=5, pady=5)
- w = Button(box, text="Cancel", width=10, command=self.cancel)
- w.pack(side=LEFT, padx=5, pady=5)
-
- # Bind Return and escape keys
- self.bind("<Return>", self.ok)
- self.bind("<Escape>", self.cancel)
- # Create the frame "box"
- box.pack(side=BOTTOM)
-
-# Add standard status bar. Override if you don't want the status bar
- def statusBar(self):
- pass
- # self.statusbar = Label(self, text="", bd=1, relief=SUNKEN, anchor=W)
- # self.statusbar.pack(side=BOTTOM, fill=X)
-
-# Template for action taken when OK is pressed
- def ok(self, event=None):
- # If data is not valid then put the focus back
- if not self.validate():
- self.initial_focus.focus_set()
- return
- # Remove the window from the screen (without destroying it)
- self.withdraw()
- # Call all pending idle tasks, without processing any other events.
- self.update_idletasks()
- # Perform required task (collection of result, inputs etc.)
- self.apply()
- # Take action when all task has finished
- self.cancel(status=1)
-
-# Template for action taken when cancel pressed
- def cancel(self, event=None, status=0):
- # Catch the status
- self.status=status
- # Put focus back to the parent window
- self.parent.focus_set()
- # Destroy child window
- self.destroy()
-
-# Template for validation of data
- def validate(self):
- return 1
-
-# Template for required action (Saving Data, results)
- def apply(self):
- pass
-
-# Test case
-if __name__=='__main__':
- root=Tk()
- d =MyTemplate(root)
- mainloop()
-
diff --git a/OSCAD/forntEnd/test.py b/OSCAD/forntEnd/test.py
deleted file mode 100755
index 225030d..0000000
--- a/OSCAD/forntEnd/test.py
+++ /dev/null
@@ -1,35 +0,0 @@
-##-------------------------------
-# file: test.py
-# simple demonstration of the Tkinter notebook
-
-from Tkinter import *
-from notebook import *
-
-a = Tk()
-n = notebook(a, LEFT)
-
-# uses the notebook's frame
-f1 = Frame(n())
-b1 = Button(f1, text="Button 1")
-e1 = Entry(f1)
-# pack your widgets before adding the frame
-# to the notebook (but not the frame itself)!
-b1.pack(fill=BOTH, expand=1)
-e1.pack(fill=BOTH, expand=1)
-
-f2 = Frame(n())
-# this button destroys the 1st screen radiobutton
-b2 = Button(f2, text='Button 2', command=lambda:x1.destroy())
-b3 = Button(f2, text='Beep 2', command=lambda:Tk.bell(a))
-b2.pack(fill=BOTH, expand=1)
-b3.pack(fill=BOTH, expand=1)
-
-f3 = Frame(n())
-
-# keeps the reference to the radiobutton (optional)
-x1 = n.add_screen(f1, "Screen 1")
-n.add_screen(f2, "Screen 2")
-n.add_screen(f3, "dummy")
-
-if __name__ == "__main__":
- a.mainloop()
diff --git a/OSCAD/forntEnd/toolTip.py b/OSCAD/forntEnd/toolTip.py
deleted file mode 100755
index 0409390..0000000
--- a/OSCAD/forntEnd/toolTip.py
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/usr/bin/python
-from Tkinter import *
-
-class ToolTip(object):
-
- def __init__(self, widget):
- self.widget = widget
- self.tipwindow = None
- self.id = None
- self.x = self.y = 0
-
- def showtip(self, text):
- "Display text in tooltip window"
- self.text = text
- if self.tipwindow or not self.text:
- return
- x, y, cx, cy = self.widget.bbox("insert")
- x = x + self.widget.winfo_rootx() + 27
- y = y + cy + self.widget.winfo_rooty() +27
- self.tipwindow = tw = Toplevel(self.widget)
- tw.wm_overrideredirect(1)
- tw.wm_geometry("+%d+%d" % (x, y))
- try:
- # For Mac OS
- tw.tk.call("::tk::unsupported::MacWindowStyle",
- "style", tw._w,
- "help", "noActivates")
- except TclError:
- pass
- label = Label(tw, text=self.text, justify=LEFT,
- background="#ffffe0", relief=SOLID, borderwidth=1,
- font=("tahoma", "8", "normal"))
- label.pack(ipadx=1)
-
- def hidetip(self):
- tw = self.tipwindow
- self.tipwindow = None
- if tw:
- tw.destroy()
-
-def createToolTip(widget, text):
- toolTip = ToolTip(widget)
- def enter(event):
- toolTip.showtip(text)
- def leave(event):
- toolTip.hidetip()
- widget.bind('<Enter>', enter)
- widget.bind('<Leave>', leave)