24
paste.py
24
paste.py
@@ -15,8 +15,8 @@ def _cmd_paste(arg1=None, arg2=None):
|
|||||||
root = tk.Tk(baseName="")
|
root = tk.Tk(baseName="")
|
||||||
root.withdraw()
|
root.withdraw()
|
||||||
result = root.clipboard_get()
|
result = root.clipboard_get()
|
||||||
newline = prof.settings_boolean_get("paste", "newline", False)
|
newline = prof.settings_boolean_get("paste", "newline", True)
|
||||||
if newline:
|
if len(result.splitlines()) > 1 and newline:
|
||||||
prof.send_line(u'\u000A' + result)
|
prof.send_line(u'\u000A' + result)
|
||||||
else:
|
else:
|
||||||
prof.send_line(result)
|
prof.send_line(result)
|
||||||
@@ -25,34 +25,34 @@ def _cmd_paste(arg1=None, arg2=None):
|
|||||||
|
|
||||||
if arg1 == "newline":
|
if arg1 == "newline":
|
||||||
if not arg2:
|
if not arg2:
|
||||||
root = tk.Tk(baseName="")
|
prof.cons_show("")
|
||||||
root.withdraw()
|
newline = prof.settings_boolean_get("paste", "newline", True)
|
||||||
result = root.clipboard_get()
|
if newline:
|
||||||
prof.send_line(u'\u000A' + result)
|
prof.cons_show("paste.py newline: on")
|
||||||
|
else:
|
||||||
|
prof.cons_show("paste.py newline: off")
|
||||||
elif arg2 == "on":
|
elif arg2 == "on":
|
||||||
prof.settings_boolean_set("paste", "newline", True)
|
prof.settings_boolean_set("paste", "newline", True)
|
||||||
prof.cons_show("paste.py newline enabled")
|
prof.cons_show("paste.py newline enabled.")
|
||||||
elif arg2 == "off":
|
elif arg2 == "off":
|
||||||
prof.settings_boolean_set("paste", "newline", False)
|
prof.settings_boolean_set("paste", "newline", False)
|
||||||
prof.cons_show("paste.py newline disabled")
|
prof.cons_show("paste.py newline disabled.")
|
||||||
else:
|
else:
|
||||||
prof.cons_bad_cmd_usage("/paste")
|
prof.cons_bad_cmd_usage("/paste")
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
prof.cons_bad_cmd_usage("/paste")
|
prof.cons_bad_cmd_usage("/paste")
|
||||||
|
|
||||||
|
|
||||||
def prof_init(version, status, account_name, fulljid):
|
def prof_init(version, status, account_name, fulljid):
|
||||||
synopsis = [
|
synopsis = [
|
||||||
"/paste",
|
"/paste",
|
||||||
"/paste newline",
|
|
||||||
"/paste newline on|off"
|
"/paste newline on|off"
|
||||||
]
|
]
|
||||||
description = "Paste contents of clipboard."
|
description = "Paste contents of clipboard."
|
||||||
args = [
|
args = [
|
||||||
[ "newline", "Send newline before clipboard contents." ],
|
[ "newline on|off", "Send newline before multiline clipboard text, defaults to on" ]
|
||||||
[ "newline on|off", "Always send newline." ]
|
|
||||||
]
|
]
|
||||||
examples = []
|
examples = []
|
||||||
prof.register_command("/paste", 0, 2, synopsis, description, args, examples, _cmd_paste)
|
prof.register_command("/paste", 0, 2, synopsis, description, args, examples, _cmd_paste)
|
||||||
|
|||||||
Reference in New Issue
Block a user