MCPcopy Create free account
hub / github.com/dialect-app/dialect / __init__

Method __init__

dialect/main.py:35–60  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

33
34class Dialect(Adw.Application):
35 def __init__(self):
36 Adw.Application.__init__(self, application_id=APP_ID, flags=Gio.ApplicationFlags.HANDLES_COMMAND_LINE)
37 self.set_resource_base_path(RES_PATH)
38
39 # App window
40 self.window: DialectWindow | None = None
41 # CLI
42 self.argv: dict[str, str] = {}
43 self._signal_handler: int | None = None
44
45 # Add command line options
46 self.add_main_option(
47 "selection",
48 ord("n"),
49 GLib.OptionFlags.NONE,
50 GLib.OptionArg.NONE,
51 "Translate text from the primary clipboard",
52 None,
53 )
54 self.add_main_option("text", ord("t"), GLib.OptionFlags.NONE, GLib.OptionArg.STRING, "Text to translate", None)
55 self.add_main_option("src", ord("s"), GLib.OptionFlags.NONE, GLib.OptionArg.STRING, "Source lang code", None)
56 self.add_main_option(
57 "dest", ord("d"), GLib.OptionFlags.NONE, GLib.OptionArg.STRING, "Destination lang code", None
58 )
59
60 self.setup_actions()
61
62 def do_activate(self):
63 def on_translator_loading(_win, _pspec):

Callers

nothing calls this directly

Calls 1

setup_actionsMethod · 0.95

Tested by

no test coverage detected