Changeset 1110

Show
Ignore:
Timestamp:
11/11/08 16:09:47 (2 months ago)
Author:
bhimebau
Message:

larger visualizer and moved controls

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • analog/pyeac/trunk/eeepc/controlpanel.py

    r1107 r1110  
    7979        self.ledonf = ledonf 
    8080        self.ledofff = ledofff 
    81         self.tr() 
    82         b1 = gui.Button("RESET",width=70) 
    83         b1.connect(gui.CLICK,resetf) 
    84         self.td(b1,align=-1) 
    8581 
    8682        self.tr() 
     
    9086        self.td(self.s1,align=-1) 
    9187    
     88        self.tr() 
     89        b1 = gui.Button("RESET",width=70) 
     90        b1.connect(gui.CLICK,resetf) 
     91        self.td(b1,align=-1) 
     92 
    9293    def handler(self): 
    9394        if self.s1.value: 
     
    134135            self.tr() 
    135136            self.td(gui.Label("Current Source/Sink = ",color=fg),align=-1) 
    136             self.td(self.current_slider,align=-1) 
     137#            self.td(self.current_slider,align=-1) 
    137138            self.td(self.current_input,align=0) 
    138139            self.tr() 
  • analog/pyeac/trunk/eeepc/pyeac.py

    r1107 r1110  
    2323 
    2424def get_grid_square(pos): 
    25     (gbx,gby) = (315,0) 
     25    (gbx,gby) = (490,0) 
    2626    (gsx,gsy) = (60,60) 
    2727    (posx,posy) = pos 
     
    8383 
    8484    csp = Context_Sensitive_Panel(pg, (1,1)) 
    85     c.add(csp,0,325) 
    86  
    87     c.add(bcc,650,100) 
     85    c.add(csp,490,300) 
     86    c.add(bcc,670,490) 
    8887 
    8988    app.init(c) 
     
    9392     
    9493    clock = pygame.time.Clock() 
    95     mousepos = (315,0) 
     94    mousepos = (490,0) 
    9695    mouseb1pressed = False 
    9796 
     
    136135        screen.fill((0,0,0)) 
    137136        screen.blit(phyeac_vis.surface,(0,0)) 
    138         screen.blit(phyeac_raw.master_surface,(315,0)) 
    139         screen.blit(highlighted_surface,(315,0)) 
     137        screen.blit(phyeac_raw.master_surface,(490,0)) 
     138        screen.blit(highlighted_surface,(490,0)) 
    140139        if selected_square_surface != None: 
    141             screen.blit(selected_square_surface,(315,0)) 
     140            screen.blit(selected_square_surface,(490,0)) 
    142141             
    143142 
  • analog/pyeac/trunk/eeepc/visualizer.py

    r1094 r1110  
    66import random 
    77from pygame.locals import * 
     8from numpy import arange,zeros 
     9from scipy import mgrid, interpolate 
    810 
    911class Visualizer: 
     
    1113    def __init__(self, absolute=True): 
    1214        self.absolute = absolute 
    13         self.fill_color = (100,0,0) 
     15        self.fill_color = (0,0,0) 
    1416        self.palette = self.createpalette() 
    15         self.surface = pygame.Surface((300,300)) 
    16         fill_window = Rect((0,0),(60,60)) 
     17        self.surface = pygame.Surface((480,480)) 
     18        fill_window = Rect((0,0),(96,96)) 
    1719        for y in range(5): 
    1820            for x in range(5): 
    1921                self.surface.fill(self.fill_color,fill_window) 
    20                 fill_window = fill_window.move(60,0) 
    21             fill_window = fill_window.move(-300,60
     22                fill_window = fill_window.move(96,0) 
     23            fill_window = fill_window.move(-480,96
    2224     
    2325    def set_block(self, pos, color): 
    24         fill_window = Rect((pos[0]*60,pos[1]*60),(60,60)) 
     26        fill_window = Rect((pos[0]*96,pos[1]*96),(96,96)) 
    2527        self.surface.fill(color,fill_window) 
    2628                 
    2729    def set_all(self,color): 
    28         fill_window = Rect((0,0),(300,300)) 
     30        fill_window = Rect((0,0),(480,480)) 
    2931        self.surface.fill(color,fill_window) 
    3032 
    3133    def update(self,pg): 
    3234        if self.absolute == True: 
     35#             x,y = mgrid[0.0:5.0:1.0,0.0:5.0:1.0] 
     36#             z = zeros((5,5)) 
     37#             for row in range(5): 
     38#                 for col in range(5): 
     39#                     z[row][col] = float(pg.grid[row][col].voltage) 
     40#  
     41#             print z.shape 
     42#             xnew,ynew = mgrid[0.0:5.0:1.0/400.0,0.0:5.0:1.0/400.0] 
     43#             tck = interpolate.bisplrep(x,y,z,s=0) 
     44#             znew = interpolate.bisplev(xnew[:,0],ynew[0,:],tck) 
     45#             print znew.shape 
     46#             row = 0 
     47#            col = 0 
     48#             for row in range(400): 
     49#                for col in range(400): 
     50#                      color_norm = znew[row][col]/5.0 
     51#                     if color_norm > 1: 
     52#                         color_norm = 1 
     53#                     elif color_norm < 0: 
     54#                         color_norm = 0 
     55#  
     56#                     color_norm *= 16777215 
     57#                     red = (int(color_norm) & 0xFF0000) >> 16 
     58#                     if red > 0xFF: 
     59#                         print red 
     60#                     green = (int(color_norm) & 0x00FF00) >> 8 
     61#                     if green > 0xFF: 
     62#                         print green 
     63#                     blue = (int(color_norm) & 0x0000FF)  
     64#                     if blue > 0xFF: 
     65#                         print blue 
     66#  
     67#                     self.surface.set_at((row,col),(red,green,blue)) 
     68             
    3369            max = 5.0 
    3470            min = 0.0