|
16 | 16 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | 17 |
|
18 | 18 | # Import libs |
19 | | -import os |
| 19 | +import os, traceback |
20 | 20 | from gi.repository import Gtk, Gdk, Gio, GdkPixbuf, GLib |
21 | 21 |
|
22 | 22 | # Import tools |
@@ -118,7 +118,9 @@ def init_window_content(self, gfile, get_cb): |
118 | 118 | popovers, the tools, their options, and a new image. Depending on the |
119 | 119 | parameters, the new image can be imported from the clipboard, loaded |
120 | 120 | from a GioFile, or (else) it can be a blank image.""" |
121 | | - self.tools = None |
| 121 | + self.prompt_action(_("Error starting the application, please report this bug.")) |
| 122 | + |
| 123 | + self.tools = {} |
122 | 124 | self.minimap = DrMinimap(self, None) |
123 | 125 | self.options_manager = DrOptionsManager(self) |
124 | 126 | self.saving_manager = DrSavingManager(self) |
@@ -231,14 +233,13 @@ def _enable_first_tool(self): |
231 | 233 | def _load_tool(self, tool_id, tool_class, disabled_tools, dev): |
232 | 234 | """Given its id and its python class, this method tries to load a tool, |
233 | 235 | and show an error message if the tool initialization failed.""" |
234 | | - if dev: # Simplest way to get an error stack |
235 | | - self.tools[tool_id] = tool_class(self) |
236 | | - elif tool_id not in disabled_tools: |
| 236 | + if tool_id not in disabled_tools: |
237 | 237 | try: |
238 | 238 | self.tools[tool_id] = tool_class(self) |
239 | | - except: |
| 239 | + except Exception as err: |
240 | 240 | # Context: an error message |
241 | | - self.prompt_message(True, _("Failed to load tool: %s") % tool_id) |
| 241 | + self.prompt_action(_("Failed to load tool: %s") % tool_id) |
| 242 | + traceback.print_exc() |
242 | 243 |
|
243 | 244 | def _build_tool_rows(self): |
244 | 245 | """Adds each tool's button to the side pane.""" |
@@ -708,10 +709,10 @@ def prompt_message(self, show, label): |
708 | 709 | self.info_action.set_visible(False) |
709 | 710 | if show: |
710 | 711 | self.info_label.set_label(label) |
711 | | - if show or self.gsettings.get_boolean('devel-only') and label != "": |
| 712 | + if show and self.gsettings.get_boolean('devel-only') and label != "": |
712 | 713 | print('Drawing: ' + label) |
713 | 714 |
|
714 | | - def prompt_action(self, message, action_name, action_label): |
| 715 | + def prompt_action(self, message, action_name='app.report_bug', action_label=_("Report a bug")): |
715 | 716 | """Update the content of the info bar, including its actionable button |
716 | 717 | which is set as visible.""" |
717 | 718 | self.prompt_message(True, message) |
|
0 commit comments