mirror of
https://github.com/python/cpython.git
synced 2025-11-03 11:23:31 +00:00
Add option for no updates on dragging
This commit is contained in:
parent
a114eb5bd3
commit
70787ed8ae
1 changed files with 9 additions and 11 deletions
|
|
@ -123,7 +123,7 @@ class StripWidget(Pmw.MegaWidget):
|
||||||
|
|
||||||
canvas.pack()
|
canvas.pack()
|
||||||
canvas.bind('<ButtonRelease-1>', self.__select_chip)
|
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
|
# Load a proc into the Tcl interpreter. This is used in the
|
||||||
# set_color() method to speed up setting the chip colors.
|
# 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)
|
assert self.__axis in (0, 1, 2)
|
||||||
self.initialiseoptions(StripWidget)
|
self.initialiseoptions(StripWidget)
|
||||||
self.__delegate = self['delegate']
|
self.__delegate = self['delegate']
|
||||||
|
self.__update_while_dragging = 1
|
||||||
|
|
||||||
def __set_color(self):
|
def __set_color(self):
|
||||||
rgbtuple = self['color']
|
rgbtuple = self['color']
|
||||||
|
|
@ -182,17 +183,11 @@ class StripWidget(Pmw.MegaWidget):
|
||||||
if chip and (1 <= chip[0] <= self.__numchips):
|
if chip and (1 <= chip[0] <= self.__numchips):
|
||||||
color = self.__chips[chip[0]-1]
|
color = self.__chips[chip[0]-1]
|
||||||
rgbtuple = ColorDB.rrggbb_to_triplet(color)
|
rgbtuple = ColorDB.rrggbb_to_triplet(color)
|
||||||
|
|
||||||
self.__delegate.set_color(self, rgbtuple)
|
self.__delegate.set_color(self, rgbtuple)
|
||||||
## import profile
|
|
||||||
## import pstats
|
def __drag_select_chip(self, event=None):
|
||||||
## import tempfile
|
if self.__update_while_dragging:
|
||||||
## statfile = tempfile.mktemp()
|
self.__select_chip(event)
|
||||||
## 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 __set_delegate(self):
|
def __set_delegate(self):
|
||||||
self.__delegate = self['delegate']
|
self.__delegate = self['delegate']
|
||||||
|
|
@ -244,3 +239,6 @@ class StripWidget(Pmw.MegaWidget):
|
||||||
else:
|
else:
|
||||||
outline = 'black'
|
outline = 'black'
|
||||||
self.__canvas.itemconfigure(chip, outline=outline)
|
self.__canvas.itemconfigure(chip, outline=outline)
|
||||||
|
|
||||||
|
def set_update_while_dragging(self, flag):
|
||||||
|
self.__update_while_dragging = flag
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue