From: Tero K. <te...@us...> - 2005-08-15 18:34:25
|
Update of /cvsroot/openexvis/openexvis In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1648 Modified Files: ChangeLog oevt_python.py openexvis.py visualizer.py Log Message: Move the new value of a variable on top of the old one, which is now shown. Index: oevt_python.py =================================================================== RCS file: /cvsroot/openexvis/openexvis/oevt_python.py,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- oevt_python.py 15 Aug 2005 14:12:09 -0000 1.5 +++ oevt_python.py 15 Aug 2005 18:34:16 -0000 1.6 @@ -63,25 +63,31 @@ lastconst = op['oparg2'] elif op['opcode'] == 'STORE_NAME' or op['opcode'] == 'STORE_ATTR': # Storing the last constant in the given variable. - self.variables[op['oparg2']] = lastconst + if self.variables.has_key(op['oparg2']): + tmp = self.variables[op['oparg2']] + v = [lastconst, tmp[0]] + else: + v = [lastconst, ''] + self.variables[op['oparg2']] = v #print "DEBUG: variables == ", self.variables viscommands += 'STORE_VARIABLE:' + op['oparg2'] + ':' + \ - str(self.variables[op['oparg2']]) + ':' + \ - str(lastconst) + ';' + str(v[0]) + ':' + str(v[1]) + ';' elif op['opcode'] == 'SETUP_LOOP': viscommands += 'BEGIN_LOOP;' elif op['opcode'] == 'LOAD_NAME' or op['opcode'] == 'LOAD_ATTR': # Loading the given variable. try: - viscommands += 'LOAD:' + op['oparg2'] + ':' + \ - str(self.variables[op['oparg2']]) + ';' + v = self.variables[op['oparg2']] + viscommands += 'LOAD:' + op['oparg2'] + ':' + str(v[0]) + \ + ':' + str(v[1]) + ';' olderconst = lastconst - lastconst = self.variables[op['oparg2']] + lastconst = v[0] except KeyError, msg: print "oevt_python.py: No such key: ", msg # It can still be a valid operation, so do it like this. # TODO: Think this over. - viscommands += 'LOAD:' + op['oparg2'] + ':' + '' + ';' + viscommands += 'LOAD:' + op['oparg2'] + ':' + '' +':' + \ + '' + ';' elif op['opcode'] == 'COMPARE_OP': viscommands += 'COMPARE:' + op['oparg2'] + ':' + \ str(olderconst) + ':' + str(lastconst) + ';' Index: openexvis.py =================================================================== RCS file: /cvsroot/openexvis/openexvis/openexvis.py,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- openexvis.py 15 Aug 2005 17:00:32 -0000 1.11 +++ openexvis.py 15 Aug 2005 18:34:16 -0000 1.12 @@ -98,9 +98,9 @@ # Some important locations for drawing the visualization. self.const_start = (self.vis_split_x - self.gridw * 3, \ self.const_split + self.gridh * 1) - self.const_end = (self.vis_split_x + self.gridw * 8, \ + self.var_name_pos = (self.vis_split_x + self.gridw * 1, \ self.eval_split - self.gridh * 3) - self.var_pos = (self.vis_split_x + self.gridw * 1, \ + self.var_value_pos = (self.vis_split_x + self.gridw * 8, \ self.eval_split - self.gridh * 3) self.eval_left_pos = (self.vis_split_x + self.gridw, \ self.eval_split + self.gridh * 1) @@ -171,7 +171,7 @@ line_markers = self.cBuf.get_markers_in_region(line_iter, end_iter) if line_markers: return True - # Update the visualization area. + # Create the animation pixmaps. self.update_pixmaps(vis_code, viscommands) moresteps = True while moresteps: @@ -180,6 +180,7 @@ gtk.main_iteration() while gtk.events_pending(): gtk.main_iteration() + # Update the visualization area. moresteps = self.draw_anim_frame() if self.do_steps: while self.do_steps and not self.step_fwd: @@ -343,12 +344,20 @@ """Store displaying the variables in the visualization pixmap.""" pos = 0 for v in cur_vars: - x = self.var_pos[0] - y = self.var_pos[1] - (self.gridh * pos) - w = self.gridw * 6 + # Variable name. + nx = self.var_name_pos[0] + ny = self.var_name_pos[1] - (self.gridh * pos) + nw = self.gridw * 5 + ntxt = self.vArea.create_pango_layout(v[0]) + # Variable value. + vx = self.var_value_pos[0] + vy = self.var_value_pos[1] - (self.gridh * pos) + vw = self.gridw * 2 + vtxt = self.vArea.create_pango_layout(v[2]) + # Height is same for both h = self.gridh - txt = self.vArea.create_pango_layout(v[0]) - self.do_frame_pixmap(self.var_color, w, h, x, x, y, y, txt) + self.do_frame_pixmap(self.var_color, nw, h, nx, nx, ny, ny, ntxt) + self.do_frame_pixmap(self.var_color, vw, h, vx, vx, vy, vy, vtxt) pos += 1 def draw_show_constants(self, cur_consts): @@ -372,8 +381,8 @@ """Store a constant moved to a variable in the visualization pixmap.""" startx = self.const_start[0] starty = self.const_start[1] - endx = self.const_end[0] - endy = self.const_end[1] + endx = self.var_value_pos[0] + endy = self.var_value_pos[1] w = self.gridw * 2 h = self.gridh txt = self.vArea.create_pango_layout(constant[:8]) Index: visualizer.py =================================================================== RCS file: /cvsroot/openexvis/openexvis/visualizer.py,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- visualizer.py 15 Aug 2005 14:17:25 -0000 1.7 +++ visualizer.py 15 Aug 2005 18:34:16 -0000 1.8 @@ -65,15 +65,16 @@ cmd.append(['SHOW_CONSTANTS', cur_consts]) elif c[0] == 'STORE_VARIABLE': # c[1] is the variable name to store to. - # c[2] is the variable value. - # c[3] is the constant to store. - cur_vars.append([c[1], c[2]]) + # c[2] is the variable's new value. + # c[3] is the variable's old value. + cur_vars.append([c[1], c[2], c[3]]) cmd.append(['SHOW_VARIABLES', cur_vars]) - cmd.append(['SHOW_STORING', c[3], c[1]]) + cmd.append(['SHOW_STORING', c[2], c[1]]) elif c[0] == 'LOAD': # c[1] is the variable name. # c[2] is the variable value. - cur_vars.append([c[1], c[2]]) + # c[3] is the variable's old value + cur_vars.append([c[1], c[2], c[3]]) cmd.append(['SHOW_VARIABLES', cur_vars]) elif c[0] == 'BEGIN_LOOP': cmd.append(['SHOW_LOOP']) Index: ChangeLog =================================================================== RCS file: /cvsroot/openexvis/openexvis/ChangeLog,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- ChangeLog 15 Aug 2005 17:00:32 -0000 1.8 +++ ChangeLog 15 Aug 2005 18:34:16 -0000 1.9 @@ -3,6 +3,8 @@ CVS + * When storing to a variable, the old value is now shown and new value moved on + top of it * Visualization objects have a black border 0.2.0 |