diff options
author | Barry Warsaw <barry@python.org> | 1998-03-16 23:08:53 (GMT) |
---|---|---|
committer | Barry Warsaw <barry@python.org> | 1998-03-16 23:08:53 (GMT) |
commit | 70787ed8ae896a94ab1dc4399472ca70a79edd87 (patch) | |
tree | a56db0ba7832e6ed4effabf84b6b16d80468cc45 /Tools/pynche/StripViewer.py | |
parent | a114eb5bd3b4e2fab829c241e9f92e00a512cb76 (diff) | |
download | cpython-70787ed8ae896a94ab1dc4399472ca70a79edd87.zip cpython-70787ed8ae896a94ab1dc4399472ca70a79edd87.tar.gz cpython-70787ed8ae896a94ab1dc4399472ca70a79edd87.tar.bz2 |
Add option for no updates on dragging
Diffstat (limited to 'Tools/pynche/StripViewer.py')
-rw-r--r-- | Tools/pynche/StripViewer.py | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/Tools/pynche/StripViewer.py b/Tools/pynche/StripViewer.py index 608a58d..25a204b 100644 --- a/Tools/pynche/StripViewer.py +++ b/Tools/pynche/StripViewer.py @@ -123,7 +123,7 @@ class StripWidget(Pmw.MegaWidget): canvas.pack() canvas.bind('<ButtonRelease-1>', self.__select_chip) - canvas.bind('<B1-Motion>', self.__select_chip) + canvas.bind('<B1-Motion>', self.__drag_select_chip) # Load a proc into the Tcl interpreter. This is used in the # set_color() method to speed up setting the chip colors. @@ -162,6 +162,7 @@ class StripWidget(Pmw.MegaWidget): assert self.__axis in (0, 1, 2) self.initialiseoptions(StripWidget) self.__delegate = self['delegate'] + self.__update_while_dragging = 1 def __set_color(self): rgbtuple = self['color'] @@ -182,17 +183,11 @@ class StripWidget(Pmw.MegaWidget): if chip and (1 <= chip[0] <= self.__numchips): color = self.__chips[chip[0]-1] rgbtuple = ColorDB.rrggbb_to_triplet(color) - self.__delegate.set_color(self, rgbtuple) -## import profile -## import pstats -## import tempfile -## statfile = tempfile.mktemp() -## p = profile.Profile() -## p.runcall(self.__delegate.set_color, self, rgbtuple) -## p.dump_stats(statfile) -## s = pstats.Stats(statfile) -## s.strip_dirs().sort_stats('time').print_stats(10) + + def __drag_select_chip(self, event=None): + if self.__update_while_dragging: + self.__select_chip(event) def __set_delegate(self): self.__delegate = self['delegate'] @@ -244,3 +239,6 @@ class StripWidget(Pmw.MegaWidget): else: outline = 'black' self.__canvas.itemconfigure(chip, outline=outline) + + def set_update_while_dragging(self, flag): + self.__update_while_dragging = flag |