def __check_disk_info(self, dst, total_size):
        (capacity, available, used) = get_disk_info(str(dst))
        if available < total_size:
            self.utils.cprint(_("There is not enough space left on your USB stick for the image."), "red")

            self.utils.cprint(_("Unmounting directories..."), "red")
            unmount_dirs()

            return False

        self.utils.cprint(_("USB disk informations:"), "brightgreen")
        self.utils.cprint("    %s:" % _("Capacity"), "green", True)
        print("%dMB" % capacity)

        self.utils.cprint("    %s:" % _("Available"), "green", True)
        print("%dMB" % available)

        self.utils.cprint("    %s:" % _("Used"), "green", True)
        print("%dMB" % used)

        print(_("\nPlease double check your path information. If you don't type the path to the USB stick correctly, you may damage your computer. Would you like to continue?"))

        answer = raw_input("%s " % _("Please type CONFIRM to continue:"))
        if answer in (_('CONFIRM'), _('confirm')):
            self.utils.cprint(_("Writing image data to USB stick!"), "green")

            return True

        self.utils.cprint(_("You did not type CONFIRM. Exiting.."), "red")
        unmount_dirs()

        return False
Exemple #2
0
    def on_button_create_clicked(self):
        # FIXED issue: #1
        src = unicode(str(self.line_image.displayText()))
        dst = str(self.line_disk.displayText())

        if dst.startswith("/dev/"):
            device = dst
            dst = tempfile.mkdtemp(suffix="_usbPuding")

            from puding.pardusTools import Authorization

            auth = Authorization()
            auth.mount(device, dst)

        if not self.__check_destination(dst):
            self.warning_dialog(self.tr("Directory is Invalid"), self.tr("Please check the USB disk path."))

            return False

        try:
            (name, md5, url) = self.__get_source_info(src)

        except TypeError: # 'bool' object is not iterable
            # It's not true way, you should warn to the users with WarningDialog.
            return False

        mount_point = get_mounted(dst)
        (capacity, available, used) = get_disk_info(dst)

        # Mount iso
        if not os.path.ismount(self.iso_dir):
            cmd = "fuseiso %s %s" % (src, self.iso_dir)
            if run_command(cmd):
                # FIX ME: Should use warning dialog.
                return False

        # FIX ME: Now Puding supports only Pardus.
        from pardusTools import Main

        self.tools = Main(self.iso_dir, dst)
        total_size = self.tools.get_total_size()

        if available < total_size:
            self.warning_dialog("Warning", "There is not enough space left on your USB stick for the image.")

        else:
            self.confirm_infos = ConfirmDialog(src, dst, mount_point, name, total_size, capacity, available, used)

            if self.confirm_infos.exec_() == QtGui.QDialog.Accepted:
                create_USB_dirs(dst)
                self.__create_image(src, dst)

                if dst.endswith("Puding"):
                    auth.umount(dst)

        run_command("fusermount -u %s" % self.iso_dir)
Exemple #3
0
    def on_button_create_clicked(self):
        # FIXED issue: #1
        src = unicode(str(self.line_image.displayText()))
        dst = str(self.line_disk.displayText())

        if dst.startswith("/dev/"):
            device = dst
            dst = tempfile.mkdtemp(suffix="_usbPuding")

            from puding.pardusTools import Authorization

            auth = Authorization()
            auth.mount(device, dst)

        if not self.__check_destination(dst):
            self.warning_dialog(self.tr("Directory is Invalid"), self.tr("Please check the USB disk path."))

            return False

        try:
            (name, md5, url) = self.__get_source_info(src)

        except TypeError: # 'bool' object is not iterable
            # It's not true way, you should warn to the users with WarningDialog.
            return False

        mount_point = get_mounted(dst)
        (capacity, available, used) = get_disk_info(dst)

        # Mount iso
        if not os.path.ismount(self.iso_dir):
            cmd = "fuseiso %s %s" % (src, self.iso_dir)
            if run_command(cmd):
                # FIX ME: Should use warning dialog.
                return False

        # FIX ME: Now Puding supports only Pardus.
        from pardusTools import Main

        self.tools = Main(self.iso_dir, dst)
        total_size = self.tools.get_total_size()

        if available < total_size:
            self.warning_dialog("Warning", "There is not enough space left on your USB stick for the image.")

        else:
            self.confirm_infos = ConfirmDialog(src, dst, mount_point, name, total_size, capacity, available, used)

            if self.confirm_infos.exec_() == QtGui.QDialog.Accepted:
                create_USB_dirs(dst)
                self.__create_image(src, dst)

                if dst.endswith("Puding"):
                    auth.umount(dst)

        run_command("fusermount -u %s" % self.iso_dir)
Exemple #4
0
    def __check_disk_info(self, dst, total_size):
        (capacity, available, used) = get_disk_info(str(dst))
        if available < total_size:
            self.utils.cprint(
                _("There is not enough space left on your USB stick for the image."
                  ), "red")

            self.utils.cprint(_("Unmounting directories..."), "red")
            unmount_dirs()

            return False

        self.utils.cprint(_("USB disk informations:"), "brightgreen")
        self.utils.cprint("    %s:" % _("Capacity"), "green", True)
        print("%dMB" % capacity)

        self.utils.cprint("    %s:" % _("Available"), "green", True)
        print("%dMB" % available)

        self.utils.cprint("    %s:" % _("Used"), "green", True)
        print("%dMB" % used)

        print(
            _("\nPlease double check your path information. If you don't type the path to the USB stick correctly, you may damage your computer. Would you like to continue?"
              ))

        answer = raw_input("%s " % _("Please type CONFIRM to continue:"))
        if answer in (_('CONFIRM'), _('confirm')):
            self.utils.cprint(_("Writing image data to USB stick!"), "green")

            return True

        self.utils.cprint(_("You did not type CONFIRM. Exiting.."), "red")
        unmount_dirs()

        return False