Enable the console only when running from source path.
This commit is contained in:
parent
53ccec5267
commit
2ae62db4cc
@ -318,8 +318,9 @@ class BrowserShell(dbus.service.Object):
|
||||
self.__browsers.append(browser)
|
||||
browser.activity_connect_to_shell()
|
||||
|
||||
sys.stdout = LogWriter("Web Browser")
|
||||
sys.stderr = LogWriter("Web Browser")
|
||||
if len(sys.argv) > 1 and sys.argv[1] == "--console":
|
||||
sys.stdout = LogWriter("Web Browser")
|
||||
sys.stderr = LogWriter("Web Browser")
|
||||
|
||||
BrowserShell.get_instance().open_web_activity()
|
||||
gtk.main()
|
||||
|
@ -399,8 +399,9 @@ class ChatShell(dbus.service.Object):
|
||||
def send_message(self, message):
|
||||
self._group_chat.send_message(message)
|
||||
|
||||
sys.stdout = LogWriter("Chat")
|
||||
sys.stderr = LogWriter("Chat")
|
||||
if len(sys.argv) > 1 and sys.argv[1] == "--console":
|
||||
sys.stdout = LogWriter("Chat")
|
||||
sys.stderr = LogWriter("Chat")
|
||||
|
||||
ChatShell.get_instance().open_group_chat()
|
||||
gtk.main()
|
||||
|
@ -7,12 +7,15 @@ import gtk
|
||||
|
||||
from sugar.shell import shell
|
||||
|
||||
def start():
|
||||
def start(console):
|
||||
shell.main()
|
||||
|
||||
print 'aaaa'
|
||||
activities = ['sugar/chat/chat', 'sugar/browser/browser']
|
||||
|
||||
for activity in activities:
|
||||
os.spawnvp(os.P_NOWAIT, 'python', [ 'python', '-m', activity ])
|
||||
args = [ 'python', '-m', activity ]
|
||||
if console:
|
||||
args.append('--console')
|
||||
os.spawnvp(os.P_NOWAIT, 'python', args)
|
||||
|
||||
gtk.main()
|
||||
|
16
sugar/sugar
16
sugar/sugar
@ -10,17 +10,23 @@ if curdir == '.':
|
||||
else:
|
||||
basedir = os.path.dirname(curdir)
|
||||
|
||||
console = False
|
||||
|
||||
if os.path.isfile(os.path.join(curdir, '__uninstalled__.py')):
|
||||
if basedir == '':
|
||||
print "Running sugar from current directory..."
|
||||
print 'Running sugar from current directory...'
|
||||
else:
|
||||
print "Running sugar from " + basedir + " ..."
|
||||
sys.path.append(basedir)
|
||||
print 'Running sugar from ' + basedir + ' ...'
|
||||
sys.path.insert(0, basedir)
|
||||
os.environ['PYTHONPATH'] = basedir
|
||||
console = True
|
||||
else:
|
||||
print "Running the installed sugar..."
|
||||
print 'Running the installed sugar...'
|
||||
|
||||
if console:
|
||||
print 'Redirecting output to the console, press ctrl+d to open it.'
|
||||
|
||||
from sugar.session import session
|
||||
|
||||
session.start()
|
||||
session.start(console)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user