def initialize(self): NormalSpoke.initialize(self) self.initialize_start() # get object references from the builders self._main_notebook = self.builder.get_object("main_notebook") # * the registration tab * # # container for the main registration controls self._registration_grid = self.builder.get_object("registration_grid") # authentication self._account_radio_button = self.builder.get_object("account_radio_button") self._activation_key_radio_button = self.builder.get_object("activation_key_radio_button") # authentication - account self._account_revealer = self.builder.get_object("account_revealer") self._username_entry = self.builder.get_object("username_entry") self._password_entry = self.builder.get_object("password_entry") # authentication - activation key self._activation_key_revealer = self.builder.get_object("activation_key_revealer") self._organization_entry = self.builder.get_object("organization_entry") self._activation_key_entry = self.builder.get_object("activation_key_entry") # system purpose self._system_purpose_checkbox = self.builder.get_object("system_purpose_checkbox") self._system_purpose_revealer = self.builder.get_object("system_purpose_revealer") self._system_purpose_role_combobox = self.builder.get_object( "system_purpose_role_combobox" ) self._system_purpose_sla_combobox = self.builder.get_object( "system_purpose_sla_combobox" ) self._system_purpose_usage_combobox = self.builder.get_object( "system_purpose_usage_combobox" ) # insights self._insights_checkbox = self.builder.get_object("insights_checkbox") # options expander self._options_expander = self.builder.get_object("options_expander") # HTTP proxy self._http_proxy_checkbox = self.builder.get_object("http_proxy_checkbox") self._http_proxy_revealer = self.builder.get_object("http_proxy_revealer") self._http_proxy_location_entry = self.builder.get_object("http_proxy_location_entry") self._http_proxy_username_entry = self.builder.get_object("http_proxy_username_entry") self._http_proxy_password_entry = self.builder.get_object("http_proxy_password_entry") # RHSM baseurl self._custom_rhsm_baseurl_checkbox = self.builder.get_object( "custom_rhsm_baseurl_checkbox" ) self._custom_rhsm_baseurl_revealer = self.builder.get_object( "custom_rhsm_baseurl_revealer" ) self._custom_rhsm_baseurl_entry = self.builder.get_object( "custom_rhsm_baseurl_entry" ) # server hostname self._custom_server_hostname_checkbox = self.builder.get_object( "custom_server_hostname_checkbox" ) self._custom_server_hostname_revealer = self.builder.get_object( "custom_server_hostname_revealer" ) self._custom_server_hostname_entry = self.builder.get_object( "custom_server_hostname_entry" ) # status label self._registration_status_label = self.builder.get_object("registration_status_label") # register button self._register_button = self.builder.get_object("register_button") # * the subscription status tab * # # general status self._method_status_label = self.builder.get_object("method_status_label") self._role_status_label = self.builder.get_object("role_status_label") self._sla_status_label = self.builder.get_object("sla_status_label") self._usage_status_label = self.builder.get_object("usage_status_label") self._insights_status_label = self.builder.get_object("insights_status_label") # attached subscriptions self._attached_subscriptions_label = self.builder.get_object( "attached_subscriptions_label" ) self._subscriptions_listbox = self.builder.get_object("subscriptions_listbox") # unregister button self._unregister_revealer = self.builder.get_object("unregister_revealer") self._unregister_button = self.builder.get_object("unregister_button") # setup spoke state based on data from the Subscription DBus module self._update_spoke_state() # start the rest of spoke initialization which might take some time # (mainly due to waiting for various initialization threads to finish) # in a separate thread threadMgr.add(AnacondaThread(name=THREAD_SUBSCRIPTION_SPOKE_INIT, target=self._initialize))
text_mode=anaconda.tui_mode) # Initialize the network now, in case the display needs it from pyanaconda.network import initialize_network, wait_for_connecting_NM_thread, wait_for_connected_NM initialize_network() # If required by user, wait for connection before starting the installation. if opts.waitfornet: log.info( "network: waiting for connectivity requested by inst.waitfornet=%d", opts.waitfornet) wait_for_connected_NM(timeout=opts.waitfornet) # In any case do some actions only after NM finishes its connecting. threadMgr.add( AnacondaThread(name=constants.THREAD_WAIT_FOR_CONNECTING_NM, target=wait_for_connecting_NM_thread)) # now start the interface display.setup_display(anaconda, opts) if anaconda.gui_startup_failed: # we need to reinitialize the locale if GUI startup failed, # as we might now be in text mode, which might not be able to display # the characters from our current locale log.warning( "reinitializing locale due to failed attempt to start the GUI") localization.setup_locale(os.environ["LANG"], localization_proxy, text_mode=anaconda.tui_mode) # we now know in which mode we are going to run so store the information from pykickstart import constants as pykickstart_constants
# Initialize the network now, in case the display needs it from pyanaconda.network import networkInitialize, wait_for_connecting_NM_thread, wait_for_connected_NM networkInitialize(ksdata) # If required by user, wait for connection before starting the installation. if opts.waitfornet: log.info( "network: waiting for connectivity requested by inst.waitfornet=%d", opts.waitfornet) wait_for_connected_NM(timeout=opts.waitfornet) # In any case do some actions only after NM finishes its connecting. threadMgr.add( AnacondaThread(name=constants.THREAD_WAIT_FOR_CONNECTING_NM, target=wait_for_connecting_NM_thread, args=(ksdata, ))) # initialize the screen access manager before launching the UI from pyanaconda import screen_access screen_access.initSAM() # try to open any existing config file # (might be created by pre-anaconda helper tools, injected during image # generation, etc.) screen_access.sam.open_config_file() # now start the interface display.setup_display(anaconda, opts, addon_paths=addon_paths) if anaconda.gui_startup_failed: # we need to reinitialize the locale if GUI startup failed, # as we might now be in text mode, which might not be able to display
def initialize(self): NormalSpoke.initialize(self) self.initialize_start() self._daysStore = self.builder.get_object("days") self._monthsStore = self.builder.get_object("months") self._yearsStore = self.builder.get_object("years") self._regionsStore = self.builder.get_object("regions") self._citiesStore = self.builder.get_object("cities") self._tzmap = self.builder.get_object("tzmap") self._dateBox = self.builder.get_object("dateBox") # we need to know it the new value is the same as previous or not self._old_region = None self._old_city = None self._regionCombo = self.builder.get_object("regionCombobox") self._cityCombo = self.builder.get_object("cityCombobox") self._daysFilter = self.builder.get_object("daysFilter") self._daysFilter.set_visible_func(self.existing_date, None) self._citiesFilter = self.builder.get_object("citiesFilter") self._citiesFilter.set_visible_func(self.city_in_region, None) self._hoursLabel = self.builder.get_object("hoursLabel") self._minutesLabel = self.builder.get_object("minutesLabel") self._amPmUp = self.builder.get_object("amPmUpButton") self._amPmDown = self.builder.get_object("amPmDownButton") self._amPmLabel = self.builder.get_object("amPmLabel") self._radioButton24h = self.builder.get_object("timeFormatRB") self._amPmRevealer = self.builder.get_object("amPmRevealer") # Set the entry completions. # The text_column property needs to be set here. If we set # it in the glade file, the completion doesn't show text. region_completion = self.builder.get_object("regionCompletion") region_completion.set_text_column(0) city_completion = self.builder.get_object("cityCompletion") city_completion.set_text_column(0) # create widgets for displaying/configuring date day_box, self._dayCombo, day_label = _new_date_field_box(self._daysFilter) self._dayCombo.connect("changed", self.on_day_changed) month_box, self._monthCombo, month_label = _new_date_field_box(self._monthsStore) self._monthCombo.connect("changed", self.on_month_changed) year_box, self._yearCombo, year_label = _new_date_field_box(self._yearsStore) self._yearCombo.connect("changed", self.on_year_changed) # get the right order for date widgets and respective formats and put # widgets in place widgets, formats = resolve_date_format(year_box, month_box, day_box) for widget in widgets: self._dateBox.pack_start(widget, False, False, 0) self._day_format, suffix = formats[widgets.index(day_box)] day_label.set_text(suffix) self._month_format, suffix = formats[widgets.index(month_box)] month_label.set_text(suffix) self._year_format, suffix = formats[widgets.index(year_box)] year_label.set_text(suffix) self._ntpSwitch = self.builder.get_object("networkTimeSwitch") self._regions_zones = get_all_regions_and_timezones() # Set the initial sensitivity of the AM/PM toggle based on the time-type selected self._radioButton24h.emit("toggled") if not flags.can_touch_runtime_system("modify system time and date"): self._set_date_time_setting_sensitive(False) self._config_dialog = NTPconfigDialog(self.data, self._timezone_module) self._config_dialog.initialize() threadMgr.add(AnacondaThread(name=constants.THREAD_DATE_TIME, target=self._initialize))
def initialize(self): super().initialize() self.initialize_start() # set X keyboard defaults # - this needs to be done early in spoke initialization so that # the spoke status does not show outdated keyboard selection keyboard.set_x_keyboard_defaults(self._l12_module.proxy, self._xkl_wrapper) # make sure the x_layouts list has at least one keyboard layout if not self._l12_module.proxy.XLayouts: self._l12_module.proxy.SetXLayouts([DEFAULT_KEYBOARD]) self._add_dialog = AddLayoutDialog(self.data) self._add_dialog.initialize() if flags.can_touch_runtime_system( "hide runtime keyboard configuration " "warning", touch_live=True): self.builder.get_object("warningBox").hide() # We want to store layouts' names but show layouts as # 'language (description)'. layoutColumn = self.builder.get_object("layoutColumn") layoutRenderer = self.builder.get_object("layoutRenderer") override_cell_property(layoutColumn, layoutRenderer, "text", _show_layout, self._xkl_wrapper) self._store = self.builder.get_object("addedLayoutStore") self._add_data_layouts() self._selection = self.builder.get_object("layoutSelection") self._switching_dialog = ConfigureSwitchingDialog( self.data, self._l12_module) self._switching_dialog.initialize() self._layoutSwitchLabel = self.builder.get_object("layoutSwitchLabel") if not flags.can_touch_runtime_system("test X layouts", touch_live=True): # Disable area for testing layouts as we cannot make # it work without modifying runtime system widgets = [ self.builder.get_object("testingLabel"), self.builder.get_object("testingWindow"), self.builder.get_object("layoutSwitchLabel") ] # Use testingLabel's text to explain why this part is not # sensitive. widgets[0].set_text( _("Testing layouts configuration not " "available.")) for widget in widgets: widget.set_sensitive(False) hubQ.send_not_ready(self.__class__.__name__) hubQ.send_message(self.__class__.__name__, _("Getting list of layouts...")) threadMgr.add( AnacondaThread(name=THREAD_KEYBOARD_INIT, target=self._wait_ready))
def execute(self): """Execute the changes.""" threadMgr.add( AnacondaThread(name=THREAD_CHECK_SOFTWARE, target=self._check_software_selection))
startup_utils.initialize_locale(opts, text_mode=anaconda.tui_mode) # Initialize the network now, in case the display needs it from pyanaconda.network import initialize_network, wait_for_connecting_NM_thread, wait_for_connected_NM initialize_network() # If required by user, wait for connection before starting the installation. if opts.waitfornet: log.info( "network: waiting for connectivity requested by inst.waitfornet=%d", opts.waitfornet) wait_for_connected_NM(timeout=opts.waitfornet) # In any case do some actions only after NM finishes its connecting. threadMgr.add( AnacondaThread(name=constants.THREAD_WAIT_FOR_CONNECTING_NM, target=wait_for_connecting_NM_thread)) # now start the interface display.setup_display(anaconda, opts) if anaconda.gui_startup_failed: # we need to reinitialize the locale if GUI startup failed, # as we might now be in text mode, which might not be able to display # the characters from our current locale startup_utils.reinitialize_locale(opts, text_mode=anaconda.tui_mode) # we now know in which mode we are going to run so store the information from pykickstart import constants as pykickstart_constants display_mode_coversion_table = { constants.DisplayModes.GUI: pykickstart_constants.DISPLAY_MODE_GRAPHICAL, constants.DisplayModes.TUI: pykickstart_constants.DISPLAY_MODE_TEXT
def gtk_batch_map(action, items, args=(), pre_func=None, batch_size=1): """ Function that maps an action on items in a way that makes the action run in the main thread, but without blocking the main thread for a noticeable time. If a pre-processing function is given it is mapped on the items first before the action happens in the main thread. .. DANGER:: MUST NOT BE CALLED NOR WAITED FOR FROM THE MAIN THREAD. :param action: any action that has to be done on the items in the main thread :type action: (action_item, \\*args) -> None :param items: an iterable of items that the action should be mapped on :type items: iterable :param args: additional arguments passed to the action function :type args: tuple :param pre_func: a function that is mapped on the items before they are passed to the action function :type pre_func: item -> action_item :param batch_size: how many items should be processed in one run in the main loop :raise AssertionError: if called from the main thread :return: None """ assert (not threadMgr.in_main_thread()) def preprocess(queue_instance): if pre_func: for item in items: queue_instance.put(pre_func(item)) else: for item in items: queue_instance.put(item) queue_instance.put(TERMINATOR) def process_one_batch(arguments): (queue_instance, action, done_event) = arguments tstamp_start = time.time() tstamp = time.time() # process as many batches as user shouldn't notice while tstamp - tstamp_start < NOTICEABLE_FREEZE: for _i in range(batch_size): try: action_item = queue_instance.get_nowait() if action_item is TERMINATOR: # all items processed, tell we are finished and return done_event.set() return False else: # run action on the item action(action_item, *args) except queue.Empty: # empty queue_instance, reschedule to run later return True tstamp = time.time() # out of time but something left, reschedule to run again later return True item_queue_instance = queue.Queue() done_event = threading.Event() # we don't want to log the whole list, type and address is enough log.debug("Starting applying %s on %s", action, object.__repr__(items)) # start a thread putting preprocessed items into the queue_instance threadMgr.add( AnacondaThread(prefix="AnaGtkBatchPre", target=preprocess, args=(item_queue_instance, ))) run_in_loop(process_one_batch, (item_queue_instance, action, done_event)) done_event.wait() log.debug("Finished applying %s on %s", action, object.__repr__(items))
def execute(self): """Execute the changes.""" threadMgr.add( AnacondaThread(name=constants.THREAD_CHECK_SOFTWARE, target=self.checkSoftwareSelection))
enable_installer_mode() # Initialize the network now, in case the display needs it from pyanaconda.network import initialize_network, wait_for_connecting_NM_thread, wait_for_connected_NM initialize_network() # If required by user, wait for connection before starting the installation. if opts.waitfornet: log.info( "network: waiting for connectivity requested by inst.waitfornet=%d", opts.waitfornet) wait_for_connected_NM(timeout=opts.waitfornet) # In any case do some actions only after NM finishes its connecting. threadMgr.add( AnacondaThread(name=constants.THREAD_WAIT_FOR_CONNECTING_NM, target=wait_for_connecting_NM_thread)) # now start the interface display.setup_display(anaconda, opts) if anaconda.gui_startup_failed: # we need to reinitialize the locale if GUI startup failed, # as we might now be in text mode, which might not be able to display # the characters from our current locale log.warning( "reinitializing locale due to failed attempt to start the GUI") localization.setup_locale(os.environ["LANG"], localization_proxy, text_mode=anaconda.tui_mode) # we now know in which mode we are going to run so store the information from pykickstart import constants as pykickstart_constants
def initialize(self): super().initialize() self.initialize_start() threadMgr.add( AnacondaThread(name=constants.THREAD_SOFTWARE_WATCHER, target=self._initialize))