From 088378a9b73a394bf333ae99de732016a6c69862 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Wed, 3 Dec 2008 21:23:04 +0000 Subject: [PATCH] [thorstenp] fix reimported modules --- src/common/helpers.py | 3 +-- src/gajim.py | 15 ++++++++------- src/htmltextview.py | 1 - src/roster_window.py | 11 ++--------- 4 files changed, 11 insertions(+), 19 deletions(-) diff --git a/src/common/helpers.py b/src/common/helpers.py index ba11c11e5..1cc0d41a3 100644 --- a/src/common/helpers.py +++ b/src/common/helpers.py @@ -36,7 +36,6 @@ import subprocess import urllib import errno import select -import sha import base64 import sys from encodings.punycode import punycode_encode @@ -732,7 +731,7 @@ def get_jid_from_iq(iq_obj): def get_auth_sha(sid, initiator, target): ''' return sha of sid + initiator + target used for proxy auth''' - return sha.new("%s%s%s" % (sid, initiator, target)).hexdigest() + return hash_sha1("%s%s%s" % (sid, initiator, target)).hexdigest() distro_info = { diff --git a/src/gajim.py b/src/gajim.py index bdbefa360..a81eb6f8b 100755 --- a/src/gajim.py +++ b/src/gajim.py @@ -37,9 +37,9 @@ ## import os +import warnings if os.name == 'nt': - import warnings warnings.filterwarnings(action='ignore') if os.path.isdir('gtk'): @@ -56,6 +56,11 @@ if os.name == 'nt': os.environ['GTK_BASEPATH'] = 'gtk' import sys +if sys.platform == 'darwin': + try: + import osx + except ImportError: + pass if os.name == 'nt': # needed for docutils @@ -151,7 +156,6 @@ common.configpaths.gajimpaths.init_profile(profile) del profile # PyGTK2.10+ only throws a warning -import warnings warnings.filterwarnings('error', module='gtk') try: import gtk @@ -162,7 +166,6 @@ except Warning, msg: warnings.resetwarnings() if os.name == 'nt': - import warnings warnings.filterwarnings(action='ignore') pritext = '' @@ -408,9 +411,8 @@ def on_exit(): gajim.interface.save_config() if sys.platform == 'darwin': try: - import osx osx.shutdown() - except ImportError: + except Exception: pass import atexit @@ -3366,9 +3368,8 @@ if __name__ == '__main__': if sys.platform == 'darwin': try: - import osx osx.init() - except ImportError: + except Exception: pass Interface() diff --git a/src/htmltextview.py b/src/htmltextview.py index 6ea832d45..b6395b2ae 100644 --- a/src/htmltextview.py +++ b/src/htmltextview.py @@ -1003,7 +1003,6 @@ change_cursor = None if __name__ == '__main__': import os - from common import gajim class log(object): diff --git a/src/roster_window.py b/src/roster_window.py index f8fa2f66c..af8a35895 100644 --- a/src/roster_window.py +++ b/src/roster_window.py @@ -1726,7 +1726,6 @@ class RosterWindow: def music_track_changed(self, unused_listener, music_track_info, account=''): - from common import pep if account == '': accounts = gajim.connections.keys() if music_track_info is None: @@ -2033,13 +2032,8 @@ class RosterWindow: del gajim.interface.status_sent_to_users[account][contact.jid] # Delete pep if needed - #FIXME: py2.5only -# keep_pep = any(c.show not in ('error', 'offline') for c in -# contact_instances) - keep_pep = False - for c in contact_instances: - if c.show not in ('error', 'offline'): - keep_pep = True + keep_pep = any(c.show not in ('error', 'offline') for c in + contact_instances) if not keep_pep and contact.jid != gajim.get_jid_from_account(account) \ and not contact.is_groupchat(): pep.delete_pep(contact.jid, account) @@ -3288,7 +3282,6 @@ class RosterWindow: if gajim.connections[account].pep_supported: # As many implementations don't support retracting items, we send a # "Stopped" event first - from common import pep pep.user_send_tune(account, '') pep.user_retract_tune(account) helpers.update_optional_features(account)