Changeset 1110
- Timestamp:
- 11/11/08 16:09:47 (2 months ago)
- Files:
-
- analog/pyeac/trunk/eeepc/controlpanel.py (modified) (3 diffs)
- analog/pyeac/trunk/eeepc/controlpanel.pyc (modified) (previous)
- analog/pyeac/trunk/eeepc/pyeac.py (modified) (4 diffs)
- analog/pyeac/trunk/eeepc/visualizer.py (modified) (2 diffs)
- analog/pyeac/trunk/eeepc/visualizer.pyc (modified) (previous)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
analog/pyeac/trunk/eeepc/controlpanel.py
r1107 r1110 79 79 self.ledonf = ledonf 80 80 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)85 81 86 82 self.tr() … … 90 86 self.td(self.s1,align=-1) 91 87 88 self.tr() 89 b1 = gui.Button("RESET",width=70) 90 b1.connect(gui.CLICK,resetf) 91 self.td(b1,align=-1) 92 92 93 def handler(self): 93 94 if self.s1.value: … … 134 135 self.tr() 135 136 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) 137 138 self.td(self.current_input,align=0) 138 139 self.tr() analog/pyeac/trunk/eeepc/pyeac.py
r1107 r1110 23 23 24 24 def get_grid_square(pos): 25 (gbx,gby) = ( 315,0)25 (gbx,gby) = (490,0) 26 26 (gsx,gsy) = (60,60) 27 27 (posx,posy) = pos … … 83 83 84 84 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) 88 87 89 88 app.init(c) … … 93 92 94 93 clock = pygame.time.Clock() 95 mousepos = ( 315,0)94 mousepos = (490,0) 96 95 mouseb1pressed = False 97 96 … … 136 135 screen.fill((0,0,0)) 137 136 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)) 140 139 if selected_square_surface != None: 141 screen.blit(selected_square_surface,( 315,0))140 screen.blit(selected_square_surface,(490,0)) 142 141 143 142 analog/pyeac/trunk/eeepc/visualizer.py
r1094 r1110 6 6 import random 7 7 from pygame.locals import * 8 from numpy import arange,zeros 9 from scipy import mgrid, interpolate 8 10 9 11 class Visualizer: … … 11 13 def __init__(self, absolute=True): 12 14 self.absolute = absolute 13 self.fill_color = ( 100,0,0)15 self.fill_color = (0,0,0) 14 16 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)) 17 19 for y in range(5): 18 20 for x in range(5): 19 21 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) 22 24 23 25 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)) 25 27 self.surface.fill(color,fill_window) 26 28 27 29 def set_all(self,color): 28 fill_window = Rect((0,0),( 300,300))30 fill_window = Rect((0,0),(480,480)) 29 31 self.surface.fill(color,fill_window) 30 32 31 33 def update(self,pg): 32 34 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 33 69 max = 5.0 34 70 min = 0.0
