def isoDate(): """ Sends a date in ISO format """ time.sleep(0.1) # wait a little in order to be sure that user not pressing a hotkey anymore output = datetime.datetime.now().strftime("%Y-%m-%d") storedClipboard = ClipboardUtil.pasteFromClipboardXsel() sendText(output) ClipboardUtil.copyToClipboardXclip(storedClipboard)
def isoDate(): """ Sends a date in ISO format """ time.sleep( 0.1 ) # wait a little in order to be sure that user not pressing a hotkey anymore output = datetime.datetime.now().strftime("%Y-%m-%d") storedClipboard = ClipboardUtil.pasteFromClipboardXsel() sendText(output) ClipboardUtil.copyToClipboardXclip(storedClipboard)
def newTask(): """ Sends a task template """ KeyboardUtil.setDefaultLanguage() output = datetime.datetime.now().strftime("%Y%m%d%H%M%S") Tk().withdraw() text = tkSimpleDialog.askstring('Task category', 'Category::') if text is None or text == "": sys.exit() #works as well #time.sleep(0.24) #output = system.exec_command("date +%Y%m%d%H%M%S") #time = output.stdout.readline() storedClipboard = ClipboardUtil.pasteFromClipboardXsel() sendText("task " + text + "\n" + " " + output + " " + "\n\n" + "solution" + "\n\n" + "info" + "\n\n" + "keywords") sendKey("Home Up Up Up Up Up Up End") ClipboardUtil.copyToClipboardXclip(storedClipboard)
""" Sends series of characters to UI. Based on xdotool. This tool must be installed. This class uses fastest way: clipboard and xdotool. Author Andrew Terekhine Since 2011-11-23 """ from Tkinter import Tk import datetime import sys import tkSimpleDialog import ClipboardUtil import SendToUi output = datetime.datetime.now().strftime("%Y%m%d%H%M%S") Tk().withdraw() text = tkSimpleDialog.askstring('Task category', 'Category::') if text is None or text == "": sys.exit() #works as well #time.sleep(0.24) #output = system.exec_command("date +%Y%m%d%H%M%S") #time = output.stdout.readline() storedClipboard = ClipboardUtil.pasteFromClipboardXsel() SendToUi.sendText("task " + text + "\n" + " " + output + " " + "\n\n" + "solution" + "\n\n" + "info" + "\n\n" + "keywords") SendToUi.sendKey("Home Up Up Up Up Up Up End") ClipboardUtil.copyToClipboardXclip(storedClipboard)
def getSelection(): storedClipboard = SendToUi.beforeSetClipboard() text = ClipboardUtil.pasteFromClipboardXsel() SendToUi.afterSetClipboard(storedClipboard) return text