(self)
| 33 | |
| 34 | class 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): |
nothing calls this directly
no test coverage detected