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