(self)
| 105 | Gst.init(None) # Init Gst |
| 106 | |
| 107 | def process_command_line(self): |
| 108 | if not self.argv: |
| 109 | return |
| 110 | |
| 111 | text = "" |
| 112 | langs: dict[str, str | None] = {"src": None, "dest": None} |
| 113 | selection = "selection" in self.argv |
| 114 | |
| 115 | if "text" in self.argv: |
| 116 | text = self.argv["text"] |
| 117 | if "src" in self.argv: |
| 118 | langs["src"] = self.argv["src"] |
| 119 | if "dest" in self.argv: |
| 120 | langs["dest"] = self.argv["dest"] |
| 121 | |
| 122 | if self.window is not None: |
| 123 | if not text and selection: |
| 124 | self.window.queue_selection_translation(langs["src"], langs["dest"]) |
| 125 | elif text: |
| 126 | self.window.translate(text, langs["src"], langs["dest"]) |
| 127 | |
| 128 | # Clean CLI args |
| 129 | self.argv = {} |
| 130 | |
| 131 | def setup_actions(self): |
| 132 | """Setup menu actions""" |
no test coverage detected