r4677 - developers/werner/ahrt/host/tmc/lib
werner at docs.openmoko.org
werner at docs.openmoko.org
Sun Sep 28 03:44:31 CEST 2008
Author: werner
Date: 2008-09-28 03:44:31 +0200 (Sun, 28 Sep 2008)
New Revision: 4677
Modified:
developers/werner/ahrt/host/tmc/lib/dxplore.py
Log:
Highlight:
- waveforms can be edited, e.g., to manually correct glitches
Details:
- lib/dxplore.py (main_window): key "e" (edit) changes the value of the sample
on the right side of the cursor
Modified: developers/werner/ahrt/host/tmc/lib/dxplore.py
===================================================================
--- developers/werner/ahrt/host/tmc/lib/dxplore.py 2008-09-28 01:42:31 UTC (rev 4676)
+++ developers/werner/ahrt/host/tmc/lib/dxplore.py 2008-09-28 01:44:31 UTC (rev 4677)
@@ -33,6 +33,8 @@
color_normal = "green"
color_selected = "yellow"
+ color_edit = "red"
+ edit_border = 2
decode_color = "white"
decode_bg_color = "#4040ff"
decode_font = "-*-helvetica-medium-r-*-*-12-*-*-*-*-*-*-*"
@@ -43,11 +45,22 @@
self.tag = "d_%d" % number
self.zoom_tag = "d_z_%d" % number
self.d = data
+ self.edits = []
self.draw()
def draw(self):
if self.main.pos0 > len(self.d):
return
+
+ for pos in self.edits:
+ if pos < self.main.pos0:
+ return
+ self.main.w.create_rectangle(
+ self.x(pos)-self.edit_border, self.y(0)+self.edit_border,
+ self.x(pos+1)+self.edit_border, self.y(1)-self.edit_border,
+ fill = self.color_edit, outline = self.color_edit,
+ tags = "d_ed_"+self.tag)
+
pos0 = max(0, self.main.pos0)
last = self.d[pos0]
line = [ self.x(pos0), self.y(last) ]
@@ -86,6 +99,7 @@
def redraw(self):
self.main.w.delete(self.tag)
+ self.main.w.delete("d_ed_"+self.tag)
self.draw()
def x(self, sample):
@@ -134,7 +148,15 @@
self.main.w.delete("d_fg_"+self.tag)
self.main.w.delete("d_bg_"+self.tag)
+ def edit(self, pos):
+ self.d[pos] = 1-self.d[pos]
+ if pos in self.edits:
+ self.edits.remove(pos)
+ else:
+ self.edits.append(pos)
+ self.redraw()
+
# Base class to have access to the pretty-printing methods.
class measurement_base:
@@ -429,6 +451,7 @@
master.bind("-", self.zoom_out)
master.bind(".", self.center)
master.bind("c", self.center)
+ master.bind("e", self.edit)
master.bind("<space>", self.user_coord)
def decoder_menu(self, master, ch, n):
@@ -678,6 +701,12 @@
self.decode_from = None
self.meas_start.hide()
+ def edit(self, event):
+ if self.selected is None:
+ return
+ self.selected.edit(self.cur.pos)
+ self.cur.move(self.cur.x)
+
class dxplore:
More information about the commitlog
mailing list