diff options
author | Jeremy Katz <katzj@redhat.com> | 2005-08-26 22:40:20 +0000 |
---|---|---|
committer | Jeremy Katz <katzj@redhat.com> | 2005-08-26 22:40:20 +0000 |
commit | 30674045a3f43d3b309295b56d96d64799e7c708 (patch) | |
tree | 5c6aa9859ae8224c9e3e34f83a57d5ff9a1e68a6 | |
parent | 0c22c52b53a519dd51acb3ac7cbaafa810760e31 (diff) | |
download | anaconda-30674045a3f43d3b309295b56d96d64799e7c708.tar.gz anaconda-30674045a3f43d3b309295b56d96d64799e7c708.tar.xz anaconda-30674045a3f43d3b309295b56d96d64799e7c708.zip |
2005-08-26 Jeremy Katz <katzj@redhat.com>
* dispatch.py (installSteps): Add new autopart type step, remove
some obsolete stuff (fdisk, fdasd)
* gui.py (stepToClass): Add new step.
(getGladeWidget): Add helper function for glade screens.
* text.py (stepToClasses): Add new step.
* installclass.py (BaseInstallClass.setSteps): Add new step.
* iw/autopart_type.py: Add first pass at new autopartitioning
screen. Still want to make the shown options more dynamic based
on what your system initially looks like.
* textw/partition_text.py: Add new autopartitioning screen.
* ui/autopart.glade: Add glade file for new autopartitioning screen.
-rw-r--r-- | ChangeLog | 14 | ||||
-rw-r--r-- | dispatch.py | 7 | ||||
-rwxr-xr-x | gui.py | 9 | ||||
-rw-r--r-- | installclass.py | 1 | ||||
-rw-r--r-- | iw/autopart_type.py | 112 | ||||
-rw-r--r-- | text.py | 1 | ||||
-rw-r--r-- | textw/partition_text.py | 110 | ||||
-rw-r--r-- | ui/autopart.glade | 170 |
8 files changed, 414 insertions, 10 deletions
@@ -1,3 +1,17 @@ +2005-08-26 Jeremy Katz <katzj@redhat.com> + + * dispatch.py (installSteps): Add new autopart type step, remove + some obsolete stuff (fdisk, fdasd) + * gui.py (stepToClass): Add new step. + (getGladeWidget): Add helper function for glade screens. + * text.py (stepToClasses): Add new step. + * installclass.py (BaseInstallClass.setSteps): Add new step. + * iw/autopart_type.py: Add first pass at new autopartitioning + screen. Still want to make the shown options more dynamic based + on what your system initially looks like. + * textw/partition_text.py: Add new autopartitioning screen. + * ui/autopart.glade: Add glade file for new autopartitioning screen. + 2005-08-25 Jeremy Katz <katzj@redhat.com> * network.py (NetworkDevice.__init__): Don't set some types that diff --git a/dispatch.py b/dispatch.py index cb20ba23d..8a7997a0f 100644 --- a/dispatch.py +++ b/dispatch.py @@ -69,18 +69,13 @@ installSteps = [ #("findinstall", ("dispatch", "intf", "id", "instPath")), ("installtype", ("dispatch", "id", "method", "intf")), ("zfcpconfig", ("id.zfcp", "id.diskset", "intf")), - ("partitionmethod", ("id.partitions", "id.instClass")), ("partitionobjinit", partitionObjectsInitialize, ("id.diskset", "id.partitions", "dir", "intf")), - ("partitionmethodsetup", partitionMethodSetup, ("id.partitions", - "dispatch")), - ("autopartition", ("id.diskset", "id.partitions", "intf", "dispatch")), + ("parttype", ("id.diskset", "id.partitions", "intf", "dispatch")), ("autopartitionexecute", doAutoPartition, ("dir", "id.diskset", "id.partitions", "intf", "id.instClass", "dispatch")), - ("fdisk", ("id.diskset", "id.partitions", "intf")), - ("fdasd", ("id.diskset", "id.partitions", "intf")), ("partition", ("id.fsset", "id.diskset", "id.partitions", "intf")), ("upgrademount", upgradeMountFilesystems, ("intf", "id.upgradeRoot", "id.fsset", "instPath")), @@ -56,6 +56,7 @@ stepToClass = { "partitionmethod" : ("partmethod_gui", "PartitionMethodWindow"), "partition" : ("partition_gui", "PartitionWindow"), "autopartition" : ("partition_gui", "AutoPartitionWindow"), + "parttype" : ("autopart_type", "PartitionTypeWindow"), "findinstall" : ("examine_gui", "UpgradeExamineWindow"), "addswap" : ("upgrade_swap_gui", "UpgradeSwapWindow"), "upgrademigratefs" : ("upgrade_migratefs_gui", "UpgradeMigrateFSWindow"), @@ -406,6 +407,14 @@ def findGladeFile(file): return fn raise RuntimeError, "Unable to find glade file %s" %(fn,) +def getGladeWidget(file, rootwidget, i18ndomain="anaconda"): + f = findGladeFile(file) + xml = gtk.glade.XML(f, root = rootwidget, domain = i18ndomain) + w = xml.get_widget(rootwidget) + if w is None: + raise RuntimeError, "Unable to find root widget %s in %s" %(rootwidget, file) + return (xml, w) + def findPixmap(file): for dir in ("/mnt/source/RHupdates/pixmaps/", "/mnt/source/RHupdates/", diff --git a/installclass.py b/installclass.py index e27e962ac..a84a8a1f6 100644 --- a/installclass.py +++ b/installclass.py @@ -128,6 +128,7 @@ class BaseInstallClass: "partitionmethod", "partitionobjinit", "partitionmethodsetup", + "parttype", "autopartition", "autopartitionexecute", "fdisk", diff --git a/iw/autopart_type.py b/iw/autopart_type.py new file mode 100644 index 000000000..7d0a592ef --- /dev/null +++ b/iw/autopart_type.py @@ -0,0 +1,112 @@ +# +# autopart_type.py: Allows the user to choose how they want to partition +# +# Jeremy Katz <katzj@redhat.com> +# +# Copyright 2005 Red Hat, Inc. +# +# This software may be freely redistributed under the terms of the GNU +# general public license. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# + + +import gtk +import gobject + +import autopart +import constants +import gui +from partition_ui_helpers_gui import * + +from iw_gui import * +from flags import flags + +class PartitionTypeWindow(InstallWindow): + def __init__(self, ics): + InstallWindow.__init__(self, ics) + ics.setTitle("Automatic Partitioning") + ics.setNextEnabled(True) + ics.readHTML("autopart") + + def getNext(self): + active = self.combo.get_active_iter() + val = self.combo.get_model().get_value(active, 1) + + if val == -1: + self.dispatch.skipStep("autopartitionexecute", skip = 1) + else: + self.dispatch.skipStep("autopartitionexecute", skip = 0) + + self.partitions.useAutopartitioning = 1 + self.partitions.autoClearPartType = val + + allowdrives = [] + model = self.drivelist.get_model() + for row in model: + if row[0]: + allowdrives.append(row[1]) + + if len(allowdrives) < 1: + mustHaveSelectedDrive(self.intf) + raise gui.StayOnScreen + + self.partitions.autoClearPartDrives = allowdrives + + if not autopart.queryAutoPartitionOK(self.intf, self.diskset, + self.partitions): + raise gui.StayOnScreen + + if self.xml.get_widget("reviewButton").get_active(): + self.dispatch.skipStep("partition", skip = 0) + else: + self.dispatch.skipStep("partition") + + return None + + + def getScreen(self, diskset, partitions, intf, dispatch): + self.diskset = diskset + self.partitions = partitions + self.intf = intf + self.dispatch = dispatch + + (self.xml, vbox) = gui.getGladeWidget("autopart.glade", "parttypeBox") + + self.combo = self.xml.get_widget("partitionTypeCombo") + cell = gtk.CellRendererText() + self.combo.pack_start(cell, True) + self.combo.set_attributes(cell, text = 0) + cell.set_property("wrap-width", 475) + self.combo.set_size_request(450, -1) + + store = gtk.TreeStore(gobject.TYPE_STRING, gobject.TYPE_INT) + self.combo.set_model(store) + opts = (("Remove all partitions on selected drives and create default layout.", CLEARPART_TYPE_ALL), + ("Remove linux partitions on selected drives and create default layout.", CLEARPART_TYPE_LINUX), + ("Use free space on selected drives and create default layout.", CLEARPART_TYPE_NONE), + ("Create custom layout.", -1)) + for (txt, val) in opts: + iter = store.append(None) + store[iter] = (txt, val) + if val == partitions.autoClearPartType: + self.combo.set_active_iter(iter) + + if ((self.combo.get_active() == -1) or + dispatch.stepInSkipList("autopartitionexecute")): + self.combo.set_active(n-1) + + self.drivelist = createAllowedDrivesList(diskset.disks, + partitions.autoClearPartDrives) + self.drivelist.set_size_request(375, 80) + + self.xml.get_widget("driveScroll").add(self.drivelist) + + self.xml.get_widget("reviewButton").set_active(not dispatch.stepInSkipList("partition")) + + return vbox + + @@ -41,6 +41,7 @@ stepToClasses = { "welcome" : ("welcome_text", "WelcomeWindow"), "installtype" : ("installpath_text", "InstallPathWindow"), "autopartition" : ("partition_text", "AutoPartitionWindow"), + "parttype" : ("partition_text", "PartitionTypeWindow"), "custom-upgrade" : ("upgrade_text", "UpgradeExamineWindow"), "addswap" : ("upgrade_text", "UpgradeSwapWindow"), "upgrademigratefs" : ("upgrade_text", "UpgradeMigrateFSWindow"), diff --git a/textw/partition_text.py b/textw/partition_text.py index dd0786b15..3e01c3bfe 100644 --- a/textw/partition_text.py +++ b/textw/partition_text.py @@ -1595,8 +1595,110 @@ class AutoPartitionWindow: return INSTALL_OK -class DasdPreparation: - def __call__(self, screen, todo): - todo.skipFdisk = 1 - return INSTALL_NOOP + +class PartitionTypeWindow: + def typeboxChange(self, (typebox, drivelist)): + flag = FLAGS_RESET + if typebox.current() == CLEARPART_TYPE_NONE: + flag = FLAGS_SET + # XXX need a way to disable the checkbox tree + + def shutdownUI(self): + # XXX remove parted object refs + # need to put in clear() method for checkboxtree in snack + self.drivelist.key2item = {} + self.drivelist.item2key = {} + + def __call__(self, screen, diskset, partitions, intf, dispatch): + g = GridFormHelp(screen, _("Partitioning Type"), "autopart", 1, 6) + + txt = TextboxReflowed(65, _("Installation requires partitioning " + "of your hard drive. By default, " + "a partitioning layout is chosen " + "which is reasonable for most " + "users. You can either choose " + "to use this or create your own.")) + g.add(txt, 0, 0, (0, 0, 0, 0)) + + opts = (("Remove all partitions on selected drives and create default layout.", CLEARPART_TYPE_ALL), + ("Remove linux partitions on selected drives and create default layout.", CLEARPART_TYPE_LINUX), + ("Use free space on selected drives and create default layout.", CLEARPART_TYPE_NONE), + ("Create custom layout.", -1)) + typebox = Listbox(height = len(opts), scroll = 0) + for (txt, val) in opts: + typebox.append(txt, val) + + if dispatch.stepInSkipList("autopartitionexecute"): + typebox.setCurrent(-1) + else: + typebox.setCurrent(partitions.autoClearPartType) + + g.add(typebox, 0, 1, (0, 1, 0, 0)) + + # list of drives to select which to clear + subgrid = Grid(1, 2) + subgrid.setField(TextboxReflowed(55, _("Which drive(s) do you want to " + "use for this installation?")), + 0, 0) + cleardrives = partitions.autoClearPartDrives + disks = diskset.disks.keys() + disks.sort() + drivelist = CheckboxTree(height=2, scroll=1) + if not cleardrives or len(cleardrives) < 1: + for disk in disks: + drivelist.append(disk, selected = 1) + else: + for disk in disks: + if disk in cleardrives: + selected = 1 + else: + selected = 0 + drivelist.append(disk, selected = selected) + subgrid.setField(drivelist, 0, 1) + g.add(subgrid, 0, 2, (0, 1, 0, 0)) + + + + bb = ButtonBar(screen, [ TEXT_OK_BUTTON, TEXT_BACK_BUTTON ]) + g.add(bb, 0, 5, (0,1,0,0)) + + + typebox.setCallback(self.typeboxChange, (typebox, drivelist)) + self.drivelist = drivelist + + + while 1: + rc = g.run() + res = bb.buttonPressed(rc) + + if res == TEXT_BACK_CHECK: + self.shutdownUI() + screen.popWindow() + + return INSTALL_BACK + + if len(self.drivelist.getSelection()) < 1: + mustHaveSelectedDrive(intf) + continue + + cur = typebox.current() + if cur == -1: + dispatch.skipStep("autopartitionexecute", skip = 1) + else: + dispatch.skipStep("autopartitionexecute", skip = 0) + + partitions.autoClearPartType = cur + partitions.autoClearPartDrives = self.drivelist.getSelection() + + if queryAutoPartitionOK(intf, diskset, partitions): + self.shutdownUI() + screen.popWindow() + + # XXX we always unskip disk druid in tui right now since + # we don't ask if you want to review amd if you're using + # text mode, we hope you're smart enough to deal (#82474) + dispatch.skipStep("partition", skip = 0) + + return INSTALL_OK + diff --git a/ui/autopart.glade b/ui/autopart.glade new file mode 100644 index 000000000..e8be57e0c --- /dev/null +++ b/ui/autopart.glade @@ -0,0 +1,170 @@ +<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*--> +<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd"> + +<glade-interface> + +<widget class="GtkWindow" id="unused1"> + <property name="title" translatable="yes" context="yes"></property> + <property name="type">GTK_WINDOW_TOPLEVEL</property> + <property name="window_position">GTK_WIN_POS_NONE</property> + <property name="modal">False</property> + <property name="default_width">440</property> + <property name="default_height">250</property> + <property name="resizable">True</property> + <property name="destroy_with_parent">False</property> + <property name="decorated">True</property> + <property name="skip_taskbar_hint">False</property> + <property name="skip_pager_hint">False</property> + <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property> + <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> + <property name="focus_on_map">True</property> + + <child> + <widget class="GtkVBox" id="parttypeBox"> + <property name="border_width">18</property> + <property name="homogeneous">False</property> + <property name="spacing">18</property> + + <child> + <widget class="GtkLabel" id="label1"> + <property name="label" translatable="yes" context="yes">Installation requires partitioning of your hard drive. By default, a partitioning layout is chosen which is reasonable for most users. You can either choose to use this or create your own.</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">True</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkAlignment" id="alignment1"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="yalign">0.5</property> + <property name="xscale">0</property> + <property name="yscale">1</property> + <property name="top_padding">0</property> + <property name="bottom_padding">0</property> + <property name="left_padding">0</property> + <property name="right_padding">0</property> + + <child> + <widget class="GtkComboBox" id="partitionTypeCombo"> + <property name="add_tearoffs">False</property> + <property name="focus_on_click">True</property> + </widget> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkAlignment" id="alignment"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="yalign">0.5</property> + <property name="xscale">0</property> + <property name="yscale">1</property> + <property name="top_padding">0</property> + <property name="bottom_padding">0</property> + <property name="left_padding">30</property> + <property name="right_padding">0</property> + + <child> + <widget class="GtkVBox" id="driveVbox"> + <property name="border_width">6</property> + <property name="homogeneous">False</property> + <property name="spacing">12</property> + + <child> + <widget class="GtkLabel" id="label2"> + <property name="label" translatable="yes" context="yes">_Select the drive(s) to use for this installation.</property> + <property name="use_underline">True</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="mnemonic_widget">partitionTypeCombo</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkScrolledWindow" id="driveScroll"> + <property name="visible">True</property> + <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property> + <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> + <property name="shadow_type">GTK_SHADOW_IN</property> + <property name="window_placement">GTK_CORNER_TOP_LEFT</property> + + <child> + <placeholder/> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + </widget> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkCheckButton" id="reviewButton"> + <property name="label" translatable="yes" context="yes">Re_view and modify partitioning layout</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="active">False</property> + <property name="inconsistent">False</property> + <property name="draw_indicator">True</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="pack_type">GTK_PACK_END</property> + </packing> + </child> + </widget> + </child> +</widget> + +</glade-interface> |