From: Tero K. <te...@us...> - 2005-08-15 00:40:30
|
Update of /cvsroot/openexvis/openexvis In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29186 Modified Files: ChangeLog openexvis.py Log Message: Lines can now be marked to be skipped while visualizing. Index: openexvis.py =================================================================== RCS file: /cvsroot/openexvis/openexvis/openexvis.py,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- openexvis.py 14 Aug 2005 22:46:59 -0000 1.6 +++ openexvis.py 15 Aug 2005 00:40:15 -0000 1.7 @@ -47,8 +47,7 @@ self.oevWindow.maximize() # Set up the code area. - self.clear_code_buffer() - self.cArea.set_show_line_numbers(True) + self.init_code_area() # Set up the visualization area. self.init_visualization_area() @@ -77,6 +76,16 @@ self.const_layout = self.vArea.create_pango_layout("Constantly empty.") self.eval_layout = self.vArea.create_pango_layout("Non-evaluation.") + def init_code_area(self): + """Initialize the code area.""" + self.clear_code_buffer() + self.cArea.set_show_line_numbers(True) + # Markers are used to tell the visualizer which lines to not visualize. + self.cArea.set_show_line_markers(True) + marker_image = \ + gtk.gdk.pixbuf_new_from_file('./images/skip_line_marker.xpm') + self.cArea.set_marker_pixbuf('SKIP_LINE_MARKER', marker_image) + def set_positions(self): """Set some important positions in the visualization area.""" self.vis_width, self.vis_height = self.vDraw.get_size() @@ -159,6 +168,14 @@ self.vis_pixmaps = [] # Mark the line we're visualizing on the code area. vis_code = self.mark_line(lineno) + # If the line is marked, we should skip it. Note that the buffer counts + # from 0 but the user visually sees a line one further. + line_iter = self.cBuf.get_iter_at_line(lineno-1) + end_iter = line_iter.copy() + end_iter.forward_to_line_end() + line_markers = self.cBuf.get_markers_in_region(line_iter, end_iter) + if line_markers: + return True # Update the visualization area. self.update_pixmaps(vis_code, viscommands) moresteps = True @@ -378,7 +395,8 @@ self.cBuf.remove_tag_by_name('visualize', \ self.cBuf.get_start_iter(), \ self.cBuf.get_end_iter()) - # Highlight the line currently visualized. + # Highlight the line currently visualized. Note that the buffer starts + # counting from 0 but we want to highlight lines from 1 line further. si = self.cBuf.get_iter_at_line(lineno-1) ei = si.copy() ei.forward_line() @@ -579,9 +597,29 @@ """Draw the visualization area contents.""" x , y, width, height = event.area # The image is a pixmap we build behind the scenes. - self.vDraw.draw_drawable(self.vArea.get_style().fg_gc[gtk.STATE_NORMAL],\ + self.vDraw.draw_drawable( \ + self.vArea.get_style().fg_gc[gtk.STATE_NORMAL],\ self.pixmap, x, y, x, y, width, height) + def on_codeArea_button_press_event(self, obj, event): + """Update the markers.""" + if obj.get_window_type(event.window) == gtk.TEXT_WINDOW_LEFT: + # We have a click over the left border. + event_x, event_y = event.get_coords() + x, y = self.cArea.window_to_buffer_coords(gtk.TEXT_WINDOW_LEFT, \ + int(event_x), int(event_y)) + line_iter, line_top = self.cArea.get_line_at_y(y) + lineno = line_iter.get_line() + print "About to set line marker at ", lineno + end_iter = line_iter.copy() + end_iter.forward_to_line_end() + line_markers = self.cBuf.get_markers_in_region(line_iter, end_iter) + if not line_markers: + self.cBuf.create_marker(None, 'SKIP_LINE_MARKER', line_iter) + else: + for m in line_markers: + self.cBuf.delete_marker(m) + def main(): oev = OevGUI() Index: ChangeLog =================================================================== RCS file: /cvsroot/openexvis/openexvis/ChangeLog,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- ChangeLog 12 Aug 2005 23:01:44 -0000 1.5 +++ ChangeLog 15 Aug 2005 00:40:15 -0000 1.6 @@ -3,6 +3,7 @@ CVS + * Lines can now be marked to be skipped while visualizing * Major changes to the code handling visualization data * Major changes to visualization area * Code area is now insensitive while visualizing |