예제 #1
0
파일: user_info.py 프로젝트: EntityOS/Cnchi
    def validate(self, element, value):
        """ Check that what the user is typing is ok """
        if len(value) == 0:
            self.image_is_ok[element].set_from_icon_name(
                ICON_WARNING,
                Gtk.IconSize.LARGE_TOOLBAR)
            self.image_is_ok[element].show()
            self.error_label[element].show()
        else:
            result = validation.check(element, value)
            if not result:
                self.image_is_ok[element].set_from_icon_name(
                    ICON_OK,
                    Gtk.IconSize.LARGE_TOOLBAR)
                self.image_is_ok[element].show()
                self.error_label[element].hide()
            else:
                self.image_is_ok[element].set_from_icon_name(
                    ICON_WARNING,
                    Gtk.IconSize.LARGE_TOOLBAR)
                self.image_is_ok[element].show()

                if validation.NAME_BADCHAR in result:
                    txt = _("Invalid characters entered")
                elif validation.NAME_BADDOTS in result:
                    txt = _("Username can't contain dots")
                elif validation.NAME_LENGTH in result:
                    txt = _("Too many characters")
                else:
                    txt = _("Unknown error")

                my_format = "<small><span color='darkred'>{0}</span></small>"
                txt = my_format.format(txt)
                self.error_label[element].set_markup(txt)
                self.error_label[element].show()
예제 #2
0
    def set_keymap(self):
        """ Uses selected keymap """
        if self.keyboard_layout['code']:
            self.settings.set("keyboard_layout", self.keyboard_layout['code'])
            self.settings.set("keyboard_variant", self.keyboard_variant['code'])

            cmd = ['setxkbmap', '-layout', self.keyboard_layout['code']]

            if self.keyboard_variant['code']:
                cmd.extend(["-variant", self.keyboard_variant['code']])

            try:
                subprocess.check_call(cmd)
            except subprocess.CalledProcessError as process_error:
                logging.warning(process_error)

            # Show logs to inform of keymap change
            if self.keyboard_variant['code']:
                cmd.extend(["-variant", self.keyboard_variant['code']])
                txt = _("Set keyboard to layout name '{0}' ({1}) and variant name '{2}' ({3})").format(
                    self.keyboard_layout['description'],
                    self.keyboard_layout['code'],
                    self.keyboard_variant['description'],
                    self.keyboard_variant['code'])
            else:
                txt = _("Set keyboard to layout name '{0}' ({1})").format(
                    self.keyboard_layout['description'],
                    self.keyboard_layout['code'])
            logging.debug(txt)
예제 #3
0
파일: zfs.py 프로젝트: satriani-vai/Cnchi
    def prepare_device_list(self):
        """ Create columns for our treeview """

        # Use check | Disk (sda) | Size(GB) | Name (device name) | Device ID

        use_toggle = Gtk.CellRendererToggle()
        use_toggle.connect("toggled", self.on_use_device_toggled)

        col = Gtk.TreeViewColumn(
            _("Use"), use_toggle, active=COL_USE_ACTIVE, visible=COL_USE_VISIBLE, sensitive=COL_USE_SENSITIVE
        )

        self.device_list.append_column(col)

        render_text = Gtk.CellRendererText()
        col = Gtk.TreeViewColumn(_("Disk"), render_text, text=COL_DISK)
        self.device_list.append_column(col)

        render_text_right = Gtk.CellRendererText()
        render_text_right.set_property("xalign", 1)
        col = Gtk.TreeViewColumn(_("Size (GB)"), render_text_right, text=COL_SIZE)
        self.device_list.append_column(col)

        col = Gtk.TreeViewColumn(_("Device"), render_text, text=COL_DEVICE_NAME)
        self.device_list.append_column(col)

        col = Gtk.TreeViewColumn(_("Disk ID"), render_text, text=COL_DISK_ID)
        self.device_list.append_column(col)
예제 #4
0
파일: features.py 프로젝트: triplem/Cnchi
    def show_info_dialog(self, feature):
        """ Some features show an information dialog when this screen is accepted """
        if feature == "aur":
            # Aur disclaimer
            txt1 = _("Arch User Repository - Disclaimer")
            txt2 = _("The Arch User Repository is a collection of user-submitted PKGBUILDs\n" \
                "that supplement software available from the official repositories.\n\n" \
                "The AUR is community driven and NOT supported by Arch or Antergos.\n")
        elif feature == "ufw":
            # Ufw rules info
            txt1 = _("Uncomplicated Firewall will be installed with these rules:")
            toallow = misc.get_network()
            txt2 = _("ufw default deny\nufw allow from %s\nufw allow Transmission\nufw allow SSH") % toallow

        txt1 = "<big>%s</big>" % txt1
        txt2 = "<i>%s</i>" % txt2

        info = Gtk.MessageDialog(transient_for=None,
                                 modal=True,
                                 destroy_with_parent=True,
                                 message_type=Gtk.MessageType.INFO,
                                 buttons=Gtk.ButtonsType.CLOSE)
        info.set_markup(txt1)                                        
        info.format_secondary_markup(txt2)
        info.run()
        info.destroy()
예제 #5
0
    def set_keymap(self):
        """ Uses selected keymap """
        if self.keyboard_layout['code']:
            self.settings.set("keyboard_layout", self.keyboard_layout['code'])
            self.settings.set("keyboard_variant", self.keyboard_variant['code'])

            # setxkbmap sets the keyboard layout for the current X session only
            cmd = ['setxkbmap', '-layout', self.keyboard_layout['code']]

            if self.keyboard_variant['code']:
                cmd.extend(["-variant", self.keyboard_variant['code']])
                txt = _("Set keyboard to '{0}' ({1}), wvariant '{2}' ({3})")
                txt = txt.format(
                    self.keyboard_layout['description'],
                    self.keyboard_layout['code'],
                    self.keyboard_variant['description'],
                    self.keyboard_variant['code'])
            else:
                txt = _("Set keyboard to '{0}' ({1})").format(
                    self.keyboard_layout['description'],
                    self.keyboard_layout['code'])

            try:
                subprocess.check_call(cmd)
                logging.debug(txt)
            except (OSError, subprocess.CalledProcessError) as setxkbmap_error:
                logging.warning(setxkbmap_error)
예제 #6
0
    def get_changes(self):
        """ Grab all changes for confirmation """
        change_list = [action.Action("delete", self.auto_device)]

        auto = auto_partition.AutoPartition(dest_dir=DEST_DIR,
                                            auto_device=self.auto_device,
                                            use_luks=self.settings.get("use_luks"),
                                            luks_password=self.settings.get("luks_root_password"),
                                            use_lvm=self.settings.get("use_lvm"),
                                            use_home=self.settings.get("use_home"),
                                            bootloader=self.settings.get("bootloader"),
                                            callback_queue=self.callback_queue)

        devices = auto.get_devices()
        mount_devices = auto.get_mount_devices()
        fs_devices = auto.get_fs_devices()

        mount_points = {}
        for mount_point in mount_devices:
            device = mount_devices[mount_point]
            mount_points[device] = mount_point

        for device in sorted(fs_devices.keys()):
            try:
                txt = _("Device {0} will be created ({1} filesystem) as {2}").format(device, fs_devices[device], mount_points[device])
            except KeyError:
                txt = _("Device {0} will be created ({1} filesystem)").format(device, fs_devices[device])
            act = action.Action("info", txt)
            change_list.append(act)

        return change_list
예제 #7
0
파일: alongside.py 프로젝트: Gyruman/thus
    def fill_choose_partition_combo(self):
        self.choose_partition_combo.remove_all()

        devices = []

        for device in sorted(self.oses.keys()):
            # if "Swap" not in self.oses[device]:
            if "windows" in self.oses[device].lower():
                devices.append(device)

        if len(devices) > 1:
            new_device_found = False
            for device in sorted(devices):
                if self.get_new_device(device):
                    new_device_found = True
                    line = "{0} ({1})".format(self.oses[device], device)
                    self.choose_partition_combo.append_text(line)
            self.select_first_combobox_item(self.choose_partition_combo)
            self.show_all()
            if not new_device_found:
                txt = _("Can't find any spare partition number.\nAlongside installation can't continue.")
                self.choose_partition_label.hide()
                self.choose_partition_combo.hide()
                self.label.set_markup(txt)
                show.error(self.get_toplevel(), txt)
        elif len(devices) == 1:
            self.set_resize_widget(devices[0])
            self.show_all()
            self.choose_partition_label.hide()
            self.choose_partition_combo.hide()
        else:
            logging.warning(_("Can't find any installed OS!"))
예제 #8
0
파일: automatic.py 프로젝트: triplem/Cnchi
    def start_installation(self):
        #self.install_progress.set_sensitive(True)
        self.settings.set('auto_device', self.auto_device)
        logging.info(_("Cnchi will install Antergos on %s") % self.auto_device)
        
        # In automatic installation we always install Grub
        self.settings.set('install_bootloader', True)

        if os.path.exists("/sys/firmware/efi/systab"):
            bootloader_type = "UEFI_x86_64"
        else:
            bootloader_type = "GRUB2"
        self.settings.set('bootloader_type', bootloader_type)
        self.settings.set('bootloader_device', self.auto_device)
        logging.info(_("Antergos will install the %s bootloader on %s"), bootloader_type, self.auto_device)

        # We don't need to pass which devices will be mounted nor which filesystems
        # the devices will be formatted with, as auto_partition.py takes care of everything
        # in an automatic installation.
        mount_devices = {}
        fs_devices = {}

        if not self.testing:
            self.process = installation_process.InstallationProcess( \
                            self.settings, \
                            self.callback_queue, \
                            mount_devices, \
                            fs_devices, \
                            None, \
                            self.alternate_package_list)

            self.process.start()
        else:
            logging.warning(_("Testing mode. Cnchi will not change anything!"))
예제 #9
0
파일: zfs.py 프로젝트: FrankDev14/Cnchi
 def show_pool_type_help(self, pool_type):
     """ Show pool type help to the user """
     msg = ""
     if pool_type == "None":
         msg = _("'None' pool will use ZFS on a single selected disk.")
     elif pool_type == "Stripe":
         msg = _("When created together, with equal capacity, ZFS "
                 "space-balancing makes a span act like a RAID0 stripe. "
                 "The space is added together. Provided all the devices "
                 "are of the same size, the stripe behavior will "
                 "continue regardless of fullness level. If "
                 "devices/vdevs are not equally sized, then they will "
                 "fill mostly equally until one device/vdev is full.")
     elif pool_type == "Mirror":
         msg = _("A mirror consists of two or more devices, all data "
                 "will be written to all member devices. Cnchi will "
                 "try to group devices in groups of two.")
     elif pool_type.startswith("RAID-Z"):
         msg = _("ZFS implements RAID-Z, a variation on standard "
                 "RAID-5. ZFS supports three levels of RAID-Z which "
                 "provide varying levels of redundancy in exchange for "
                 "decreasing levels of usable storage. The types are "
                 "named RAID-Z1 through RAID-Z3 based on the number of "
                 "parity devices in the array and the number of disks "
                 "which can fail while the pool remains operational.")
     if msg:
         show.message(self.get_main_window(), msg)
예제 #10
0
파일: user_info.py 프로젝트: nhold/Cnchi
    def validate(self, element, value):
        """ Check that what the user is typing is ok """
        if len(value) == 0:
            self.is_ok[element].set_from_stock("gtk-no", Gtk.IconSize.BUTTON)
            self.is_ok[element].show()
            self.error_label[element].show()
        else:
            result = validation.check(element, value)
            if len(result) == 0:
                self.is_ok[element].set_from_stock("gtk-yes", Gtk.IconSize.BUTTON)
                self.is_ok[element].show()
                self.error_label[element].hide()
            else:
                self.is_ok[element].set_from_stock("gtk-no", Gtk.IconSize.BUTTON)
                self.is_ok[element].show()

                if validation.NAME_BADCHAR in result:
                    txt = _("Invalid characters entered")
                    txt = "<small><span color='darkred'>%s</span></small>" % txt
                    self.error_label[element].set_markup(txt)
                elif validation.NAME_BADDOTS in result:
                    txt = _("Username can't contain dots")
                    txt = "<small><span color='darkred'>%s</span></small>" % txt
                    self.error_label[element].set_markup(txt)
                elif validation.NAME_LENGTH in result:
                    txt = _("Too many characters")
                    txt = "<small><span color='darkred'>%s</span></small>" % txt
                    self.error_label[element].set_markup(txt)

                self.error_label[element].show()
예제 #11
0
파일: keymap.py 프로젝트: triplem/Cnchi
    def translate_ui(self):
        self.header.set_subtitle(_("Select Your Keyboard Layout"))
        
        lbl = self.ui.get_object("label_layouts")
        lbl.set_markup(_("Keyboard Layouts"))

        lbl = self.ui.get_object("label_variants")
        lbl.set_markup(_("Keyboard Variants"))
예제 #12
0
    def translate_ui(self):
        txt = _("Select the OS you would like Antergos installed next to.")
        txt = '<span size="large">%s</span>' % txt
        self.label.set_markup(txt)

        self.header.set_subtitle(_("Antergos Alongside Installation"))

        txt = _("Install Now!")
        self.forward_button.set_label(txt)
예제 #13
0
파일: zfs.py 프로젝트: FrankDev14/Cnchi
    def check_pool_type(self, show_warning=False):
        """ Check that the user has selected the right number
        of devices for the selected pool type """

        num_drives = 0
        msg = ""
        pool_type = self.zfs_options["pool_type"]

        for row in self.device_list_store:
            if row[COL_USE_ACTIVE]:
                num_drives += 1

        if pool_type == "None":
            is_ok = num_drives == 1
            if not is_ok:
                msg = _("You must select one drive")

        elif pool_type in ["Stripe", "Mirror"]:
            is_ok = num_drives > 1
            if not is_ok:
                msg = _("For the {0} pool_type, you must select at least two "
                        "drives").format(pool_type)

        elif "RAID" in pool_type:
            pool_types = {
                'RAID-Z': {'min_drives': 3, 'min_parity_drives': 1},
                'RAID-Z2': {'min_drives': 4, 'min_parity_drives': 2},
                'RAID-Z3': {'min_drives': 5, 'min_parity_drives': 3}
            }

            min_drives = pool_types[pool_type]['min_drives']
            min_parity_drives = pool_types[pool_type]['min_parity_drives']

            if num_drives < min_drives:
                is_ok = False
                msg = _("You must select at least {0} drives")
                msg = msg.format(min_drives)
            else:
                num = math.log2(num_drives - min_parity_drives)
                if not is_int(num):
                    msg = _("For the {0} pool type, you must use a 'power of "
                            "two' (2,4,8,...) plus the appropriate number of "
                            "drives for the parity. RAID-Z = 1 disk, RAIDZ-2 "
                            "= 2 disks, and so on.")
                    msg = msg.format(pool_type, min_parity_drives)
                    is_ok = False
                else:
                    is_ok = True
        else:
            # If we get here, something is wrong.
            msg = _('An unknown error occurred while processing chosen ZFS options.')
            is_ok = False

        if not is_ok and show_warning:
            show.message(self.get_main_window(), msg)

        return is_ok
예제 #14
0
파일: slides.py 프로젝트: Gyruman/thus
    def translate_ui(self):
        """ Translates all ui elements """

        txt = _("Installing Manjaro...")
        txt = "<span weight='bold' size='large'>{0}</span>".format(txt)
        self.title.set_markup(txt)

        if len(self.info_label.get_label()) <= 0:
            self.set_message(_("Please wait..."))
예제 #15
0
파일: desktop.py 프로젝트: EntityOS/Cnchi
    def translate_ui(self, desktop, set_header=True):
        """ Translates all ui elements """
        label = self.ui.get_object("desktop_info")
        txt = "<span weight='bold'>{0}</span>\n".format(desktop_info.NAMES[desktop])
        description = desktop_info.DESCRIPTIONS[desktop]
        txt = txt + _(description)
        label.set_markup(txt)

        # This sets the desktop's image
        path = os.path.join(self.desktops_dir, desktop + ".png")
        if self.desktop_image is None:
            self.desktop_image = Gtk.Image.new_from_file(path)
            overlay = self.ui.get_object("image_overlay")
            overlay.add(self.desktop_image)
        else:
            self.desktop_image.set_from_file(path)

        # and this sets the icon
        filename = "desktop-environment-" + desktop.lower() + ".svg"
        icon_path = os.path.join(desktop_info.DESKTOP_ICONS_PATH, "scalable", filename)
        icon_exists = os.path.exists(icon_path)

        if self.icon_desktop_image is None:
            if icon_exists:
                pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(icon_path, 48, 48)
                self.icon_desktop_image = Gtk.Image.new_from_pixbuf(pixbuf)
            else:
                filename = desktop.lower() + ".png"
                icon_path = os.path.join(desktop_info.DESKTOP_ICONS_PATH, "48x48", filename)
                icon_exists = os.path.exists(icon_path)
                if icon_exists:
                    self.icon_desktop_image = Gtk.Image.new_from_file(icon_path)
                else:
                    self.icon_desktop_image = Gtk.Image.new_from_icon_name(
                        "image-missing",
                        Gtk.IconSize.DIALOG)

            overlay = self.ui.get_object("image_overlay")
            overlay.add_overlay(self.icon_desktop_image)
        else:
            if icon_exists:
                pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(icon_path, 48, 48)
                self.icon_desktop_image.set_from_pixbuf(pixbuf)
            else:
                filename = desktop.lower() + ".png"
                icon_path = os.path.join(desktop_info.DESKTOP_ICONS_PATH, "48x48", filename)
                icon_exists = os.path.exists(icon_path)
                if icon_exists:
                    self.icon_desktop_image.set_from_file(icon_path)
                else:
                    self.icon_desktop_image.set_from_icon_name("image-missing", Gtk.IconSize.DIALOG)

        if set_header:
            # set header text
            txt = _("Choose Your Desktop")
            self.header.set_subtitle(txt)
예제 #16
0
파일: zfs.py 프로젝트: satriani-vai/Cnchi
    def check_pool_type(self, show_warning=False):
        """ Check that the user has selected the right number
        of devices for the selected pool type """

        num_drives = 0
        msg = ""
        pool_type = self.zfs_options["pool_type"]

        for row in self.device_list_store:
            if row[COL_USE_ACTIVE]:
                num_drives += 1

        if pool_type == "None":
            if num_drives == 1:
                is_ok = True
            else:
                is_ok = False
                msg = _("You must select one drive")
        elif pool_type in ["Stripe", "Mirror"]:
            if num_drives > 1:
                is_ok = True
            else:
                is_ok = False
                msg = _("For the {0} pool_type, you must select at least two " "drives").format(pool_type)
        elif "RAID" in pool_type:
            min_drives = 3
            min_parity_drives = 1

            if pool_type == "RAID-Z2":
                min_drives = 4
                min_parity_drives = 2
            elif pool_type == "RAID-Z3":
                min_drives = 5
                min_parity_drives = 3

            if num_drives < min_drives:
                is_ok = False
                msg = _("You must select at least {0} drives")
                msg = msg.format(min_drives)
            else:
                num = math.log2(num_drives - min_parity_drives)
                if not is_int(num):
                    msg = _(
                        "For the {0} pool type, you must use a 'power of "
                        "two' (2,4,8,...) plus the appropriate number of "
                        "drives for the parity. RAID-Z = 1 disk, RAIDZ-2 "
                        "= 2 disks, and so on."
                    )
                    msg = msg.format(pool_type, min_parity_drives)
                else:
                    is_ok = True

        if not is_ok and show_warning:
            show.message(self.get_main_window(), msg)

        return is_ok
예제 #17
0
    def translate_ui(self):
        """ Translates all ui elements """
        txt = _("Choose the new size of your installation")
        txt = '<span size="large">{0}</span>'.format(txt)
        self.label.set_markup(txt)

        txt = _("Choose the partition that you want to shrink:")
        self.choose_partition_label.set_markup(txt)

        self.header.set_subtitle(_("DSGos Alongside Installation"))
예제 #18
0
파일: keymap.py 프로젝트: Gyruman/thus
    def translate_ui(self):
        """ Translates all ui elements """
        txt = _("Select your keyboard layout")
        txt = "<span weight='bold' size='large'>{0}</span>".format(txt)
        self.title.set_markup(txt)

        lbl = self.ui.get_object("label_layouts")
        lbl.set_markup(_("Keyboard Layouts"))

        lbl = self.ui.get_object("label_variants")
        lbl.set_markup(_("Keyboard Variants"))
예제 #19
0
파일: location.py 프로젝트: triplem/Cnchi
    def translate_ui(self):
        txt = _("The location you select will be used to help determine the system locale.\n" \
            "This should normally be the country in which you reside.\n" \
            "Here is a shortlist of locations based on the language you selected.")
        self.label_help.set_markup(txt)

        txt = _("Country, territory or area:")
        txt = "<span weight='bold'>%s</span>" % txt
        self.label_choose_country.set_markup(txt)

        self.header.set_subtitle(_("Select your location"))
예제 #20
0
    def create_toolviews(self):
        render = Gtk.CellRendererText()
        col = Gtk.TreeViewColumn(_("Layouts"),render,text=0)
        liststore = Gtk.ListStore(str)
        self.layout_treeview.append_column(col)
        self.layout_treeview.set_model(liststore)

        render = Gtk.CellRendererText()
        col = Gtk.TreeViewColumn(_("Variants"),render,text=0)
        liststore = Gtk.ListStore(str)
        self.variant_treeview.append_column(col)
        self.variant_treeview.set_model(liststore)
예제 #21
0
    def prepare_treeview(self):
        """ Create columns for our treeview """
        render_text = Gtk.CellRendererText()

        col = Gtk.TreeViewColumn(_("Device"), render_text, text=0)
        self.treeview.append_column(col)

        col = Gtk.TreeViewColumn(_("Detected OS"), render_text, text=1)
        self.treeview.append_column(col)

        col = Gtk.TreeViewColumn(_("Filesystem"), render_text, text=2)
        self.treeview.append_column(col)
예제 #22
0
파일: language.py 프로젝트: triplem/Cnchi
    def translate_ui(self):
        txt_bold = _("Notice: The Cnchi Installer is beta software.")
        txt = _("Cnchi is pre-release beta software that is under active development.\n"
        "It does not yet properly handle RAID, btrfs subvolumes, or other advanced\n"
        "setups. Please proceed with caution as data loss is possible!\n\n"
        "If you find any bugs, please report them at <a href='http://bugs.antergos.com'>http://bugs.antergos.com</a>")
        txt = "<span weight='bold'>%s</span>\n\n" % txt_bold + txt
        label = self.ui.get_object("welcome_label")
        label.set_markup(txt)

        txt = _("Welcome to Antergos!")
        self.header.set_subtitle(txt)
예제 #23
0
파일: wireless.py 프로젝트: Antergos/Cnchi
    def translate_ui(self):
        lbl = self.ui.get_object("wireless_section_label")
        lbl.set_markup(_("Connecting this computer to a wi-fi network"))

        btn = self.ui.get_object("no_wireless")
        btn.set_label(_("I don't want to connect to a wi-fi network right now"))

        btn = self.ui.get_object("use_wireless")
        btn.set_label(_("Connect to this network"))

        password_label_text = _("Password:"******"Display password")
        self.nmwidget.translate(password_label_text, display_password_text)
예제 #24
0
    def translate_ui(self):
        """ Translates all ui elements """
        txt_bold = _("Notice: The Cnchi Installer is beta software")
        # FIXME: Can't use an a html tag in the label. Causes an accessible GTK Assertion
        txt = _("Cnchi is beta software that is under active development.\n"
                "It does not yet properly handle RAID, btrfs subvolumes, or other advanced\n"
                "setups. Please proceed with caution as data loss is possible!\n\n")
        txt_markup = "<span weight='bold'>{0}</span>\n\n{1}".format(txt_bold, txt)
        label = self.ui.get_object("welcome_label")
        label.set_markup(txt_markup)

        txt = _("Choose your language")
        self.header.set_subtitle(txt)
예제 #25
0
파일: alongside.py 프로젝트: Gyruman/thus
    def translate_ui(self):
        """ Translates all ui elements """

        txt = _("Manjaro alongside another OS")
        txt = "<span weight='bold' size='large'>{0}</span>".format(txt)
        self.title.set_markup(txt)

        txt = _("Choose the new size of your installation")
        txt = '<span size="large">{0}</span>'.format(txt)
        self.label.set_markup(txt)

        txt = _("Choose the partition that you want to shrink:")
        self.choose_partition_label.set_markup(txt)
예제 #26
0
파일: zfs.py 프로젝트: FrankDev14/Cnchi
 def append_change(self, action_type, device, info=""):
     """ Add change for summary screen """
     if action_type == "create":
         info = _("Create {0} on device {1}").format(info, device)
         encrypt = self.zfs_options["encrypt_disk"]
         act = action.Action("info", info, True, True, "", encrypt)
     elif action_type == "add":
         info = _("Add device {0} to {1}").format(device, info)
         encrypt = self.zfs_options["encrypt_disk"]
         act = action.Action("info", info, True, True, "", encrypt)
     elif action_type == "delete":
         act = action.Action(action_type, device)
     self.change_list.append(act)
예제 #27
0
파일: language.py 프로젝트: Antergos/Cnchi
 def translate_ui(self):
     """ Translates all ui elements """
     txt_bold = _("Notice: The Cnchi Installer is beta software.")
     # FIXME: Can't use an a html tag in the label
     # (as we're running as root)
     txt = _("<span weight='bold'>{0}</span>\n\n"
             "Cnchi is pre-release beta software that is under active "
             "development. It does not yet properly handle RAID, btrfs "
             "subvolumes, or other advanced setups. Please proceed with "
             "caution as data loss is possible!\n\n"
             "If you find any bugs, please report them at "
             "<a href='{1}'>{1}</a>")
     url = "https://github.com/Antergos/Cnchi/issues"
     txt = txt.format(txt_bold, url)
예제 #28
0
    def store_values(self):
        """ Let's do our installation! """
        response = self.show_warning()
        if response == Gtk.ResponseType.NO:
            return False

        luks_password = self.entry['luks_password'].get_text()
        self.settings.set('luks_root_password', luks_password)
        if luks_password != "":
            logging.debug(_("A root LUKS password has been set"))

        logging.info(_("Automatic install on %s"), self.auto_device)
        self.start_installation()
        return True
예제 #29
0
파일: location.py 프로젝트: triplem/Cnchi
    def store_values(self):
        country = self.selected_country
        lang_code = self.settings.get("language_code")
        for mylocale in self.locales:
            if self.locales[mylocale] == country:
                self.settings.set("locale", mylocale)
                try:
                    import locale
                    locale.setlocale(locale.LC_ALL, mylocale)
                    logging.info(_("locale changed to : %s") % mylocale)
                except (ImportError, locale.Error):
                    logging.warning(_("Can't change to locale '%s'") % mylocale)

        return True
예제 #30
0
파일: automatic.py 프로젝트: Gyruman/thus
    def store_values(self):
        """ The user clicks 'Install now!' """
        response = self.show_warning()
        if response == Gtk.ResponseType.NO:
            return False

        luks_password = self.entry['luks_password'].get_text()
        self.settings.set('luks_root_password', luks_password)
        if luks_password != "":
            logging.debug(_("A root LUKS password has been set"))

        logging.info(_("Automatic install on {0}").format(self.auto_device))
        self.start_installation()
        return True
예제 #31
0
파일: ask.py 프로젝트: prescott66/Cnchi
    def translate_ui(self):
        """ Translate screen before showing it """
        #self.header.set_title("Cnchi")
        self.header.set_subtitle(_("Installation Type"))

        #txt = _("Installation Type")
        #txt = "<span weight='bold' size='large'>%s</span>" % txt
        #self.title.set_markup(txt)

        # In case we're coming from an installer screen, we change
        # to go-next stock button and we activate it
        #self.forward_button.set_label("")
        #image1 = Gtk.Image.new_from_icon_name("go-next", Gtk.IconSize.LARGE_TOOLBAR)
        #self.forward_button.set_image(image1)
        self.forward_button.set_always_show_image(True)
        self.forward_button.set_sensitive(True)

        # Automatic Install
        radio = self.ui.get_object("automatic_radiobutton")
        radio.set_label(_("Erase disk and install Antergos"))

        label = self.ui.get_object("automatic_description")
        txt = _("Warning: This will erase ALL data on your disk.")
        txt = '<span weight="light" size="small">%s</span>' % txt
        label.set_markup(txt)
        label.set_line_wrap(True)

        button = self.ui.get_object("encrypt_checkbutton")
        txt = _("Encrypt this installation for increased security.")
        button.set_label(txt)

        label = self.ui.get_object("encrypt_label")
        txt = _(
            "You will be asked to create an encryption password in the next step."
        )
        txt = '<span weight="light" size="small">%s</span>' % txt
        label.set_markup(txt)

        button = self.ui.get_object("lvm_checkbutton")
        txt = "Use LVM with this installation."
        button.set_label(txt)

        label = self.ui.get_object("lvm_label")
        txt = _(
            "This will setup LVM and allow you to easily manage partitions and create snapshots."
        )
        txt = '<span weight="light" size="small">%s</span>' % txt
        label.set_markup(txt)

        button = self.ui.get_object("home_checkbutton")
        txt = _("Set your Home in a different partition/volume")
        button.set_label(txt)

        label = self.ui.get_object("home_label")
        txt = _(
            "This will setup you /home directory in a different partition or volume."
        )
        txt = '<span weight="light" size="small">%s</span>' % txt
        label.set_markup(txt)

        # Alongside Install (still experimental. Needs a lot of testing)
        if "windows" in self.other_os.lower():
            radio = self.ui.get_object("alongside_radiobutton")
            label = self.ui.get_object("alongside_description")
            radio.set_label(_("Install Antergos alongside %s") % self.other_os)

            txt = _("Install Antergos alongside %s") % self.other_os
            txt = '<span weight="light" size="small">%s</span>' % txt
            label.set_markup(txt)
            label.set_line_wrap(True)

        # Advanced Install
        radio = self.ui.get_object("advanced_radiobutton")
        radio.set_label(
            _("Choose exactly where Antergos should be installed. (advanced)"))

        label = self.ui.get_object("advanced_description")
        txt = _("Edit partition table and choose mount points.")
        txt = '<span weight="light" size="small">%s</span>' % txt
        label.set_markup(txt)
        label.set_line_wrap(True)
예제 #32
0
    def translate_ui(self):
        """ Translate widgets """
        self.header.set_subtitle(_("ZFS Setup"))

        # Encrypt disk checkbox
        btn = self.ui.get_object("encrypt_disk_btn")
        # TODO: Finnish LUKS+ZFS
        self.zfs_options["encrypt_disk"] = False
        btn.set_sensitive(False)
        btn.set_active(self.zfs_options["encrypt_disk"])

        # Disable/Enable Encrypt disk options entries
        entries = [
            'password_entry', 'password_check_entry', 'password_lbl',
            'password_check_lbl'
        ]
        for name in entries:
            entry = self.ui.get_object(name)
            entry.set_sensitive(self.zfs_options["encrypt_disk"])

        # Encrypt swap
        btn = self.ui.get_object('encrypt_swap_btn')
        # TODO: Finnish LUKS+ZFS
        self.zfs_options["encrypt_swap"] = False
        btn.set_sensitive(False)
        btn.set_active(self.zfs_options["encrypt_swap"])

        # Pool name checkbox
        btn = self.ui.get_object("pool_name_btn")
        btn.set_active(self.zfs_options["use_pool_name"])

        # Disable/Enable Pool name entry
        entry = self.ui.get_object('pool_name_entry')
        entry.set_sensitive(self.zfs_options["use_pool_name"])

        # Set pool type label text
        lbl = self.ui.get_object('pool_type_label')
        lbl.set_markup(_("Pool type"))

        # Fill pool types combobox
        combo = self.ui.get_object('pool_type_combo')
        combo.remove_all()
        active_index = 0
        for index in self.pool_types:
            combo.append_text(self.pool_types[index])
            if self.zfs_options["pool_type"] == self.pool_types[index]:
                active_index = index
        combo.set_active(active_index)

        # Set partition scheme label text
        lbl = self.ui.get_object('partition_scheme_label')
        lbl.set_markup(_("Partition scheme"))

        # Fill partition scheme combobox
        combo = self.ui.get_object('partition_scheme_combo')
        combo.remove_all()
        active_index = 0
        for index in self.schemes:
            combo.append_text(self.schemes[index])
            if self.zfs_options["scheme"] == self.schemes[index]:
                active_index = index
        combo.set_active(active_index)

        # Set all labels
        lbl = self.ui.get_object('password_check_lbl')
        lbl.set_markup(_("Validate password"))

        lbl = self.ui.get_object('password_lbl')
        lbl.set_markup(_("Password"))

        lbl = self.ui.get_object('swap_size_lbl')
        lbl.set_markup(_("Swap size (MB)"))

        # Set button labels
        btn = self.ui.get_object('encrypt_swap_btn')
        btn.set_label(_("Encrypt swap"))

        btn = self.ui.get_object('encrypt_disk_btn')
        btn.set_label(_("Encrypt disk"))

        btn = self.ui.get_object('pool_name_btn')
        btn.set_label(_("Pool name"))

        btn = self.ui.get_object('force_4k_btn')
        btn.set_label(_("Force ZFS 4k block size"))

        # Set swap Size
        swap_size = str(self.zfs_options["swap_size"])
        entry = self.ui.get_object("swap_size_entry")
        entry.set_text(swap_size)
예제 #33
0
    def check_pool_type(self, show_warning=False):
        """ Check that the user has selected the right number
        of devices for the selected pool type """

        num_drives = 0
        msg = ""
        pool_type = self.zfs_options["pool_type"]

        for row in self.device_list_store:
            if row[COL_USE_ACTIVE]:
                num_drives += 1

        if pool_type == "None":
            is_ok = num_drives == 1
            if not is_ok:
                msg = _("You must select one drive")

        elif pool_type in ["Stripe", "Mirror"]:
            is_ok = num_drives > 1
            if not is_ok:
                msg = _("For the {0} pool_type, you must select at least two "
                        "drives").format(pool_type)

        elif "RAID" in pool_type:
            pool_types = {
                'RAID-Z': {
                    'min_drives': 3,
                    'min_parity_drives': 1
                },
                'RAID-Z2': {
                    'min_drives': 4,
                    'min_parity_drives': 2
                },
                'RAID-Z3': {
                    'min_drives': 5,
                    'min_parity_drives': 3
                }
            }

            min_drives = pool_types[pool_type]['min_drives']
            min_parity_drives = pool_types[pool_type]['min_parity_drives']

            if num_drives < min_drives:
                is_ok = False
                msg = _("You must select at least {0} drives")
                msg = msg.format(min_drives)
            else:
                num = math.log2(num_drives - min_parity_drives)
                if not is_int(num):
                    msg = _("For the {0} pool type, you must use a 'power of "
                            "two' (2,4,8,...) plus the appropriate number of "
                            "drives for the parity. RAID-Z = 1 disk, RAIDZ-2 "
                            "= 2 disks, and so on.")
                    msg = msg.format(pool_type, min_parity_drives)
                    is_ok = False
                else:
                    is_ok = True
        else:
            # If we get here, something is wrong.
            msg = _(
                'An unknown error occurred while processing chosen ZFS options.'
            )
            is_ok = False

        if not is_ok and show_warning:
            show.message(self.get_main_window(), msg)

        return is_ok
예제 #34
0
    def translate_ui(self):
        """ Translates all ui elements """
        desktop = self.settings.get('desktop')

        txt = desktops.NAMES[desktop] + " - " + _("Feature Selection")
        self.header.set_subtitle(txt)

        # AUR
        txt = _("Arch User Repository (AUR) Support")
        txt = "<span weight='bold' size='large'>%s</span>" % txt
        self.titles["aur"].set_markup(txt)
        txt = _("The AUR is a community-driven repository for Arch users.")
        txt = "<span size='small'>%s</span>" % txt
        self.labels["aur"].set_markup(txt)

        txt = _("Use yaourt to install AUR packages.\n"
                "The AUR was created to organize and share new packages\n"
                "from the community and to help expedite popular packages'\n"
                "inclusion into the [community] repository.")
        self.titles["aur"].set_tooltip_markup(txt)
        self.switches["aur"].set_tooltip_markup(txt)
        self.labels["aur"].set_tooltip_markup(txt)

        # Bluetooth
        txt = _("Bluetooth Support")
        txt = "<span weight='bold' size='large'>%s</span>" % txt
        self.titles["bluetooth"].set_markup(txt)
        txt = _("Enables your system to make wireless connections via Bluetooth.")
        txt = "<span size='small'>%s</span>" % txt
        self.labels["bluetooth"].set_markup(txt)

        txt = _("Bluetooth is a standard for the short-range wireless\n"
                "interconnection of cellular phones, computers, and\n"
                "other electronic devices. In Linux, the canonical\n"
                "implementation of the Bluetooth protocol stack is BlueZ")
        self.titles["bluetooth"].set_tooltip_markup(txt)
        self.switches["bluetooth"].set_tooltip_markup(txt)
        self.labels["bluetooth"].set_tooltip_markup(txt)

        # Extra TTF Fonts
        txt = _("Extra Truetype Fonts")
        txt = "<span weight='bold' size='large'>%s</span>" % txt
        self.titles["fonts"].set_markup(txt)
        txt = _("Installation of extra TrueType fonts")
        txt = "<span size='small'>%s</span>" % txt
        self.labels["fonts"].set_markup(txt)

        txt = _("TrueType is an outline font standard developed by\n"
                "Apple and Microsoft in the late 1980s as a competitor\n"
                "to Adobe's Type 1 fonts used in PostScript. It has\n"
                "become the most common format for fonts on both the\n"
                "Mac OS and Microsoft Windows operating systems.")
        self.titles["fonts"].set_tooltip_markup(txt)
        self.switches["fonts"].set_tooltip_markup(txt)
        self.labels["fonts"].set_tooltip_markup(txt)

        # Gnome Extra
        txt = _("Gnome Extra")
        txt = "<span weight='bold' size='large'>%s</span>" % txt
        self.titles["gnome_extra"].set_markup(txt)
        txt = _("Installation of extra Gnome applications")
        txt = "<span size='small'>%s</span>" % txt
        self.labels["gnome_extra"].set_markup(txt)

        txt = _("Contains various optional tools such as a media\n"
                "player, a calculator, an editor and other non-critical\n"
                "applications that go well with the GNOME desktop.\n")
        self.titles["gnome_extra"].set_tooltip_markup(txt)
        self.switches["gnome_extra"].set_tooltip_markup(txt)
        self.labels["gnome_extra"].set_tooltip_markup(txt)

        # Printing support (cups)
        txt = _("Printing Support")
        txt = "<span weight='bold' size='large'>%s</span>" % txt
        self.titles["cups"].set_markup(txt)
        txt = _("Installation of printer drivers and management tools.")
        txt = "<span size='small'>%s</span>" % txt
        self.labels["cups"].set_markup(txt)

        txt = _("CUPS is the standards-based, open source printing\n"
                "system developed by Apple Inc. for OS® X and other\n"
                "UNIX®-like operating systems.")
        self.titles["cups"].set_tooltip_markup(txt)
        self.switches["cups"].set_tooltip_markup(txt)
        self.labels["cups"].set_tooltip_markup(txt)

        # LibreOffice
        txt = _("LibreOffice")
        txt = "<span weight='bold' size='large'>%s</span>" % txt
        self.titles["office"].set_markup(txt)
        txt = _("Open source office suite. Supports editing MS Office files.")
        txt = "<span size='small'>%s</span>" % txt
        self.labels["office"].set_markup(txt)

        txt = _("LibreOffice is the free power-packed Open Source\n"
                "personal productivity suite for Windows, Macintosh\n"
                "and Linux, that gives you six feature-rich applications\n"
                "for all your document production and data processing\n"
                "needs: Writer, Calc, Impress, Draw, Math and Base.")
        self.titles["office"].set_tooltip_markup(txt)
        self.switches["office"].set_tooltip_markup(txt)
        self.labels["office"].set_tooltip_markup(txt)

        # Visual effects
        txt = _("Visual Effects")
        txt = "<span weight='bold' size='large'>%s</span>" % txt
        self.titles["visual"].set_markup(txt)
        txt = _("Enable transparency, shadows, and other desktop effects.")
        txt = "<span size='small'>%s</span>" % txt
        self.labels["visual"].set_markup(txt)

        txt = _("Compton is a lightweight, standalone composite manager,\n"
                "suitable for use with window managers that do not natively\n"
                "provide compositing functionality. Compton itself is a fork\n"
                "of xcompmgr-dana, which in turn is a fork of xcompmgr.\n"
                "See the compton github page for further information.")
        self.titles["visual"].set_tooltip_markup(txt)
        self.switches["visual"].set_tooltip_markup(txt)
        self.labels["visual"].set_tooltip_markup(txt)

        # Firewall
        txt = _("Uncomplicated Firewall")
        txt = "<span weight='bold' size='large'>%s</span>" % txt
        self.titles["firewall"].set_markup(txt)
        txt = _("Control the incoming and outgoing network traffic.")
        txt = "<span size='small'>%s</span>" % txt
        self.labels["firewall"].set_markup(txt)

        txt = _("Ufw stands for Uncomplicated Firewall, and is a program for\n"
                "managing a netfilter firewall. It provides a command line\n"
                "interface and aims to be uncomplicated and easy to use.")
        self.titles["firewall"].set_tooltip_markup(txt)
        self.switches["firewall"].set_tooltip_markup(txt)
        self.labels["firewall"].set_tooltip_markup(txt)

        # Proprietary packages (third_party)
        txt = _("Proprietary Software")
        txt = "<span weight='bold' size='large'>%s</span>" % txt
        self.titles["third_party"].set_markup(txt)
        txt = _("Software to play Flash videos, MP3 audio, and other media.")
        txt = "<span size='small'>%s</span>" % txt
        self.labels["third_party"].set_markup(txt)

        # Sort listbox items
        self.listbox.invalidate_sort()
예제 #35
0
파일: automatic.py 프로젝트: stas-prze/thus
    def translate_ui(self):
        txt = _("Automatic installation mode")
        txt = "<span weight='bold' size='large'>{0}</span>".format(txt)
        self.title.set_markup(txt)

        txt = _("Select drive:")
        self.device_label.set_markup(txt)

        label = self.ui.get_object('text_automatic')
        txt = _("WARNING! This installation mode will overwrite everything on your drive!")
        txt = "<b>{0}</b>".format(txt)
        label.set_markup(txt)

        label = self.ui.get_object('info_label')
        txt = _("Please choose the drive where you want to install Manjaro\nand click the button below to start the process.")
        txt = "{0}".format(txt)
        label.set_markup(txt)

        label = self.ui.get_object('label_luks_password')
        txt = _("Encryption Password:"******"Confirm your password:"******"LUKS Password. Do not use special characters or accents!")
        label.set_markup(txt)

        btn = self.ui.get_object('checkbutton_show_password')
        btn.set_label(_("Show password"))

        txt = _("Install now!")
        self.forward_button.set_label(txt)

        txt = _("Use the device below for boot loader installation:")
        txt = "<span weight='bold' size='small'>{0}</span>".format(txt)
        label = self.ui.get_object('bootloader_device_info_label')
        label.set_markup(txt)

        txt = _("Bootloader:")
        label = self.ui.get_object('bootloader_label')
        label.set_markup(txt)

        txt = _("Device:")
        label = self.ui.get_object('bootloader_device_label')
        label.set_markup(txt)
예제 #36
0
    def translate_ui(self, desktop, set_header=True):
        """ Translates all ui elements """
        label = self.ui.get_object("desktop_info")
        txt = "<span weight='bold'>{0}</span>\n".format(
            desktop_info.NAMES[desktop])
        description = desktop_info.DESCRIPTIONS[desktop]
        txt = txt + _(description)
        label.set_markup(txt)

        # This sets the desktop's image
        path = os.path.join(self.desktops_dir, desktop + ".png")
        if self.desktop_image is None:
            self.desktop_image = Gtk.Image.new_from_file(path)
            overlay = self.ui.get_object("image_overlay")
            overlay.add(self.desktop_image)
        else:
            self.desktop_image.set_from_file(path)

        # and this sets the icon
        filename = "desktop-environment-" + desktop.lower() + ".svg"
        icon_path = os.path.join(desktop_info.DESKTOP_ICONS_PATH, "scalable",
                                 filename)
        icon_exists = os.path.exists(icon_path)

        if self.icon_desktop_image is None:
            if icon_exists:
                pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(
                    icon_path, 48, 48)
                self.icon_desktop_image = Gtk.Image.new_from_pixbuf(pixbuf)
            else:
                filename = desktop.lower() + ".png"
                icon_path = os.path.join(desktop_info.DESKTOP_ICONS_PATH,
                                         "48x48", filename)
                icon_exists = os.path.exists(icon_path)
                if icon_exists:
                    self.icon_desktop_image = Gtk.Image.new_from_file(
                        icon_path)
                else:
                    self.icon_desktop_image = Gtk.Image.new_from_icon_name(
                        "image-missing", Gtk.IconSize.DIALOG)

            overlay = self.ui.get_object("image_overlay")
            overlay.add_overlay(self.icon_desktop_image)
        else:
            if icon_exists:
                pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(
                    icon_path, 48, 48)
                self.icon_desktop_image.set_from_pixbuf(pixbuf)
            else:
                filename = desktop.lower() + ".png"
                icon_path = os.path.join(desktop_info.DESKTOP_ICONS_PATH,
                                         "48x48", filename)
                icon_exists = os.path.exists(icon_path)
                if icon_exists:
                    self.icon_desktop_image.set_from_file(icon_path)
                else:
                    self.icon_desktop_image.set_from_icon_name(
                        "image-missing", Gtk.IconSize.DIALOG)

        if set_header:
            # set header text
            txt = _("Choose Your Desktop")
            self.header.set_subtitle(txt)
예제 #37
0
    def translate_ui(self):
        """ Translates screen before showing it """
        self.header.set_subtitle(_("Installation Type"))

        self.forward_button.set_always_show_image(True)
        self.forward_button.set_sensitive(True)

        description_style = '<span style="italic">{0}</span>'
        bold_style = '<span weight="bold">{0}</span>'

        oses_str = self.get_os_list_str()

        max_width_chars = 80

        # Automatic Install
        radio = self.ui.get_object("automatic_radiobutton")
        if len(oses_str) > 0:
            txt = _("Replace {0} with Antergos").format(oses_str)
        else:
            txt = _("Erase disk and install Antergos")
        radio.set_label(txt)
        radio.set_name('auto_radio_btn')

        label = self.ui.get_object("automatic_description")
        txt = _("Warning: This will erase ALL data on your disk.")
        # txt = description_style.format(txt)
        label.set_text(txt)
        label.set_name("automatic_desc")
        label.set_hexpand(False)
        label.set_line_wrap(True)
        label.set_max_width_chars(max_width_chars)

        button = self.ui.get_object("encrypt_checkbutton")
        txt = _("Encrypt this installation for increased security.")
        button.set_label(txt)
        button.set_name("enc_btn")
        button.set_hexpand(False)
        # button.set_line_wrap(True)
        # button.set_max_width_chars(max_width_chars)

        label = self.ui.get_object("encrypt_label")
        txt = _("You will be asked to create an encryption password in the next step.")
        # txt = description_style.format(txt)
        label.set_text(txt)
        label.set_name("enc_label")
        label.set_hexpand(False)
        label.set_line_wrap(True)
        label.set_max_width_chars(max_width_chars)

        button = self.ui.get_object("lvm_checkbutton")
        txt = _("Use LVM with this installation.")
        button.set_label(txt)
        button.set_name("lvm_btn")
        button.set_hexpand(False)
        # button.set_line_wrap(True)
        # button.set_max_width_chars(max_width_chars)

        label = self.ui.get_object("lvm_label")
        txt = _("This will setup LVM and allow you to easily manage partitions and create snapshots.")
        # txt = description_style.format(txt)
        label.set_text(txt)
        label.set_name("lvm_label")
        label.set_hexpand(False)
        label.set_line_wrap(True)
        label.set_max_width_chars(max_width_chars)

        button = self.ui.get_object("home_checkbutton")
        txt = _("Set your Home in a different partition/volume")
        button.set_label(txt)
        button.set_name("home_btn")
        button.set_hexpand(False)
        # button.set_line_wrap(True)
        # button.set_max_width_chars(max_width_chars)

        label = self.ui.get_object("home_label")
        txt = _("This will setup you /home directory in a different partition or volume.")
        # txt = description_style.format(txt)
        label.set_text(txt)
        label.set_name("home_label")
        label.set_hexpand(False)
        label.set_line_wrap(True)
        label.set_max_width_chars(max_width_chars)

        # Alongside Install (For now, only works with Windows)
        # if len(oses_str) > 0:
        #     txt = _("Install Antergos alongside {0}").format(oses_str)
        #     radio = self.ui.get_object("alongside_radiobutton")
        #     radio.set_label(txt)
        #
        #     label = self.ui.get_object("alongside_description")
        #     txt = _("Installs Antergos without removing {0}").format(oses_str)
        #     txt = description_style.format(txt)
        #     label.set_markup(txt)
        #     label.set_line_wrap(True)
        #
        #     intro_txt = _("This computer has {0} installed.").format(oses_str)
        #     intro_txt = intro_txt + "\n" + _("What do you want to do?")
        # else:
        intro_txt = _("How would you like to proceed?")

        intro_label = self.ui.get_object("introduction")
        # intro_txt = bold_style.format(intro_txt)
        intro_label.set_text(intro_txt)
        intro_label.set_name("intro_label")
        intro_label.set_hexpand(False)
        intro_label.set_line_wrap(True)
        intro_label.set_max_width_chars(max_width_chars)

        # Advanced Install
        radio = self.ui.get_object("advanced_radiobutton")
        radio.set_label(_("Choose exactly where Antergos should be installed."))
        radio.set_name("advanced_radio_btn")

        label = self.ui.get_object("advanced_description")
        txt = _("Edit partition table and choose mount points.")
        # txt = description_style.format(txt)
        label.set_text(txt)
        label.set_name("adv_desc_label")
        label.set_hexpand(False)
        label.set_line_wrap(True)
        label.set_max_width_chars(max_width_chars)
예제 #38
0
    def store_values(self):
        """ Store selected values """
        check = self.ui.get_object("encrypt_checkbutton")
        use_luks = check.get_active()

        check = self.ui.get_object("lvm_checkbutton")
        use_lvm = check.get_active()

        check = self.ui.get_object("home_checkbutton")
        use_home = check.get_active()

        if self.next_page == "installation_automatic":
            self.settings.set('use_lvm', use_lvm)
            self.settings.set('use_luks', use_luks)
            self.settings.set('use_luks_in_root', True)
            self.settings.set('luks_root_volume', "cryptAntergos")
            self.settings.set('use_home', use_home)
        else:
            # Set defaults. We don't know these yet.
            self.settings.set('use_lvm', False)
            self.settings.set('use_luks', False)
            self.settings.set('use_luks_in_root', False)
            self.settings.set('luks_root_volume', "")
            self.settings.set('use_home', False)

        if self.settings.get('use_luks'):
            logging.info("Antergos installation will be encrypted using LUKS")

        if self.settings.get('use_lvm'):
            logging.info("Antergos will be installed using LVM volumes")
            if self.settings.get('use_home'):
                logging.info("Antergos will be installed using a separate /home volume.")
        elif self.settings.get('use_home'):
            logging.info("Antergos will be installed using a separate /home partition.")

        if self.next_page == "installation_alongside":
            self.settings.set('partition_mode', 'alongside')
        elif self.next_page == "installation_advanced":
            self.settings.set('partition_mode', 'advanced')
        elif self.next_page == "installation_automatic":
            self.settings.set('partition_mode', 'automatic')

        # Check if there are still processes running...
        must_wait = False
        for proc in self.process_list:
            if proc.is_alive():
                must_wait = True
                break

        if must_wait:
            from gi.repository import Gtk
            txt1 = _("Ranking mirrors")
            txt2 = _("Cnchi is still updating and optimizing your mirror lists.")
            txt2 += "\n\n"
            txt2 += _("Please be patient...")
            txt1 = "<big>{0}</big>".format(txt1)
            txt2 = "<i>{0}</i>".format(txt2)
            wait_ui = Gtk.Builder()
            ui_file = os.path.join(self.ui_dir, "wait.ui")
            wait_ui.add_from_file(ui_file)
            lbl1 = wait_ui.get_object("label1")
            lbl1.set_markup(txt1)
            lbl2 = wait_ui.get_object("label2")
            lbl2.set_markup(txt2)
            progress_bar = wait_ui.get_object("progressbar")
            wait_window = wait_ui.get_object("wait_window")
            wait_window.set_modal(True)
            wait_window.set_transient_for(self.get_toplevel())
            wait_window.set_default_size(320, 240)
            wait_window.set_position(Gtk.WindowPosition.CENTER)
            wait_window.show_all()

            ask_box = self.ui.get_object("ask")
            if ask_box:
                ask_box.set_sensitive(False)

            import time
            logging.debug("Waiting for all external processes to finish...")
            while must_wait:
                must_wait = False
                for proc in self.process_list:
                    # This waits until process finishes, no matter the time.
                    if proc.is_alive():
                        must_wait = True
                # Just wait...
                time.sleep(0.1)
                # Update our progressbar dialog
                progress_bar.pulse()
                while Gtk.events_pending():
                    Gtk.main_iteration()
            logging.debug("All external processes are finished. Installation can go on")
            wait_window.hide()

            if ask_box:
                ask_box.set_sensitive(True)

        return True
예제 #39
0
    def create_zfs(self, solaris_partition_number):
        """ Setup ZFS system """

        # Make sure the ZFS modules are loaded
        call(["modprobe", "zfs"])

        # Empty DEST_DIR or zfs pool will fail to mount on it
        # (this will delete preexisting installing attempts, too)
        if os.path.exists(DEST_DIR):
            self.clear_dest_dir()

        device_paths = self.zfs_options["device_paths"]
        if not device_paths:
            txt = _("No devices were selected for the ZFS pool")
            raise InstallError(txt)

        # Using by-id (recommended) does not work atm
        # https://github.com/zfsonlinux/zfs/issues/3708

        # Can't use the whole first disk, just the dedicated zfs partition
        device_paths[0] = self.get_partition_path(device_paths[0],
                                                  solaris_partition_number)

        line = ", ".join(device_paths)
        logging.debug("Cnchi will create a ZFS pool using %s devices", line)

        # Just in case...
        if os.path.exists("/etc/zfs/zpool.cache"):
            os.remove("/etc/zfs/zpool.cache")

        try:
            os.mkdir(DEST_DIR, mode=0o755)
        except OSError:
            pass

        pool_name = self.zfs_options["pool_name"]
        pool_type = self.zfs_options["pool_type"]

        if not self.pool_name_is_valid(pool_name):
            txt = _(
                "Pool name is invalid. It must contain only alphanumeric characters (a-zA-Z0-9_), "
                "hyphens (-), colons (:), and/or spaces ( ). Names starting with the letter 'c' "
                "followed by a number (c[0-9]) are not allowed. The following names are also not "
                "allowed: 'mirror', 'raidz', 'spare', 'log'.")
            raise InstallError(txt)

        # Create zpool
        self.create_zfs_pool(pool_name, pool_type, device_paths)

        # Set the mount point of the root filesystem
        self.set_zfs_mountpoint(pool_name, "/")

        # Set the bootfs property on the descendant root filesystem so the
        # boot loader knows where to find the operating system.
        cmd = ["zpool", "set", "bootfs={0}".format(pool_name), pool_name]
        call(cmd, fatal=True)

        # Create zpool.cache file
        cmd = ["zpool", "set", "cachefile=/etc/zfs/zpool.cache", pool_name]
        call(cmd, fatal=True)

        if self.settings.get('use_home'):
            # Create home zvol
            logging.debug("Creating zfs subvolume 'home'")
            self.create_zfs_vol(pool_name, "home")
            self.set_zfs_mountpoint("{0}/home".format(pool_name), "/home")
            # ZFS automounts, we have to unmount /install/home and delete it,
            # otherwise we won't be able to import the zfs pool
            home_path = "{0}/home".format(DEST_DIR)
            call(["zfs", "umount", home_path], warning=False)
            shutil.rmtree(path=home_path, ignore_errors=True)

        # Create swap zvol (it has to be named "swap")
        swap_size = self.get_swap_size(pool_name)
        self.create_zfs_vol(pool_name, "swap", swap_size)

        # Wait until /dev initialized correct devices
        call(["udevadm", "settle"])
        call(["sync"])

        # Export the pool
        # Makes the kernel to flush all pending data to disk, writes data to
        # the disk acknowledging that the export was done, and removes all
        # knowledge that the storage pool existed in the system
        logging.debug("Exporting pool %s...", pool_name)
        cmd = ["zpool", "export", "-f", pool_name]
        call(cmd, fatal=True)

        # Let's get the id of the pool (to import it)
        pool_id, _status = self.get_pool_id(pool_name)

        if not pool_id:
            # Something bad has happened. Will use the pool name instead.
            logging.warning("Can't get %s zpool id", pool_name)
            pool_id = pool_name

        # Save pool id
        self.settings.set("zfs_pool_id", pool_id)

        # Finally, re-import the pool by-id
        # DEST_DIR must be empty or importing will fail!
        logging.debug("Importing pool %s (%s)...", pool_name, pool_id)
        cmd = [
            "zpool", "import", "-f", "-d", "/dev/disk/by-id", "-R", DEST_DIR,
            pool_id
        ]
        call(cmd, fatal=True)

        # Copy created cache file to destination
        try:
            dst_dir = os.path.join(DEST_DIR, "etc/zfs")
            os.makedirs(dst_dir, mode=0o755, exist_ok=True)
            src = "/etc/zfs/zpool.cache"
            dst = os.path.join(dst_dir, "zpool.cache")
            shutil.copyfile(src, dst)
        except OSError as copy_error:
            logging.warning(copy_error)

        # Store hostid
        hostid = call(["hostid"])
        if hostid:
            hostid_path = os.path.join(DEST_DIR, "etc/hostid")
            with open(hostid_path, "w") as hostid_file:
                hostid_file.write("{0}\n".format(hostid))
예제 #40
0
파일: user_info.py 프로젝트: codyzu/Cnchi
    def translate_ui(self):
        """ Translates all ui elements """
        label = self.ui.get_object('fullname_label')
        txt = _("Your name:")
        label.set_markup(txt)

        label = self.ui.get_object('fullname')
        txt = _("Your name")
        label.set_placeholder_text(txt)

        label = self.ui.get_object('hostname_label')
        txt = _("Your computer's name:")
        label.set_markup(txt)

        label = self.ui.get_object('hostname')
        txt = _("Hostname")
        label.set_placeholder_text(txt)

        label = self.ui.get_object('username_label')
        txt = _("Pick a username:"******"Username")
        label.set_placeholder_text(txt)

        label = self.ui.get_object('password_label')
        txt = _("Choose a password:"******"Password")
        label.set_placeholder_text(txt)

        label = self.ui.get_object('verified_password_label')
        txt = _("Confirm your password:"******"Confirm password")
        label.set_placeholder_text(txt)

        label = self.ui.get_object('hostname_extra_label')
        txt = _("Identifies your system to other computers and devices.")
        txt = '<span size="small">{0}</span>'.format(txt)
        label.set_markup(txt)

        small_dark_red = '<small><span color="darkred">{0}</span></small>'

        txt = _("You must enter a name")
        txt = small_dark_red.format(txt)
        self.error_label['hostname'].set_markup(txt)

        txt = _("You must enter a username")
        txt = small_dark_red.format(txt)
        self.error_label['username'].set_markup(txt)

        txt = _("You must enter a password")
        txt = small_dark_red.format(txt)
        self.error_label['password'].set_markup(txt)

        self.login['auto'].set_label(_("Log in automatically"))
        self.login['pass'].set_label(_("Require my password to log in"))
        self.login['encrypt'].set_label(_("Encrypt my home folder"))

        btn = self.ui.get_object('checkbutton_show_password')
        btn.set_label(_("show password"))

        self.header.set_subtitle(_("Create Your User Account"))
예제 #41
0
                              location)
                country_code = 'us'
        else:
            country_name = 'USA'
            country_code = 'us'
        logging.debug("Selected country name: %s", country_name)
        logging.debug("Selected country code: %s", country_code)
        self.settings.set('country_name', country_name)
        self.settings.set('country_code', country_code)
        return True

    @staticmethod
    def get_and_save_install_id():
        context_filter = ContextFilter()
        context_filter.get_and_save_install_id(is_location_screen=True)


# When testing, no _() is available
try:
    _("")
except NameError as err:

    def _(message):
        return message


if __name__ == '__main__':
    from test_screen import _, run

    run('Location')
예제 #42
0
파일: slides.py 프로젝트: prescott66/Cnchi
    def manage_events_from_cb_queue(self):
        """ We should do as less as possible here, we want to maintain our
            queue message as empty as possible """

        if self.fatal_error:
            return False

        while self.callback_queue.empty() == False:
            try:
                event = self.callback_queue.get_nowait()
            except queue.Empty:
                return True

            if event[0] == 'percent':
                self.progress_bar.set_fraction(event[1])
            elif event[0] == 'text':
                if event[1] == 'hide':
                    self.progress_bar.set_show_text(False)
                    self.progress_bar.set_text("")
                else:
                    self.progress_bar.set_show_text(True)
                    self.progress_bar.set_text(event[1])
            elif event[0] == 'pulse':
                if event[1] == 'stop':
                    self.stop_pulse()
                elif event[1] == 'start':
                    self.start_pulse()
            elif event[0] == 'progress_bar':
                if event[1] == 'hide':
                    self.progress_bar.hide()
            elif event[0] == 'finished':
                logging.info(event[1])
                if not self.settings.get('bootloader_ok'):
                    # Warn user about GRUB and ask if we should open wiki page.
                    boot_warn = _(
                        "IMPORTANT: There may have been a problem with the Grub(2) bootloader\n"
                        "installation which could prevent your system from booting properly. Before\n"
                        "rebooting, you may want to verify whether or not GRUB(2) is installed and\n"
                        "configured. The Arch Linux Wiki contains troubleshooting information:\n"
                        "\thttps://wiki.archlinux.org/index.php/GRUB\n"
                        "\nWould you like to view the wiki page now?")
                    response = show.question(boot_warn)
                    if response == Gtk.ResponseType.YES:
                        import webbrowser
                        misc.drop_privileges()
                        webbrowser.open(
                            'https://wiki.archlinux.org/index.php/GRUB')

                install_ok = _(
                    "Installation Complete!\nDo you want to restart your system now?"
                )
                response = show.question(install_ok)
                self.remove_temp_files()
                self.settings.set('stop_all_threads', True)
                logging.shutdown()
                if response == Gtk.ResponseType.YES:
                    self.reboot()
                else:
                    sys.exit(0)
                return False
            elif event[0] == 'error':
                self.callback_queue.task_done()
                # A fatal error has been issued. We empty the queue
                self.empty_queue()

                # Show the error
                show.fatal_error(event[1])

                # Ask if user wants to retry
                res = show.question(
                    _("Do you want to retry the installation using the same configuration?"
                      ))
                if res == GTK_RESPONSE_YES:
                    # Restart installation process
                    logging.debug(_("Restarting installation process..."))
                    p = self.settings.get('installer_thread_call')

                    self.process = installation_process.InstallationProcess(
                        self.settings, self.callback_queue, p['mount_devices'],
                        p['fs_devices'], p['ssd'], p['alternate_package_list'],
                        p['blvm'])

                    self.process.start()
                    return True
                else:
                    self.fatal_error = True
                    return False
            elif event[0] == 'info':
                logging.info(event[1])
                if self.should_pulse:
                    self.progress_bar.set_text(event[1])
                else:
                    self.set_message(event[1])

            self.callback_queue.task_done()

        return True
예제 #43
0
    def translate_ui(self):
        """ Translate widgets """
        txt = _("Select drive:")
        self.device_label.set_markup(txt)

        label = self.ui.get_object('text_automatic')
        txt = _(
            "WARNING! This will overwrite everything currently on your drive!")
        txt = "<b>{0}</b>".format(txt)
        label.set_markup(txt)

        label = self.ui.get_object('info_label')
        txt = _("Select the drive we should use to install Reborn OS and then "
                "click above to start the process.")
        label.set_markup(txt)

        label = self.ui.get_object('label_luks_password')
        txt = _("Encryption Password:"******"Confirm your password:"******"LUKS Password. We do not recommend using special characters or accents!"
        )
        label.set_markup(txt)

        btn = self.ui.get_object('checkbutton_show_password')
        btn.set_label(_("Show password"))

        self.header.set_subtitle(_("Automatic Installation Mode"))

        txt = _("Use the device below for boot loader installation:")
        txt = "<span weight='bold' size='small'>{0}</span>".format(txt)
        label = self.ui.get_object('bootloader_device_info_label')
        label.set_markup(txt)

        txt = _("Bootloader:")
        label = self.ui.get_object('bootloader_label')
        label.set_markup(txt)

        txt = _("Device:")
        label = self.ui.get_object('bootloader_device_label')
        label.set_markup(txt)
예제 #44
0
 def stop_threads(self):
     logging.debug(_("Stoping timezone threads..."))
     if self.auto_timezone_thread != None:
         self.auto_timezone_thread.stop()
     if self.mirrorlist_thread != None:
         self.mirrorlist_thread.stop()
예제 #45
0
 def quit_cnchi(self):
     self.remove_temp_files()
     logging.info(_("Quiting installer..."))
     self.settings.set('stop_all_threads', True)
     logging.shutdown()
     sys.exit(0)
예제 #46
0
파일: slides.py 프로젝트: prescott66/Cnchi
    def translate_ui(self):
        """ Translates all ui elements """
        if len(self.info_label.get_label()) <= 0:
            self.set_message(_("Please wait..."))

        self.header.set_subtitle(_("Installing Antergos..."))
예제 #47
0
    def translate_ui(self):
        """ Translates all ui elements """
        txt = _("Installation Summary")
        self.header.set_subtitle(txt)

        items = {
            "location": _("Location"),
            "timezone": _("Timezone"),
            "keyboard": _("Keyboard"),
            "de": _("Desktop Environment"),
            "features": _("Features"),
            "partitions": _("Partitions")
        }

        for item_id in items:
            label = self.ui.get_object(item_id + "_label")
            txt = "<b>{0}</b>".format(items[item_id])
            label.set_markup(txt)

        # Fill stateboxes

        # Location
        statebox = self.ui.get_object("location_statebox")
        statebox.set_property("label", self.settings.get('location'))

        # Timezone
        statebox = self.ui.get_object("timezone_statebox")
        txt = "{0}/{1}".format(self.settings.get("timezone_human_country"),
                               self.settings.get("timezone_human_zone"))
        statebox.set_property("label", txt)

        # Keyboard
        statebox = self.ui.get_object("keyboard_statebox")
        layout = self.settings.get("keyboard_layout")
        variant = self.settings.get("keyboard_variant")
        txt = _("Layout: {0}").format(layout)
        if variant:
            txt += ", " + _("Variant: {0}").format(variant)
        statebox.set_property("label", txt)

        # Desktop Environment
        statebox = self.ui.get_object("de_statebox")
        desktop = self.settings.get('desktop')
        desktop_name = desktop_info.NAMES[desktop]
        statebox.set_property("label", desktop_name)

        # Features
        statebox = self.ui.get_object("features_statebox")
        txt = ""
        self.num_features = 0
        for feature in features_info.TITLES:
            if self.settings.get("feature_" + feature):
                feature_title = _(features_info.TITLES[feature])
                txt += "{0}\n".format(feature_title)
                self.num_features += 1
        txt = txt[:-1]
        statebox.set_property("label", txt)

        # Partitions
        install_screen = self.get_install_screen()
        if install_screen:
            txt = ""
            statebox = self.ui.get_object("partitions_statebox")
            changes = install_screen.get_changes()
            if changes == None or len(changes) == 0:
                txt = _("Error getting changes from install screen")
                logging.error("Error getting changes from install screen")
            else:
                for action in changes:
                    txt += "{0}\n".format(_(str(action)))
                txt = txt[:-1]
        else:
            txt = _("Error getting changes from install screen")
            logging.error("Error getting changes from install screen")

        statebox.set_property("label", txt)
예제 #48
0
파일: slides.py 프로젝트: stas-prze/thus
    def manage_events_from_cb_queue(self):
        """ We should do as less as possible here, we want to maintain our
            queue message as empty as possible """

        if self.fatal_error:
            return False

        if self.callback_queue is None:
            return True

        while not self.callback_queue.empty():
            try:
                event = self.callback_queue.get_nowait()
            except queue.Empty:
                return True

            if event[0] == 'percent':
                self.progress_bar.set_fraction(float(event[1]))
            elif event[0] == 'downloads_percent':
                self.downloads_progress_bar.set_fraction(float(event[1]))
            elif event[0] == 'text':
                if event[1] == 'hide':
                    self.progress_bar.set_show_text(False)
                    self.progress_bar.set_text("")
                else:
                    self.progress_bar.set_show_text(True)
                    self.progress_bar.set_text(event[1])
            elif event[0] == 'pulse':
                if event[1] == 'stop':
                    self.stop_pulse()
                elif event[1] == 'start':
                    self.start_pulse()
            elif event[0] == 'progress_bar':
                if event[1] == 'hide':
                    self.progress_bar.hide()
            elif event[0] == 'downloads_progress_bar':
                if event[1] == 'hide':
                    self.downloads_progress_bar.hide()
                if event[1] == 'show':
                    self.downloads_progress_bar.show()
            elif event[0] == 'finished':
                logging.info(event[1])
                if not self.settings.get('bootloader_installation_successful'):
                    # Warn user about GRUB and ask if we should open wiki page.
                    boot_warn = _(
                        "IMPORTANT: There may have been a problem with the bootloader\n"
                        "installation which could prevent your system from booting properly. Before\n"
                        "rebooting, you may want to verify whether or not the bootloader is installed and\n"
                        "configured. The Arch Linux Wiki contains troubleshooting information:\n"
                        "\thttps://wiki.archlinux.org/index.php/GRUB\n"
                        "\nWould you like to view the wiki page now?")
                    response = show.question(self.get_toplevel(), boot_warn)
                    if response == Gtk.ResponseType.YES:
                        import webbrowser

                        misc.drop_privileges()
                        webbrowser.open(
                            'https://wiki.archlinux.org/index.php/GRUB')

                install_ok = _(
                    "Installation Complete!\nDo you want to restart your system now?"
                )
                response = show.question(self.get_toplevel(), install_ok)
                misc.remove_temp_files()
                self.settings.set('stop_all_threads', True)
                logging.shutdown()
                if response == Gtk.ResponseType.YES:
                    self.reboot()
                else:
                    sys.exit(0)
                return False
            elif event[0] == 'error':
                self.callback_queue.task_done()
                # A fatal error has been issued. We empty the queue
                self.empty_queue()

                # Show the error
                show.fatal_error(self.get_toplevel(), event[1])
            elif event[0] == 'info':
                logging.info(event[1])
                if self.should_pulse:
                    self.progress_bar.set_text(event[1])
                else:
                    self.set_message(event[1])

            self.callback_queue.task_done()

        return True