Ejemplo n.º 1
0
def main():
	if not keyboard.is_keyboard():
		return

	text = keyboard.get_selected_text()

	clipboard.set(text)
Ejemplo n.º 2
0
def main():
    content = get_selected_text()
    if content == '':
        content = get_input_context()[0]
        if content == '':
            return
    img = Function(content).plot()
    v = Plot_View(img)
    set_view(v)
Ejemplo n.º 3
0
def main():
	if not keyboard.is_keyboard():
		return

	text = keyboard.get_selected_text()

	clipboard.set(text)
	if text:
		# clear selection
		keyboard.insert_text(' ')
		keyboard.backspace(1)
Ejemplo n.º 4
0
def main():
	if not keyboard.is_keyboard():
		return

	text = keyboard.get_selected_text()

	if not text:
		dialogs.hud_alert('No text selected', 'error')
		return

	new_text = text.title()
	keyboard.insert_text(new_text)
Ejemplo n.º 5
0
def main():
    if not keyboard.is_keyboard():
        return

    text = keyboard.get_selected_text()

    if not text:
        dialogs.hud_alert('No text selected', 'error')
        return

    newText = quote(text, safe=':/')
    keyboard.insert_text(newText)
Ejemplo n.º 6
0
def main():
    if not keyboard.is_keyboard():
        return

    selected_text = keyboard.get_selected_text()
    if selected_text:
        keyboard.backspace(1)

    tpl = keyboard.get_input_context()
    right = tpl[1]
    delete_count = len(right)
    keyboard.move_cursor(delete_count)
    keyboard.backspace(delete_count)
Ejemplo n.º 7
0
def main():
    if not keyboard.is_keyboard():
        return

    selected_text = keyboard.get_selected_text()
    if selected_text:
        keyboard.backspace(1)

    tpl = keyboard.get_input_context()
    left = tpl[0]
    delete_count = len(left)

    keyboard.backspace(delete_count)
Ejemplo n.º 8
0
def main():
    if not keyboard.is_keyboard():
        return

    text = keyboard.get_selected_text()

    if not text:
        dialogs.hud_alert('No text selected', 'error')
        return

    url = f'shortcuts://run-shortcut?name=テキストを連携&input={text}'

    newUrl = quote(url, safe=':/')
    webbrowser.open(newUrl)
Ejemplo n.º 9
0
	def update(self):
		# Grap the last typed text by the user
		context = get_input_context()
		# Grap the selected text by the user
		select = get_selected_text()
		# If the user select some text
		if select != '':
			inp = select
		else:
			# If go here user didn't select text so the script is going to grap the last stuff he typed
			inp = context[0]
		# pass the input to the eval function
		try:
			self.label.text= '{}'.format(eval(inp))
		except Exception as e:
			self.label.text='{}'.format(e)
Ejemplo n.º 10
0
def main():
	if not keyboard.is_keyboard():
		return

	selected_text = keyboard.get_selected_text()
	left, right = keyboard.get_input_context()

	delete_selection()
	move_to_first_letter_of_line()
	delete_line()

	# if column == 0, returns '\n'
	if left == '\n':
		left = ''

	cut_text = left + selected_text + right + '\n'
	clipboard.set(cut_text)
Ejemplo n.º 11
0
def main():
    if not keyboard.is_keyboard():
        return

    text = keyboard.get_selected_text()

    if not text:
        dialogs.hud_alert('No text selected', 'error')
        return

    snippets = get_dics('Surround Text.txt')
    selected = dialogs.list_dialog('select Replacements', snippets)
    if not selected:
        return

    m = re.match(r'^(.*)〜(.*)$', selected)
    if not m:
        return

    g = m.groups()
    left = g[0]
    right = g[1]
    newText = left + text + right
    keyboard.insert_text(newText)
Ejemplo n.º 12
0
def main():
    text = get_selected_text()
    if text != '':
        url = 'working-copy://clone?remote={}'.format(text)
        open(url)
Ejemplo n.º 13
0
def delete_selection():
	selected_text = keyboard.get_selected_text()
	if selected_text:
		keyboard.insert_text(' ')
		keyboard.backspace(1)
	return
 def b_copy_action(sender):
     context = keyboard.get_input_context()
     t = keyboard.get_selected_text()
     clipboard.set(t)
Ejemplo n.º 15
0
def main():
	text = keyboard.get_selected_text()
	
	task = urllib.parse.quote(text.encode('utf-8'))
	
	webbrowser.open('http://www.cantonese.sheik.co.uk/dictionary/search/?searchtype=1&text=' + task)
Ejemplo n.º 16
0
def main():
    text = keyboard.get_selected_text()

    text = re.sub("^ ", "", text)
    text = re.sub("&nbsp;<br>$", "", text)
    text = re.sub("<br>$|^<br>", "", text)
    text = re.sub("<u>|</u>", "", text)

    text = re.sub(
        "<td>|</td>|<tr>|</tr>|<tbody>|</tbody>|<table>|</table>|{|}", "",
        text)
    text = re.sub(r"(\D)(\d|\d\S\d|\d\S\S\S\d)(\s|$|&nbsp;|,\D|;|<)",
                  r"\1<sup>\2</sup>\3", text)
    '''text = re.sub(" |&nbsp;","",text)'''

    text = re.sub(" - | -- | –– ", " — ", text)
    text = re.sub("--|––", "—", text)
    text = text.replace("-", "–")
    text = text.replace("...", "…")

    text = re.sub("<div>", "<br>", text, 1)

    text = re.sub(r"(\S\D)(c|d|g|h|l|m|n|r|t|v)ize", r"\1\2ise", text)
    text = text.replace("avor", "avour")
    text = text.replace("honor", "honour")
    text = text.replace("color", "colour")
    text = text.replace("成语 saw", "idiom")

    text = re.sub(
        "&nbsp;</div><div>|&nbsp;<br>| <br>|</div><div>|<br />|<br/>", "<br>",
        text)
    text = text.replace("<br><br><br>", "<br><br>")

    text = re.sub("<div>|</div>", "", text)

    text = text.replace("  ", " ")
    text = text.replace(" / ", "/")
    text = re.sub(r"( |^)'(\b|<)", r"\1‘\2", text)
    text = re.sub(r"(\b|>)'(\s|\.|,|\))", r"\1’\2", text)
    text = text.replace("'", "’")
    text = re.sub(r"( |^)\"(\b|<)", r"\1“\2", text)
    text = re.sub(r"(\b|>)\"(\s|\.|,|\)|$)", r"\1”\2", text)
    text = re.sub(
        "\(Jyutping\)|\(jyutping\)",
        "[<a href=\"http://www.cantonese.sheik.co.uk/dictionary/characters/751/\">粵</a>]",
        text)
    text = re.sub(
        "\(Pinyin\)|\(pinyin\)",
        "[<a href=\"http://www.cantonese.sheik.co.uk/dictionary/characters/331/\">國</a>]",
        text)

    text = text.replace("msg–", "msg-")
    text = re.sub("<br>$|^<br>|&nbsp;$", "", text)
    text = re.sub("<br>$|^<br>|&nbsp;$", "", text)
    text = re.sub("&nbsp;", " ", text)

    if keyboard.is_keyboard():
        keyboard.play_input_click()
        keyboard.insert_text(text)
    else:
        # For debugging in the main app:
        print(f'Keyboard input: {text}')
Ejemplo n.º 17
0
def main():
    seletected = get_selected_text()
    if seletected == '':
        return
    url = 'dash://{}'.format(seletected)
    open(url)