diff options
author | pnfisher <pnfisher> | 1999-08-13 23:20:11 +0000 |
---|---|---|
committer | pnfisher <pnfisher> | 1999-08-13 23:20:11 +0000 |
commit | ef2df67e146d1108b8f6e110114bf8efccb55cad (patch) | |
tree | 76552f426a78be3855ef3228f928ddd315143003 /iw | |
parent | d8eeaf413269c8e9addfae0ed75a6df0feea307d (diff) | |
download | anaconda-ef2df67e146d1108b8f6e110114bf8efccb55cad.tar.gz anaconda-ef2df67e146d1108b8f6e110114bf8efccb55cad.tar.xz anaconda-ef2df67e146d1108b8f6e110114bf8efccb55cad.zip |
Implment basic autopartitioning, and rework thread logic in gui.py
Diffstat (limited to 'iw')
-rw-r--r-- | iw/autopartition.py | 48 | ||||
-rw-r--r-- | iw/keyboard.py | 54 | ||||
-rw-r--r-- | iw/network.py | 1 | ||||
-rw-r--r-- | iw/package.py | 56 | ||||
-rw-r--r-- | iw/rootpartition.py | 16 |
5 files changed, 143 insertions, 32 deletions
diff --git a/iw/autopartition.py b/iw/autopartition.py new file mode 100644 index 000000000..017dd109a --- /dev/null +++ b/iw/autopartition.py @@ -0,0 +1,48 @@ +from gtk import * +from iw import * +from thread import * + +FSEDIT_CLEAR_LINUX = (1 << 0) +FSEDIT_CLEAR_ALL = (1 << 2) +FSEDIT_USE_EXISTING = (1 << 3) + +class AutoPartitionWindow (InstallWindow): + + def __init__ (self, ics): + InstallWindow.__init__ (self, ics) + + self.todo = ics.getToDo () + ics.setTitle ("Auto partition") + ics.setNextEnabled (TRUE) + + def getNext (self): + attempt = [ + ( "/boot", 16, 0x83, 0, -1 ), + ( "/", 256, 0x83, 0, -1 ), + ( "/usr", 512, 0x83, 1, -1 ), + ( "/var", 256, 0x83, 0, -1 ), + ( "/home", 512, 0x83, 1, -1 ), + ( "Swap-auto", 64, 0x82, 0, -1 ), + ] + + ret = self.todo.ddruid.attempt (attempt, "Workstation", self.type) + return None + + def typeSelected (self, button, data): + self.type = data + + def getScreen (self): + box = GtkVBox (FALSE) + + group = GtkRadioButton (None, "Remove all data") + group.connect ("clicked", self.typeSelected, FSEDIT_CLEAR_ALL) + box.pack_start (group, FALSE) + item = GtkRadioButton (group, "Remove Linux partitions") + item.connect ("clicked", self.typeSelected, FSEDIT_CLEAR_LINUX) + box.pack_start (item, FALSE) + item = GtkRadioButton (group, "Use existing free space") + item.connect ("clicked", self.typeSelected, FSEDIT_USE_EXISTING) + box.pack_start (item, FALSE) + item.set_active (TRUE) + + return box diff --git a/iw/keyboard.py b/iw/keyboard.py index 9f0bb708d..eec6e48ce 100644 --- a/iw/keyboard.py +++ b/iw/keyboard.py @@ -1,5 +1,6 @@ from gtk import * from iw import * +import xkb class KeyboardWindow (InstallWindow): @@ -10,21 +11,56 @@ class KeyboardWindow (InstallWindow): ics.setHTML ("<HTML><BODY>Select your keyboard." "</BODY></HTML>") ics.setNextEnabled (TRUE) + self.kb = xkb.XKB () + self.rules = self.kb.getRules () def getNext (self): - self.todo.keyboard.set (self.keyboardList.get_selection ()[0].children ()[0].get ()) +# self.todo.keyboard.set (self.keyboardList.get_selection ()[0].children ()[0].get ()) return None def getScreen (self): + print self.todo.keyboard.available () + box = GtkVBox (FALSE) + box.pack_start (GtkLabel ("Model"), FALSE) sw = GtkScrolledWindow () sw.set_border_width (5) sw.set_policy (POLICY_AUTOMATIC, POLICY_AUTOMATIC) - self.keyboardList = GtkList () - self.keyboardList.set_selection_mode (SELECTION_BROWSE) - sorted_keyboards = self.todo.keyboard.available () - sorted_keyboards.sort () - self.keyboardList.append_items (map (GtkListItem, sorted_keyboards)) - sw.add_with_viewport (self.keyboardList) - - return sw + self.modelList = GtkCList () + self.modelList.set_selection_mode (SELECTION_BROWSE) + for model in self.rules[0].values (): + self.modelList.append ((model,)) + self.modelList.columns_autosize () + sw.add (self.modelList) + box.pack_start (sw, TRUE) + + box.pack_start (GtkLabel ("Layout"), FALSE) + sw = GtkScrolledWindow () + sw.set_border_width (5) + sw.set_policy (POLICY_AUTOMATIC, POLICY_AUTOMATIC) + self.layoutList = GtkCList () + self.layoutList.set_selection_mode (SELECTION_BROWSE) + layouts = self.rules[1].values () + layouts.sort () + for layout in layouts: + self.layoutList.append ((layout,)) + self.layoutList.columns_autosize () + sw.add (self.layoutList) + box.pack_start (sw, TRUE) + + box.pack_start (GtkLabel ("Variant"), FALSE) + sw = GtkScrolledWindow () + sw.set_border_width (5) + sw.set_policy (POLICY_AUTOMATIC, POLICY_AUTOMATIC) + self.variantList = GtkCList () + self.variantList.set_selection_mode (SELECTION_BROWSE) + self.variantList.append (("None",)) + for variant in self.rules[2].values (): + self.variantList.append ((variant,)) + self.variantList.columns_autosize () + sw.add (self.variantList) + box.pack_start (sw, FALSE) + + print self.kb.getOptions () + + return box diff --git a/iw/network.py b/iw/network.py index 458e6dd1b..9eb09760d 100644 --- a/iw/network.py +++ b/iw/network.py @@ -81,6 +81,7 @@ class NetworkWindow (InstallWindow): devLine.pack_start (devLabel) menu = GtkMenu () self.devs = self.todo.network.available () + print self.devs if self.devs: self.devs.keys ().sort () self.dev = self.devs[self.devs.keys()[0]] diff --git a/iw/package.py b/iw/package.py index f7da28eb4..a6b0d4042 100644 --- a/iw/package.py +++ b/iw/package.py @@ -36,7 +36,7 @@ class IndividualPackageSelectionWindow (InstallWindow): if (x == ()): return () if (len (x) == 1): return (x[0],) else: return (x[0], self.build_tree (x[1:])) - + def merge (self, a, b): if a == (): return self.build_tree (b) if b == (): return a @@ -369,7 +369,7 @@ class PackageSelectionWindow (InstallWindow): "</BODY></HTML>") def getNext (self): - if self.individualPackages.get_active (): + if self.individualPackages.get_active (): return IndividualPackageSelectionWindow else: return None @@ -384,23 +384,33 @@ class PackageSelectionWindow (InstallWindow): sw.set_border_width (5) sw.set_policy (POLICY_AUTOMATIC, POLICY_AUTOMATIC) - box = GtkVBox (FALSE, 10) + self.groupList = GtkCList () + self.groupList.set_selection_mode (SELECTION_MULTIPLE) + + self.groupList.freeze () for comp in self.todo.comps: if not comp.hidden: - checkButton = GtkCheckButton (comp.name) - checkButton.set_active (comp.selected) - - def toggled (widget, comp): - if widget.get_active (): - comp.select (0) - else: - comp.unselect (0) - - checkButton.connect ("toggled", toggled, comp) + row = self.groupList.append ((comp.name,)) + if comp.selected: + self.groupList.select_row (row, 0) - box.pack_start (checkButton) + self.groupList.set_row_data (row, comp) - sw.add_with_viewport (box) + self.groupList.columns_autosize () + self.groupList.thaw () + + def selectRow (widget, row, *args): + comp = widget.get_row_data (row) + comp.select (0) + + def unselectRow (widget, row, *args): + comp = widget.get_row_data (row) + comp.unselect (0) + + self.groupList.connect ("select-row", selectRow) + self.groupList.connect ("unselect-row", unselectRow) + + sw.add (self.groupList) vbox = GtkVBox (FALSE, 5) self.individualPackages = GtkCheckButton ("Select individual packages") @@ -413,3 +423,19 @@ class PackageSelectionWindow (InstallWindow): return vbox + +# box = GtkVBox (FALSE, 10) + +# checkButton = GtkCheckButton (comp.name) +# checkButton.set_active (comp.selected) + +# def selectRow (widget, row, *args): +# if widget.get_active (): +# comp.select (0) +# else: +# comp.unselect (0) + +# self.groupList.connect ("select-row", toggled, comp) +# self.groupList.connect ("unselect-row", toggled, comp) + +# box.pack_start (checkButton) diff --git a/iw/rootpartition.py b/iw/rootpartition.py index d5d7d55fb..fef911bae 100644 --- a/iw/rootpartition.py +++ b/iw/rootpartition.py @@ -28,6 +28,13 @@ class PartitionWindow (InstallWindow): ics.setHTML ("<HTML><BODY>Select a root partition" "</BODY></HTML>") ics.setNextEnabled (TRUE) + from gnomepyfsedit import fsedit + + if not self.todo.ddruid: + self.todo.ddruid = \ + fsedit(1, self.todo.drives.available ().keys (), []) + self.todo.ddruid.setCallback (self.enableCallback, self) + def getNext (self): print "calling self.ddruid.next ()" @@ -52,14 +59,7 @@ class PartitionWindow (InstallWindow): def enableCallback (self, value): self.ics.setNextEnabled (value) - def getScreen (self): - from gnomepyfsedit import fsedit - - if not self.todo.ddruid: - self.todo.ddruid = \ - fsedit(1, self.todo.drives.available ().keys (), []) - self.todo.ddruid.setCallback (self.enableCallback, self) - + def getScreen (self): self.bin = GtkFrame (None, _obj = self.todo.ddruid.getWindow ()) self.bin.set_shadow_type (SHADOW_NONE) self.todo.ddruid.edit () |