本文整理汇总了Python中actions.Actions.can_undo方法的典型用法代码示例。如果您正苦于以下问题:Python Actions.can_undo方法的具体用法?Python Actions.can_undo怎么用?Python Actions.can_undo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类actions.Actions
的用法示例。
在下文中一共展示了Actions.can_undo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Model
# 需要导入模块: from actions import Actions [as 别名]
# 或者: from actions.Actions import can_undo [as 别名]
model = Model( ( width, height ), observer )
screen = pygame.display.set_mode( ( width, height + 40 ) )
objects = [ ]
actions = Actions()
leftClick = rightClick = False
while running:
for event in pygame.event.get():
if QUIT == event.type:
running = False
elif KEYUP == event.type:
if K_g == event.key:
model = model.update_position( Point( 0, 0, 0 ) )
elif K_i == event.key:
mode = Mode.INSERT
elif K_u == event.key:
if actions.can_undo():
actions.undo()
elif K_r == event.key:
if actions.can_redo():
actions.redo()
elif K_ESCAPE == event.key:
mode = Mode.COMMAND
elif len( objects ) > 0 and K_RETURN == event.key:
actions.do( \
( objects[ -1 ].close, [] ), \
( objects[ -1 ].open, [] ) \
)
elif K_o == event.key: mode = Mode.OBSERVE
elif K_v == event.key: mode = Mode.VISUAL
if K_COLON | KMOD_SHIFT == event.key and Mode.COMMAND == mode:
command = enter_command( screen )