417 |
|
|
418 |
def key(self, key): |
def key(self, key): |
419 |
self.context.setSlowAnimation() |
self.context.setSlowAnimation() |
420 |
# p("Entered key: ", key) |
p("Entered key: ", key) |
421 |
if key == 'Escape' or key == 'Tab': |
if key == 'Escape' or key == 'Tab': |
422 |
"""Removes the focus from the current accursed node and sets no new accursed node.""" |
"""Removes the focus from the current accursed node and sets no new accursed node.""" |
423 |
self.context.c.setAccursed(None) |
self.context.c.setAccursed(None) |
469 |
elif key == 'Right': |
elif key == 'Right': |
470 |
"""Move the cursor a character to the right.""" |
"""Move the cursor a character to the right.""" |
471 |
self.context.c.moveRight() |
self.context.c.moveRight() |
472 |
if key == "Ctrl-HomE": |
elif key == "Ctrl-HomE": |
473 |
"""Move the cursor into the beginning of the text.""" |
"""Move the cursor into the beginning of the text.""" |
474 |
self.context.c.moveBegin() |
self.context.c.moveBegin() |
475 |
if key == "Ctrl-EnD": |
elif key == "Ctrl-EnD": |
476 |
"""Move the cursor to the end of the text.""" |
"""Move the cursor to the end of the text.""" |
477 |
self.context.c.moveEnd() |
self.context.c.moveEnd() |
478 |
if key == "Ctrl-C" or "Ctrl-K": |
elif key == "Ctrl-C" or key == "Ctrl-K": |
479 |
"""Copy the content of the node into the clipboard.""" |
"""Copy the content of the node into the clipboard.""" |
480 |
text = self.alphContent.getText(fen.graph, self.context.c.getAccursed()) |
text = self.alphContent.getText(fen.graph, self.context.c.getAccursed()) |
481 |
PUIClipboard.puiCopy(text) |
PUIClipboard.puiCopy(text) |
482 |
if key == "Ctrl-V" or key=="Ctrl-Y": |
print 'PUI copied:', PUIClipboard.getText() |
483 |
|
elif key == "Ctrl-V" or key =="Ctrl-Y": |
484 |
"""Paste the content the clipboard just after the cursor.""" |
"""Paste the content the clipboard just after the cursor.""" |
485 |
|
print 'PUI to paste:', PUIClipboard.getText() |
486 |
self.context.insertText(PUIClipboard.getText()) |
self.context.insertText(PUIClipboard.getText()) |
487 |
print 'PUI', PUIClipboard.getText() |
elif key == "Home" or key == "Ctrl-A": |
|
if key == "Home" or key == "Ctrl-A": |
|
488 |
"""Move the cursor into the beginning of the line.""" |
"""Move the cursor into the beginning of the line.""" |
489 |
self.context.c.moveBeginLine() |
self.context.c.moveBeginLine() |
490 |
if key == "End" or key == "Ctrl-E": |
elif key == "End" or key == "Ctrl-E": |
491 |
"""Move the cursor to the end of the line.""" |
"""Move the cursor to the end of the line.""" |
492 |
self.context.c.moveEndLine() |
self.context.c.moveEndLine() |
493 |
if key == "Ctrl-2": |
elif key == "Ctrl-2": |
494 |
"""Set 2D filleting.""" |
"""Set 2D filleting.""" |
495 |
self.view.depthColor = 0 |
self.view.depthColor = 0 |
496 |
self.view.fillet3d = 0 |
self.view.fillet3d = 0 |
497 |
self.main.floatingView.depthColor = 0 |
self.main.floatingView.depthColor = 0 |
498 |
self.main.floatingView.fillet3d = 0 |
self.main.floatingView.fillet3d = 0 |
499 |
if key == "Ctrl-3": |
elif key == "Ctrl-3": |
500 |
"""Set 3D filleting.""" |
"""Set 3D filleting.""" |
501 |
self.view.depthColor = 1 |
self.view.depthColor = 1 |
502 |
self.view.fillet3d = 1 |
self.view.fillet3d = 1 |
503 |
self.main.floatingView.depthColor = 1 |
self.main.floatingView.depthColor = 1 |
504 |
self.main.floatingView.fillet3d = 1 |
self.main.floatingView.fillet3d = 1 |
505 |
if key == "Ctrl-B": |
elif key == "Ctrl-B": |
506 |
"""Buffer accursed node.""" |
"""Buffer accursed node.""" |
507 |
self.context.components.append(self.context.c.getAccursed()) |
self.context.components.append(self.context.c.getAccursed()) |
508 |
if key == "Ctrl-0": |
elif key == "Ctrl-0": |
509 |
"""Set calibrating state of custom controller on / off.""" |
"""Set calibrating state of custom controller on / off.""" |
510 |
if self.calibrating and self.naxes: |
if self.calibrating and self.naxes: |
511 |
p("Custom controller calibrated.") |
p("Custom controller calibrated.") |