From ee0dae6059f244c747314ab6aa4d5f3c4b4ac111 Mon Sep 17 00:00:00 2001 From: Stephen Watson Date: Mon, 25 Sep 2006 19:34:37 +0000 Subject: [PATCH] Ensure window response codes are treated as int(), required for python 2.5 and pygtk 2.6 (Stephen Watson). git-svn-id: https://rox.svn.sourceforge.net/svnroot/rox/trunk/ROX-Lib2@4798 66de3db3-b00d-0410-b41b-f4738ad19bea --- python/rox/OptionsBox.py | 6 +++--- python/rox/__init__.py | 2 +- python/rox/debug.py | 4 ++-- python/rox/fileutils.py | 4 ++-- python/rox/mime_handler.py | 4 ++-- python/rox/saving.py | 6 +++--- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/python/rox/OptionsBox.py b/python/rox/OptionsBox.py index 7c995bb..03c4854 100644 --- a/python/rox/OptionsBox.py +++ b/python/rox/OptionsBox.py @@ -169,7 +169,7 @@ class OptionsBox(g.Dialog): self.connect('destroy', destroyed) def got_response(widget, response): - if response == g.RESPONSE_OK: + if response == int(g.RESPONSE_OK): self.destroy() elif response == REVERT: for o in self.options: @@ -931,7 +931,7 @@ class FontButton(g.Button): self.dialog = None def response(dialog, resp): - if resp != g.RESPONSE_OK: + if resp != int(g.RESPONSE_OK): dialog.destroy() return self.label.set_text(dialog.get_font_name()) @@ -986,7 +986,7 @@ class ColourButton(g.Button): self.dialog = None def response(dialog, resp): - if resp != g.RESPONSE_OK: + if resp != int(g.RESPONSE_OK): dialog.destroy() return self.set(dialog.colorsel.get_current_color()) diff --git a/python/rox/__init__.py b/python/rox/__init__.py index 95daab4..6148bbe 100644 --- a/python/rox/__init__.py +++ b/python/rox/__init__.py @@ -173,7 +173,7 @@ def confirm(message, stock_icon, action = None): resp = box.run() box.destroy() toplevel_unref() - return resp == g.RESPONSE_OK + return resp == int(g.RESPONSE_OK) def report_exception(): """Display the current python exception in an error box, returning diff --git a/python/rox/debug.py b/python/rox/debug.py index b5e38bf..c7faa70 100644 --- a/python/rox/debug.py +++ b/python/rox/debug.py @@ -61,7 +61,7 @@ def show_exception(type, value, tb, auto_details = False): else: g.main() resp = reply.pop() - if resp == g.RESPONSE_OK or resp == g.RESPONSE_DELETE_EVENT: + if resp == int(g.RESPONSE_OK) or resp == int(g.RESPONSE_DELETE_EVENT): break if resp == SAVE: global savebox @@ -77,7 +77,7 @@ def show_exception(type, value, tb, auto_details = False): continue if resp == QUIT: sys.exit(1) - elif resp == g.RESPONSE_HELP: + elif resp == int(g.RESPONSE_HELP): _show_debug_help() continue assert resp == DETAILS diff --git a/python/rox/fileutils.py b/python/rox/fileutils.py index 9ed51ba..85c0145 100644 --- a/python/rox/fileutils.py +++ b/python/rox/fileutils.py @@ -34,12 +34,12 @@ def report_patherror(message, path): box.set_default_response(g.RESPONSE_APPLY) while 1: resp = box.run() - if resp != g.RESPONSE_APPLY: break + if resp != int(g.RESPONSE_APPLY): break filerpath = os.path.normpath(path) filer.show_file(filerpath) box.destroy() toplevel_unref() - if resp != g.RESPONSE_OK: + if resp != int(g.RESPONSE_OK): raise OSError, message def _makedirs_recursive(path, mode): diff --git a/python/rox/mime_handler.py b/python/rox/mime_handler.py index 7c6ddc1..2f7a5e1 100644 --- a/python/rox/mime_handler.py +++ b/python/rox/mime_handler.py @@ -265,7 +265,7 @@ def _install_type_handler(types, dir, desc, application=None, overwrite=True, win=InstallList(application, desc, dir, types, info) - if win.run()!=rox.g.RESPONSE_ACCEPT: + if win.run()!=int(rox.g.RESPONSE_ACCEPT): win.destroy() return @@ -331,7 +331,7 @@ def install_send_to_types(types, application=None, injint=None): _("""The application can handle files of these types. Click on OK to add it to the SendTo menu for the type of file, and also the customized File menu."""), check=False) - if win.run()!=rox.g.RESPONSE_ACCEPT: + if win.run()!=int(rox.g.RESPONSE_ACCEPT): win.destroy() return diff --git a/python/rox/saving.py b/python/rox/saving.py index 4c25ca9..10374c3 100644 --- a/python/rox/saving.py +++ b/python/rox/saving.py @@ -556,11 +556,11 @@ class SaveBox(g.Dialog): except: rox.report_exception() return - if response == g.RESPONSE_CANCEL: + if response == int(g.RESPONSE_CANCEL): self.destroy() - elif response == g.RESPONSE_OK: + elif response == int(g.RESPONSE_OK): self.save_area.save_to_file_in_entry() - elif response == g.RESPONSE_DELETE_EVENT: + elif response == int(g.RESPONSE_DELETE_EVENT): pass else: raise Exception('Unknown response!') -- 2.11.4.GIT