示例#1
0
文件: ask.py 项目: Acidburn0zzz/Cnchi
    def __init__(self, params, prev_page="features", next_page=None):
        super().__init__(self, params, "ask", prev_page, next_page)

        data_dir = self.settings.get("data")
        #partitioner_dir = os.path.join(data_dir, "images", "partitioner")
        partitioner_dir = os.path.join(data_dir, "images", "partitioner", "small")

        image = self.ui.get_object("automatic_image")
        path = os.path.join(partitioner_dir, "automatic.png")
        image.set_from_file(path)

        image = self.ui.get_object("alongside_image")
        path = os.path.join(partitioner_dir, "alongside.png")
        image.set_from_file(path)

        image = self.ui.get_object("advanced_image")
        path = os.path.join(partitioner_dir, "advanced.png")
        image.set_from_file(path)

        oses = {}
        oses = bootinfo.get_os_dict()

        self.other_os = ""
        for k in oses:
            if "sda" in k and oses[k] != "unknown":
                self.other_os = oses[k]

        # By default, select automatic installation
        self.next_page = "installation_automatic"
示例#2
0
    def __init__(self, params, prev_page="features", next_page=None):
        super().__init__(self, params, "ask", prev_page, next_page)

        data_dir = self.settings.get("data")
        #partitioner_dir = os.path.join(data_dir, "images", "partitioner")
        partitioner_dir = os.path.join(data_dir, "images", "partitioner",
                                       "small")

        image = self.ui.get_object("automatic_image")
        path = os.path.join(partitioner_dir, "automatic.png")
        image.set_from_file(path)

        image = self.ui.get_object("alongside_image")
        path = os.path.join(partitioner_dir, "alongside.png")
        image.set_from_file(path)

        image = self.ui.get_object("advanced_image")
        path = os.path.join(partitioner_dir, "advanced.png")
        image.set_from_file(path)

        oses = {}
        oses = bootinfo.get_os_dict()

        self.other_os = ""
        for k in oses:
            if "sda" in k and oses[k] != "unknown":
                self.other_os = oses[k]

        # By default, select automatic installation
        self.next_page = "installation_automatic"
示例#3
0
文件: alongside.py 项目: Gyruman/thus
    def __init__(self, params, prev_page="installation_ask", next_page="user_info"):
        super().__init__(self, params, "alongside", prev_page, next_page)

        self.label = self.ui.get_object('label_info')

        self.choose_partition_label = self.ui.get_object('choose_partition_label')
        self.choose_partition_combo = self.ui.get_object('choose_partition_combo')

        self.oses = bootinfo.get_os_dict()
        # print(self.oses)
        self.resize_widget = None
示例#4
0
    def populate_treeview(self):
        if self.treeview_store is not None:
            self.treeview_store.clear()

        self.treeview_store = Gtk.TreeStore(str, str, str)

        oses = {}
        oses = bootinfo.get_os_dict()

        self.partitions = {}

        try:
            device_list = parted.getAllDevices()
        except:
            txt = _("pyparted3 not found!")
            logging.error(txt)
            show.fatal_error(txt)
            device_list = []

        for dev in device_list:
            ## avoid cdrom and any raid, lvm volumes or encryptfs
            if not dev.path.startswith("/dev/sr") and \
               not dev.path.startswith("/dev/mapper"):
                try:
                    disk = parted.Disk(dev)
                    # create list of partitions for this device (p.e. /dev/sda)
                    partition_list = disk.partitions

                    for p in partition_list:
                        if p.type != pm.PARTITION_EXTENDED:
                            ## Get filesystem
                            fs_type = ""
                            if p.fileSystem and p.fileSystem.type:
                                fs_type = p.fileSystem.type
                            if "swap" not in fs_type:
                                if p.path in oses:
                                    row = [p.path, oses[p.path], fs_type]
                                else:
                                    row = [p.path, _("unknown"), fs_type]
                                self.treeview_store.append(None, row)
                        self.partitions[p.path] = p
                except Exception as e:
                    txt = _(
                        "Unable to create list of partitions for alongside installation."
                    )
                    logging.warning(txt)
                    #show.warning(txt)

        # assign our new model to our treeview
        self.treeview.set_model(self.treeview_store)
        self.treeview.expand_all()
示例#5
0
    def populate_treeview(self):
        if self.treeview_store is not None:
            self.treeview_store.clear()

        self.treeview_store = Gtk.TreeStore(str, str, str)

        oses = {}
        oses = bootinfo.get_os_dict()

        self.partitions = {}

        try:
            device_list = parted.getAllDevices()
        except:
            txt = _("pyparted3 not found!")
            logging.error(txt)
            show.fatal_error(txt)
            device_list = []

        for dev in device_list:
            ## avoid cdrom and any raid, lvm volumes or encryptfs
            if not dev.path.startswith("/dev/sr") and \
               not dev.path.startswith("/dev/mapper"):
                try:
                    disk = parted.Disk(dev)
                    # create list of partitions for this device (p.e. /dev/sda)
                    partition_list = disk.partitions

                    for p in partition_list:
                        if p.type != pm.PARTITION_EXTENDED:
                            ## Get filesystem
                            fs_type = ""
                            if p.fileSystem and p.fileSystem.type:
                                fs_type = p.fileSystem.type
                            if "swap" not in fs_type:
                                if p.path in oses:
                                    row = [p.path, oses[p.path], fs_type]
                                else:
                                    row = [p.path, _("unknown"), fs_type]
                                self.treeview_store.append(None, row)
                        self.partitions[p.path] = p
                except Exception as e:
                    txt = _("Unable to create list of partitions for alongside installation.")
                    logging.warning(txt)
                    #show.warning(txt)

        # assign our new model to our treeview
        self.treeview.set_model(self.treeview_store)
        self.treeview.expand_all()
示例#6
0
    def __init__(self,
                 params,
                 prev_page="installation_ask",
                 next_page="user_info"):
        super().__init__(self, params, "alongside", prev_page, next_page)

        self.label = self.ui.get_object('label_info')

        self.choose_partition_label = self.ui.get_object(
            'choose_partition_label')
        self.choose_partition_combo = self.ui.get_object(
            'choose_partition_combo')

        self.oses = bootinfo.get_os_dict()
        # print(self.oses)
        self.resize_widget = None
    def populate_treeview(self):
        if self.treeview_store != None:
            self.treeview_store.clear()

        self.treeview_store = Gtk.TreeStore(str, str, str)

        oses = {}
        oses = bootinfo.get_os_dict()

        self.partitions = {}

        device_list = parted.getAllDevices()

        for dev in device_list:
            ## avoid cdrom and any raid, lvm volumes or encryptfs
            if not dev.path.startswith("/dev/sr") and \
               not dev.path.startswith("/dev/mapper"):
                try:
                    disk = parted.Disk(dev)
                    # create list of partitions for this device (p.e. /dev/sda)
                    partition_list = disk.partitions

                    for p in partition_list:
                        if p.type != pm.PARTITION_EXTENDED:
                            ## Get file system
                            fs_type = ""
                            if p.fileSystem and p.fileSystem.type:
                                fs_type = p.fileSystem.type
                            if "swap" not in fs_type:
                                if p.path in oses:
                                    row = [p.path, oses[p.path], fs_type]
                                else:
                                    row = [p.path, _("unknown"), fs_type]
                                self.treeview_store.append(None, row)
                        self.partitions[p.path] = p
                except Exception as e:
                    log.debug(
                        _("In alongside install, can't create list of partitions"
                          ))

        # assign our new model to our treeview
        self.treeview.set_model(self.treeview_store)
        self.treeview.expand_all()
示例#8
0
    def check_alongside(self):
        """ Check if alongside installation type must be enabled.
        Alongside only works when Windows is installed on sda  """

        enable_alongside = False

        # FIXME: Alongside does not work in UEFI systems
        if os.path.exists("/sys/firmware/efi"):
            msg = _(
                "The 'alongside' installation mode does not work in UEFI systems"
            )
            logging.debug(msg)
            enable_alongside = False
        else:
            oses = bootinfo.get_os_dict()
            self.other_oses = []
            for key in oses:
                # We only check the first hard disk
                if "sda" in key and oses[key] not in [
                        "unknown", "Swap", "Data or Swap"
                ] and oses[key] not in self.other_oses:
                    self.other_oses.append(oses[key])

            if len(self.other_oses) > 0:
                for detected_os in self.other_oses:
                    if "windows" in detected_os.lower():
                        logging.debug(_("Windows(tm) OS detected."))
                        enable_alongside = True
                if not enable_alongside:
                    logging.debug(_("Windows(tm) OS not detected."))
                    enable_alongside = False
            else:
                logging.debug(_("Can't detect any OS in device sda."))
                enable_alongside = False

            if not check_alongside_disk_layout():
                logging.debug(
                    _("Unsuported disk layout for the 'alongside' installation mode"
                      ))
                enable_alongside = False

        return enable_alongside
示例#9
0
文件: ask.py 项目: triplem/Cnchi
    def __init__(self, params):
        self.header = params['header']
        self.ui_dir = params['ui_dir']
        self.forward_button = params['forward_button']
        self.backwards_button = params['backwards_button']
        self.settings = params['settings']

        super().__init__()
        self.ui = Gtk.Builder()
        self.ui.add_from_file(os.path.join(self.ui_dir, "ask.ui"))

        data_dir = self.settings.get("data")
        #partitioner_dir = os.path.join(data_dir, "images", "partitioner")
        partitioner_dir = os.path.join(data_dir, "images", "partitioner", "small")

        image = self.ui.get_object("automatic_image")
        path = os.path.join(partitioner_dir, "automatic.png")
        image.set_from_file(path)

        image = self.ui.get_object("alongside_image")
        path = os.path.join(partitioner_dir, "alongside.png")
        image.set_from_file(path)

        image = self.ui.get_object("advanced_image")
        path = os.path.join(partitioner_dir, "advanced.png")
        image.set_from_file(path)

        self.ui.connect_signals(self)

        super().add(self.ui.get_object("installation_ask"))

        oses = {}
        oses = bootinfo.get_os_dict()

        self.other_os = ""
        for k in oses:
            if "sda" in k and oses[k] != "unknown":
                self.other_os = oses[k]

        # by default, select automatic installation
        self.next_page = "installation_automatic"
    def populate_treeview(self):
        if self.treeview_store != None:
            self.treeview_store.clear()

        self.treeview_store = Gtk.TreeStore(str, str, str)

        oses = {}
        oses = bootinfo.get_os_dict()
        
        self.partitions = {}

        device_list = parted.getAllDevices()
        
        for dev in device_list:
            ## avoid cdrom and any raid, lvm volumes or encryptfs
            if not dev.path.startswith("/dev/sr") and \
               not dev.path.startswith("/dev/mapper"):
                try:           
                    disk = parted.Disk(dev)
                    # create list of partitions for this device (p.e. /dev/sda)
                    partition_list = disk.partitions
                    
                    for p in partition_list:
                        if p.type != pm.PARTITION_EXTENDED:
                            ## Get file system
                            fs_type = ""
                            if p.fileSystem and p.fileSystem.type:
                                fs_type = p.fileSystem.type
                            if "swap" not in fs_type:
                                if p.path in oses:
                                    row = [ p.path, oses[p.path], fs_type ]
                                else:
                                    row = [ p.path, _("unknown"), fs_type ]
                                self.treeview_store.append(None, row)
                        self.partitions[p.path] = p
                except Exception as e:
                    log.debug(_("In alongside install, can't create list of partitions"))

        # assign our new model to our treeview
        self.treeview.set_model(self.treeview_store)
        self.treeview.expand_all()
示例#11
0
文件: ask.py 项目: EntityOS/Cnchi
    def check_alongside(self):
        """ Check if alongside installation type must be enabled.
        Alongside only works when Windows is installed on sda  """

        enable_alongside = False

        # FIXME: Alongside does not work in UEFI systems
        if os.path.exists("/sys/firmware/efi"):
            msg = "The 'alongside' installation mode does not work in UEFI systems"
            logging.debug(msg)
            enable_alongside = False
        else:
            oses = bootinfo.get_os_dict()
            self.other_oses = []
            for key in oses:
                # We only check the first hard disk
                non_valid = ["unknown", "Swap", "Data or Swap", self.other_oses]
                if "sda" in key and oses[key] not in non_valid:
                    self.other_oses.append(oses[key])

            if self.other_oses:
                for detected_os in self.other_oses:
                    if "windows" in detected_os.lower():
                        logging.debug("Windows(tm) OS detected.")
                        enable_alongside = True
                if not enable_alongside:
                    logging.debug("Windows(tm) OS not detected.")
                    enable_alongside = False
            else:
                logging.debug("Can't detect any OS in device sda.")
                enable_alongside = False

            if not check_alongside_disk_layout():
                msg = "Unsuported disk layout for the 'alongside' installation mode"
                logging.debug(msg)
                enable_alongside = False

        return enable_alongside
示例#12
0
文件: ask.py 项目: g97iulio1609/thus
    def __init__(self, params):
        self.title = params['title']
        self.forward_button = params['forward_button']
        self.backwards_button = params['backwards_button']
        self.settings = params['settings']

        super().__init__()
        self.ui = Gtk.Builder()
        self.ui_dir = self.settings.get('ui')
        self.ui.add_from_file(os.path.join(self.ui_dir, "installation_ask.ui"))

        partitioner_dir = os.path.join(self.settings.get("data"),
                                       "partitioner/small/")

        image = self.ui.get_object("automatic_image")
        image.set_from_file(partitioner_dir + "automatic.png")

        image = self.ui.get_object("alongside_image")
        image.set_from_file(partitioner_dir + "alongside.png")

        image = self.ui.get_object("advanced_image")
        image.set_from_file(partitioner_dir + "advanced.png")

        self.ui.connect_signals(self)

        super().add(self.ui.get_object("installation_ask"))

        oses = {}
        oses = bootinfo.get_os_dict()

        self.other_os = ""
        for k in oses:
            if "sda" in k and oses[k] != "unknown":
                self.other_os = oses[k]

        # by default, select automatic installation
        self.next_page = "installation_automatic"
示例#13
0
文件: ask.py 项目: prodigeni/thus
    def __init__(self, params):
        self.title = params["title"]
        self.forward_button = params["forward_button"]
        self.backwards_button = params["backwards_button"]
        self.settings = params["settings"]

        super().__init__()
        self.ui = Gtk.Builder()
        self.ui_dir = self.settings.get("ui")
        self.ui.add_from_file(os.path.join(self.ui_dir, "installation_ask.ui"))

        partitioner_dir = os.path.join(self.settings.get("data"), "partitioner/small/")

        image = self.ui.get_object("automatic_image")
        image.set_from_file(partitioner_dir + "automatic.png")

        image = self.ui.get_object("alongside_image")
        image.set_from_file(partitioner_dir + "alongside.png")

        image = self.ui.get_object("advanced_image")
        image.set_from_file(partitioner_dir + "advanced.png")

        self.ui.connect_signals(self)

        super().add(self.ui.get_object("installation_ask"))

        oses = {}
        oses = bootinfo.get_os_dict()

        self.other_os = ""
        for k in oses:
            if "sda" in k and oses[k] != "unknown":
                self.other_os = oses[k]

        # by default, select automatic installation
        self.next_page = "installation_automatic"