def error(primary, secondary): dialog = HIGDialog((gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE), _ERROR, primary, secondary) gtk.threads_enter() dialog.run() gtk.threads_leave() sys.exit(1337)
def _configurable(icon, primary, secondary, *buttons): def responder(src, response): callback = buttons[response][1] # Before calling back, check to see if it's callable if (callback and hasattr(callback, '__call__')): callback() response = 0 btns = [] for label, callback in buttons: btns.append(label) btns.append(response) response += 1 dialog = HIGDialog(tuple(btns), icon, primary, secondary) dialog.connect("response", responder) return dialog