コード例 #1
0
def copy_modify_paste(modifying_function):
    selected_text = utils.getSelectedText()
    if not selected_text:
        print "No selected text?"
        return
    modified_text = modifying_function(str(selected_text))
    # tried to use the original clipboard here, but couldn't get it to "clear" -- some apps would
    # somehow get the original, unmodified text when the paste happened
    new_clipboard = Clipboard()
    new_clipboard.set_text(modified_text)
    new_clipboard.copy_to_system()
    Key("c-v").execute()
コード例 #2
0
def copy_modify_paste(modifying_function):
    selected_text = utils.getSelectedText()
    if not selected_text:
        print "No selected text?"
        return
    modified_text = modifying_function(str(selected_text))
    # tried to use the original clipboard here, but couldn't get it to "clear" -- some apps would
    # somehow get the original, unmodified text when the paste happened
    new_clipboard = Clipboard()
    new_clipboard.set_text(modified_text)
    new_clipboard.copy_to_system()
    Key("c-v").execute()
コード例 #3
0
def save_to_clipboard(text):
    """Stores text to the clipboard"""
    clipboard = Clipboard(from_system=True)
    clipboard.set_text(text)
    clipboard.copy_to_system()
コード例 #4
0
def reverse_clip():
    """Reverses the most recent clipboard item"""
    clip = text_clip()
    clipboard = Clipboard(from_system=True)
    clipboard.set_text(clip[::-1])
    clipboard.copy_to_system()
コード例 #5
0
def restore_clip():
    """Restores the most recent clipboard item"""
    global clip
    clipboard = Clipboard(from_system=True)
    clipboard.set_text(clip)
    clipboard.copy_to_system()
コード例 #6
0
ファイル: clipboard.py プロジェクト: barrysims/dragonfly
def save_to_clipboard(text):
    """Stores text to the clipboard"""
    clipboard = Clipboard(from_system=True)
    clipboard.set_text(text)
    clipboard.copy_to_system()
コード例 #7
0
ファイル: clipboard.py プロジェクト: barrysims/dragonfly
def reverse_clip():
    """Reverses the most recent clipboard item"""
    clip = text_clip()
    clipboard = Clipboard(from_system=True)
    clipboard.set_text(clip[::-1])
    clipboard.copy_to_system()
コード例 #8
0
ファイル: clipboard.py プロジェクト: barrysims/dragonfly
def restore_clip():
    """Restores the most recent clipboard item"""
    global clip
    clipboard = Clipboard(from_system=True)
    clipboard.set_text(clip)
    clipboard.copy_to_system()