Ejemplo n.º 1
0
        def ask_if_download():
            filename[0], size_bytes = getFilenameAndLength(item.url, headers, filename[0])
            size_mbytes = size_bytes and util.BtoMB(size_bytes) or "???"
            free_bytes = util.get_free_space(destination[0])
            free_mbytes = free_bytes and util.BtoMB(free_bytes) or "???"

            message = "%s:\n\n%s:\n%s - %sMB\n\n%s:\n%s - %sMB %s\n\n%s:\n%s"%(
                    _("Do you want to download"),
                    _("Source"), toString(item.name), str(size_mbytes),
                    _("Destination"), toString(destination[0]), str(free_mbytes), _("free"),
                    _("Filename"), toString(filename[0]))
            choices = [ (_("yes"), "yes"), (_("no"), "no"), 
                    (_("Change location"), "change"), (_("Edit filename"), "filename") ]

            session.openWithCallback(ask_if_download_callback,
                    MessageBox, message, MessageBox.TYPE_YESNO, list=choices)
Ejemplo n.º 2
0
        def ask_if_download():
            filename[0], size_bytes = getFilenameAndLength(item.url, headers, filename[0])
            size_mbytes = size_bytes and util.BtoMB(size_bytes) or "???"
            free_bytes = util.get_free_space(destination[0])
            free_mbytes = free_bytes and util.BtoMB(free_bytes) or "???"

            message = "%s:\n\n%s:\n%s - %sMB\n\n%s:\n%s - %sMB %s\n\n%s:\n%s"%(
                    _("Do you want to download"),
                    _("Source"), toString(item.name), str(size_mbytes),
                    _("Destination"), toString(destination[0]), str(free_mbytes), _("free"),
                    _("Filename"), toString(filename[0]))
            choices = [ (_("yes"), "yes"), (_("no"), "no"), 
                    (_("Change location"), "change"), (_("Edit filename"), "filename") ]

            session.openWithCallback(ask_if_download_callback,
                    MessageBox, message, MessageBox.TYPE_YESNO, list=choices)