summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Wilson <msw@redhat.com>1999-09-22 23:22:55 +0000
committerMatt Wilson <msw@redhat.com>1999-09-22 23:22:55 +0000
commit41e3dea439ab42cb9f226388dc75b3bc58e5981a (patch)
tree3b6b96a4e6062a4489bffcd2bf97eb993165adbd
parent056336bc2b1f604f6dd603834a7b84a70331c4ee (diff)
downloadanaconda-41e3dea439ab42cb9f226388dc75b3bc58e5981a.tar.gz
anaconda-41e3dea439ab42cb9f226388dc75b3bc58e5981a.tar.xz
anaconda-41e3dea439ab42cb9f226388dc75b3bc58e5981a.zip
turn on swap
-rwxr-xr-xgui.py56
-rw-r--r--iw/rootpartition.py31
2 files changed, 56 insertions, 31 deletions
diff --git a/gui.py b/gui.py
index 5547fbbe6..82bdda2b6 100755
--- a/gui.py
+++ b/gui.py
@@ -112,39 +112,34 @@ class GtkMainThread (Thread):
threads_leave ()
class MessageWindow:
- def quit (self, *args):
- if self.quitmain:
- mainquit ()
- else:
- self.window.destroy ()
+ def quit (self, dialog, button):
+ self.rc = button
+ if self.mutex:
+ self.mutex.set ()
+
+ def okcancelquit (self, button):
+ self.rc = button
+ if self.mutex:
self.mutex.set ()
+
+ def getrc (self):
+ return self.rc
- def __init__ (self, title, text):
+ def __init__ (self, title, text, type = "ok"):
threads_enter ()
- self.window = GtkWindow (WINDOW_POPUP)
- self.window.set_title (title)
- self.window.set_position (WIN_POS_CENTER)
- self.window.set_modal (TRUE)
- box = GtkVBox (5, FALSE)
- box.set_border_width (10)
-
- label = GtkLabel (text)
+ if type == "ok":
+ self.window = GnomeOkDialog (text)
+ self.window.connect ("clicked", self.quit)
+ if type == "okcancel":
+ self.window = GnomeOkCancelDialog (text, self.okcancelquit)
+ # this is the pixmap + the label
+ hbox = self.window.vbox.children ()[0]
+ label = hbox.children ()[1]
label.set_line_wrap (TRUE)
- label.set_alignment (0.0, 0.5)
- box.pack_start (label)
-
- bb = GtkHButtonBox ()
- ok = GnomeStockButton (STOCK_BUTTON_OK)
- bb.pack_start (ok)
- box.pack_end (bb, FALSE, TRUE)
- ok.connect ("clicked", self.quit)
-
- frame = GtkFrame ()
- frame.set_shadow_type (SHADOW_OUT)
- frame.add (box)
- self.window.add (frame)
+ self.window.set_position (WIN_POS_CENTER)
+
self.window.show_all ()
- gdk_flush ()
+
threads_leave ()
# there are two cases to cover here in order to be
@@ -158,12 +153,11 @@ class MessageWindow:
# by the clicked signal handler
thread = currentThread ()
if thread.getName () == "gtk_main":
- self.quitmain = 1
+ self.mutex = None
threads_enter ()
- mainloop ()
+ self.rc = self.window.run ()
threads_leave ()
else:
- self.quitmain = 0
self.mutex = Event ()
self.mutex.wait ()
diff --git a/iw/rootpartition.py b/iw/rootpartition.py
index 8f75e1d51..66912510e 100644
--- a/iw/rootpartition.py
+++ b/iw/rootpartition.py
@@ -3,8 +3,10 @@ from iw import *
from thread import *
import isys
from gui import _
+import gui
from fdisk import *
import isys
+import iutil
class ConfirmPartitionWindow (InstallWindow):
def __init__ (self, ics):
@@ -22,6 +24,7 @@ class ConfirmPartitionWindow (InstallWindow):
return PartitionWindow
class PartitionWindow (InstallWindow):
+ swapon = 0
def __init__ (self, ics):
InstallWindow.__init__ (self, ics)
@@ -30,6 +33,29 @@ class PartitionWindow (InstallWindow):
ics.readHTML ("partition")
ics.setNextEnabled (FALSE)
self.skippedScreen = 0
+ self.swapon = 0
+
+ def checkSwap (self):
+ if PartitionWindow.swapon or (iutil.memInstalled() > 30000):
+ return 1
+
+ threads_leave ()
+ message = gui.MessageWindow(_("Low Memory"),
+ _("As you don't have much memory in this machine, we "
+ "need to turn on swap space immediately. To do this "
+ "we'll have to write your new partition table to the "
+ "disk immediately. Is that okay?"), "okcancel")
+ threads_enter ()
+
+ if (message.getrc () == 1):
+ return 0
+
+ self.todo.ddruid.save ()
+ self.todo.makeFilesystems (createFs = 0)
+ self.todo.ddruidAlreadySaved = 1
+ PartitionWindow.swapon = 1
+
+ return 1
def getNext (self):
self.todo.ddruid.next ()
@@ -60,6 +86,9 @@ class PartitionWindow (InstallWindow):
liloBoot = None
+ if not self.checkSwap ():
+ return PartitionWindow
+
for (mount, device, type, raidType, other) in raid:
self.todo.addMount(device, mount, type)
@@ -87,6 +116,8 @@ class PartitionWindow (InstallWindow):
if self.todo.getSkipPartitioning():
self.skippedScreen = 1
+ if not self.checkSwap ():
+ return AutoPartitionWindow
return None
self.bin = GtkFrame (None, _obj = self.todo.ddruid.getWindow ())