mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-01-06 11:09:57 -08:00
79cf61c53e
* Bump rumps from 0.3.0 to 0.4.0 Bumps [rumps](https://github.com/jaredks/rumps) from 0.3.0 to 0.4.0. - [Release notes](https://github.com/jaredks/rumps/releases) - [Changelog](https://github.com/jaredks/rumps/blob/master/CHANGES.rst) - [Commits](https://github.com/jaredks/rumps/commits) --- updated-dependencies: - dependency-name: rumps dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * Update rumps==0.4.0 Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> [skip ci]
33 lines
1.4 KiB
Python
33 lines
1.4 KiB
Python
from AppKit import NSApplication, NSTextField, NSSecureTextField, NSKeyDown, NSCommandKeyMask
|
|
|
|
|
|
class Editing(NSTextField):
|
|
"""NSTextField with cut, copy, paste, undo and selectAll"""
|
|
def performKeyEquivalent_(self, event):
|
|
return _perform_key_equivalent(self, event)
|
|
|
|
|
|
class SecureEditing(NSSecureTextField):
|
|
"""NSSecureTextField with cut, copy, paste, undo and selectAll"""
|
|
def performKeyEquivalent_(self, event):
|
|
return _perform_key_equivalent(self, event)
|
|
|
|
|
|
def _perform_key_equivalent(self, event):
|
|
if event.type() == NSKeyDown and event.modifierFlags() & NSCommandKeyMask:
|
|
if event.charactersIgnoringModifiers() == "x":
|
|
NSApplication.sharedApplication().sendAction_to_from_("cut:", None, self)
|
|
return True
|
|
elif event.charactersIgnoringModifiers() == "c":
|
|
NSApplication.sharedApplication().sendAction_to_from_("copy:", None, self)
|
|
return True
|
|
elif event.charactersIgnoringModifiers() == "v":
|
|
NSApplication.sharedApplication().sendAction_to_from_("paste:", None, self)
|
|
return True
|
|
elif event.charactersIgnoringModifiers() == "z":
|
|
NSApplication.sharedApplication().sendAction_to_from_("undo:", None, self)
|
|
return True
|
|
elif event.charactersIgnoringModifiers() == "a":
|
|
NSApplication.sharedApplication().sendAction_to_from_("selectAll:", None, self)
|
|
return True
|