Module: Yast::AutoinstallDriveDialogInclude
- Defined in:
- ../../src/include/autoinstall/DriveDialog.rb
Instance Method Summary (collapse)
- - (Object) disableReuse
- - (Object) DriveCheck
- - (Object) DriveDelete
- - (Object) DriveDisplay
- - (Object) DriveEventHandler
-
- (Object) DriveLoad(driveIdx)
GENERAL DIALOG IFACE.
- - (Object) DriveNew
- - (Object) DriveStore
- - (Object) enableReuse(selected)
- - (Object) initialize_autoinstall_DriveDialog(include_target)
- - (Object) updateData(drive)
-
- (Object) updateGUI(d)
SYNCING GUI DATA.
Instance Method Details
- (Object) disableReuse
69 70 71 72 73 74 75 76 77 |
# File '../../src/include/autoinstall/DriveDialog.rb', line 69 def disableReuse UI.ChangeWidget(Id(:cb_reuse), :Value, :all) UI.ChangeWidget(Id(:cb_reuse), :Enabled, false) if UI.QueryWidget(Id(:rbg), :CurrentButton) != :rb_init UI.ChangeWidget(Id(:rbg), :CurrentButton, :rb_init) end nil end |
- (Object) DriveCheck
143 144 145 146 147 148 149 150 151 152 153 |
# File '../../src/include/autoinstall/DriveDialog.rb', line 143 def DriveCheck @currentDrive = updateData(@currentDrive) storedDrive = DriveLoad(@currentDriveIdx) if !AutoinstDrive.areEqual(@currentDrive, storedDrive) if Popup.YesNo("Store unsaved changes to drive?") AutoinstPartPlan.updateDrive(@currentDrive) end end nil end |
- (Object) DriveDelete
227 228 229 230 231 232 233 |
# File '../../src/include/autoinstall/DriveDialog.rb', line 227 def DriveDelete drive = Ops.get_string(@stack, :which, "") Builtins.y2milestone("DriveDelete('%1')", drive) AutoinstPartPlan.removeDrive(Builtins.tointeger(drive)) nil end |
- (Object) DriveDisplay
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 |
# File '../../src/include/autoinstall/DriveDialog.rb', line 155 def DriveDisplay drive = Ops.get_string(@stack, :which, "") Builtins.y2milestone("DriveDisplay('%1')", drive) @currentDriveIdx = Builtins.tointeger(drive) @currentDrive = DriveLoad(@currentDriveIdx) contents = VBox( Heading(@driveDialogTitle), HVCenter( HVSquash( VBox( ComboBox( Id(:device), Opt(:editable), _("D&evice"), toItemList(@allDevices) ), VSpacing(1), RadioButtonGroup( Id(:rbg), VBox( Left( RadioButton( Id(:rb_init), Opt(:notify), _("&Intialize drive") ) ), # initially selected Left( RadioButton(Id(:rb_reuse), Opt(:notify), _("Re&use"), true) ), ComboBox( Id(:cb_reuse), Opt(:editable), _("&Type"), toItemList(@reuseTypes) ) ) ), VSpacing(2), PushButton(Id(:apply), _("Apply")) ) ) ) ) UI.ReplaceWidget(Id(@replacement_point), contents) updateGUI(drive) nil end |
- (Object) DriveEventHandler
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
# File '../../src/include/autoinstall/DriveDialog.rb', line 207 def DriveEventHandler Builtins.y2milestone( "DriveEventHandler(): current event: '%1'", @currentEvent ) if Ops.is_map?(@currentEvent) if :rb_init == Ops.get_symbol(@currentEvent, "WidgetID", :Empty) # initialize drive -> set reuse type to all and disable combobox disableReuse eventHandled elsif :rb_reuse == Ops.get_symbol(@currentEvent, "WidgetID", :Empty) # reuse drive -> enable combobox enableReuse(nil) eventHandled end end nil end |
- (Object) DriveLoad(driveIdx)
GENERAL DIALOG IFACE
119 120 121 122 123 124 125 126 127 128 129 |
# File '../../src/include/autoinstall/DriveDialog.rb', line 119 def DriveLoad(driveIdx) drive = AutoinstPartPlan.getDrive(driveIdx) Builtins.y2milestone("loaded drive('%1'): '%2'", driveIdx, drive) if !Builtins.contains(@allDevices, Ops.get_string(drive, "device", "")) @allDevices = Builtins.add( @allDevices, Ops.get_string(drive, "device", "") ) end deep_copy(drive) end |
- (Object) DriveNew
235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 |
# File '../../src/include/autoinstall/DriveDialog.rb', line 235 def DriveNew # TODO: implement default name defaultDevice = "auto" newDrive = AutoinstPartPlan.addDrive( AutoinstDrive.new(defaultDevice, :CT_DISK) ) selectTreeItem(AutoinstDrive.getNodeReference(newDrive)) Ops.set( @stack, :which, Builtins.tostring(Ops.get_integer(newDrive, "_id", 999)) ) DriveDisplay() nil end |
- (Object) DriveStore
131 132 133 134 135 136 137 138 139 140 141 |
# File '../../src/include/autoinstall/DriveDialog.rb', line 131 def DriveStore @currentDrive = updateData(@currentDrive) AutoinstPartPlan.updateDrive(@currentDrive) Builtins.y2milestone( "updated drive('%1'): '%2'", Ops.get_string(@currentDrive, "device", ""), @currentDrive ) nil end |
- (Object) enableReuse(selected)
56 57 58 59 60 61 62 63 64 65 66 67 |
# File '../../src/include/autoinstall/DriveDialog.rb', line 56 def enableReuse(selected) selected = deep_copy(selected) if selected != nil && Ops.is_symbol?(selected) UI.ChangeWidget(Id(:cb_reuse), :Value, selected) end UI.ChangeWidget(Id(:cb_reuse), :Enabled, true) if UI.QueryWidget(Id(:rbg), :CurrentButton) != :rb_reuse UI.ChangeWidget(Id(:rbg), :CurrentButton, :rb_reuse) end nil end |
- (Object) initialize_autoinstall_DriveDialog(include_target)
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File '../../src/include/autoinstall/DriveDialog.rb', line 11 def initialize_autoinstall_DriveDialog(include_target) textdomain "autoinst" Yast.include include_target, "autoinstall/common.rb" Yast.include include_target, "autoinstall/types.rb" Yast.import "Popup" Yast.import "AutoinstPartPlan" Yast.import "AutoinstDrive" # INTERNAL STUFF # local copy of current device the user wants to # edit using this dialog @currentDrive = {} @currentDriveIdx = 999 @allDevices = [ "auto", "/dev/hda", "/dev/hdb", "/dev/hdc", "/dev/sda", "/dev/sdb" ] @reuseTypes = ["all", "free", "linux"] @driveDialogTitle = _("Edit Drive") # INITIALIZE DIALOG @driveType = "drive" @driveDialog = { :type => @driveType, :display => lambda { DriveDisplay() }, :eventHandler => lambda { DriveEventHandler() }, :store => lambda { DriveStore() }, :new => lambda { DriveNew() }, :delete => lambda { DriveDelete() }, :check => lambda { DriveCheck() } } Builtins.y2milestone("adding drive dialog to dialog list.") @dialogs = Builtins.add(@dialogs, @driveType, @driveDialog) end |
- (Object) updateData(drive)
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
# File '../../src/include/autoinstall/DriveDialog.rb', line 97 def updateData(drive) drive = deep_copy(drive) drive = AutoinstDrive.set( drive, "device", symbol2string(Convert.to_symbol(UI.QueryWidget(Id(:device), :Value))) ) if UI.QueryWidget(Id(:rbg), :CurrentButton) == :rb_init drive = AutoinstDrive.set(drive, "initialize", true) drive = AutoinstDrive.set(drive, "use", :all) else drive = AutoinstDrive.set(drive, "initialize", false) drive = AutoinstDrive.set( drive, "use", UI.QueryWidget(Id(:cb_reuse), :Value) ) end deep_copy(drive) end |
- (Object) updateGUI(d)
SYNCING GUI <-> DATA
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File '../../src/include/autoinstall/DriveDialog.rb', line 81 def updateGUI(d) drive = Ops.get_string( AutoinstPartPlan.getDrive(Builtins.tointeger(d)), "device", "" ) UI.ChangeWidget(Id(:device), :Value, string2symbol(drive)) if Ops.get_boolean(@currentDrive, "initialize", false) == true disableReuse else enableReuse(Ops.get(@currentDrive, "use")) end nil end |