Ejemplo n.º 1
0
import subprocess
import sys
import gtk
import ClipboardUtil
import Message
import subprocess
import SendToUi
import SendToUi
import SystemUtil

fireFoxPid=SystemUtil.getProcessOutput("pidof firefox")

if fireFoxPid == "":
    sys.exit("Firefox window is not found")
lines = fireFoxPid.split(None, 4)
fireFoxPid = lines[0]

fireFoxWindowName=SystemUtil.getWindowNameByProcessId(fireFoxPid)
(title,s,url) = fireFoxWindowName.partition('- Firefox -')
lines = title.split(None, 4)
title = lines[4]

# sometimes there are several browser windows are opened get the url of the first window
lines = url.split(None, 2)
url = lines[0]

storedClipboard = ClipboardUtil.pasteFromClipboardXsel()

SendToUi.sendText(title +"\n    " + url.lstrip())

ClipboardUtil.copyToClipboardXclip(storedClipboard)
Ejemplo n.º 2
0
"""
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)
Ejemplo n.º 3
0
def fireFoxAltWToCtrlW():
    if Common.isAtiveTitle(Common.FIREFOX_TITLE):
        SendToUi.sendKey("Alt")
        SendToUi.sendKey("Control+w")
Ejemplo n.º 4
0
def search(keyword):
    KeyboardUtil.setDefaultLanguage()
    open()
    scanForKeyword()
    if keyword != "":
        SendToUi.sendKey(keyword)
Ejemplo n.º 5
0
def scanForKeyword():
    SendToUi.sendKey("Control+Home Control+e underscore underscore")
Ejemplo n.º 6
0
def googleMail():
    if Common.isAtiveTitle(Common.INTELLIJ_IDEA_TITLE):
        time.sleep(0.05)  # important it won't work without a timeout
        SendToUi.sendKey("alt+F3")
    else:
        openExecute(SITE_GOOGLE_MAIL)
Ejemplo n.º 7
0
def getSelection():
    storedClipboard = SendToUi.beforeSetClipboard()
    text = ClipboardUtil.pasteFromClipboardXsel()
    SendToUi.afterSetClipboard(storedClipboard)
    return text