* Start X11 automatically on OS X if not running.

* Moved one import in osx/__init__.py. If that import fails, we still
  got the few functions defined we need, even if the rest of that file
  doesn't work due to missing deps.
This commit is contained in:
js 2008-06-07 21:12:27 +00:00
parent 8def8de5c7
commit 0551c9ddac
2 changed files with 13 additions and 7 deletions

View File

@ -142,8 +142,16 @@ try:
import gtk import gtk
except Warning, msg: except Warning, msg:
if str(msg) == 'could not open display': if str(msg) == 'could not open display':
print >> sys.stderr, _('Gajim needs X server to run. Quiting...') if sys.platform == 'darwin':
sys.exit() os.system('/Applications/Utilities/X11.app/Contents/MacOS/X11 &')
try:
import gtk
except Warning, msg:
print >> sys.stderr, _('No X11 running and failed to start it! Quitting...')
sys.exit()
else:
print >> sys.stderr, _('Gajim needs X server to run. Quiting...')
sys.exit()
warnings.resetwarnings() warnings.resetwarnings()
if os.name == 'nt': if os.name == 'nt':

View File

@ -1,15 +1,12 @@
import sys, commands import sys, commands
from network_manager_listener import device_now_active, device_no_longer_active from network_manager_listener import device_now_active, device_no_longer_active
import nsapp
if sys.platform != "darwin": if sys.platform != 'darwin':
raise ImportError("System platform is not OS/X") raise ImportError('System platform is not OS X')
net_device_active = True net_device_active = True
### ###
### Utility functions ### Utility functions
### ###
@ -21,6 +18,7 @@ def checkPID(pid, procname):
return True return True
return False return False
import nsapp
def init(): def init():
nsapp.init() nsapp.init()