--- pyanaconda/ui/gui/spokes/custom.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/pyanaconda/ui/gui/spokes/custom.py b/pyanaconda/ui/gui/spokes/custom.py index 8f38eb4..6b3a4e4 100644 --- a/pyanaconda/ui/gui/spokes/custom.py +++ b/pyanaconda/ui/gui/spokes/custom.py @@ -206,7 +206,8 @@ def validate_mountpoint(mountpoint, used_mountpoints, strict=True): valid = MOUNTPOINT_IN_USE elif not mountpoint: valid = MOUNTPOINT_EMPTY - elif mountpoint.startswith("/dev"): + elif mountpoint.startswith("/dev") or mountpoint.startswith("/proc") or \ + mountpoint.startswith("/sys"): valid = MOUNTPOINT_INVALID elif (mountpoint.lower() not in fake_mountpoints and ((len(mountpoint) > 1 and mountpoint.endswith("/")) or
This seems to be what more people want, and it's certainly far more simple. --- pyanaconda/ui/gui/spokes/custom.glade | 559 ++++++---------------------------- pyanaconda/ui/gui/spokes/custom.py | 208 +++---------- 2 files changed, 146 insertions(+), 621 deletions(-)
diff --git a/pyanaconda/ui/gui/spokes/custom.glade b/pyanaconda/ui/gui/spokes/custom.glade index 39c0906..8d79f44 100644 --- a/pyanaconda/ui/gui/spokes/custom.glade +++ b/pyanaconda/ui/gui/spokes/custom.glade @@ -805,469 +805,8 @@ use. Try something else?</property> </packing> </child> <child> - <object class="GtkNotebook" id="optionsNotebook"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="no_show_all">True</property> - <property name="show_tabs">False</property> - <child> - <object class="GtkGrid" id="lvmGrid"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="column_spacing">12</property> - <child> - <object class="GtkBox" id="box8"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <child> - <object class="GtkCheckButton" id="lvmRedundancyCheckbox"> - <property name="label" translatable="yes">Redundancy (_mirror)</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="use_underline">True</property> - <property name="xalign">0</property> - <property name="draw_indicator">True</property> - <signal name="toggled" handler="on_raid_feature_toggled" swapped="no"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="lvmRedundancyLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="ypad">2</property> - <property name="label" translatable="yes">(-0Gb)</property> - <attributes> - <attribute name="foreground" value="#ffff00000000"/> - </attributes> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="GtkBox" id="box9"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <child> - <object class="GtkCheckButton" id="lvmPerformanceCheckbox"> - <property name="label" translatable="yes">Optimi_zed performance (stripe)</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="use_underline">True</property> - <property name="xalign">0</property> - <property name="draw_indicator">True</property> - <signal name="toggled" handler="on_raid_feature_toggled" swapped="no"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="lvmPerformanceLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">(-0Gb)</property> - <attributes> - <attribute name="foreground" value="#ffff00000000"/> - </attributes> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - </object> - </child> - <child type="tab"> - <placeholder/> - </child> - <child> - <object class="GtkGrid" id="raidGrid"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="column_spacing">12</property> - <child> - <object class="GtkBox" id="box12"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <child> - <object class="GtkCheckButton" id="raidRedundancyCheckbox"> - <property name="label" translatable="yes">Redundancy (_mirror)</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="use_underline">True</property> - <property name="xalign">0</property> - <property name="draw_indicator">True</property> - <signal name="toggled" handler="on_raid_feature_toggled" swapped="no"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="raidRedundancyLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="ypad">2</property> - <property name="label" translatable="yes">(-0Gb)</property> - <attributes> - <attribute name="foreground" value="#ffff00000000"/> - </attributes> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="GtkBox" id="box13"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <child> - <object class="GtkCheckButton" id="raidPerformanceCheckbox"> - <property name="label" translatable="yes">Optimi_zed performance (stripe)</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="use_underline">True</property> - <property name="xalign">0</property> - <property name="draw_indicator">True</property> - <signal name="toggled" handler="on_raid_feature_toggled" swapped="no"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="raidPerformanceLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">(-0Gb)</property> - <attributes> - <attribute name="foreground" value="#ffff00000000"/> - </attributes> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="GtkBox" id="box14"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <child> - <object class="GtkCheckButton" id="raidErrorCheckbox"> - <property name="label" translatable="yes">Error detection (_parity)</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="use_underline">True</property> - <property name="xalign">0</property> - <property name="draw_indicator">True</property> - <signal name="toggled" handler="on_raid_feature_toggled" swapped="no"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="raidErrorLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">(-0Gb)</property> - <attributes> - <attribute name="foreground" value="#ffff00000000"/> - </attributes> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">2</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="GtkBox" id="box15"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="margin_left">12</property> - <child> - <object class="GtkCheckButton" id="raidDistErrorCheckbox"> - <property name="label" translatable="yes">D_istributed</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="use_underline">True</property> - <property name="xalign">0</property> - <property name="draw_indicator">True</property> - <signal name="toggled" handler="on_raid_feature_toggled" swapped="no"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="raidDistErrorLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">(-0Gb)</property> - <attributes> - <attribute name="foreground" value="#ffff00000000"/> - </attributes> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkCheckButton" id="raidRedundantErrorCheckbox"> - <property name="label" translatable="yes">Red_undant</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="margin_left">6</property> - <property name="use_underline">True</property> - <property name="xalign">0</property> - <property name="draw_indicator">True</property> - <signal name="toggled" handler="on_raid_feature_toggled" swapped="no"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">2</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="raidRedundantErrorLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">(-0Gb)</property> - <attributes> - <attribute name="foreground" value="#ffff00000000"/> - </attributes> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">3</property> - </packing> - </child> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">3</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="raidLevelLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="xalign">0</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">2</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - </object> - <packing> - <property name="position">1</property> - </packing> - </child> - <child type="tab"> - <placeholder/> - </child> - <child> - <object class="GtkGrid" id="btrfsGrid"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="column_spacing">12</property> - <child> - <object class="GtkBox" id="box3"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <child> - <object class="GtkCheckButton" id="btrfsRedundancyCheckbox"> - <property name="label" translatable="yes">Redundancy (_mirror)</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="use_underline">True</property> - <property name="xalign">0</property> - <property name="draw_indicator">True</property> - <signal name="toggled" handler="on_raid_feature_toggled" swapped="no"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="btrfsRedundancyLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="ypad">2</property> - <property name="label" translatable="yes">(-0Gb)</property> - <attributes> - <attribute name="foreground" value="#ffff00000000"/> - </attributes> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="GtkBox" id="box4"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <child> - <object class="GtkCheckButton" id="btrfsPerformanceCheckbox"> - <property name="label" translatable="yes">Optimi_zed performance (stripe)</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="use_underline">True</property> - <property name="xalign">0</property> - <property name="draw_indicator">True</property> - <signal name="toggled" handler="on_raid_feature_toggled" swapped="no"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="btrfsPerformanceLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">(-0Gb)</property> - <attributes> - <attribute name="foreground" value="#ffff00000000"/> - </attributes> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - </object> - <packing> - <property name="position">2</property> - </packing> - </child> - <child type="tab"> - <placeholder/> - </child> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">3</property> - <property name="width">3</property> - <property name="height">1</property> - </packing> - </child> - <child> <object class="GtkCheckButton" id="reformatCheckbox"> - <property name="label" translatable="yes">_Reformat</property> + <property name="label" translatable="yes">Refor_mat</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property> @@ -1287,6 +826,7 @@ use. Try something else?</property> <object class="GtkLabel" id="volumeGroupLabel"> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="xalign">0</property> <property name="label" translatable="yes">_Volume Group:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">volumeGroupCombo</property> @@ -1318,7 +858,7 @@ use. Try something else?</property> </child> <child> <object class="GtkButton" id="modifyVGButton"> - <property name="label" translatable="yes">Modif_y...</property> + <property name="label" translatable="yes">_Modify...</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> @@ -1332,6 +872,46 @@ use. Try something else?</property> <property name="height">1</property> </packing> </child> + <child> + <object class="GtkLabel" id="raidLevelLabel"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">_RAID Level:</property> + <property name="use_underline">True</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">3</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <placeholder/> + </child> + <child> + <object class="GtkComboBox" id="raidLevelCombo"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="model">raidStoreFiltered</property> + <child> + <object class="GtkCellRendererText" id="raidLevelRenderer"/> + <attributes> + <attribute name="markup">0</attribute> + </attributes> + </child> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">3</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> </object> </child> <child type="label"> @@ -2411,4 +1991,57 @@ use. Try something else?</property> <property name="step_increment">1</property> <property name="page_increment">10</property> </object> + <object class="GtkListStore" id="raidLevelStore"> + <columns> + <!-- column-name raidLevel --> + <column type="gchararray"/> + <!-- column-name vaidForLVM --> + <column type="gboolean"/> + <!-- column-name validForRAID --> + <column type="gboolean"/> + <!-- column-name validForBTRFS --> + <column type="gboolean"/> + </columns> + <data> + <row> + <col id="0" translatable="yes">RAID0 <span foreground="grey">(Performance)</span></col> + <col id="1">True</col> + <col id="2">True</col> + <col id="3">True</col> + </row> + <row> + <col id="0" translatable="yes">RAID1 <span foreground="grey">(Redundancy)</span></col> + <col id="1">True</col> + <col id="2">True</col> + <col id="3">True</col> + </row> + <row> + <col id="0" translatable="yes">RAID4 <span foreground="grey">(Error Checking)</span></col> + <col id="1">False</col> + <col id="2">True</col> + <col id="3">False</col> + </row> + <row> + <col id="0" translatable="yes">RAID5 <span foreground="grey">(Distributed Error Checking)</span></col> + <col id="1">False</col> + <col id="2">True</col> + <col id="3">False</col> + </row> + <row> + <col id="0" translatable="yes">RAID6 <span foreground="grey">(Redundant Error Checking)</span></col> + <col id="1">False</col> + <col id="2">True</col> + <col id="3">False</col> + </row> + <row> + <col id="0" translatable="yes">RAID10 <span foreground="grey">(Performance, Redundancy)</span></col> + <col id="1">False</col> + <col id="2">True</col> + <col id="3">False</col> + </row> + </data> + </object> + <object class="GtkTreeModelFilter" id="raidStoreFiltered"> + <property name="child_model">raidLevelStore</property> + </object> </interface> diff --git a/pyanaconda/ui/gui/spokes/custom.py b/pyanaconda/ui/gui/spokes/custom.py index 6b3a4e4..be0f179 100644 --- a/pyanaconda/ui/gui/spokes/custom.py +++ b/pyanaconda/ui/gui/spokes/custom.py @@ -128,39 +128,6 @@ device_text_map = {DEVICE_TYPE_LVM: DEVICE_TEXT_LVM, DEVICE_TYPE_PARTITION: DEVICE_TEXT_PARTITION, DEVICE_TYPE_BTRFS: DEVICE_TEXT_BTRFS}
-options_page_dict = {DEVICE_TYPE_LVM: 0, - DEVICE_TYPE_MD: 1, - DEVICE_TYPE_BTRFS: 2} - -# raid feature names. These are the basis for some UI widget names. -raid_features = ["Performance", "Redundancy", "Error", "DistError", - "RedundantError"] - -# feature names by raid level -raid_level_features = {"raid0": ["Performance"], - "raid1": ["Redundancy"], - "raid10": ["Performance", "Redundancy"], - "raid4": ["Performance", "Error"], - "raid5": ["Performance", "DistError"], - "raid6": ["Performance", "RedundantError"], - "single": []} - -# disabled features by raid_level -raid_disabled_features = {"raid1": ["Error", "DistError", "RedundantError"], - "raid10": ["Error", "DistError", "RedundantError"], - "raid4": ["Performance", "Redundancy", "DistError", "RedundantError"], - "raid5": ["Performance", "Redundancy", "Error", "RedundantError"], - "raid6": ["Performance", "Redundancy", "Error", "DistError"], - None: ["Error", "DistError", "RedundantError"], -} - -# reference raid level by feature name -feature_raid_levels = {"Performance": "raid0", - "Redundancy": "raid1", - "Error": "raid4", - "DistError": "raid5", - "RedundantError": "raid6"} - partition_only_format_types = ["efi", "hfs+", "prepboot", "biosboot", "appleboot"]
@@ -449,7 +416,7 @@ class HelpDialog(GUIObject):
class CustomPartitioningSpoke(NormalSpoke, StorageChecker): builderObjects = ["customStorageWindow", "sizeAdjustment", - "partitionStore", + "partitionStore", "raidStoreFiltered", "raidLevelStore", "addImage", "removeImage", "settingsImage"] mainWidgetName = "customStorageWindow" uiFile = "spokes/custom.glade" @@ -523,8 +490,6 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker): self._partitionsViewport = self.builder.get_object("partitionsViewport") self._partitionsNotebook = self.builder.get_object("partitionsNotebook")
- self._optionsNotebook = self.builder.get_object("optionsNotebook") - self._addButton = self.builder.get_object("addButton") self._removeButton = self.builder.get_object("removeButton") self._configButton = self.builder.get_object("configureButton") @@ -541,12 +506,8 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker): setViewportBackground(self.builder.get_object("availableSpaceViewport"), "#db3279") setViewportBackground(self.builder.get_object("totalSpaceViewport"), "#60605b")
- # Set the background of the options notebook to slightly darker than - # everything else, and give it a border. - provider = Gtk.CssProvider() - provider.load_from_data("GtkNotebook { background-color: shade(@theme_bg_color, 0.95); border-width: 1px; border-style: solid; border-color: @borders; }") - context = self._optionsNotebook.get_style_context() - context.add_provider(provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION) + raidStoreFilter = self.builder.get_object("raidStoreFiltered") + raidStoreFilter.set_visible_func(self._raid_level_visible)
self._accordion = Accordion() self._partitionsViewport.add(self._accordion) @@ -1361,113 +1322,67 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker): # from other pages since we haven't altered the filesystem self.add_new_selector(device)
- def _get_raid_widget_dict(self, device_type): - """ Return dict of widget tuples with feature keys for device_type. """ - if device_type == DEVICE_TYPE_MD: - prefix = "raid" + def _raid_level_visible(self, model, itr, user_data): + device_type = self._get_current_device_type() + if device_type == DEVICE_TYPE_LVM: + return model[itr][1] + elif device_type == DEVICE_TYPE_MD: + return model[itr][2] elif device_type == DEVICE_TYPE_BTRFS: - prefix = "btrfs" - elif device_type == DEVICE_TYPE_LVM: - prefix = "lvm" - else: - return {} - - widget_dict = {} - for feature in raid_features: - button = self.builder.get_object("%s%sCheckbox" % (prefix, feature)) - label = self.builder.get_object("%s%sLabel" % (prefix, feature)) - if button and label: - widget_dict[feature] = (button, label) - - return widget_dict + return model[itr][3]
def _get_raid_level(self): - """ Return the raid level string based on the current ui selections. """ - device_type = self._get_current_device_type() - widget_dict = self._get_raid_widget_dict(device_type) - if not widget_dict: - return None - - active = [] - for feature in raid_features: - if feature not in widget_dict: - continue - - (button, label) = widget_dict[feature] - if button.get_active(): - active.append(feature) - - raid_level = None - for (level, feature_set) in raid_level_features.items(): - if set(active) == set(feature_set): - raid_level = level - break - - if raid_level is None: - # this is okay for lvm or btrfs but not for md until we add linear - log.error("UI: failed to get raid level (%s)" % active) + combo = self.builder.get_object("raidLevelCombo") + itr = combo.get_active_iter() + store = combo.get_model()
- return raid_level - - def on_raid_feature_toggled(self, widget): - new_state = widget.get_active() - log.debug("widget %s new state: %s" % (widget, new_state)) - - raid_level = self._get_raid_level() - - # now that we've established a raid level, update disabled features - self._update_disabled_raid_features(raid_level) - - def _get_raid_disabled_features(self, raid_level): - """ Return a list of disabled features based on raid level. """ - disabled = raid_disabled_features.get(raid_level, []) - disk_count = len(self._device_disks) - # go through each feature's reference raid level, filtering any that - # require more disks than we have available - for feature in raid_features: - # XXX we're using the mdraid rules for min members - level = mdraid.raidLevel(feature_raid_levels[feature]) - min_disks = mdraid.get_raid_min_members(level) - if min_disks > disk_count and feature not in disabled: - disabled.append(feature) - - return disabled - - def _update_disabled_raid_features(self, raid_level): - """ Update disabled feature widgets based on raid level. """ - device_type = self._get_current_device_type() - widget_dict = self._get_raid_widget_dict(device_type) - disabled = self._get_raid_disabled_features(raid_level) - for feature in raid_features: - if feature not in widget_dict: - continue + if not itr: + return
- (button, label) = widget_dict[feature] - button.set_sensitive(feature not in disabled) + return store[itr][0].split()[0].lower()
def _populate_raid(self, raid_level, size): """ Set up the raid-specific portion of the device details. """ device_type = self._get_current_device_type() log.debug("populate_raid: %s, %s" % (device_type, raid_level))
+ raid_label = self.builder.get_object("raidLevelLabel") + raid_combo = self.builder.get_object("raidLevelCombo") + if device_type == DEVICE_TYPE_MD: base_level = "raid0" # FIXME: should be linear - - level_label = self.builder.get_object("raidLevelLabel") - level_label.set_text(raid_level.upper()) elif device_type == DEVICE_TYPE_BTRFS: base_level = "single" else: + for widget in [raid_label, raid_combo]: + widget.set_no_show_all(True) + widget.hide() + return
+ if not raid_level: + raid_level = base_level + + # Set a default RAID level in the combo. + i = 0 + for row in raid_combo.get_model(): + if row[0].startswith(raid_level.upper()): + raid_combo.set_active(i) + break + + i += 1 + + for widget in [raid_label, raid_combo]: + widget.set_no_show_all(False) + widget.show() + # Create a DeviceFactory to use to calculate the disk space needs for # this device with various raid features enabled. with ui_storage_logger(): factory = self.__storage.getDeviceFactory(device_type, size, disks=self._device_disks, - raid_level=base_level) + raid_level=raid_level)
- widget_dict = self._get_raid_widget_dict(device_type) try: base_size = factory.device_size except MDRaidError as e: @@ -1477,31 +1392,13 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker): self.window.show_all() return
- active = raid_level_features[raid_level] - disabled = self._get_raid_disabled_features(raid_level) - for feature in raid_features: - if feature not in widget_dict: - # this feature isn't supported for this device type - continue - - (button, label) = widget_dict[feature] - - # is this feature enabled for the current raid level? - button.set_active(feature in active) - - # what is the incremental disk space requirement for this feature? - # TODO: update this when the size spinner changes - level = mdraid.raidLevel(feature_raid_levels[feature]) - min_disks = mdraid.get_raid_min_members(level) - if min_disks <= len(factory.disks): - factory.raid_level = feature_raid_levels[feature] - delta = factory.device_size - base_size - label.set_text("+%s" % str(Size(spec="%fmb" % delta)).upper()) - else: - label.set_text(_("(not enough disks)")) - - # some features are not available to some raid levels - button.set_sensitive(feature not in disabled) + # what is the incremental disk space requirement for this feature? + # TODO: update this when the size spinner changes + level = self._get_raid_level() + min_disks = mdraid.get_raid_min_members(level) + if min_disks <= len(factory.disks): + factory.raid_level = level + delta = factory.device_size - base_size
def _get_current_device_type(self): typeCombo = self.builder.get_object("deviceTypeCombo") @@ -1736,7 +1633,6 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
self._populate_raid(raid_level, device.size) self._populate_lvm(device=use_dev) - self.builder.get_object("optionsNotebook").set_sensitive(not device.exists) # do this last in case this was set sensitive in on_device_type_changed if use_dev.exists: nameEntry.set_sensitive(False) @@ -2413,13 +2309,6 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker): include_btrfs = False fs_type_sensitive = True
- # eventually LVM will be handled in the else clause - if new_type in (DEVICE_TYPE_PARTITION, DEVICE_TYPE_LVM, DEVICE_TYPE_DISK): - self._optionsNotebook.hide() - else: - self._optionsNotebook.show() - self._optionsNotebook.set_current_page(options_page_dict[new_type]) - raid_level = None if new_type == DEVICE_TYPE_BTRFS: # add btrfs to the fstype combo and lock it in @@ -2478,6 +2367,9 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker): fs_type_sensitive) # end btrfs magic
+ raidStoreFilter = self.builder.get_object("raidStoreFiltered") + raidStoreFilter.refilter() + def clear_errors(self): self._error = None self.clear_info()
On 01/22/2013 04:31 PM, Chris Lumens wrote:
This seems to be what more people want, and it's certainly far more simple.
pyanaconda/ui/gui/spokes/custom.glade | 559 ++++++---------------------------- pyanaconda/ui/gui/spokes/custom.py | 208 +++---------- 2 files changed, 146 insertions(+), 621 deletions(-)
diff --git a/pyanaconda/ui/gui/spokes/custom.glade b/pyanaconda/ui/gui/spokes/custom.glade index 39c0906..8d79f44 100644 --- a/pyanaconda/ui/gui/spokes/custom.glade +++ b/pyanaconda/ui/gui/spokes/custom.glade @@ -805,469 +805,8 @@ use. Try something else?</property> </packing> </child> <child>
<object class="GtkNotebook" id="optionsNotebook">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="no_show_all">True</property>
<property name="show_tabs">False</property>
<child>
<object class="GtkGrid" id="lvmGrid">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="column_spacing">12</property>
<child>
<object class="GtkBox" id="box8">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkCheckButton" id="lvmRedundancyCheckbox">
<property name="label" translatable="yes">Redundancy (_mirror)</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_raid_feature_toggled" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="lvmRedundancyLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="ypad">2</property>
<property name="label" translatable="yes">(-0Gb)</property>
<attributes>
<attribute name="foreground" value="#ffff00000000"/>
</attributes>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkBox" id="box9">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkCheckButton" id="lvmPerformanceCheckbox">
<property name="label" translatable="yes">Optimi_zed performance (stripe)</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_raid_feature_toggled" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="lvmPerformanceLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">(-0Gb)</property>
<attributes>
<attribute name="foreground" value="#ffff00000000"/>
</attributes>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
</object>
</child>
<child type="tab">
<placeholder/>
</child>
<child>
<object class="GtkGrid" id="raidGrid">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="column_spacing">12</property>
<child>
<object class="GtkBox" id="box12">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkCheckButton" id="raidRedundancyCheckbox">
<property name="label" translatable="yes">Redundancy (_mirror)</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_raid_feature_toggled" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="raidRedundancyLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="ypad">2</property>
<property name="label" translatable="yes">(-0Gb)</property>
<attributes>
<attribute name="foreground" value="#ffff00000000"/>
</attributes>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkBox" id="box13">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkCheckButton" id="raidPerformanceCheckbox">
<property name="label" translatable="yes">Optimi_zed performance (stripe)</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_raid_feature_toggled" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="raidPerformanceLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">(-0Gb)</property>
<attributes>
<attribute name="foreground" value="#ffff00000000"/>
</attributes>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkBox" id="box14">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkCheckButton" id="raidErrorCheckbox">
<property name="label" translatable="yes">Error detection (_parity)</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_raid_feature_toggled" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="raidErrorLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">(-0Gb)</property>
<attributes>
<attribute name="foreground" value="#ffff00000000"/>
</attributes>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkBox" id="box15">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">12</property>
<child>
<object class="GtkCheckButton" id="raidDistErrorCheckbox">
<property name="label" translatable="yes">D_istributed</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_raid_feature_toggled" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="raidDistErrorLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">(-0Gb)</property>
<attributes>
<attribute name="foreground" value="#ffff00000000"/>
</attributes>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="raidRedundantErrorCheckbox">
<property name="label" translatable="yes">Red_undant</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="margin_left">6</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_raid_feature_toggled" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="raidRedundantErrorLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">(-0Gb)</property>
<attributes>
<attribute name="foreground" value="#ffff00000000"/>
</attributes>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">3</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="raidLevelLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">2</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
<child type="tab">
<placeholder/>
</child>
<child>
<object class="GtkGrid" id="btrfsGrid">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="column_spacing">12</property>
<child>
<object class="GtkBox" id="box3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkCheckButton" id="btrfsRedundancyCheckbox">
<property name="label" translatable="yes">Redundancy (_mirror)</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_raid_feature_toggled" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="btrfsRedundancyLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="ypad">2</property>
<property name="label" translatable="yes">(-0Gb)</property>
<attributes>
<attribute name="foreground" value="#ffff00000000"/>
</attributes>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkBox" id="box4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkCheckButton" id="btrfsPerformanceCheckbox">
<property name="label" translatable="yes">Optimi_zed performance (stripe)</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_raid_feature_toggled" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="btrfsPerformanceLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">(-0Gb)</property>
<attributes>
<attribute name="foreground" value="#ffff00000000"/>
</attributes>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
</object>
<packing>
<property name="position">2</property>
</packing>
</child>
<child type="tab">
<placeholder/>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">3</property>
<property name="width">3</property>
<property name="height">1</property>
</packing>
</child>
<child> <object class="GtkCheckButton" id="reformatCheckbox">
<property name="label" translatable="yes">_Reformat</property>
<property name="label" translatable="yes">Refor_mat</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property>
@@ -1287,6 +826,7 @@ use. Try something else?</property> <object class="GtkLabel" id="volumeGroupLabel"> <property name="visible">True</property> <property name="can_focus">False</property>
<property name="xalign">0</property> <property name="label" translatable="yes">_Volume Group:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">volumeGroupCombo</property>
@@ -1318,7 +858,7 @@ use. Try something else?</property> </child> <child> <object class="GtkButton" id="modifyVGButton">
<property name="label" translatable="yes">Modif_y...</property>
<property name="label" translatable="yes">_Modify...</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property>
@@ -1332,6 +872,46 @@ use. Try something else?</property> <property name="height">1</property> </packing> </child>
<child>
<object class="GtkLabel" id="raidLevelLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_RAID Level:</property>
<property name="use_underline">True</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">3</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<object class="GtkComboBox" id="raidLevelCombo">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="model">raidStoreFiltered</property>
<child>
<object class="GtkCellRendererText" id="raidLevelRenderer"/>
<attributes>
<attribute name="markup">0</attribute>
</attributes>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">3</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child> </object> </child> <child type="label">
@@ -2411,4 +1991,57 @@ use. Try something else?</property> <property name="step_increment">1</property> <property name="page_increment">10</property> </object>
<object class="GtkListStore" id="raidLevelStore">
<columns>
<!-- column-name raidLevel -->
<column type="gchararray"/>
<!-- column-name vaidForLVM -->
---- valid <--------------------------maybe??
<column type="gboolean"/>
<!-- column-name validForRAID -->
<column type="gboolean"/>
<!-- column-name validForBTRFS -->
<column type="gboolean"/>
</columns>
<data>
<row>
<col id="0" translatable="yes">RAID0 <span foreground="grey">(Performance)</span></col>
<col id="1">True</col>
<col id="2">True</col>
<col id="3">True</col>
</row>
<row>
<col id="0" translatable="yes">RAID1 <span foreground="grey">(Redundancy)</span></col>
<col id="1">True</col>
<col id="2">True</col>
<col id="3">True</col>
</row>
<row>
<col id="0" translatable="yes">RAID4 <span foreground="grey">(Error Checking)</span></col>
<col id="1">False</col>
<col id="2">True</col>
<col id="3">False</col>
</row>
<row>
<col id="0" translatable="yes">RAID5 <span foreground="grey">(Distributed Error Checking)</span></col>
<col id="1">False</col>
<col id="2">True</col>
<col id="3">False</col>
</row>
<row>
<col id="0" translatable="yes">RAID6 <span foreground="grey">(Redundant Error Checking)</span></col>
<col id="1">False</col>
<col id="2">True</col>
<col id="3">False</col>
</row>
<row>
<col id="0" translatable="yes">RAID10 <span foreground="grey">(Performance, Redundancy)</span></col>
<col id="1">False</col>
<col id="2">True</col>
<col id="3">False</col>
</row>
</data>
</object>
<object class="GtkTreeModelFilter" id="raidStoreFiltered">
- <property name="child_model">raidLevelStore</property>
</object> </interface>
diff --git a/pyanaconda/ui/gui/spokes/custom.py b/pyanaconda/ui/gui/spokes/custom.py index 6b3a4e4..be0f179 100644 --- a/pyanaconda/ui/gui/spokes/custom.py +++ b/pyanaconda/ui/gui/spokes/custom.py @@ -128,39 +128,6 @@ device_text_map = {DEVICE_TYPE_LVM: DEVICE_TEXT_LVM, DEVICE_TYPE_PARTITION: DEVICE_TEXT_PARTITION, DEVICE_TYPE_BTRFS: DEVICE_TEXT_BTRFS}
-options_page_dict = {DEVICE_TYPE_LVM: 0,
DEVICE_TYPE_MD: 1,
DEVICE_TYPE_BTRFS: 2}
-# raid feature names. These are the basis for some UI widget names. -raid_features = ["Performance", "Redundancy", "Error", "DistError",
"RedundantError"]
-# feature names by raid level -raid_level_features = {"raid0": ["Performance"],
"raid1": ["Redundancy"],
"raid10": ["Performance", "Redundancy"],
"raid4": ["Performance", "Error"],
"raid5": ["Performance", "DistError"],
"raid6": ["Performance", "RedundantError"],
"single": []}
-# disabled features by raid_level -raid_disabled_features = {"raid1": ["Error", "DistError", "RedundantError"],
"raid10": ["Error", "DistError", "RedundantError"],
"raid4": ["Performance", "Redundancy", "DistError", "RedundantError"],
"raid5": ["Performance", "Redundancy", "Error", "RedundantError"],
"raid6": ["Performance", "Redundancy", "Error", "DistError"],
None: ["Error", "DistError", "RedundantError"],
-}
-# reference raid level by feature name -feature_raid_levels = {"Performance": "raid0",
"Redundancy": "raid1",
"Error": "raid4",
"DistError": "raid5",
"RedundantError": "raid6"}
- partition_only_format_types = ["efi", "hfs+", "prepboot", "biosboot", "appleboot"]
@@ -449,7 +416,7 @@ class HelpDialog(GUIObject):
class CustomPartitioningSpoke(NormalSpoke, StorageChecker): builderObjects = ["customStorageWindow", "sizeAdjustment",
"partitionStore",
"partitionStore", "raidStoreFiltered", "raidLevelStore", "addImage", "removeImage", "settingsImage"] mainWidgetName = "customStorageWindow" uiFile = "spokes/custom.glade"
@@ -523,8 +490,6 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker): self._partitionsViewport = self.builder.get_object("partitionsViewport") self._partitionsNotebook = self.builder.get_object("partitionsNotebook")
self._optionsNotebook = self.builder.get_object("optionsNotebook")
self._addButton = self.builder.get_object("addButton") self._removeButton = self.builder.get_object("removeButton") self._configButton = self.builder.get_object("configureButton")
@@ -541,12 +506,8 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker): setViewportBackground(self.builder.get_object("availableSpaceViewport"), "#db3279") setViewportBackground(self.builder.get_object("totalSpaceViewport"), "#60605b")
# Set the background of the options notebook to slightly darker than
# everything else, and give it a border.
provider = Gtk.CssProvider()
provider.load_from_data("GtkNotebook { background-color: shade(@theme_bg_color, 0.95); border-width: 1px; border-style: solid; border-color: @borders; }")
context = self._optionsNotebook.get_style_context()
context.add_provider(provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION)
raidStoreFilter = self.builder.get_object("raidStoreFiltered")
raidStoreFilter.set_visible_func(self._raid_level_visible) self._accordion = Accordion() self._partitionsViewport.add(self._accordion)
@@ -1361,113 +1322,67 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker): # from other pages since we haven't altered the filesystem self.add_new_selector(device)
- def _get_raid_widget_dict(self, device_type):
""" Return dict of widget tuples with feature keys for device_type. """
if device_type == DEVICE_TYPE_MD:
prefix = "raid"
- def _raid_level_visible(self, model, itr, user_data):
device_type = self._get_current_device_type()
if device_type == DEVICE_TYPE_LVM:
return model[itr][1]
elif device_type == DEVICE_TYPE_MD:
return model[itr][2] elif device_type == DEVICE_TYPE_BTRFS:
prefix = "btrfs"
elif device_type == DEVICE_TYPE_LVM:
prefix = "lvm"
else:
return {}
widget_dict = {}
for feature in raid_features:
button = self.builder.get_object("%s%sCheckbox" % (prefix, feature))
label = self.builder.get_object("%s%sLabel" % (prefix, feature))
if button and label:
widget_dict[feature] = (button, label)
return widget_dict
return model[itr][3] def _get_raid_level(self):
""" Return the raid level string based on the current ui selections. """
device_type = self._get_current_device_type()
widget_dict = self._get_raid_widget_dict(device_type)
if not widget_dict:
return None
active = []
for feature in raid_features:
if feature not in widget_dict:
continue
(button, label) = widget_dict[feature]
if button.get_active():
active.append(feature)
raid_level = None
for (level, feature_set) in raid_level_features.items():
if set(active) == set(feature_set):
raid_level = level
break
if raid_level is None:
# this is okay for lvm or btrfs but not for md until we add linear
log.error("UI: failed to get raid level (%s)" % active)
combo = self.builder.get_object("raidLevelCombo")
itr = combo.get_active_iter()
store = combo.get_model()
return raid_level
- def on_raid_feature_toggled(self, widget):
new_state = widget.get_active()
log.debug("widget %s new state: %s" % (widget, new_state))
raid_level = self._get_raid_level()
# now that we've established a raid level, update disabled features
self._update_disabled_raid_features(raid_level)
- def _get_raid_disabled_features(self, raid_level):
""" Return a list of disabled features based on raid level. """
disabled = raid_disabled_features.get(raid_level, [])
disk_count = len(self._device_disks)
# go through each feature's reference raid level, filtering any that
# require more disks than we have available
for feature in raid_features:
# XXX we're using the mdraid rules for min members
level = mdraid.raidLevel(feature_raid_levels[feature])
min_disks = mdraid.get_raid_min_members(level)
if min_disks > disk_count and feature not in disabled:
disabled.append(feature)
return disabled
- def _update_disabled_raid_features(self, raid_level):
""" Update disabled feature widgets based on raid level. """
device_type = self._get_current_device_type()
widget_dict = self._get_raid_widget_dict(device_type)
disabled = self._get_raid_disabled_features(raid_level)
for feature in raid_features:
if feature not in widget_dict:
continue
if not itr:
return
(button, label) = widget_dict[feature]
button.set_sensitive(feature not in disabled)
return store[itr][0].split()[0].lower() def _populate_raid(self, raid_level, size): """ Set up the raid-specific portion of the device details. """ device_type = self._get_current_device_type() log.debug("populate_raid: %s, %s" % (device_type, raid_level))
raid_label = self.builder.get_object("raidLevelLabel")
raid_combo = self.builder.get_object("raidLevelCombo")
if device_type == DEVICE_TYPE_MD: base_level = "raid0" # FIXME: should be linear
level_label = self.builder.get_object("raidLevelLabel")
level_label.set_text(raid_level.upper()) elif device_type == DEVICE_TYPE_BTRFS: base_level = "single" else:
for widget in [raid_label, raid_combo]:
widget.set_no_show_all(True)
widget.hide()
return
if not raid_level:
raid_level = base_level
# Set a default RAID level in the combo.
i = 0
for row in raid_combo.get_model():
if row[0].startswith(raid_level.upper()):
raid_combo.set_active(i)
break
i += 1
for widget in [raid_label, raid_combo]:
widget.set_no_show_all(False)
widget.show()
# Create a DeviceFactory to use to calculate the disk space needs for # this device with various raid features enabled. with ui_storage_logger(): factory = self.__storage.getDeviceFactory(device_type, size, disks=self._device_disks,
raid_level=base_level)
raid_level=raid_level)
widget_dict = self._get_raid_widget_dict(device_type) try: base_size = factory.device_size except MDRaidError as e:
@@ -1477,31 +1392,13 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker): self.window.show_all() return
active = raid_level_features[raid_level]
disabled = self._get_raid_disabled_features(raid_level)
for feature in raid_features:
if feature not in widget_dict:
# this feature isn't supported for this device type
continue
(button, label) = widget_dict[feature]
# is this feature enabled for the current raid level?
button.set_active(feature in active)
# what is the incremental disk space requirement for this feature?
# TODO: update this when the size spinner changes
level = mdraid.raidLevel(feature_raid_levels[feature])
min_disks = mdraid.get_raid_min_members(level)
if min_disks <= len(factory.disks):
factory.raid_level = feature_raid_levels[feature]
delta = factory.device_size - base_size
label.set_text("+%s" % str(Size(spec="%fmb" % delta)).upper())
else:
label.set_text(_("(not enough disks)"))
# some features are not available to some raid levels
button.set_sensitive(feature not in disabled)
# what is the incremental disk space requirement for this feature?
# TODO: update this when the size spinner changes
level = self._get_raid_level()
min_disks = mdraid.get_raid_min_members(level)
if min_disks <= len(factory.disks):
factory.raid_level = level
delta = factory.device_size - base_size def _get_current_device_type(self): typeCombo = self.builder.get_object("deviceTypeCombo")
@@ -1736,7 +1633,6 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
self._populate_raid(raid_level, device.size) self._populate_lvm(device=use_dev)
self.builder.get_object("optionsNotebook").set_sensitive(not device.exists) # do this last in case this was set sensitive in on_device_type_changed if use_dev.exists: nameEntry.set_sensitive(False)
@@ -2413,13 +2309,6 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker): include_btrfs = False fs_type_sensitive = True
# eventually LVM will be handled in the else clause
if new_type in (DEVICE_TYPE_PARTITION, DEVICE_TYPE_LVM, DEVICE_TYPE_DISK):
self._optionsNotebook.hide()
else:
self._optionsNotebook.show()
self._optionsNotebook.set_current_page(options_page_dict[new_type])
raid_level = None if new_type == DEVICE_TYPE_BTRFS: # add btrfs to the fstype combo and lock it in
@@ -2478,6 +2367,9 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker): fs_type_sensitive) # end btrfs magic
raidStoreFilter = self.builder.get_object("raidStoreFiltered")
raidStoreFilter.refilter()
def clear_errors(self): self._error = None self.clear_info()
@@ -2411,4 +1991,57 @@ use. Try something else?</property> <property name="step_increment">1</property> <property name="page_increment">10</property>
</object> + <object class="GtkListStore" id="raidLevelStore"> + <columns> + <!-- column-name raidLevel --> + <column type="gchararray"/> + <!-- column-name vaidForLVM -->
---- valid <--------------------------maybe??
Whoops, yes. Good catch.
- Chris
On Tue, 2013-01-22 at 16:31 -0500, Chris Lumens wrote:
This seems to be what more people want, and it's certainly far more simple.
pyanaconda/ui/gui/spokes/custom.glade | 559 ++++++---------------------------- pyanaconda/ui/gui/spokes/custom.py | 208 +++---------- 2 files changed, 146 insertions(+), 621 deletions(-)
# Set a default RAID level in the combo.
i = 0
for row in raid_combo.get_model():
if row[0].startswith(raid_level.upper()):
raid_combo.set_active(i)
break
i += 1
You can use 'for (i, row) in enumerate(raid_combo.get_model())' here.
pyanaconda/ui/gui/spokes/custom.glade | 559 ++++++---------------------------- pyanaconda/ui/gui/spokes/custom.py | 208 +++---------- 2 files changed, 146 insertions(+), 621 deletions(-)
# Set a default RAID level in the combo.
i = 0
for row in raid_combo.get_model():
if row[0].startswith(raid_level.upper()):
raid_combo.set_active(i)
break
i += 1
You can use 'for (i, row) in enumerate(raid_combo.get_model())' here.
Oh, that's a good tip. I'll work it in. There's probably other places this can be done too.
- Chris
--- pyanaconda/ui/gui/spokes/custom.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pyanaconda/ui/gui/spokes/custom.py b/pyanaconda/ui/gui/spokes/custom.py index be0f179..55399b7 100644 --- a/pyanaconda/ui/gui/spokes/custom.py +++ b/pyanaconda/ui/gui/spokes/custom.py @@ -1350,7 +1350,7 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker): raid_combo = self.builder.get_object("raidLevelCombo")
if device_type == DEVICE_TYPE_MD: - base_level = "raid0" # FIXME: should be linear + base_level = "raid1" # FIXME: should be linear elif device_type == DEVICE_TYPE_BTRFS: base_level = "single" else: @@ -2325,7 +2325,7 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker): # here I suppose we could alter the default based on disk count raid_level = "single" elif new_type == DEVICE_TYPE_MD: - raid_level = "raid0" + raid_level = "raid1"
# lvm uses the RHS to set disk set. no foolish minds here. exists = self._current_selector and self._current_selector._device.exists
Yes, I know it's already described in the help text. --- pyanaconda/ui/gui/spokes/lib/accordion.py | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-)
diff --git a/pyanaconda/ui/gui/spokes/lib/accordion.py b/pyanaconda/ui/gui/spokes/lib/accordion.py index 2b1f217..3811af3 100644 --- a/pyanaconda/ui/gui/spokes/lib/accordion.py +++ b/pyanaconda/ui/gui/spokes/lib/accordion.py @@ -1,3 +1,4 @@ +# vim: set fileencoding=utf8 # Mountpoint selector accordion and page classes # # Copyright (C) 2012 Red Hat, Inc. @@ -229,16 +230,20 @@ class CreateNewPage(Page): self.pageTitle = ""
# Create a box where we store the "Here's how you create a new blah" info. - self._createBox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=6) + self._createBox = Gtk.Grid() + self._createBox.set_row_spacing(6) + self._createBox.set_column_spacing(6) self._createBox.set_margin_left(16)
- label = Gtk.Label(_("You haven't created any mount points for your %s %s installation yet:") % (productName, productVersion)) - label.set_alignment(0, 0.5) + label = Gtk.Label(_("You haven't created any mount points for your %s %s installation yet. You can:") % (productName, productVersion)) label.set_line_wrap(True) - self._createBox.add(label) + self._createBox.attach(label, 0, 0, 2, 1) + + self._createBox.attach(Gtk.Label("•"), 0, 1, 1, 1)
self._createNewButton = Gtk.LinkButton("", label=_("_Click here to create them automatically.")) label = self._createNewButton.get_children()[0] + label.set_alignment(0, 0.5) label.set_line_wrap(True) label.set_use_underline(True)
@@ -246,11 +251,20 @@ class CreateNewPage(Page): self._createNewButton.set_halign(Gtk.Align.START) self._createNewButton.connect("clicked", cb) self._createNewButton.connect("activate-link", lambda *args: Gtk.true()) - self._createBox.add(self._createNewButton) + self._createBox.attach(self._createNewButton, 1, 1, 1, 1) + + self._createBox.attach(Gtk.Label("•"), 0, 2, 1, 1) + + label = Gtk.Label(_("Create new mount points by clicking the '+' button.")) + label.set_alignment(0, 0.5) + label.set_line_wrap(True) + self._createBox.attach(label, 1, 2, 1, 1) + + self._createBox.attach(Gtk.Label("•"), 0, 3, 1, 1)
- label = Gtk.Label(_("Or, create new mount points below with the '+' icon.")) + label = Gtk.Label(_("Or, assign new mount points to existing partitions after selecting them below.")) label.set_alignment(0, 0.5) label.set_line_wrap(True) - self._createBox.add(label) + self._createBox.attach(label, 1, 3, 1, 1)
self.add(self._createBox)
Have fun trying to please the pedants with the descriptions in patch 2, but the whole set looks fine to me.
Dave
On Tue, 2013-01-22 at 16:31 -0500, Chris Lumens wrote:
pyanaconda/ui/gui/spokes/custom.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/pyanaconda/ui/gui/spokes/custom.py b/pyanaconda/ui/gui/spokes/custom.py index 8f38eb4..6b3a4e4 100644 --- a/pyanaconda/ui/gui/spokes/custom.py +++ b/pyanaconda/ui/gui/spokes/custom.py @@ -206,7 +206,8 @@ def validate_mountpoint(mountpoint, used_mountpoints, strict=True): valid = MOUNTPOINT_IN_USE elif not mountpoint: valid = MOUNTPOINT_EMPTY
- elif mountpoint.startswith("/dev"):
- elif mountpoint.startswith("/dev") or mountpoint.startswith("/proc") or \
elif (mountpoint.lower() not in fake_mountpoints and ((len(mountpoint) > 1 and mountpoint.endswith("/")) ormountpoint.startswith("/sys"): valid = MOUNTPOINT_INVALID
Apart from the minor comments these all look good to me.
anaconda-patches@lists.fedorahosted.org