logging.debug('Adding %s to cache_pkgs_md5_check_failed list', event[1]) self.settings.set('cache_pkgs_md5_check_failed', event[1]) self.callback_queue.task_done() return True def empty_queue(self): """ Empties messages queue """ while not self.callback_queue.empty(): try: self.callback_queue.get_nowait() self.callback_queue.task_done() except queue.Empty: return @misc.raise_privileges def reboot(self): """ Reboots the system, used when installation is finished """ cmd = ["sync"] subprocess.call(cmd) cmd = ["/usr/bin/systemctl", "reboot", "--force", "--no-wall"] subprocess.call(cmd) if __name__ == '__main__': from test_screen import run run('Slides')
info.format_secondary_markup(txt2) info.run() info.destroy() def get_prev_page(self): return _prev_page def get_next_page(self): return _next_page def prepare(self, direction): """ Prepare features screen to get ready to show itself """ desktop = self.settings.get('desktop') self.features = self.features_by_desktop[desktop] self.translate_ui() self.show_all() self.hide_features() if self.defaults: self.enable_defaults() self.defaults = False # When testing, no _() is available try: _("") except NameError as err: def _(message): return message if __name__ == '__main__': from test_screen import _,run run('Features')
txt = _("Loading, please wait...") else: txt = "" self.labels['loading'].set_markup(txt) self.labels['loading'].queue_draw() misc.gtk_refresh() def store_values(self): self.forward_button.show() return True def prepare(self, direction): self.translate_ui() self.show_all() self.forward_button.hide() if self.disable_tryit: self.buttons['tryit'].set_sensitive(False) if direction == "backwards": self.show_loading_message(do_show=False) # When testing, no _() is available try: _("") except NameError as err: def _(message): return message if __name__ == '__main__': from test_screen import _, run run('Welcome')
self.settings.set('partition_mode', 'automatic') return True def get_next_page(self): return self.next_page def on_automatic_radiobutton_toggled(self, widget): """ Automatic selected, enable all options """ if widget.get_active(): self.next_page = "installation_automatic" self.enable_automatic_options(True) def on_alongside_radiobutton_toggled(self, widget): """ Alongside selected, disable all automatic options """ if widget.get_active(): self.next_page = "installation_alongside" self.enable_automatic_options(False) def on_advanced_radiobutton_toggled(self, widget): """ Advanced selected, disable all automatic options """ if widget.get_active(): self.next_page = "installation_advanced" self.enable_automatic_options(False) if __name__ == '__main__': from test_screen import _, run run('InstallationAsk')
# Store hostid hostid = call(["hostid"]) if hostid: with open("/install/etc/hostid", "w") as hostid_file: hostid_file.write("{0}\n".format(hostid)) def run_install(self, packages, metalinks): """ Start installation process """ self.installation = install.Installation( self.settings, self.callback_queue, packages, metalinks, self.mount_devices, self.fs_devices ) self.installation.start() try: _("") except NameError as err: def _(message): return message if __name__ == "__main__": # When testing, no _() is available from test_screen import _, run run("zfs")
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)) def run_install(self, packages, metalinks): """ Start installation process """ self.installation = install.Installation( self.settings, self.callback_queue, packages, metalinks, self.mount_devices, self.fs_devices) self.installation.start() try: _("") except NameError as err: def _(message): return message if __name__ == '__main__': # When testing, no _() is available from test_screen import _, run run('zfs')
self.callback_queue.task_done() return True def empty_queue(self): """ Empties messages queue """ while not self.callback_queue.empty(): try: self.callback_queue.get_nowait() self.callback_queue.task_done() except queue.Empty: return @misc.raise_privileges def reboot(self): """ Reboots the system, used when installation is finished """ os.system("sync") subprocess.call(["/usr/bin/systemctl", "reboot", "--force", "--no-wall"]) # When testing, no _() is available try: _("") except NameError as err: def _(message): return message if __name__ == '__main__': from test_screen import _, run run('Slides')
self.translate_ui() # Enable forward button self.forward_button.set_sensitive(True) self.show_all() # Launch rank mirrors process to optimize Arch and Antergos mirrorlists if (not self.disable_rank_mirrors and not self.rank_mirrors_launched): proc = AutoRankmirrorsProcess(self.settings) proc.daemon = True proc.name = "rankmirrors" proc.start() self.process_list.append(proc) self.rank_mirrors_launched = True else: logging.debug("Not running rank mirrors. This is discouraged.") # When testing, no _() is available try: _("") except NameError as err: def _(message): return message if __name__ == '__main__': from test_screen import _, run run('Language')
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')
self.translate_ui() # Enable forward button self.forward_button.set_sensitive(True) self.show_all() # Launch rank mirrors process to optimize Arch and Antergos mirrorlists if not self.testing and not self.disable_rank_mirrors and not self.rank_mirrors_launched: proc = AutoRankmirrorsProcess() proc.daemon = True proc.name = "rankmirrors" proc.start() self.process_list.append(proc) self.rank_mirrors_launched = True else: logging.debug("Not running rank mirrors. This is discouraged.") # When testing, no _() is available try: _("") except NameError as err: def _(message): return message if __name__ == "__main__": from test_screen import _, run run("Language")
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 # When testing, no _() is available try: _("") except NameError as err: def _(message): return message if __name__ == "__main__": from test_screen import _, run run("Location")
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 def get_prev_page(self): return _prev_page def get_next_page(self): return _next_page # When testing, no _() is available try: _("") except NameError as err: def _(message): return message if __name__ == '__main__': from test_screen import _,run run('Location')
def empty_queue(self): """ Empties messages queue """ while self.callback_queue.empty() == False: try: event = self.callback_queue.get_nowait() self.callback_queue.task_done() except queue.Empty: return @misc.raise_privileges def reboot(self): """ Reboots the system, used when installation is finished """ os.system("sync") subprocess.call(["/usr/bin/systemctl", "reboot", "--force", "--no-wall"]) # When testing, no _() is available try: _("") except NameError as err: def _(message): return message if __name__ == "__main__": from test_screen import _, run run("Slides")
logging.info(txt, self.auto_device) self.settings.set('auto_device', self.auto_device) ssd = {self.auto_device: fs.is_ssd(self.auto_device)} if not self.testing: self.installation = install.Installation( self.settings, self.callback_queue, packages, metalinks, self.mount_devices, self.fs_devices, ssd) self.installation.start() else: logging.debug("Testing mode, not changing anything") # When testing, no _() is available try: _("") except NameError as err: def _(message): return message if __name__ == '__main__': from test_screen import _, run run('InstallationAutomatic')
self.error_label["password"], self.password_strength, ) # Check if all fields are filled and ok all_ok = True ok_widgets = self.is_ok.values() if not self.settings.get("z_hidden"): for ok_widget in ok_widgets: (icon_name, icon_size) = ok_widget.get_stock() visible = ok_widget.get_visible() if visible == False or icon_name != "gtk-yes": all_ok = False self.forward_button.set_sensitive(all_ok) # When testing, no _() is available try: _("") except NameError as err: def _(message): return message if __name__ == "__main__": from test_screen import _, run run("UserInfo")
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) def set_keyboard_widget_keymap(self): """ Pass current keyboard layout to the keyboard widget. """ self.keyboard_widget.set_layout(self.keyboard_layout['code']) self.keyboard_widget.set_variant(self.keyboard_variant['code']) self.keyboard_widget.show_all() # When testing, no _() is available try: _("") except NameError as err: def _(message): return message if __name__ == '__main__': from test_screen import _, run run('Keymap')
label = self.ui.get_object("features_label") label.hide() def store_values(self): response = show.question( self.get_toplevel(), _("Are you REALLY sure you want to continue?")) if response != Gtk.ResponseType.YES: return False install_screen = self.get_install_screen() self.process = Process(install_screen, self.settings, self.callback_queue) self.process.start() return True def get_prev_page(self): page = "installation_" + self.settings.get('partition_mode') return page # When testing, no _() is available try: _("") except NameError as err: def _(message): return message if __name__ == '__main__': from test_screen import _, run run('Summary')
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)) def run_install(self, packages, metalinks): """ Start installation process """ self.installation = install.Installation(self.settings, self.callback_queue, packages, metalinks, self.mount_devices, self.fs_devices) self.installation.start() try: _("") except NameError as err: def _(message): return message if __name__ == '__main__': # When testing, no _() is available from test_screen import _, run run('zfs')
def run_install(self, packages, metalinks): """ Perform installation """ txt = _("Cnchi will install Antergos on device %s") logging.info(txt, self.auto_device) self.settings.set('auto_device', self.auto_device) ssd = {self.auto_device: fs.is_ssd(self.auto_device)} self.installation = install.Installation(self.settings, self.callback_queue, packages, metalinks, self.mount_devices, self.fs_devices, ssd) self.installation.start() # When testing, no _() is available try: _("") except NameError as err: def _(message): return message if __name__ == '__main__': from test_screen import _, run run('InstallationAutomatic')
fs_devices[npart.path] = "ext4" fs.create_fs(npart.path, 'ext4', 'ROOT') # TODO: User should be able to choose if installing a bootloader or not (and which one) self.settings.set('bootloader_install', True) if self.settings.get('bootloader_install'): self.settings.set('bootloader', "grub2") self.settings.set('bootloader_device', device_path) msg = _("Manjaro will install the bootloader {0} in device {1}") msg = msg.format(self.bootloader, self.bootloader_device) logging.info(msg) else: logging.info(_("Thus will not install any bootloader")) if not self.testing: self.process = installation_process.InstallationProcess( self.settings, self.callback_queue, mount_devices, fs_devices) self.process.start() else: logging.warning(_("Testing mode. Thus will not change anything!")) ''' if __name__ == '__main__': from test_screen import _, run run('InstallationAlongside')
self.root_password_strength, ICON_OK, ICON_WARNING) else: self.is_ok['root_password'].show() self.is_false['root_password'].hide() # Check if all fields are filled and ok all_ok = True ok_widgets = self.is_ok.values() for ok_widget in ok_widgets: widget = ok_widget.get_visible() if widget is False: all_ok = False self.forward_button.set_sensitive(all_ok) # When testing, no _() is available try: _("") except NameError as err: def _(message): return message if __name__ == '__main__': from test_screen import _, run run('UserInfo')
# self.spinner.show() # self.spinner.start() self.selection_changed(None) def pw_validated(self, unused, validated): pass def prepare(self, direction): self.translate_ui() self.show_all() if not nm.wireless_hardware_present(): self.nmwidget.set_sensitive(False) btn = self.ui.get_object('use_wireless') btn.set_sensitive(False) def store_values(): return True # When testing, no _() is available try: _("") except NameError as err: def _(message): return message if __name__ == '__main__': from test_screen import _, run run('Wireless')
txt = _("Let me manage the mirrors lists (advanced)") radio.set_label(txt) radio.set_name('user_radio_btn') intro_txt = _("How would you like to proceed?") intro_label = self.ui.get_object("introduction") 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(80) def store_values(self): """ Store selected values """ if self.use_rankmirrors: self.start_rank_mirrors() if self.use_listboxes: for listbox in self.listboxes: listbox.save_changes() return True def get_next_page(self): return self.next_page if __name__ == '__main__': from test_screen import _, run run('Mirrors')
elif widget == self.entry['username']: username = self.entry['username'].get_text() self.validate('username', username) elif (widget == self.entry['password'] or widget == self.entry['verified_password']): validation.check_password( self.entry['password'], self.entry['verified_password'], self.image_is_ok['password'], self.error_label['password'], self.password_strength) # Check if all fields are filled and ok all_ok = True ok_widgets = self.image_is_ok.values() if not self.settings.get('z_hidden'): for ok_widget in ok_widgets: icon_name = ok_widget.get_property('icon-name') visible = ok_widget.is_visible() if not visible or icon_name == ICON_WARNING: all_ok = False self.forward_button.set_sensitive(all_ok) if __name__ == '__main__': from test_screen import _, run run('UserInfo')
_("Thus will install the bootloader of type %s in %s") % (self.settings.get('bootloader_type'), self.settings.get('bootloader_location'))) else: logging.warning("Cnchi will not install any boot loader") 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() # When testing, no _() is available try: _("") except NameError as err: def _(message): return message if __name__ == '__main__': from test_screen import _, run run('InstallationAlongside')
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) def set_keyboard_widget_keymap(self): """ Pass current keyboard layout to the keyboard widget. """ self.keyboard_widget.set_layout(self.keyboard_layout['code']) self.keyboard_widget.set_variant(self.keyboard_variant['code']) self.keyboard_widget.show_all() # When testing, no _() is available try: _("") except NameError as err: def _(message): return message if __name__ == '__main__': from test_screen import _, run run('Keymap')
def store_values(self): """ User wants to continue """ parent = self.get_toplevel() msg = _("Are you REALLY sure you want to continue?") try: response = show.question(parent, msg) except TypeError as ex: response = show.question(None, msg) if response != Gtk.ResponseType.YES: return False install_screen = self.get_install_screen() self.process = Process(install_screen, self.settings, self.callback_queue) self.process.start() return True def get_prev_page(self): """ Gets previous page """ # page = "installation_" + self.settings.get('partition_mode') return self.prev_page if __name__ == '__main__': from test_screen import _, run run('Summary')
self.forward_button.set_sensitive(True) if not self.testing and has_internet: # Launch reflector script to determine the 10 fastest mirrors self.thread = AutoRankmirrorsThread() self.thread.start() return True def prepare(self, direction): """ Load screen """ self.translate_ui() self.show_all() self.forward_button.set_sensitive(self.check_all()) # Set timer self.timeout_id = GLib.timeout_add(5000, self.on_timer) # When testing, no _() is available try: _("") except NameError as err: def _(message): return message if __name__ == '__main__': from test_screen import _, run run('Check')
logging.debug("We have connection. Let's get our timezone") try: url = urllib.request.Request( url="http://geo.antergos.com", data=logo_digest, headers={"User-Agent": "Antergos Installer", "Connection": "close"}) with urllib.request.urlopen(url) as conn: coords = conn.read().decode('utf-8').strip() if coords == "0 0": # Sometimes server returns 0 0, we treat it as an error coords = None except Exception as general_error: logging.error(general_error) coords = None if coords: coords = coords.split() logging.debug( _("Timezone (latitude %s, longitude %s) detected."), coords[0], coords[1]) self.coords_queue.put(coords) if __name__ == '__main__': def _(x): return x from test_screen import _, run run('Timezone')
if not self.testing and not self.reflector_launched: # Launch reflector script to determine the 10 fastest mirrors self.thread = AutoRankmirrorsThread() self.thread.start() self.reflector_launched = True return True def prepare(self, direction): """ Load screen """ self.translate_ui() self.show_all() self.forward_button.set_sensitive(self.check_all()) # Set timer self.timeout_id = GLib.timeout_add(5000, self.on_timer) # When testing, no _() is available try: _("") except NameError as err: def _(message): return message if __name__ == '__main__': from test_screen import _, run run('Check')
desktop = label.get_text() self.set_desktop(desktop) def store_values(self): """ Store desktop """ self.settings.set('desktop', self.desktop_choice.lower()) logging.info("Cnchi will install Antergos with the '%s' desktop", self.desktop_choice.lower()) return True @staticmethod def scroll_to_cell(treeview, path): """ Scrolls treeview to show the desired cell """ treeview.scroll_to_cell(path) return False # When testing, no _() is available try: _("") except NameError as err: def _(message): return message if __name__ == '__main__': from test_screen import _, run run('DesktopAsk')
self.selection_changed(None) def pw_validated(self, unused, validated): pass def prepare(self, direction): self.translate_ui() self.show_all() if not nm.wireless_hardware_present(): self.nmwidget.set_sensitive(False) btn = self.ui.get_object("use_wireless") btn.set_sensitive(False) def store_values(): return True # When testing, no _() is available try: _("") except NameError as err: def _(message): return message if __name__ == "__main__": from test_screen import _, run run("Wireless")
if listbox_row is not None: for vbox in listbox_row: for label in vbox.get_children(): lang = label.get_text() current_language, sorted_choices, display_map = i18n.get_languages(self.language_list) if len(lang) > 0: self.settings.set("language_name", display_map[lang][0]) self.settings.set("language_code", display_map[lang][1]) return True def prepare(self, direction): self.translate_ui() # Enable forward button self.forward_button.set_sensitive(True) self.show_all() # When testing, no _() is available try: _("") except NameError as err: def _(message): return message if __name__ == '__main__': from test_screen import _, run run('Language')
WARNING: IF LAYOUT IS CHANGED IN desktop.ui THEN THIS SHOULD BE CHANGED ACCORDINGLY. """ if listbox_row is not None: for vbox in listbox_row: label = vbox.get_children()[1] desktop = label.get_text() self.set_desktop(desktop) def store_values(self): """ Store desktop """ self.settings.set('desktop', self.desktop_choice.lower()) logging.info("DSGos_Installer will install DSGos with the '%s' desktop", self.desktop_choice.lower()) return True @staticmethod def scroll_to_cell(treeview, path): """ Scrolls treeview to show the desired cell """ treeview.scroll_to_cell(path) return False # When testing, no _() is available try: _("") except NameError as err: def _(message): return message if __name__ == '__main__': from test_screen import _, run run('DesktopAsk')
buttons=Gtk.ButtonsType.CLOSE) info.set_markup(txt1) info.format_secondary_markup(txt2) info.run() info.destroy() def prepare(self, direction): """ Prepare features screen to get ready to show itself """ desktop = self.settings.get('desktop') self.features = self.features_by_desktop[desktop] self.translate_ui() self.show_all() self.hide_features() if self.defaults: self.enable_defaults() self.defaults = False # When testing, no _() is available try: _("") except NameError as err: def _(message): return message if __name__ == '__main__': from test_screen import _, run run('Features')
""" Automatic selected, enable all options """ if widget.get_active(): self.next_page = "installation_automatic" self.enable_automatic_options(True) def on_alongside_radiobutton_toggled(self, widget): """ Alongside selected, disable all automatic options """ if widget.get_active(): self.next_page = "installation_alongside" self.enable_automatic_options(False) def on_advanced_radiobutton_toggled(self, widget): """ Advanced selected, disable all automatic options """ if widget.get_active(): self.next_page = "installation_advanced" self.enable_automatic_options(False) # When testing, no _() is available try: _("") except NameError as err: def _(message): return message if __name__ == '__main__': from test_screen import _, run run('InstallationAsk')
# Tell timezone thread to start searching now self.settings.set('timezone_start', True) # Simulate a forward button click self.forward_button.emit("clicked") def store_values(self): self.forward_button.show() return True def prepare(self, direction): self.translate_ui() self.show_all() self.forward_button.hide() if self.disable_tryit: self.button['tryit'].set_sensitive(False) def start_auto_timezone_thread(self): import timezone self.auto_timezone_thread = timezone.AutoTimezoneThread(self.auto_timezone_coords, self.settings) self.auto_timezone_thread.start() # When testing, no _() is available try: _("") except NameError as err: def _(message): return message if __name__ == '__main__': from test_screen import _,run run('Welcome')
timezone = coords_list[3] coords = "{0} {1}".format(latitude, longitude) if status == "fail": coords = None except Exception as general_error: logging.error(general_error) coords = None if coords: coords = coords.split() msg = _("Timezone (latitude {0}, longitude {1}) detected.") msg = msg.format(coords[0], coords[1]) logging.debug(msg) self.coords_queue.put(coords) # When testing, no _() is available try: _("") except NameError as err: def _(message): return message if __name__ == '__main__': from test_screen import _, run run('Timezone')
if self.load_defaults: self.switch_defaults_on() # Only load defaults once self.load_defaults = False else: # Load values user has chosen when this screen is shown again self.load_values() def load_values(self): """ Get previous selected switches values """ for feature in self.features: row = self.listbox_rows[feature] is_active = self.settings.get("feature_" + feature) if row[COL_SWITCH] is not None and is_active is not None: row[COL_SWITCH].set_active(is_active) # When testing, no _() is available try: _("") except NameError as err: def _(message): return message if __name__ == "__main__": from test_screen import _, run run("Features")