summaryrefslogtreecommitdiff
path: root/src/openbox.cc
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2003-02-16 16:33:12 +0000
committerDana Jansens <danakj@orodu.net>2003-02-16 16:33:12 +0000
commit8ed79248e79cede45b6972f3ab007add1dd55956 (patch)
tree9c1b8ea9998b0f82d2f0ad4f4a778713fe7eba38 /src/openbox.cc
parent8cbabdcb93a61110a111f77d6f0f51cf3f6dd834 (diff)
when python_exec fails on user.py:
a) remove all the bindings b) exec defaults.py c) show a dialog message
Diffstat (limited to 'src/openbox.cc')
-rw-r--r--src/openbox.cc29
1 files changed, 23 insertions, 6 deletions
diff --git a/src/openbox.cc b/src/openbox.cc
index d068880b..499e5a1c 100644
--- a/src/openbox.cc
+++ b/src/openbox.cc
@@ -14,6 +14,7 @@
#include "otk/util.hh"
#include "otk/rendercolor.hh"
#include "otk/renderstyle.hh"
+#include "otk/messagedialog.hh"
extern "C" {
#include <X11/cursorfont.h>
@@ -133,14 +134,18 @@ Openbox::Openbox(int argc, char **argv)
// initialize scripting
python_init(argv[0]);
- // load config values
- //python_exec(SCRIPTDIR"/config.py"); // load openbox config values
- // run all of the python scripts
- //python_exec(SCRIPTDIR"/builtins.py"); // builtin callbacks
- //python_exec(SCRIPTDIR"/focus.py"); // focus helpers
// run the user's script or the system defaults if that fails
- if (!python_exec(_scriptfilepath.c_str()))
+ bool pyerr = false;
+ if (!python_exec(_scriptfilepath.c_str())) {
+ pyerr = true;
+
+ // reset all the python stuff
+ _bindings->removeAllKeys();
+ _bindings->removeAllButtons();
+ _bindings->removeAllEvents();
+
python_exec(SCRIPTDIR"/defaults.py"); // system default bahaviors
+ }
// initialize all the screens
_focused_screen = 0;
@@ -183,6 +188,18 @@ Openbox::Openbox(int argc, char **argv)
setFocusedClient(0);
_state = State_Normal; // done starting
+
+ if (pyerr) {
+ std::string msg;
+ msg += _("An error occured while executing the python scripts.");
+ msg += "\n\n";
+ msg += _("See the exact error message in Openbox's output for details.");
+ otk::MessageDialog dia(this, _("Python Error"), msg);
+ dia.addButton(otk::DialogButton("OK", true));
+ dia.show();
+ dia.focus();
+ dia.run();
+ }
}