Changeset 4677


Ignore:
Timestamp:
09/28/08 03:44:31 (5 years ago)
Author:
werner
Message:

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
File:
1 edited

Legend:

Unmodified
Added
Removed
  • developers/werner/ahrt/host/tmc/lib/dxplore.py

    r4663 r4677  
    3434    color_normal = "green" 
    3535    color_selected = "yellow" 
     36    color_edit = "red" 
     37    edit_border = 2 
    3638    decode_color = "white" 
    3739    decode_bg_color = "#4040ff" 
     
    4446        self.zoom_tag = "d_z_%d" % number 
    4547        self.d = data 
     48        self.edits = [] 
    4649        self.draw() 
    4750 
     
    4952        if self.main.pos0 > len(self.d): 
    5053            return 
     54 
     55        for pos in self.edits: 
     56            if pos < self.main.pos0: 
     57                return 
     58            self.main.w.create_rectangle( 
     59              self.x(pos)-self.edit_border, self.y(0)+self.edit_border, 
     60              self.x(pos+1)+self.edit_border, self.y(1)-self.edit_border, 
     61              fill = self.color_edit, outline = self.color_edit, 
     62              tags = "d_ed_"+self.tag) 
     63 
    5164        pos0 = max(0, self.main.pos0) 
    5265        last = self.d[pos0] 
     
    87100    def redraw(self): 
    88101        self.main.w.delete(self.tag) 
     102        self.main.w.delete("d_ed_"+self.tag) 
    89103        self.draw() 
    90104 
     
    134148        self.main.w.delete("d_fg_"+self.tag) 
    135149        self.main.w.delete("d_bg_"+self.tag) 
     150 
     151    def edit(self, pos): 
     152        self.d[pos] = 1-self.d[pos] 
     153        if pos in self.edits: 
     154            self.edits.remove(pos) 
     155        else: 
     156            self.edits.append(pos) 
     157        self.redraw() 
    136158 
    137159 
     
    430452        master.bind(".", self.center) 
    431453        master.bind("c", self.center) 
     454        master.bind("e", self.edit) 
    432455        master.bind("<space>", self.user_coord) 
    433456 
     
    679702        self.meas_start.hide() 
    680703 
     704    def edit(self, event): 
     705        if self.selected is None: 
     706            return 
     707        self.selected.edit(self.cur.pos) 
     708        self.cur.move(self.cur.x) 
     709         
    681710 
    682711class dxplore: 
Note: See TracChangeset for help on using the changeset viewer.