Ejemplo n.º 1
0
	def __page_load_slot(self):
		with self.__page_load_condition:
			request = self.__page_load_request
		
		# setea la operación
		if request.method == 'GET':
			operation = QNetworkAccessManager.GetOperation
		elif request.method == 'POST':
			operation = QNetworkAccessManager.PostOperation
		else:
			raise ValueError("Unsupported method %s" % request.method)
		
		user_agent = None # el user agent para el request
		
		# Si se definieron headers personalizados se setean tambien
		qnetworkrequest =QNetworkRequest(UrlHelper.from_user_input(request.url))
		for header, value in list(self.__custom_headers.items()):
			qnetworkrequest.setRawHeader(header, value)
			if header.lower() == 'user-agent':
				user_agent = value
		
		# setea url y headers 
		qnetworkrequest =QNetworkRequest(UrlHelper.from_user_input(request.url))
		for header, value in list(request.headers.items()):
			qnetworkrequest.setRawHeader(header, value)
			if header.lower() == 'user-agent':
				user_agent = value
				
		
		self.__page._set_user_agent(user_agent)					
		
		# lo más importante: carga la página
		self.__web_view.load(qnetworkrequest, operation, request.body)
Ejemplo n.º 2
0
	def __download_slot(self, url):
		manager = self.__web_view.page().networkAccessManager();
		self.__download_manager = manager
		self.connect(manager,
			QtCore.SIGNAL("finished(QNetworkReply*)"),
			self.__download_finished_slot
		)		
		manager.get(QNetworkRequest(UrlHelper.from_user_input(url)));
Ejemplo n.º 3
0
	def __slotCargarURL(self):
		"Carga la url de la barra de dirección"
		text = self.__ui.direccionlineEdit.text()
		self.__current_webview().setUrl(UrlHelper.from_user_input(text))