コード例 #1
0
class UpperCaseSQL(MergeRule):
    pronunciation = "upper case sequel"
    mapping = {
        "select":
            R(Text("SELECT "), rdescript="SQL: Select"),
        "select top [<n>]":
            R(Text("SELECT TOP ") + Function(_render_number),
              rdescript="SQL: Select Top"),
        "select all":
            R(Text("SELECT * "), rdescript="SQL: Select All"),
        "from":
            R(Key("enter") + Text("FROM "), rdescript="SQL: From"),
        "where":
            R(Key("enter") + Text("WHERE "), rdescript="SQL: Where"),
        "group by":
            R(Key("enter") + Text("GROUP BY "), rdescript="SQL: Group By"),
        "order by":
            R(Key("enter") + Text("ORDER BY "), rdescript="Order By"),
        "ascending":
            R(Text(" ASC "), rdescript="SQL: Ascending"),
        "descending":
            R(Text(" DESC "), rdescript="SQL: Descending"),
        "left join":
            R(Key("enter") + Text("LEFT JOIN "), rdescript="SQL: Left Join"),
        "inner join":
            R(Key("enter") + Text("INNER JOIN "), rdescript="SQL: Inner Join"),
        "join":
            R(Text(" JOIN "), rdescript="SQL: Join"),
        "insert into":
            R(Text(" INSERT INTO "), rdescript="SQL: Insert"),
        "update":
            R(Text(" UPDATE TOKEN SET "), rdescript="SQL: Update"),
        "delete":
            R(Text("DELETE "), rdescript="SQL: Delete"),
        "like":
            R(Text(" LIKE '%%'") + Key("left/5:2"), rdescript="SQL: Like"),
        "union":
            R(Text(" UNION "), rdescript="SQL: Union"),
        "alias as":
            R(Text(" AS "), rdescript="SQL: Alias As"),
        "is null":
            R(Text(" IS NULL "), rdescript="SQL: Is Null"),
        "is not null":
            R(Text(" IS NOT NULL "), rdescript="SQL: Is Not Null"),
        "declare":
            R(Text(" DECLARE @ "), rdescript="SQL: Is Not Null"),
        "fun max":
            R(Text(" MAX() ") + Key("left/5:2"), rdescript="SQL: Max"),
        "fun count":
            R(Text(" COUNT() ") + Key("left/5:2"), rdescript="SQL: Count"),
        "int":
            R(Text(" INT "), rdescript="SQL: Count"),
        "var char | far char":
            R(Text(" VARCHAR() ") + Key("left:2"), rdescript="SQL: Count"),
    }
    extras = [
        IntegerRefST("n", 1, 10000),
    ]
    defaults = {"n": 0}
コード例 #2
0
    def test_non_ascii_key(self):
        """ Test handling of non-ASCII characters in ActionSeries actions.
        """

        action = Key(u"é") + Text(u"á")
        self.assertEqual(str(action), "[%r]+%r" % (u"é", u"á"))

        action = Key(u"é") | Text(u"á")
        self.assertEqual(str(action), "[%r]|%r" % (u"é", u"á"))
コード例 #3
0
def hold_modifier(short_mode):
    if "s" in short_mode:
        Key("shift:down").execute()
    if "a" in short_mode:
        Key("alt:down").execute()
    if "c" in short_mode:
        Key("control:down").execute()
    if "w" in short_mode:
        Key("win:down").execute()
    time.sleep(settings.SETTINGS["miscellaneous"]["keypress_wait"] / 1000.)
コード例 #4
0
def master_text_nav(mtn_mode, mtn_dir, nnavi500, extreme):
    '''
    (<mtn_dir> | <mtn_mode> [<mtn_dir>]) [(<nnavi500> | <extreme>)]
    mtn_mode: "shin" s, "queue" cs, "fly" c, (default None)
    mtn_dir: 0-up, 1-down, 2-left, 3-right, (default right)
    nnavi500: number of keypresses (default 1)
    extreme: home/end (default None)
    '''

    k = None
    if mtn_mode is None:
        if extreme is not None:
            if mtn_dir == "left":
                k = "home"
            elif mtn_dir == "right":
                k = "end"
            elif mtn_dir == "up":
                k = "c-home"
            elif mtn_dir == "down":
                k = "c-end"
        else:
            k = str(mtn_dir) + "/5:" + str(nnavi500)
    elif extreme is None:
        k = str(mtn_mode) + "-" + str(mtn_dir) + "/5:" + str(nnavi500)
    else:
        mtn_dir = str(mtn_dir)
        way = "end" if mtn_dir in ["right", "down"] else "home"
        k = str(mtn_mode) + "-" + str(way)
    Key(k).execute()
    time.sleep(settings.SETTINGS["miscellaneous"]["keypress_wait"] / 1000.)
コード例 #5
0
class Paste(DynStrActionBase):
    """
        Paste-from-clipboard action.

        Constructor arguments:
         - *contents* (*str*) -- contents to paste
         - *format* (*int*, Win32 clipboard format) --
           clipboard format
         - *paste* (instance derived from *ActionBase*) --
           paste action
         - *static* (boolean) --
           flag indicating whether the
           specification contains dynamic elements

        This action inserts the given *contents* into the Windows system 
        clipboard, and then performs the *paste* action to paste it into 
        the foreground application.  By default, the *paste* action is the 
        :kbd:`Control-v` keystroke.  The default clipboard format to use 
        is the *Unicode* text format.

    """

    # Default paste action.
    _default_format = win32con.CF_UNICODETEXT
    _default_paste = Key("c-v/5")

    def __init__(self, contents, format=None, paste=None, static=False):
        if not format: format = self._default_format
        if not paste: paste = self._default_paste
        if isinstance(contents, basestring):
            spec = contents
            self.contents = None
        else:
            spec = ""
            self.contents = contents
        self.format = format
        self.paste = paste
        DynStrActionBase.__init__(self, spec, static=static)

    def _parse_spec(self, spec):
        if self.contents:
            return self.contents
        else:
            return spec

    def _execute_events(self, events):
        original = Clipboard()
        original.copy_from_system()

        if self.format == win32con.CF_UNICODETEXT:
            events = unicode(events)
        elif self.format == win32con.CF_TEXT:
            events = str(events)

        clipboard = Clipboard(contents={self.format: events})
        clipboard.copy_to_system()
        self.paste.execute()

        original.copy_to_system()
        return True
コード例 #6
0
def add_modkeys(rule):
    release = R(Key("shift:up, ctrl:up, alt:up"), rdescript = "Mod Keys Up")
    
    if not hasattr(rule, "marked") and\
    rule.get_pronunciation()[0:6] != "Merged": # don't augment merged rules-- they'd get it twice
        for spec in rule.mapping_actual().keys():
            rule.mapping_actual()[spec] = release + rule.mapping_actual()[spec] + release
        rule.marked = True
コード例 #7
0
    def _execute_events(self, events):
        """
        Send keyboard events.

        If instance was initialized with *autofmt* True,
        then this method will mimic a word recognition
        and analyze its formatting so as to autoformat
        the text's spacing and capitalization before
        sending it as keyboard events.
        """
        if self._autofmt:
            # Mimic a word, select and copy it to retrieve capitalization.
            get_engine().mimic("test")
            Key("cs-left, c-c/5").execute()
            word = Clipboard.get_system_text()

            # Inspect formatting of the mimicked word.
            index = word.find("test")
            if index == -1:
                index = word.find("Test")
                capitalize = True
                if index == -1:
                    self._log.error("Failed to autoformat.")
                    return False
            else:
                capitalize = False

            # Capitalize given text if necessary.
            text = self._spec
            if capitalize:
                text = text[0].capitalize() + text[1:]

            # Reconstruct autoformatted output and convert it
            #  to keyboard events.
            prefix = word[:index]
            suffix = word[index + 4:]
            events = self._parse_spec(prefix + text + suffix)

        # Calculate keyboard events.
        use_hardware = self.require_hardware_events()
        keyboard_events = []
        for key_symbol in events:
            # Get a Typeable object for each key symbol, if possible.
            typeable = self._get_typeable(key_symbol, use_hardware)

            # Raise an error message if a Typeable could not be retrieved.
            if typeable is None:
                error_message = ("Keyboard interface cannot type this"
                                 " character: %r" % key_symbol)
                raise ActionError(error_message)

            # Get keyboard events using the Typeable.
            keyboard_events.extend(typeable.events(self._pause))

        # Send keyboard events.
        self._keyboard.send_keyboard_events(keyboard_events)
        return True
コード例 #8
0
def master_short(short_mode, key, nnavi500):
    '''
    <short_mode> <key> [<nnavi500>]
    short_mode: "shift" s, "troll" c, "alt" a, "wind" w, "trot" ca, "shoal" cs, "tron" wc, "shalt" sa, "walt" wa, "shin" ws, (default None)
    key: key to press (default None)
    nnavi500: number of keypresses (default 1)
    '''

    k = str(short_mode) + "-" + str(key) + "/5:" + str(nnavi500)
    Key(k).execute()
    time.sleep(settings.SETTINGS["miscellaneous"]["keypress_wait"] / 1000.)
コード例 #9
0
ファイル: action_paste.py プロジェクト: LexiconCode/dragonfly
 def __init__(self, contents, format=None, paste=None, static=False):
     if not format:
         format = self._default_format
     if paste is None:
         # Pass use_hardware=True to guarantee that Ctrl+V is always
         # pressed, regardless of the keyboard layout.
         paste = Key(self._default_paste_spec, use_hardware=True)
     if isinstance(contents, string_types):
         spec = contents
         self.contents = None
     else:
         spec = ""
         self.contents = contents
     self.format = format
     self.paste = paste
     DynStrActionBase.__init__(self, spec, static=static)
コード例 #10
0
    def set_foreground(self):
        # Bring this window into the foreground if it isn't already the
        # current foreground window.
        if self.handle != win32gui.GetForegroundWindow():
            if self.is_minimized:
                self.restore()

            # Press a key so Windows allows us to use SetForegroundWindow()
            # (received last input event). See Microsoft's documentation on
            # SetForegroundWindow() for why this works.
            # Only do this if neither the left or right control keys are
            # held down.
            if win32api.GetKeyState(win32con.VK_CONTROL) >= 0:
                Key("control:down,control:up").execute()

            # Set the foreground window.
            self._set_foreground()
コード例 #11
0
class TaskBar(MergeRule):
    pronunciation = "task bar"
    mapping = {
        "chromium": R(Key("w-1"), rdescript="Maximize Window"),
        "Firefox": R(Key("w-2"), rdescript="Maximize Window"),
        "viz. code": R(Key("w-3"), rdescript="Maximize Window"),
        "file system": R(Key("w-4"), rdescript="Maximize Window"),
        "(get bash) | git bash": R(Key("w-5"), rdescript="Maximize Window"),
        "slime tech": R(Key("w-6"), rdescript="Maximize Window"),
    }
    extras = []
    defaults = {}
コード例 #12
0
    def _execute_events(self, events):
        """
            Send keyboard events.

            If instance was initialized with *autofmt* True,
            then this method will mimic a word recognition
            and analyze its formatting so as to autoformat
            the text's spacing and capitalization before
            sending it as keyboard events.

        """

        if self._autofmt:
            # Mimic a word, select and copy it to retrieve capitalization.
            get_engine().mimic("test")
            Key("cs-left, c-c/5").execute()
            word = Clipboard.get_text()

            # Inspect formatting of the mimicked word.
            index = word.find("test")
            if index == -1:
                index = word.find("Test")
                capitalize = True
                if index == -1:
                    self._log.error("Failed to autoformat.")
                    return False
            else:
                capitalize = False

            # Capitalize given text if necessary.
            text = self._spec
            if capitalize:
                text = text[0].capitalize() + text[1:]

            # Reconstruct autoformatted output and convert it
            #  to keyboard events.
            prefix = word[:index]
            suffix = word[index + 4:]
            events = self._parse_spec(prefix + text + suffix)

        # Send keyboard events.
        self._keyboard.send_keyboard_events(events)
        return True
コード例 #13
0
    def test_non_ascii_key(self):
        """ Test handling of non-ASCII characters in Key action. """

        action = Key(u"é")
        self.assertEqual(str(action), "[%r]" % (u"é", ))
コード例 #14
0
class CustomPunctuation(MergeRule):
    pronunciation = "custom punctuation"
    mapping = {

        # my custom overrides
        "double quotes":
        R(Key("dquote"), rdescript="Quotation Marks"),
        "Quach it":
        R(Key("apostrophe"), rdescript="Thin Quotation Marks"),
        "equals | equal to":
        R(Text("="), rdescript="Equals"),
        "equeft":
        R(Text(" = "), rdescript="Equals"),
        "Schrock it | shrocket":
        R(Text(" => "), rdescript="Equals"),
        "not equals | not equal to":
        R(Text(" != "), rdescript="Not Equal To"),
        "is equal to":
        R(Text(" == "), rdescript="Not Equal To"),
        "[is] greater than":
        R(Text(" > "), rdescript="> Comparison"),
        "[is] less than":
        R(Text(" < "), rdescript="< Comparison"),
        "[is] greater [than] [or] equal [to]":
        R(Text(" >= "), rdescript=">= Comparison"),
        "[is] less [than] [or] equal [to]":
        R(Text(" <= "), rdescript="<= Comparison"),
        "deplush":
        R(Text(" + "), rdescript="Plus with padding"),
        "plus":
        R(Text("+"), rdescript="Plus"),
        "pluqual | Luke while":
        R(Text(" += "), rdescript="Plus Equals"),
        "deminus":
        R(Text(" - "), rdescript="Minus with padding"),
        "minus":
        R(Text("-"), rdescript="Minus"),
        "minqual | min call":
        R(Text(" -= "), rdescript="Minus Equals"),
        "min twice | mintwice":
        R(Text("--"), rdescript="Minus Twice"),

        # this is same as the default punctuation
        "sinker":
        R(Key("semicolon"), rdescript="Semicolon"),
        "prekris":
        R(Key("lparen"), rdescript="Parentheses"),
        "prekorp":
        R(Key("lparen"), rdescript="Parentheses"),
        "prekos":
        R(Key("rparen"), rdescript="Parentheses"),
        "brax":
        R(Key("lbracket"), rdescript="Square Brackets"),
        "brackorp":
        R(Key("lbracket"), rdescript="Left Square Bracket"),
        "brackos":
        R(Key("rbracket"), rdescript="Right Square Bracket"),
        "curly":
        R(Key("lbrace"), rdescript="Curly Braces"),
        "kirksorp":
        R(Key("lbrace"), rdescript="Left Curly Brace"),
        "kirkos":
        R(Key("rbrace"), rdescript="Right Curly Brace"),
        "angle":
        R(Key("langle"), rdescript="Left Angle Bracket"),
        "wrangle":
        R(Key("rangle"), rdescript="Right Angle Bracket"),
        "(pipe | pipes) (sim | symbol)":
        R(Text("|"), rdescript="Pipe Symbol"),
        "pipes and":
        R(Text("|"), rdescript="Pipe Symbol"),
        'skoosh [<npunc>]':
        R(Key("space"), rdescript="Space") * Repeat(extra="npunc"),
        "clamor":
        R(Text("!"), rdescript="Exclamation Mark"),
        "deckle":
        R(Text(":"), rdescript="Colon"),
        "starling":
        R(Key("asterisk"), rdescript="Asterisk"),
        "questo":
        R(Text("?"), rdescript="Question Mark"),
        "comma":
        R(Text(","), rdescript="Comma"),
        "carrot":
        R(Text("^"), rdescript="Carat"),
        "(period | dot)":
        R(Text("."), rdescript="Dot"),
        "at sign":
        R(Text("@"), rdescript="At Sign"),
        "hash tag | pound sign | pounder":
        R(Text("#"), rdescript="Hash Tag"),
        "apostrophe":
        R(Text("'"), rdescript="Apostrophe"),
        "tinker":
        R(Text("`"), rdescript='back tick'),
        "crunder":
        R(Text("_"), rdescript="Underscore"),
        "shawls":
        R(Text("\\"), rdescript="Back Slash"),
        "slash":
        R(Text("/"), rdescript="Forward Slash"),
        "Dolly":
        R(Text("$"), rdescript="Dollar Sign"),
        "Percy":
        R(Key("percent"), rdescript="Percent Sign"),
        'tarp [<npunc>]':
        R(Key("tab"), rdescript="Tab") * Repeat(extra="npunc"),
        'tarsh [<npunc>]':
        R(Key("s-tab"), rdescript="Tab") * Repeat(extra="npunc"),
        'shaber [<npunc>]':
        R(Key("c-rbracket"), rdescript="Tab") * Repeat(extra="npunc"),
        'shable [<npunc>]':
        R(Key("c-lbracket"), rdescript="Tab") * Repeat(extra="npunc"),
        "swipe":
        R(Text(", "), rdescript="Comma + Space"),
    }

    extras = [
        IntegerRefST("npunc", 0, 10),
    ]
    defaults = {
        "npunc": 1,
    }
コード例 #15
0
def get_output():
    get_notepad()
    Key("c-a").execute()
    output = context.read_selected_without_altering_clipboard(True)[1]
    Key("backspace").execute()
    return output
コード例 #16
0
class CustomStuff(MergeRule):
    pronunciation = "custom stuff"
    mapping = {
        "open new file":
            R(Key("c-n"), rdescript="Custom Navigation: Open New File"),
        "Lefty":
            R(Key("home"), rdescript="Custom Navigation: Home Key"),
        "Lexi":
            R(Key("s-home"), rdescript="Custom Navigation: Home Key"),
        "Ricky":
            R(Key("end"), rdescript="Custom Navigation: End Key"),
        "Ricksy":
            R(Key("s-end"), rdescript="Custom Navigation: End Key"),
        "toggle tab":
            R(Key("c-tab"), rdescript="Next Tab"),
        "Ali":
            R(Key("c-a"), rdescript="Select All"),
        "back tab [<n>]":
            R(Key("s-tab"), rdescript="Previous Tab")*Repeat(extra="n"),
        "(windy | Wendy) Max":
            R(Key("w-up"), rdescript="Maximize Window"),
        "(windy | Wendy) lease [<n>]":
            R(Key("w-left"), rdescript="Window Left")*Repeat(extra="n"),
        "(windy | Wendy) ross [<n>]":
            R(Key("w-right"), rdescript="Window Right")*Repeat(extra="n"),
        "mahni lease [<n>]":
            R(Key("sw-left"), rdescript="Monitor Left")*Repeat(extra="n"),
        "manhi ross [<n>]":
            R(Key("sw-right"), rdescript="Monitor Right")*Repeat(extra="n"),
        "workace lease":
            R(Key("cw-left"), rdescript="Workspace Left"),
        "workace ross":
            R(Key("cw-right"), rdescript="Monitor Right"),
        "peach":
            R(Key("c-t"), rdescript="Open New Tab"),
        "snatch":
            R(Key("c-x"), rdescript="Open New Tab"),
        "junk [<nnavi50>]":
            R(Key("backspace/5:%(nnavi50)d"), rspec="clear", rdescript="Backspace"),
        "spunk [<nnavi50>]":
            R(Key("del/5"), rspec="deli", rdescript="Delete")*Repeat(extra="nnavi50"),
        "snipple":
            R(Key("s-home") + Key("del/5"), rspec="clear", rdescript="Backspace"),
        "(sniper | snipper)":
            R(Key("s-end") + Key("del/5"), rspec="clear", rdescript="Backspace"),
        "fish [<nnavi50>]":
            R(Key("c-right"), rspec="fish", rdescript="Jump word to the right")*
            Repeat(extra="nnavi50"),
        "fame [<nnavi50>]":
            R(Key("c-left"), rspec="fame", rdescript="Jump word to the Left")*
            Repeat(extra="nnavi50"),
        "scrish [<nnavi50>]":
            R(Key("cs-right"), rspec="scrish", rdescript="Select word to the right")*
            Repeat(extra="nnavi50"),
        "scram [<nnavi50>]":
            R(Key("cs-left"), rspec="scram", rdescript="Select a word to the left")*
            Repeat(extra="nnavi50"),
        "shreep [<nnavi50>]":
            R(Key("s-up"), rspec="shreeep", rdescript="Select a line up")*
            Repeat(extra="nnavi50"),
        "shroom [<nnavi50>]":
            R(Key("s-down"), rspec="shroom", rdescript="Select a line down")*
            Repeat(extra="nnavi50"),
        "(Kate | Kite) [<nnavi50>]":
            R(Key("c-del"), rspec="clear", rdescript="Backspace")*Repeat(extra="nnavi50"),
        "trough [<nnavi50>]":
            R(Key("c-backspace"), rspec="clear", rdescript="Backspace")*
            Repeat(extra="nnavi50"),
        "totch":
            R(Key("c-w/20"), rdescript="Close Tab"),
        "dizzle [<n>]":
            R(Key("c-z"), rdescript="Undo")*Repeat(extra="n"),
        "rizzle [<n>]":
            R(Key("c-y"), rdescript="Redo")*Repeat(extra="n"),
        'duke':
            R(Function(navigation.left_click, nexus=_NEXUS)*Repeat(2),
              rdescript="Mouse: Double Click"),
        "marco":
            R(Key("c-f"), rdescript="Find"),
        "cram <textnv>":
            R(Function(format_text_wrapper, cpa=3, space=1), rdescript="camelCase"),
        "smash <textnv>":
            R(Function(format_text_wrapper, cap=5, space=1),
              rdescript="lowercasenospaces"),
        "squash <textnv>":
            R(Function(format_text_wrapper, cap=5, space=0),
              rdescript="lowercase with spaces"),
        "snake <textnv>":
            R(Function(format_text_wrapper, cap=5, space=3), rdescript="snake_case"),
        "Yeller <textnv>":
            R(Function(format_text_wrapper, cap=1, space=0), rdescript="UPPERCASE"),
        "spine <textnv>":
            R(Function(format_text_wrapper, cap=0, space=2),
              rdescript="spinal-case-text"),
        "tridal <textnv>":
            R(Function(format_text_wrapper, cap=2, space=0), rdescript="Title Case"),
        "Champ <textnv>":
            R(Function(format_text_wrapper, cap=4, space=0),
              rdescript="Capitalize first word"),
        "format <textnv>":
            R(Function(textformat.prior_text_format), rdescript="Last Text Format"),
        "scrodge [<nnavi50>]":
            R(Function(wheel_scroll_down), rdescript="Wheel Scroll"),
        "scroop [<nnavi50>]":
            R(Function(wheel_scroll_up), rdescript="Wheel Scroll"),
        'chiff | Jeff':
            R(Function(navigation.left_click, nexus=_NEXUS),
              rdescript="Mouse: Left Click"),
    }
    extras = [
        IntegerRefST("n", 1, 10),
        IntegerRefST("nnavi50", 1, 50),
        Dictation("textnv"),
    ]
    defaults = {"n": 1, "nnavi50": 1, "textnv": ""}
コード例 #17
0
ファイル: sql.py プロジェクト: alexboche/caster
class SQL(MergeRule):
    pronunciation = "sequel"

    mapping = {
        "select":
        R(Text(" SELECT "), rdescript="SQL: Select"),
        "select (all | every)":
        R(Text(" SELECT * "), rdescript="SQL: Select All"),
        "from":
        R(Text(" FROM "), rdescript="SQL: From"),
        "where":
        R(Text(" WHERE "), rdescript="SQL: Where"),
        "between":
        R(Text(" BETWEEN "), rdescript="SQL: Between"),
        "lodge and ":
        R(Text(" AND "), rdescript="SQL: And"),
        "lodge or":
        R(Text(" OR "), rdescript="SQL: Or"),
        "it are in":
        R(Text(" IN "), rdescript="SQL: In"),
        "equals | equal to":
        R(Text(" = "), rdescript="SQL: Equals"),
        "not equals | not equal to":
        R(Text(" <> "), rdescript="SQL: Not Equal To"),
        "group by":
        R(Text(" GROUP BY "), rdescript="SQL: Group By"),
        "order by":
        R(Text(" ORDER BY "), rdescript="Order By"),
        "ascending":
        R(Text(" ASC "), rdescript="SQL: Ascending"),
        "descending":
        R(Text(" DESC "), rdescript="SQL: Descending"),
        "left join":
        R(Text(" LEFT JOIN "), rdescript="SQL: Left Join"),
        "inner join":
        R(Text(" INNER JOIN "), rdescript="SQL: Inner Join"),
        "right join":
        R(Text(" RIGHT JOIN "), rdescript="SQL: Right Join"),
        "full join":
        R(Text(" FULL JOIN "), rdescript="SQL: Full Join"),
        "join":
        R(Text(" JOIN "), rdescript="SQL: Join"),
        "on columns":
        R(Text(" ON "), rdescript="SQL: On"),
        "using":
        R(Text(" USING () ") + Key("left/5:2"), rdescript="SQL: Using"),
        "insert into":
        R(Text(" INSERT INTO "), rdescript="SQL: Insert"),
        "update":
        R(Text(" UPDATE TOKEN SET "), rdescript="SQL: Update"),
        "delete":
        R(Text(" DELETE "), rdescript="SQL: Delete"),
        "like":
        R(Text(" LIKE '%%'") + Key("left/5:2"), rdescript="SQL: Like"),
        "union":
        R(Text(" UNION "), rdescript="SQL: Union"),
        "alias as":
        R(Text(" AS "), rdescript="SQL: Alias As"),
        "is null":
        R(Text(" IS NULL "), rdescript="SQL: Is Null"),
        "is not null":
        R(Text(" IS NOT NULL "), rdescript="SQL: Is Not Null"),
        "fun max":
        R(Text(" MAX() ") + Key("left/5:2"), rdescript="SQL: Max"),
        "fun min":
        R(Text(" MIN() ") + Key("left/5:2"), rdescript="SQL: Min"),
        "fun count":
        R(Text(" COUNT() ") + Key("left/5:2"), rdescript="SQL: Count"),
        "fun average":
        R(Text(" AVG() ") + Key("left/5:2"), rdescript="SQL: Average"),
        "over partition by":
        R(Text(" OVER (PARTITION BY ) ") + Key("left/5:2"),
          rdescript="SQL: Over Partition By"),
    }

    extras = []
    defaults = {}
コード例 #18
0
def master_short_mouse(short_mode, mouse_action):
    '''
    <short_mode><mouse_action>
    short_mode: "shift" s, "troll" c, "alt" a, "wind" w, "trot" ca, "shoal" cs, "tron" wc, "shalt" sa, "walt" wa, "shin" ws, (default None)
	mouse_action:
    '''

    if short_mode == "s":
        Key("shift:down").execute()
        Mouse(mouse_action).execute()
        Key("shift:up").execute()
    elif short_mode == "c":
        Key("control:down").execute()
        Mouse(mouse_action).execute()
        Key("control:up").execute()
    elif short_mode == "a":
        Key("alt:down").execute()
        Mouse(mouse_action).execute()
        Key("alt:up").execute()
    elif short_mode == "w":
        Key("win:down").execute()
        Mouse(mouse_action).execute()
        Key("win:up").execute()
    elif short_mode == "ca":
        Key("control:down").execute()
        Key("alt:down").execute()
        Mouse(mouse_action).execute()
        Key("control:up").execute()
        Key("alt:up").execute()
    elif short_mode == "cs":
        Key("control:down").execute()
        Key("shift:down").execute()
        Mouse(mouse_action).execute()
        Key("control:up").execute()
        Key("shift:up").execute()
    elif short_mode == "wc":
        Key("win:down").execute()
        Key("control:down").execute()
        Mouse(mouse_action).execute()
        Key("win:up").execute()
        Key("control:up").execute()
    elif short_mode == "sa":
        Key("shift:down").execute()
        Key("alt:down").execute()
        Mouse(mouse_action).execute()
        Key("shift:up").execute()
        Key("alt:up").execute()
    elif short_mode == "wa":
        Key("win:down").execute()
        Key("alt:down").execute()
        Mouse(mouse_action).execute()
        Key("win:up").execute()
        Key("alt:up").execute()
    elif short_mode == "ws":
        Key("win:down").execute()
        Key("shift:down").execute()
        Mouse(mouse_action).execute()
        Key("win:up").execute()
        Key("shift:up").execute()
    elif short_mode == "cas":
        Key("control:down").execute()
        Key("alt:down").execute()
        Key("shift:down").execute()
        Mouse(mouse_action).execute()
        Key("control:up").execute()
        Key("alt:up").execute()
        Key("shift:up").execute()
    time.sleep(settings.SETTINGS["miscellaneous"]["keypress_wait"] / 1000.)
コード例 #19
0
ファイル: punctuation.py プロジェクト: tyoung87/caster
class Punctuation(MergeRule):
    pronunciation = CCRMerger.CORE[3]

    mapping = {
        "semper":
        R(Key("semicolon"), rdescript="Semicolon"),
        "quotes":
        R(Key("dquote,dquote,left"), rdescript="Quotation Marks"),
        "thin quotes":
        R(Key("apostrophe,apostrophe,left"), rdescript="Thin Quotation Marks"),
        "[is] greater than":
        R(Key("rangle"), rdescript="> Comparison"),
        "[is] less than":
        R(Key("langle"), rdescript="< Comparison"),
        "[is] greater [than] [or] equal [to]":
        R(Key("rangle, equals"), rdescript=">= Comparison"),
        "[is] less [than] [or] equal [to]":
        R(Key("langle, equals"), rdescript="<= Comparison"),
        "[is] equal to":
        R(Key("equals,equals"), rdescript="Equality"),
        "equals":
        R(Key("equals"), rdescript="Equals Sign"),
        "prekris":
        R(Key("lparen, rparen, left"), rdescript="Parentheses"),
        "brax":
        R(Key("lbracket, rbracket, left"), rdescript="Square Brackets"),
        "curly":
        R(Key("lbrace, rbrace, left"), rdescript="Curly Braces"),
        "angle":
        R(Key("langle, rangle, left"), rdescript="Angle Brackets"),
        "plus":
        R(Text("+"), rdescript="Plus Sign"),
        "minus":
        R(Text("-"), rdescript="Dash"),
        "pipe (sim | symbol)":
        R(Text("|"), rdescript="Pipe Symbol"),
        'ace [<npunc>]':
        R(Key("space"), rdescript="Space") * Repeat(extra="npunc"),
        "clamor":
        R(Text("!"), rdescript="Exclamation Mark"),
        "deckle":
        R(Text(":"), rdescript="Colon"),
        "starling":
        R(Key("asterisk"), rdescript="Asterisk"),
        "questo":
        R(Text("?"), rdescript="Question Mark"),
        "comma":
        R(Text(","), rdescript="Comma"),
        "carrot":
        R(Text("^"), rdescript="Carat"),
        "(period | dot)":
        R(Text("."), rdescript="Dot"),
        "at sign":
        R(Text("@"), rdescript="At Sign"),
        "hash tag":
        R(Text("#"), rdescript="Hash Tag"),
        "apostrophe":
        R(Text("'"), rdescript="Apostrophe"),
        "underscore":
        R(Text("_"), rdescript="Underscore"),
        "backslash":
        R(Text("\\"), rdescript="Back Slash"),
        "slash":
        R(Text("/"), rdescript="Forward Slash"),
        "Dolly":
        R(Text("$"), rdescript="Dollar Sign"),
        "modulo":
        R(Key("percent"), rdescript="Percent Sign"),
        'tabby [<npunc>]':
        R(Key("tab"), rdescript="Tab") * Repeat(extra="npunc"),
        "boom":
        R(Text(", "), rdescript="Comma + Space"),
        "ampersand":
        R(Key("ampersand"), rdescript="Ampersand"),
        "leap":
        R(Text("("), rdescript="Left Paren"),
        "reap":
        R(Text(")"), rdescript="Right Paren"),
        "lake":
        R(Text("{"), rdescript="Left Curly"),
        "rake":
        R(Text("}"), rdescript="Right Curly"),
        "lobe":
        R(Text("["), rdescript="Left Bracket"),
        "robe":
        R(Text("]"), rdescript="Right Bracket"),
        "backtick":
        R(Text("`"), rdescript="Backtick"),
    }

    extras = [
        IntegerRefST("npunc", 0, 10),
    ]
    defaults = {
        "npunc": 1,
    }
コード例 #20
0
class DemoMappingRule(MappingRule):
    mapping = {
        "test": Key("a"),
    }
コード例 #21
0
ファイル: sql.py プロジェクト: vishweshs4/caster
class SQL(MergeRule):
    pronunciation = "sequel"

    mapping = {
        "select":
        R(Text(" select "), rdescript="SQL: Select"),
        "select all":
        R(Text(" select * "), rdescript="SQL: Select All"),
        "from":
        R(Text(" from "), rdescript="SQL: From"),
        "where":
        R(Text(" where "), rdescript="SQL: Where"),
        "lodge and ":
        R(Text(" and "), rdescript="SQL: And"),
        "lodge or":
        R(Text(" or "), rdescript="SQL: Or"),
        "it are in":
        R(Text(" in "), rdescript="SQL: In"),
        "equals | equal to":
        R(Text(" = "), rdescript="SQL: Equals"),
        "not equals | not equal to":
        R(Text(" <> "), rdescript="SQL: Not Equal To"),
        "group by":
        R(Text(" group by "), rdescript="SQL: Group By"),
        "order by":
        R(Text(" order by "), rdescript="Order By"),
        "ascending":
        R(Text(" asc "), rdescript="SQL: Ascending"),
        "descending":
        R(Text(" desc "), rdescript="SQL: Descending"),
        "left join":
        R(Text(" left join "), rdescript="SQL: Left Join"),
        "join":
        R(Text(" join "), rdescript="SQL: Join"),
        "on columns":
        R(Text(" on "), rdescript="SQL: On"),
        "using":
        R(Text(" using () ") + Key("left/5:2"), rdescript="SQL: Using"),
        "insert into":
        R(Text(" insert into "), rdescript="SQL: Insert"),
        "update":
        R(Text(" update TOKEN set "), rdescript="SQL: Update"),
        "delete":
        R(Text(" delete "), rdescript="SQL: Delete"),
        "like":
        R(Text(" like '%%'") + Key("left/5:2"), rdescript="SQL: Like"),
        "union":
        R(Text(" union "), rdescript="SQL: Union"),
        "alias as":
        R(Text(" as "), rdescript="SQL: Alias As"),
        "is null":
        R(Text(" is null "), rdescript="SQL: Is Null"),
        "is not null":
        R(Text(" is not null "), rdescript="SQL: Is Not Null"),
        "fun max":
        R(Text(" max() ") + Key("left/5:2"), rdescript="SQL: Max"),
        "fun count":
        R(Text(" count() ") + Key("left/5:2"), rdescript="SQL: Count"),
        "over partition by":
        R(Text(" over (partition by ) ") + Key("left/5:2"),
          rdescript="SQL: Over Partition By"),
    }

    extras = []
    defaults = {}