From: Tero K. <te...@us...> - 2005-08-20 19:46:53
|
Update of /cvsroot/openexvis/openexvis In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6114 Modified Files: openexvis.py Log Message: Further work towards visualizing the program structure. Index: openexvis.py =================================================================== RCS file: /cvsroot/openexvis/openexvis/openexvis.py,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- openexvis.py 18 Aug 2005 15:11:39 -0000 1.22 +++ openexvis.py 20 Aug 2005 19:46:45 -0000 1.23 @@ -187,6 +187,10 @@ if elem[1] == 'output': ei = self.oArea.get_buffer().get_end_iter() self.oArea.get_buffer().insert(ei, elem[2]) + elif elem[1] == 'function': + self.vis_permanents.append([elem[2], \ + self.gridw, self.gridh]) + self.refresh() if self.do_steps: while self.do_steps and not self.step_fwd: # Loop until we are told to step forward or to start running @@ -349,12 +353,8 @@ more_for_element = False # This makes things a bit slower but makes sure we don't erase # other elements on our way. - pmw, pmh = pm[0].get_size() self.clear_visualization_area() - for name in self.vis_drawn: - data = self.vis_pixmaps[name[0]] - self.pixmap.draw_drawable(self.gc, data[0], 0, 0, \ - data[1], data[2], -1, -1) + self.draw_non_moving() # Draw the element. self.pixmap.draw_drawable(self.gc, pm[0], 0, 0, pm[1], pm[2], \ -1, -1) @@ -371,9 +371,30 @@ self.vis_steps.append(['oev_delay_pm', self.vis_split_x, \ self.gridh * steps]) + def draw_non_moving(self): + """Draw the visualized objects not currently moving.""" + for name in self.vis_permanents: + data = self.vis_permanent_pixmaps[name[0]] + self.pixmap.draw_drawable(self.gc, data[0], 0, 0, \ + data[1], data[2], -1, -1) + for name in self.vis_drawn: + data = self.vis_pixmaps[name[0]] + self.pixmap.draw_drawable(self.gc, data[0], 0, 0, \ + data[1], data[2], -1, -1) + def draw_show_function(self, function): """Store displaying a function to self.vis_steps.""" + name = 'oev_function_' + function + x = self.gridw + y = self.gridh + color = self.static_const_color + w = self.vis_split_x - self.gridw + h = self.const_split - self.gridh + txt = function + self.create_element_pixmap(name, x, y, color, w, h, txt, \ + permanent = True) self.vis_steps.append(['const_' + function, self.gridw, self.gridh]) + self.vis_steps.append(['oev_non_animation', 'function', name]) self.draw_delay(5) def draw_show_output(self, output, source): @@ -508,7 +529,8 @@ pmname = source self.vis_steps.append([pmname, endx, endy]) - def create_element_pixmap(self, name, x, y, fgc, w, h, txt): + def create_element_pixmap(self, name, x, y, fgc, w, h, txt, \ + permanent = False): """Build a pixmap for an element of a visualization.""" gc = self.vDraw.new_gc() pm = gtk.gdk.Pixmap(self.vDraw, w, h) @@ -519,7 +541,8 @@ layout = self.vArea.create_pango_layout(txt) pm.draw_layout(self.gc, 2, 2, layout) self.vis_pixmaps[name] = [pm, x, y] - return pm + if permanent: + self.vis_permanent_pixmaps[name] = [pm, x, y] def refresh(self): """Refresh the OpenExVis window.""" @@ -603,6 +626,8 @@ def do_visualization(self): self.oArea.get_buffer().set_text('') + self.vis_permanents = [] + self.vis_permanent_pixmaps = {} # Make sure the UI only calls visualize() once for one # visualization. self.cArea.set_sensitive(False) |