This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Created on Sep 1, 2015 | |
@author: synkarius | |
''' | |
from dragonfly import Repeat, Function, Dictation, Choice, MappingRule | |
from castervoice.lib import context, navigation, alphanumeric, textformat, text_utils | |
from castervoice.lib import control, utilities | |
from castervoice.lib.actions import Key, Mouse |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Python vocabulary | |
"[key] word <python_keyword>": | |
R(Text(" %(python_keyword)s "), rdescript="Python: keyword"), | |
"builtin <python_builtin>": | |
R(Text(" %(python_builtin)s "), rdescript="Python: builtin"), | |
"standard <python_standard_library_module>": | |
R(Text(" %(python_standard_library_module)s "), rdescript="type name of Python standard library module"), | |
"lib <python_library>": | |
R(Text(" %(python_library)s "), rdescript="type name of Python nonstandard library"), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import imp | |
import importlib | |
import io | |
import sys | |
import traceback | |
import types | |
import weakref | |
import toml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# thanks to Casper and Caster for contributing commands to this. | |
from dragonfly import (Grammar, Context, AppContext, Dictation, Repeat, Function, Choice, Mouse, Pause) | |
from castervoice.lib import control | |
from castervoice.lib import settings | |
from castervoice.lib.actions import Key, Text | |
from castervoice.lib.context import AppContext | |
from castervoice.lib.dfplus.additions import IntegerRefS# thanks to Casper for contributing commands to this. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# This file is part of Dragonfly. | |
# (c) Copyright 2007, 2008 by Christo Butcher | |
# Licensed under the LGPL. | |
# | |
# Dragonfly is free software: you can redistribute it and/or modify it | |
# under the terms of the GNU Lesser General Public License as published | |
# by the Free Software Foundation, either version 3 of the License, or | |
# (at your option) any later version. | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# this file contains commands for more quickly creating dragonfly commands. | |
# users may want to make this context-specific to they're text editors | |
from dragonfly import (Grammar, MappingRule, Dictation, Function, Choice, Pause, Mouse) | |
from dragonfly.actions.action_mouse import get_cursor_position | |
from castervoice.lib import control | |
from castervoice.lib.actions import Key, Text | |
from castervoice.lib.dfplus.additions import IntegerRefST | |
from castervoice.lib.ccr.standard import SymbolSpecs | |
from castervoice.lib.dfplus.merge.mergerule import MergeRule |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function only works with keyword arguments. Something like arkalii's solution is a good way of dealing with the issue. You could also use a decorator on the add function to map argument names. This would keep the mappings clean: | |
arg_map = { | |
"num1": "x", | |
"n": "x", | |
"num2": "y", | |
"m": "y", | |
} | |
def replace_args(func): | |
def new_func(*_, **kwargs): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from dragonfly import (Grammar, AppContext, Dictation, Key, Text, Repeat, Choice, Function, ActionBase, ActionError) | |
class MultiAppContext(AppContext): | |
# ---------------------------------------------------------------------- | |
# Initialization methods. | |
def __init__(self, relevant_apps=None, title=None, exclude=False): | |
AppContext.__init__(self) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Here's a new command for writing numerical fractions more naturally. Not the most elegant but gets the job done. | |
"<number> <denominator>": R(Text("\\frac %(number)d") + Key("down") | |
+ Text("%(denominator)s") + Key("right")), | |
"[one] <denominator_single>": R(Text("\\frac 1") + Key("down") | |
+ Text("%(denominator_single)s") + Key("right")), | |
IntegerRefST("number", 2, 100), | |
Choice("denominator", { | |
"halves": "2", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Unimacro grammar to Dictate latex markup, as defined in an inifile | |
""" | |
__version__ = "$Rev: 398 $ on $Date: 2011-03-07 14:50:15 +0100 (ma, 07 mrt 2011) $ by $Author: quintijn $" | |
# This file is part of a SourceForge project called "unimacro" see | |
# http://unimacro.SourceForge.net and http://qh.antenna.nl/unimacro | |
# (c) copyright 2003 see http://qh.antenna.nl/unimacro/aboutunimacro.html | |
# or the file COPYRIGHT.txt in the natlink\natlink directory | |
# | |
# _latex.py: Dictate latex markup |