summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Katz <katzj@redhat.com>2007-11-28 17:46:47 -0500
committerJeremy Katz <katzj@redhat.com>2007-11-29 16:12:02 -0500
commit93e7dd2b0d37a69c5d7a7b2c6b70e8a28e863dd1 (patch)
treeca5f3903766912c5c3b7c6e7e6a5175f99fa957f
parent558a7bb44671dd655568586bf963f915e93a79dd (diff)
downloadanaconda-93e7dd2b0d37a69c5d7a7b2c6b70e8a28e863dd1.tar.gz
anaconda-93e7dd2b0d37a69c5d7a7b2c6b70e8a28e863dd1.tar.xz
anaconda-93e7dd2b0d37a69c5d7a7b2c6b70e8a28e863dd1.zip
Implement resizing UI for graphical mode.
This simplifies the edit partition dialog and adds resizing support
-rw-r--r--iw/lvm_dialog_gui.py18
-rw-r--r--iw/partition_dialog_gui.py43
-rw-r--r--iw/partition_ui_helpers_gui.py109
-rw-r--r--iw/raid_dialog_gui.py22
4 files changed, 76 insertions, 116 deletions
diff --git a/iw/lvm_dialog_gui.py b/iw/lvm_dialog_gui.py
index 6055a19de..560970f1c 100644
--- a/iw/lvm_dialog_gui.py
+++ b/iw/lvm_dialog_gui.py
@@ -479,25 +479,15 @@ class VolumeGroupEditor:
format = 1
migrate = 0
else:
- if self.fsoptionsDict.has_key("formatrb"):
- formatrb = self.fsoptionsDict["formatrb"]
- else:
- formatrb = None
-
- if formatrb:
- format = formatrb.get_active()
+ if self.fsoptionsDict.has_key("formatcb"):
+ format = self.fsoptionsDict["formatcb"].get_active()
if format:
fsystem = self.fsoptionsDict["fstypeCombo"].get_active_value()
else:
format = 0
- if self.fsoptionsDict.has_key("migraterb"):
- migraterb = self.fsoptionsDict["migraterb"]
- else:
- migraterb = None
-
- if migraterb:
- migrate = migraterb.get_active()
+ if self.fsoptionsDict.has_key("migratecb"):
+ migrate = self.fsoptionsDict["migratecb"].get_active()
if migrate:
fsystem = self.fsoptionsDict["migfstypeCombo"].get_active_value()
else:
diff --git a/iw/partition_dialog_gui.py b/iw/partition_dialog_gui.py
index 7c757ae94..fa7a6fd5a 100644
--- a/iw/partition_dialog_gui.py
+++ b/iw/partition_dialog_gui.py
@@ -206,30 +206,26 @@ class PartitionEditor:
# preexisting partition, just set mount point and format flag
request = copy.copy(self.origrequest)
- if self.fsoptionsDict.has_key("formatrb"):
- formatrb = self.fsoptionsDict["formatrb"]
- else:
- formatrb = None
-
- if formatrb:
- request.format = formatrb.get_active()
+ if self.fsoptionsDict.has_key("formatcb"):
+ request.format = self.fsoptionsDict["formatcb"].get_active()
if request.format:
request.fstype = self.fsoptionsDict["fstypeCombo"].get_active_value()
else:
request.format = 0
- if self.fsoptionsDict.has_key("migraterb"):
- migraterb = self.fsoptionsDict["migraterb"]
- else:
- migraterb = None
-
- if migraterb:
- request.migrate = migraterb.get_active()
+ if self.fsoptionsDict.has_key("migratecb"):
+ request.migrate = self.fsoptionsDict["migratecb"].get_active()
if request.migrate:
request.fstype =self.fsoptionsDict["migfstypeCombo"].get_active_value()
else:
request.migrate = 0
+ if self.fsoptionsDict.has_key("resizecb") and self.fsoptionsDict["resizecb"].get_active():
+ request.targetSize = self.fsoptionsDict["resizesb"].get_value_as_int()
+ else:
+ request.targetSize = None
+ print "the target size for %s is %s" %(request.mountpoint, request.targetSize)
+
# set back if we are not formatting or migrating
origfstype = self.origrequest.origfstype
if not request.format and not request.migrate:
@@ -337,21 +333,6 @@ class PartitionEditor:
lbl.set_mnemonic_widget(self.newfstypeCombo)
maintable.attach(self.newfstypeCombo, 1, 2, row, row + 1)
else:
- maintable.attach(createAlignedLabel(_("Original File System "
- "Type:")),
- 0, 1, row, row + 1)
-
- if self.origrequest.origfstype:
- typestr = self.origrequest.origfstype.getName()
- if self.origrequest.origfstype.getName() == "foreign":
- part = get_partition_by_name(self.diskset.disks,
- self.origrequest.device)
- typestr = map_foreign_to_fsname(part.native_type)
- else:
- typestr = _("Unknown")
-
- fstypelabel = gtk.Label(typestr)
- maintable.attach(fstypelabel, 1, 2, row, row + 1)
self.newfstypeCombo = None
row = row + 1
@@ -455,10 +436,6 @@ class PartitionEditor:
cursize = (endsec - startsec)/2048
bycyl_sizelabel.set_text("%s" % (int(cursize)))
else:
- maintable.attach(createAlignedLabel(_("Size (MB):")),
- 0, 1, row, row + 1)
- sizelabel = gtk.Label("%d" % (origrequest.size))
- maintable.attach(sizelabel, 1, 2, row, row + 1)
self.sizespin = None
row = row + 1
diff --git a/iw/partition_ui_helpers_gui.py b/iw/partition_ui_helpers_gui.py
index 3ec470046..75db72dad 100644
--- a/iw/partition_ui_helpers_gui.py
+++ b/iw/partition_ui_helpers_gui.py
@@ -29,6 +29,11 @@ from partedUtils import *
import rhpl
from rhpl.translate import _, N_
+def istruefalse(val):
+ if val is None or not val:
+ return False
+ return True
+
class WideCheckList(checklist.CheckList):
def toggled_item(self, data, row):
@@ -206,6 +211,9 @@ def mountptchangeCB(widget, fstypecombo):
if rhpl.getArch() == "ia64" and widget.get_children()[0].get_text() == "/boot/efi":
fstypecombo.set_active_text("vfat")
+def resizeOptionCB(widget, resizesb):
+ resizesb.set_sensitive(widget.get_active())
+
def formatOptionCB(widget, data):
(combowidget, mntptcombo, ofstype, lukscb) = data
combowidget.set_sensitive(widget.get_active())
@@ -239,100 +247,95 @@ def noformatCB(widget, data):
Returns the value of row after packing into the maintable,
and a dictionary consistenting of:
- noformatrb - radiobutton for 'leave fs unchanged'
- formatrb - radiobutton for 'format as new fs'
+ noformatcb - checkbutton for 'format as new fs'
fstype - part of format fstype menu
fstypeMenu - part of format fstype menu
- migraterb - radiobutton for migrate fs
- migfstype - menu for migrate fs types
+ migratecb - checkbutton for migrate fs
migfstypeMenu - menu for migrate fs types
lukscb - checkbutton for 'encrypt using LUKS/dm-crypt'
+ resizecb - checkbutton for 'resize fs'
+ resizesb - spinbutton with resize target
"""
def createPreExistFSOptionSection(origrequest, maintable, row, mountCombo,
ignorefs=[]):
+ rc = {}
ofstype = origrequest.fstype
- maintable.attach(gtk.HSeparator(), 0, 2, row, row + 1)
- row = row + 1
-
- label = gtk.Label(_("How would you like to prepare the file system "
- "on this partition?"))
- label.set_line_wrap(1)
- label.set_alignment(0.0, 0.0)
-
- maintable.attach(label, 0, 2, row, row + 1)
- row = row + 1
-
- noformatrb = gtk.RadioButton(label=_("Leave _unchanged "
- "(preserve data)"))
- noformatrb.set_active(1)
- maintable.attach(noformatrb, 0, 2, row, row + 1)
- row = row + 1
-
- formatrb = gtk.RadioButton(label=_("_Format partition as:"),
- group=noformatrb)
- formatrb.set_active(0)
- if origrequest.format:
- formatrb.set_active(1)
+ formatcb = gtk.CheckButton(label=_("_Format as:"))
+ maintable.attach(formatcb, 0, 1, row, row + 1)
+ formatcb.set_active(istruefalse(origrequest.format))
+ rc["formatcb"] = formatcb
- maintable.attach(formatrb, 0, 1, row, row + 1)
fstypeCombo = createFSTypeMenu(ofstype, fstypechangeCB,
mountCombo, ignorefs=ignorefs)
- fstypeCombo.set_sensitive(formatrb.get_active())
+ fstypeCombo.set_sensitive(formatcb.get_active())
maintable.attach(fstypeCombo, 1, 2, row, row + 1)
- row = row + 1
+ row += 1
+ rc["fstypeCombo"] = fstypeCombo
- if not formatrb.get_active() and not origrequest.migrate:
+ if not formatcb.get_active() and not origrequest.migrate:
mountCombo.set_data("prevmountable", ofstype.isMountable())
# this gets added to the table a bit later on
lukscb = gtk.CheckButton(_("_Encrypt"))
- formatrb.connect("toggled", formatOptionCB,
+ formatcb.connect("toggled", formatOptionCB,
(fstypeCombo, mountCombo, ofstype, lukscb))
- noformatrb.connect("toggled", noformatCB,
- (fstypeCombo, mountCombo, origrequest.origfstype))
if origrequest.origfstype.isMigratable():
- migraterb = gtk.RadioButton(label=_("Mi_grate partition to:"),
- group=noformatrb)
- migraterb.set_active(0)
- if origrequest.migrate:
- migraterb.set_active(1)
+ migratecb = gtk.CheckButton(label=_("Mi_grate filesystem to:"))
+ migratecb.set_active(istruefalse(origrequest.migrate))
migtypes = origrequest.origfstype.getMigratableFSTargets()
- maintable.attach(migraterb, 0, 1, row, row + 1)
+ maintable.attach(migratecb, 0, 1, row, row + 1)
migfstypeCombo = createFSTypeMenu(ofstype, None, None,
availablefstypes = migtypes)
- migfstypeCombo.set_sensitive(migraterb.get_active())
+ migfstypeCombo.set_sensitive(migratecb.get_active())
maintable.attach(migfstypeCombo, 1, 2, row, row + 1)
row = row + 1
-
- migraterb.connect("toggled", formatOptionCB,
+ rc["migratecb"] = migratecb
+ rc["migfstypeCombo"] = migfstypeCombo
+ migratecb.connect("toggled", formatOptionCB,
(migfstypeCombo, mountCombo, ofstype, None))
else:
- migraterb = None
+ migratecb = None
migfstypeCombo = None
- row = row + 1
+ # FIXME: we should support resizing LVs too
+ if origrequest.origfstype.isResizable() and origrequest.type == REQUEST_PREEXIST:
+ resizecb = gtk.CheckButton(label=_("_Resize partition"))
+ resizecb.set_active(origrequest.targetSize is not None)
+ rc["resizecb"] = resizecb
+ maintable.attach(resizecb, 0, 1, row, row + 1)
- if origrequest.encryption and formatrb.get_active():
+ if origrequest.targetSize is not None:
+ value = origrequest.targetSize
+ else:
+ value = origrequest.size
+ adj = gtk.Adjustment(value = value,
+ lower = origrequest.getMinimumResizeMB(),
+ upper = origrequest.getMaximumResizeMB(),
+ step_incr = 1)
+ resizesb = gtk.SpinButton(adj, digits = 0)
+ resizesb.set_property('numeric', True)
+ rc["resizesb"] = resizesb
+ maintable.attach(resizesb, 1, 2, row, row + 1)
+ resizecb.connect('toggled', resizeOptionCB, resizesb)
+ resizeOptionCB(resizecb, resizesb)
+ row = row + 1
+
+ if origrequest.encryption and formatcb.get_active():
# probably never happen
lukscb.set_active(1)
- lukscb.set_sensitive(formatrb.get_active())
- lukscb.set_data("formatstate", formatrb.get_active())
+ lukscb.set_sensitive(formatcb.get_active())
+ lukscb.set_data("formatstate", formatcb.get_active())
+ rc["lukscb"] = lukscb
maintable.attach(lukscb, 0, 2, row, row + 1)
row = row + 1
- rc = {}
- for var in ['noformatrb', 'formatrb', 'fstypeCombo',
- 'migraterb', 'migfstypeCombo', 'lukscb']:
- if eval("%s" % (var,)) is not None:
- rc[var] = eval("%s" % (var,))
-
return (row, rc)
# do tests we just want in UI for now, not kickstart
diff --git a/iw/raid_dialog_gui.py b/iw/raid_dialog_gui.py
index d90a3d04b..22123f8b0 100644
--- a/iw/raid_dialog_gui.py
+++ b/iw/raid_dialog_gui.py
@@ -183,27 +183,17 @@ class RaidEditor:
else:
request.encryption = None
else:
- if self.fsoptionsDict.has_key("formatrb"):
- formatrb = self.fsoptionsDict["formatrb"]
- else:
- formatrb = None
-
- if formatrb:
- request.format = formatrb.get_active()
+ if self.fsoptionsDict.has_key("formatcb"):
+ request.format = self.fsoptionsDict["formatcb"].get_active()
if request.format:
- request.fstype = self.fsoptionsDict["fstypeCombo"].get_active_value()
+ request.fsystem = self.fsoptionsDict["fstypeCombo"].get_active_value()
else:
request.format = 0
- if self.fsoptionsDict.has_key("migraterb"):
- migraterb = self.fsoptionsDict["migraterb"]
- else:
- migraterb = None
-
- if migraterb:
- request.migrate = migraterb.get_active()
+ if self.fsoptionsDict.has_key("migratecb"):
+ request.migrate = self.fsoptionsDict["migratecb"].get_active()
if request.migrate:
- request.fstype =self.fsoptionsDict["migfstypeCombo"].get_active_value()
+ request.fsystem = self.fsoptionsDict["migfstypeCombo"].get_active_value()
else:
request.migrate = 0