Exemple #1
0
    def _download_from_http(self, remote_uri):
        """Download the PDF from a remote location to a temporal file."""

        # Display a message
        self._message_box = PDFProgressMessageBox(
            message=_("Downloading document..."),
            button_callback=self.close_tab)
        self.pack_start(self._message_box, True, True, 0)
        self._message_box.show()
        """
        # Figure out download URI
        temp_path = os.path.join(activity.get_activity_root(), 'instance')
        if not os.path.exists(temp_path):
            os.makedirs(temp_path)

        fd, dest_path = tempfile.mkstemp(dir=temp_path)
        """

        context = WebKit2.WebContext.get_default()
        context.connect('download-started', self.__download_started_cb)
        downloadmanager.ignore_pdf(remote_uri)
    def _download_from_http(self, remote_uri):
        """Download the PDF from a remote location to a temporal file."""

        # Display a message
        self._message_box = PDFProgressMessageBox(
            message=_("Downloading document..."),
            button_callback=self.close_tab)
        self.pack_start(self._message_box, True, True, 0)
        self._message_box.show()

        """
        # Figure out download URI
        temp_path = os.path.join(activity.get_activity_root(), 'instance')
        if not os.path.exists(temp_path):
            os.makedirs(temp_path)

        fd, dest_path = tempfile.mkstemp(dir=temp_path)
        """

        context = WebKit2.WebContext.get_default()
        context.connect('download-started', self.__download_started_cb)
        downloadmanager.ignore_pdf(remote_uri)
        context.download_uri(remote_uri)