Setup menu actions
(self)
| 129 | self.argv = {} |
| 130 | |
| 131 | def setup_actions(self): |
| 132 | """Setup menu actions""" |
| 133 | |
| 134 | pronunciation = Gio.SimpleAction.new_stateful("pronunciation", None, Settings.get().show_pronunciation_value) |
| 135 | pronunciation.connect("change-state", self._on_pronunciation) |
| 136 | self.add_action(pronunciation) |
| 137 | |
| 138 | preferences = Gio.SimpleAction(name="preferences") |
| 139 | preferences.connect("activate", self._on_preferences) |
| 140 | self.add_action(preferences) |
| 141 | |
| 142 | about = Gio.SimpleAction(name="about") |
| 143 | about.connect("activate", self._on_about) |
| 144 | self.add_action(about) |
| 145 | |
| 146 | quit_action = Gio.SimpleAction(name="quit") |
| 147 | quit_action.connect("activate", self._on_quit) |
| 148 | self.add_action(quit_action) |
| 149 | |
| 150 | self.set_accels_for_action("app.pronunciation", ["<Primary>P"]) |
| 151 | self.set_accels_for_action("app.preferences", ["<Primary>comma"]) |
| 152 | self.set_accels_for_action("app.quit", ["<Primary>Q"]) |
| 153 | |
| 154 | self.set_accels_for_action("win.back", ["<Alt>Left"]) |
| 155 | self.set_accels_for_action("win.forward", ["<Alt>Right"]) |
| 156 | self.set_accels_for_action("win.switch", ["<Primary>S"]) |
| 157 | self.set_accels_for_action("win.from", ["<Primary>F"]) |
| 158 | self.set_accels_for_action("win.to", ["<Primary>T"]) |
| 159 | self.set_accels_for_action("win.clear", ["<Primary>D"]) |
| 160 | self.set_accels_for_action("win.font-size-inc", ["<Primary>plus", "<Primary>KP_Add"]) |
| 161 | self.set_accels_for_action("win.font-size-dec", ["<Primary>minus", "<Primary>KP_Subtract"]) |
| 162 | self.set_accels_for_action("win.paste", ["<Primary><Shift>V"]) |
| 163 | self.set_accels_for_action("win.copy", ["<Primary><Shift>C"]) |
| 164 | self.set_accels_for_action("win.listen-dest", ["<Primary>L"]) |
| 165 | self.set_accels_for_action("win.listen-src", ["<Primary><Shift>L"]) |
| 166 | self.set_accels_for_action("win.show-help-overlay", ["<Primary>question"]) |
| 167 | |
| 168 | def _on_pronunciation(self, action: Gio.SimpleAction, value: GLib.Variant): |
| 169 | """Update show pronunciation setting""" |