1919
2020'''
2121
22- __version__ = '10.0.4 '
22+ __version__ = '10.0.5 '
2323
2424import sys
2525import threading
@@ -78,6 +78,9 @@ class Operation:
7878 DRAG = 'drag'
7979 DUMP = 'dump'
8080 FLING_BACKWARD = 'fling_backward'
81+ FLING_FORWARD = 'fling_forward'
82+ FLING_TO_BEGINNING = 'fling_to_beginning'
83+ FLING_TO_END = 'fling_to_end'
8184 TEST = 'test'
8285 TEST_TEXT = 'test_text'
8386 TOUCH_VIEW = 'touch_view'
@@ -92,8 +95,10 @@ class Operation:
9295
9396 @staticmethod
9497 def fromCommandName (commandName ):
95- if commandName == 'flingBackward' :
96- return Operation .FLING_BACKWARD
98+ MAP = {'flingBackward' : Operation .FLING_BACKWARD , 'flingForward' : Operation .FLING_FORWARD ,
99+ 'flingToBeginning' : Operation .FLING_TO_BEGINNING , 'flingToEnd' : Operation .FLING_TO_END
100+ }
101+ return MAP [commandName ]
97102
98103class Culebron :
99104 APPLICATION_NAME = "Culebra"
@@ -925,7 +930,8 @@ def drawDragLine(self, x0, y0, x1, y1):
925930 def executeCommandAndRefresh (self , command ):
926931 self .showVignette ()
927932 if DEBUG :
928- print >> sys .stderr , 'command=' , command , command .__name__ , command .__self__ , command .__self__ .view
933+ print >> sys .stderr , 'DEBUG: command=' , command , command .__name__
934+ print >> sys .stderr , 'DEBUG: command=' , command .__self__ , command .__self__ .view
929935 self .printOperation (command .__self__ .view , Operation .fromCommandName (command .__name__ ))
930936 command ()
931937 self .printOperation (None , Operation .SLEEP , Operation .DEFAULT )
@@ -1244,8 +1250,8 @@ def __init__(self, menu, description, view, culebron):
12441250 self .description = description
12451251 self .add_command (label = 'Fling backward' , command = lambda : culebron .executeCommandAndRefresh (view .uiScrollable .flingBackward ))
12461252 self .add_command (label = 'Fling forward' , command = lambda : culebron .executeCommandAndRefresh (view .uiScrollable .flingForward ))
1247- self .add_command (label = 'Fling to beginning' , command = lambda : culebron .executeCommandAndRefresh (lambda : view .uiScrollable .flingToBeginning ( 10 ) ))
1248- self .add_command (label = 'Fling to end' , command = lambda : culebron .executeCommandAndRefresh (lambda : view .uiScrollable .flingToEnd ( 10 ) ))
1253+ self .add_command (label = 'Fling to beginning' , command = lambda : culebron .executeCommandAndRefresh (view .uiScrollable .flingToBeginning ))
1254+ self .add_command (label = 'Fling to end' , command = lambda : culebron .executeCommandAndRefresh (view .uiScrollable .flingToEnd ))
12491255
12501256 def __init__ (self , culebron , view ):
12511257 # Tkninter.Menu is not extending object, so we can't do this:
0 commit comments