diff --git a/src/common/dbus_support.py b/src/common/dbus_support.py index 71695036a..0336e84b2 100644 --- a/src/common/dbus_support.py +++ b/src/common/dbus_support.py @@ -29,8 +29,11 @@ _GAJIM_ERROR_IFACE = 'org.gajim.dbus.Error' try: if sys.platform == 'darwin': - import osx.dbus - osx.dbus.load(True) + try: + import osx.dbus + osx.dbus.load(True) + except: + pass import dbus import dbus.service import dbus.glib diff --git a/src/common/helpers.py b/src/common/helpers.py index 1f9ca45f0..87c98e54f 100644 --- a/src/common/helpers.py +++ b/src/common/helpers.py @@ -53,8 +53,10 @@ except ImportError: hash_md5 = md5.new hash_sha1 = sha.new -if sys.platform == 'darwin': +try: from osx import nsapp +except: + pass try: import winsound # windows-only built-in module for playing wav @@ -570,7 +572,10 @@ def play_sound_file(path_to_soundfile): if path_to_soundfile is None or not os.path.exists(path_to_soundfile): return if sys.platform == 'darwin': - nsapp.playFile(path_to_soundfile) + try: + nsapp.playFile(path_to_soundfile) + except: + pass elif os.name == 'nt': try: winsound.PlaySound(path_to_soundfile, diff --git a/src/gajim.py b/src/gajim.py index cd083bf1a..2435f920e 100755 --- a/src/gajim.py +++ b/src/gajim.py @@ -600,8 +600,11 @@ def on_exit(): if os.path.exists(pid_filename): os.remove(pid_filename) if sys.platform == 'darwin': - import osx - osx.shutdown() + try: + import osx + osx.shutdown() + except: + pass import atexit atexit.register(on_exit) @@ -3461,8 +3464,11 @@ if __name__ == '__main__': check_paths.check_and_possibly_create_paths() if sys.platform == 'darwin': - import osx - osx.init() + try: + import osx + osx.init() + except: + pass Interface() diff --git a/src/roster_window.py b/src/roster_window.py index 1f60581df..00b3351a4 100644 --- a/src/roster_window.py +++ b/src/roster_window.py @@ -61,8 +61,10 @@ if dbus_support.supported: import dbus from lastfm_track_listener import LastFMTrackListener -if sys.platform == 'darwin': +try: from osx import syncmenu +except: + pass #(icon, name, type, jid, account, editable, second pixbuf) ( @@ -4476,7 +4478,10 @@ class RosterWindow: advanced_sub_menu.show_all() if sys.platform == 'darwin': - syncmenu.takeover_menu(self.xml.get_widget('menubar')) + try: + syncmenu.takeover_menu(self.xml.get_widget('menubar')) + except: + pass self.actions_menu_needs_rebuild = False @@ -5692,6 +5697,8 @@ class RosterWindow: return True def setup_for_osx(self): + # This is broken + return '''Massage the GTK menu so it will match up to the OS/X nib style menu when passed to sync-menu and merged''' main_menu = self.xml.get_widget('menubar') diff --git a/src/statusicon.py b/src/statusicon.py index 8dfe843e3..ed0c02dda 100644 --- a/src/statusicon.py +++ b/src/statusicon.py @@ -27,7 +27,10 @@ from common import gajim from common import helpers if sys.platform == 'darwin': - import osx + try: + import osx + except: + pass class StatusIcon(systray.Systray): '''Class for the notification area icon'''