def on_addon_activated(self, listbox, row): box = row.get_children()[0] if isinstance(box, Gtk.Separator): return # GUI selections means that packages are no longer coming from kickstart self._kickstarted = False button = box.get_children()[0] addons = self._allAddons() group = addons[row.get_index()] wasActive = group in self.selectedGroups with blockedHandler(button, self.on_checkbox_toggled): button.set_active(not wasActive) if wasActive: self.selectedGroups.remove(group) self._addonStates[group] = self._ADDON_DESELECTED else: self.selectedGroups.append(group) if group in self.excludedGroups: self.excludedGroups.remove(group) self._addonStates[group] = self._ADDON_SELECTED
def toggle_button(self, active): """Toggle the row button.""" box = self.get_children()[0] button = box.get_children()[0] with blockedHandler(button, self._on_button_toggled): button.set_active(active)
def full_name_changed(self, editable, data=None): """Called by Gtk callback when the full name field changes.""" if self.guesser: fullname = editable.get_text() username = guess_username(fullname) with blockedHandler(self.username, self.on_username_set_by_user): self.username.set_text(username)
def _select_addon_at_row(self, row, is_selected): # GUI selections means that packages are no longer coming from kickstart. self._kickstarted = False # Activate the row. with blockedHandler(row.get_parent(), self.on_addon_activated): row.activate() # Activate the button. box = row.get_children()[0] button = box.get_children()[0] with blockedHandler(button, self.on_checkbox_toggled): button.set_active(is_selected) # Mark the selection. addons = self._all_addons() group = addons[row.get_index()] self._mark_addon_selection(group, is_selected)
def _select_addon_at_row(self, row, is_selected): # GUI selections means that packages are no longer coming from kickstart. self._kickstarted = False # Activate the row. with blockedHandler(row.get_parent(), self.on_addon_activated): row.activate() # Activate the button. box = row.get_children()[0] button = box.get_children()[0] with blockedHandler(button, self.on_checkbox_toggled): button.set_active(is_selected) # Mark the selection. addons = self._allAddons() group = addons[row.get_index()] self._mark_addon_selection(group, is_selected)
def _setup_slider(self, min_size, max_size, default_size): """Set up the slider for the given device. Set up the slider for this device, pulling out any previously given shrink value as the default. This also sets up the ticks on the slider and keyboard support. Any devices that are not resizable will not have a slider displayed, so they do not need to be worried with here. :param min_size: min value to set :type min_size: Size :param max_size: max value to set :type max_size: Size :param default_size: default value to set :type default_size: Size """ # Turn off wrapping of the displayed values. # If the values are not being displayed (get_layout() return None) # we don't need to turn off the wrapping as nothing will be displayed. layout = self._resize_slider.get_layout() if layout is not None: layout.set_width(-1) # Convert the Sizes to ints min_size = int(min_size) max_size = int(max_size) default_value = int(default_size) # The slider needs to be keyboard-accessible. We'll make small movements change in # 1% increments, and large movements in 5% increments. distance = max_size - min_size one_percent = int(distance / 100) five_percent = int(distance / 20) twenty_percent = int(distance / 5) with blockedHandler(self._resize_slider, self.on_resize_value_changed): self._resize_slider.set_range(min_size, max_size) self._resize_slider.set_value(default_value) adjustment = self.builder.get_object("resizeAdjustment") adjustment.configure(default_value, min_size, max_size, one_percent, five_percent, 0) # And then the slider needs a couple tick marks for easier navigation. self._resize_slider.clear_marks() for i in range(1, 5): self._resize_slider.add_mark(min_size + i * twenty_percent, Gtk.PositionType.BOTTOM, None) # Finally, add tick marks for the ends. self._resize_slider.add_mark(min_size, Gtk.PositionType.BOTTOM, str(Size(min_size))) self._resize_slider.add_mark(max_size, Gtk.PositionType.BOTTOM, str(Size(max_size)))
def on_full_name_changed(self, editable, data=None): """Called by Gtk callback when the full name field changes.""" fullname = editable.get_text() if self.guesser: username = guess_username(fullname) with blockedHandler(self.username_entry, self.on_username_set_by_user): self.username = username self.checker.fullname = fullname # rerun the checks self.checker.run_checks()
def on_location_changed(self, tz_map, location): if not location: return timezone = location.get_property('zone') # Updating the timezone will update the region/city combo boxes to match. # The on_city_changed handler will attempt to convert the timezone back # to a location and set it in the map, which we don't want, since we # already have a location. That's why we're here. with blockedHandler(self._cityCombo, self.on_city_changed): if self._set_timezone(timezone): # timezone successfully set self._tz = get_timezone(timezone) self._update_datetime()
def _setup_slider(self, device, value): """Set up the slider for the given device. Set up the slider for this device, pulling out any previously given shrink value as the default. This also sets up the ticks on the slider and keyboard support. Any devices that are not resizable will not have a slider displayed, so they do not need to be worried with here. :param device: The device :type device: PartitionDevice :param value: default value to set :type value: Size """ # Convert the Sizes to ints min_size = int(device.min_size) size = int(device.size) default_value = int(value) # The slider needs to be keyboard-accessible. We'll make small movements change in # 1% increments, and large movements in 5% increments. distance = size - min_size one_percent = int(distance / 100) five_percent = int(distance / 20) twenty_percent = int(distance / 5) with blockedHandler(self._resize_slider, self.on_resize_value_changed): self._resize_slider.set_range(min_size, size) self._resize_slider.set_value(default_value) adjustment = self.builder.get_object("resizeAdjustment") adjustment.configure(default_value, min_size, size, one_percent, five_percent, 0) # And then the slider needs a couple tick marks for easier navigation. self._resize_slider.clear_marks() for i in range(1, 5): self._resize_slider.add_mark(min_size + i * twenty_percent, Gtk.PositionType.BOTTOM, None) # Finally, add tick marks for the ends. self._resize_slider.add_mark(min_size, Gtk.PositionType.BOTTOM, str(device.min_size)) self._resize_slider.add_mark(size, Gtk.PositionType.BOTTOM, str(device.size))
def on_environment_activated(self, listbox, row): if not self._select_flag: return # GUI selections means that packages are no longer coming from kickstart self._kickstarted = False box = row.get_children()[0] button = box.get_children()[0] with blockedHandler(button, self.on_radio_button_toggled): button.set_active(True) # Mark the clicked environment as selected and update the screen. self._selection.environment = self.payload.environments[row.get_index()] self.refresh_addons() self._addon_list_box.show_all()
def on_environment_activated(self, listbox, row): if not self._selectFlag: return # GUI selections means that packages are no longer coming from kickstart self._kickstarted = False box = row.get_children()[0] button = box.get_children()[0] with blockedHandler(button, self.on_radio_button_toggled): button.set_active(True) # Mark the clicked environment as selected and update the screen. self.environment = self.payload.environments[row.get_index()] self.refreshAddons() self._addonListBox.show_all()
def on_environment_activated(self, listbox, row): if not self._selectFlag: return box = row.get_children()[0] button = box.get_children()[0] with blockedHandler(button, self.on_radio_button_toggled): button.set_active(True) # Remove all the groups that were selected by the previously # selected environment. if self.environment: for groupid in self.payload.environmentGroups(self.environment): if groupid in self.selectedGroups: self.selectedGroups.remove(groupid) # Then mark the clicked environment as selected and update the screen. self.environment = self.payload.environments[row.get_index()] self.refreshAddons() self._addonListBox.show_all()
def _setup_slider(self, device, value): """Set up the slider for this device, pulling out any previously given shrink value as the default. This also sets up the ticks on the slider and keyboard support. Any devices that are not resizable will not have a slider displayed, so they do not need to be worried with here. :param device: The device :type device: PartitionDevice :param value: default value to set :type value: Size """ # Convert the Sizes to ints minSize = int(device.min_size) size = int(device.size) default_value = int(value) # The slider needs to be keyboard-accessible. We'll make small movements change in # 1% increments, and large movements in 5% increments. distance = size - minSize onePercent = int(distance / 100) fivePercent = int(distance / 20) twentyPercent = int(distance / 5) with blockedHandler(self._resizeSlider, self.on_resize_value_changed): self._resizeSlider.set_range(minSize, size) self._resizeSlider.set_value(default_value) adjustment = self.builder.get_object("resizeAdjustment") adjustment.configure(default_value, minSize, size, onePercent, fivePercent, 0) # And then the slider needs a couple tick marks for easier navigation. self._resizeSlider.clear_marks() for i in range(1, 5): self._resizeSlider.add_mark(minSize + i * twentyPercent, Gtk.PositionType.BOTTOM, None) # Finally, add tick marks for the ends. self._resizeSlider.add_mark(minSize, Gtk.PositionType.BOTTOM, str(device.min_size)) self._resizeSlider.add_mark(size, Gtk.PositionType.BOTTOM, str(device.size))