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