Example #1
0
	def __run(self, context, options, args, bootstrap_event_handler):
		try:
			self.__get_options(options, args)
		except NameError as ex:
			print("Error while parsing command line arguments: %s" % ex, file=stderr)
			self.__parser.print_help()
			exit(1)
		
		if not options.countries_file:
			cf = join('config', 'countries.info')
			options.countries_file = cf
		
		if not options.output_file:
			options.output_file = None
		
		# importa el parser
		try:
			parser_class = self.__parser_loader.get_parser_class(options)
		except ImportError as ex:
			print("Error while loading Parser module %s: %s" % (
				str(options.parser), ex), file=stderr) 
			exit(1)
		
			
		from sdf import BaseParser
		if not issubclass(parser_class, BaseParser):
			print("%s must be a Parser class" % options.parser, file=stderr)
			exit(1) 
		
		BrowserFactory.create_instance(context)
		parser = parser_class(context)
		context._set_parser(parser)
		self.__parser_loader.parser_loaded(context, parser)
		BootStrap.init_and_work(parser.run, bootstrap_event_handler)
Example #2
0
	def get_webkitbrowser(self, show, show_images):
		"Devuelve un objeto de la clase WebKitBrowser llamando a su constructor"
		self.__get_webkitbrowser_condition.acquire()
		
		BootStrap.init_qt()	
		
		self.emit(QtCore.SIGNAL('get_webkitbrowser_signal(bool, bool)'),
				show, show_images)
		self.__get_webkitbrowser_condition.wait()
		if self.__get_webkitbrowser_result == None:
			self.__get_webkitbrowser_condition.release()
			raise LogicError("Couldn't get WebKitBrowser instance")
			
		else:
			self.__get_webkitbrowser_condition.release()
			return self.__get_webkitbrowser_result
Example #3
0
	def get_mozillabrowser(self):
		"Retorna una instancia de un MozillaBrowser"
		
		# FIXME todavía no hace nada, solo levanta la aplicación XULRunner
		BootStrap.init_mozilla()
		return MozillaBrowser(self.__context)