Exemplo n.º 1
0
def stoosh(nnavi500, nexus, copy_key="c-c"):
    if nnavi500 == 1:
        Key(copy_key).execute()
    else:
        cb = Clipboard(from_system=True)
        Key(copy_key).execute()
        # time for keypress to execute
        time.sleep(SETTINGS["keypress_wait"])
        nexus.clip[str(nnavi500)] = Clipboard.get_system_text()
        utilities.save_toml_relative(nexus.clip, SETTINGS["clipboard_path"])
        cb.copy_to_system()
Exemplo n.º 2
0
 def refresh(self, *args):
     '''args: spec, text'''
     aliases = utilities.load_toml_relative("config/aliases.toml")
     if not Var.key in aliases:
         aliases[Var.key] = {}
     if len(args) > 0:
         aliases[Var.key][args[0]] = args[1]
         utilities.save_toml_relative(aliases, "config/aliases.toml")
     mapping = {}
     for spec in aliases[Var.key]:
         mapping["var " + spec] = Text(str(aliases[Var.key][spec]))
         mapping["delete variable " + spec] = Function(self.delete,
                                                       spec=spec)
     mapping["variable <s> [brunt]"] = Function(lambda s: self.alias(s))
     mapping["delete variables"] = Function(self.delete_all)
     self.reset(mapping)
Exemplo n.º 3
0
 def refresh(self, *args):
     '''args: spec, text'''
     aliases = utilities.load_toml_relative("config/aliases.toml")
     if not Alias.key in aliases:
         aliases[Alias.key] = {}
     if len(args) > 0:
         aliases[Alias.key][args[0]] = args[1]
         utilities.save_toml_relative(aliases, "config/aliases.toml")
     mapping = {}
     for spec in aliases[Alias.key]:
         mapping[spec] = Function(utilities.paste_string,
                                  content=str(aliases[Alias.key][spec]))
         mapping["delete alias " + spec] = Function(self.delete, spec=spec)
     mapping["alias <s>"] = Function(lambda s: self.alias(s))
     mapping["delete aliases"] = Function(self.delete_all)
     self.reset(mapping)
Exemplo n.º 4
0
def math_mode(enable=True):
    BINDINGS = utilities.load_toml_relative("config/latex.toml")
    prefix = BINDINGS["symbol_prefix"].replace("[", "").replace("]", "")
    if enable:
        BINDINGS["symbol_prefix"] = "[" + prefix + "]"
    else:
        BINDINGS["symbol_prefix"] = prefix
    utilities.save_toml_relative(BINDINGS, "config/latex.toml")
    _NEXUS.merger.wipe()
    try:
        del _NEXUS.merger._global_rules[BINDINGS["pronunciation"]]
        want_reload_module = sys.modules["caster.ccr.latex"]
        reload(want_reload_module)
        print(BINDINGS["pronunciation"] + " rebuilt")
    except Exception as e:
        print(e)
    _NEXUS.merger.update_config()
    _NEXUS.merger.merge(3)
Exemplo n.º 5
0
 def delete(self, spec):
     aliases = utilities.load_toml_relative("config/aliases.toml")
     del aliases[Var.key][spec]
     utilities.save_toml_relative(aliases, "config/aliases.toml")
     self.refresh()
Exemplo n.º 6
0
 def delete_all(self):
     aliases = utilities.load_toml_relative("config/aliases.toml")
     aliases[Var.key] = {}
     utilities.save_toml_relative(aliases, "config/aliases.toml")
     self.refresh()