Ejemplo n.º 1
0
 def test_path_detection(self):
     """
     RuleDetails detects the name of the module it was instantiated
     in. This saves the user the trouble of specifying (and updating)
     module names manually.
     """
     rd = RuleDetails()
     self.assertTrue("test_ruleDetails.py" in rd.get_filepath())
Ejemplo n.º 2
0
    def construct_activation_rule(self):
        """
        Construct new rule and for activation.
        Should be called once only, after initial content loading.
        Rule reloading does not watch for new files, so no need to ever call this again.
        """
        if self._activation_rule_class is not None:
            return None

        _mapping = {}
        for class_name, trigger in self._class_name_to_trigger.items():
            enable_spec = "enable {}".format(trigger)
            disable_spec = "disable {}".format(trigger)
            _mapping[enable_spec] = Function(
                lambda rcn: self._activation_fn(rcn, True), rcn=class_name)
            _mapping[disable_spec] = Function(
                lambda rcn: self._activation_fn(rcn, False), rcn=class_name)

        class GrammarActivatorRule(MappingRule):
            mapping = _mapping

        self._activation_rule_class = GrammarActivatorRule

        # name that should be pretty difficult to say by mistake:
        details = RuleDetails(name="grammar manager grammar activator rule",
                              watch_exclusion=True)

        return self._activation_rule_class, details
Ejemplo n.º 3
0
 def _create_managed_rule(rule_class,
                          ccrtype,
                          executable=None,
                          function=None):
     return ManagedRule(
         rule_class,
         RuleDetails(ccrtype=ccrtype,
                     executable=executable,
                     function_context=function))
Ejemplo n.º 4
0
    def construct_activation_rule(self):
        m = {}
        for t in self._transformers:
            enable_action = \
                Function(lambda: self._transformers_config.set_transformer_active(t.get_class_name(), True))
            disable_action = \
                Function(lambda: self._transformers_config.set_transformer_active(t.get_class_name(), False))
            m["enable {} transformer".format(t.get_pronunciation())] = enable_action
            m["disable {} transformer".format(t.get_pronunciation())] = disable_action

        class TransformersActivationRule(MappingRule):
            mapping = m
        details = RuleDetails(name="transformers runner transformers activator rule",
                              watch_exclusion=True)

        return TransformersActivationRule, details
Ejemplo n.º 5
0
    def construct_activation_rule(self):
        m = {}
        for hook in self._hooks:
            enable_action = Function(
                lambda: self._hooks_config.set_hook_active(
                    hook.get_class_name(), True))
            disable_action = Function(
                lambda: self._hooks_config.set_hook_active(
                    hook.get_class_name(), False))
            m["enable {} hook".format(
                hook.get_pronunciation())] = enable_action
            m["disable {} hook".format(
                hook.get_pronunciation())] = disable_action

        class HooksActivationRule(MappingRule):
            mapping = m

        details = RuleDetails(name="hooks runner hooks activator rule",
                              watch_exclusion=True)

        return HooksActivationRule, details
Ejemplo n.º 6
0
def get_rule():
    details = RuleDetails(name="Visual Studio Code",
                          executable="code",
                          title="Visual Studio Code")
    return VSCodeNonCcrRule, details
Ejemplo n.º 7
0
def get_rule():
    details = RuleDetails(ccrtype=CCRType.SELFMOD, transformer_exclusion=True)
    return BringRule, details
Ejemplo n.º 8
0
def get_rule():
    return SSMSRule, RuleDetails(name="sequel server management studio",
                                 executable="ssms")
Ejemplo n.º 9
0
def get_rule():
    return Emoji, RuleDetails(ccrtype=CCRType.GLOBAL)
Ejemplo n.º 10
0
def get_rule():
    return LyxRule, RuleDetails(name="lyx", executable="lyx")
Ejemplo n.º 11
0
def get_rule():
    details = RuleDetails(name="total commander synchronize directories",
                          executable=["totalcmd", "totalcmd64"],
                          title='synchronize directories')
    return SyncDirsRule, details
Ejemplo n.º 12
0
def get_rule():
    return EclipseRule, RuleDetails(name="eclipse",
                                    executable="eclipse",
                                    title="Eclipse")
def get_rule():
    details = RuleDetails(ccrtype=CCRType.GLOBAL)
    return CustomStuff, details
Ejemplo n.º 14
0
def get_rule():
    return ExcelRule, RuleDetails(name="excel", executable="excel")
Ejemplo n.º 15
0
def get_rule():
    return AtomRule, RuleDetails(name="atom", executable="atom", title="Atom")
Ejemplo n.º 16
0
def get_rule():
    return GitHubDeskRule, RuleDetails(name="github desktop", executable="GitHubDesktop")
Ejemplo n.º 17
0
def get_rule():
    return Alphabet, RuleDetails(ccrtype=CCRType.GLOBAL)
Ejemplo n.º 18
0
def get_rule():
    return fmanRule, RuleDetails(name="F man", executable="fman", title="fman")
Ejemplo n.º 19
0
def get_rule():
    return Python, RuleDetails(ccrtype=CCRType.GLOBAL)
Ejemplo n.º 20
0
def get_rule():
    details = RuleDetails(name="repeat that")
    return Again, details
Ejemplo n.º 21
0
def get_rule():
    return DragonRule, RuleDetails(name="dragon")
Ejemplo n.º 22
0
def get_rule():
    return MSTeamsRule, RuleDetails(name="Microsoft Teams", executable="teams")
Ejemplo n.º 23
0
def get_rule():
    return Rust, RuleDetails(ccrtype=CCRType.GLOBAL)
Ejemplo n.º 24
0
def get_rule():
    return WindowGrid, RuleDetails(name="window grid")
Ejemplo n.º 25
0
def get_rule():
    return NPPRule, RuleDetails(name="notepad plus plus",
                                executable="notepad++")
Ejemplo n.º 26
0
def get_rule():
    details = RuleDetails(name="sikuli control rule")
    return SikuliManagementRule, details
Ejemplo n.º 27
0
def get_rule():
    details = RuleDetails(name="window management rule")
    return WindowManagementRule, details
Ejemplo n.º 28
0
def get_rule():
    return FoxitRule, RuleDetails(name="fox it reader", title="Foxit Reader")
Ejemplo n.º 29
0
def get_rule():
    return Navigation, RuleDetails(ccrtype=CCRType.GLOBAL)
Ejemplo n.º 30
0
def get_rule():
    return TrickyWords, RuleDetails(ccrtype=CCRType.GLOBAL)