Because currently this would only happen during the graphical-mode-memory-check.
While at it I changed the text composing in check_memory() so the strings are translatable. --- anaconda | 75 +++++++++++++++++++++++++++++++++++++------------------------ 1 files changed, 45 insertions(+), 30 deletions(-)
diff --git a/anaconda b/anaconda index e369d64..28bbada 100755 --- a/anaconda +++ b/anaconda @@ -314,57 +314,72 @@ def runVNC(): sys.stdin.readline() iutil.execConsole()
+def gtk_warning(title, reason): + import gtk + dialog = gtk.MessageDialog(type = gtk.MESSAGE_ERROR, + buttons = gtk.BUTTONS_CLOSE, + message_format=reason) + dialog.set_title(title) + dialog.run() + sys.exit(1) + def check_memory(anaconda, opts, display_mode=None): + reason_strict = _('You do not have enough RAM to install %s ' + 'on this machine.\n' % product.productName) + reason_method = _('You do not have enough RAM to install %s ' + 'on this machine using this install method.\n' % + product.productName) + reason_graphical = _('You do not have enough RAM to use the graphical ' + 'installer.') + reboot_extra = _('\n' + 'Press <return> to reboot your system.\n') + livecd_title = _("Not enough RAM") + livecd_extra =_(" Try the text mode installer by running:\n\n" + "'/usr/bin/liveinst -T'\n\n from a root " + "terminal.") + nolivecd_extra = _(" Starting text mode.")
if not display_mode: display_mode = anaconda.displayMode
extra_ram = 0 - reason = '' + reason = reason_strict if opts.stage2 and opts.stage2.startswith(('http', 'ftp', '@')): extra_ram += isys.URL_INSTALL_EXTRA_RAM - reason = " using this install method" + reason = reason_method
total_ram = isys.total_memory() - needed_ram = isys.MIN_RAM + extra_ram + if needed_ram > total_ram: from snack import SnackScreen, ButtonChoiceWindow - screen = SnackScreen() - ButtonChoiceWindow(screen, _('Fatal Error'), - _('You do not have enough RAM to install %s ' - 'on this machine%s.\n' - '\n' - 'Press <return> to reboot your system.\n') - %(product.productName, reason), - buttons = (_("OK"),)) - screen.finish() - sys.exit(0) + if opts.liveinst: + stdoutLog.warning(reason) + gtk_warning(livecd_title, reason) + else: + reason += reboot_extra + screen = SnackScreen() + ButtonChoiceWindow(screen, _('Fatal Error'), + reason, + buttons = (_("OK"),)) + screen.finish() + sys.exit(1)
# override display mode if machine cannot nicely run X if display_mode not in ('t', 'c') and not flags.usevnc: needed_ram += isys.GUI_INSTALL_EXTRA_RAM + reason = reason_graphical
if needed_ram > total_ram: - complain = _("You do not have enough RAM to use the graphical " - "installer.") - if flags.livecdInstall: - stdoutLog.warning(complain) - recommendation = _("Try the text mode installer by running:\n\n" - "'/usr/bin/liveinst -T'\n\n from a root " - "terminal.") - title = _("Not enough RAM") - text = "%s %s" %(complain, recommendation) - import gtk - dialog = gtk.MessageDialog(type = gtk.MESSAGE_ERROR, - buttons = gtk.BUTTONS_CLOSE, - message_format=text) - dialog.set_title(title) - dialog.run() + if opts.liveinst: + reason += livecd_extra + stdoutLog.warning(reason) + title = livecd_title + gtk_warning(title, reason) sys.exit(1) else: - resolution = _("Starting text mode.") - stdoutLog.warning("%s %s" % (complain, resolution)) + reason += nolivecd_extra + stdoutLog.warning(reason) anaconda.displayMode = 't' time.sleep(2)
--- pyanaconda/isys/mem.c | 2 +- pyanaconda/isys/mem.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/pyanaconda/isys/mem.c b/pyanaconda/isys/mem.c index 3003ba0..cd77729 100644 --- a/pyanaconda/isys/mem.c +++ b/pyanaconda/isys/mem.c @@ -85,7 +85,7 @@ int totalMemory(void) { total = (total / 128 + 1) * 128; total *= 1024;
- logMessage(INFO, "%d kB are available", total); + logMessage(INFO, "%d kB (%d MB) are available", total, total / 1024);
return total; } diff --git a/pyanaconda/isys/mem.h b/pyanaconda/isys/mem.h index 1a715d4..d664144 100644 --- a/pyanaconda/isys/mem.h +++ b/pyanaconda/isys/mem.h @@ -28,7 +28,7 @@ #define MIN_RAM 256 * 1024 // 256 MB #define GUI_INSTALL_EXTRA_RAM 128 * 1024 // 128 MB #endif -#define URL_INSTALL_EXTRA_RAM 128 * 1024 // 128 MB +#define URL_INSTALL_EXTRA_RAM 192 * 1024 // 192 MB #define MIN_GUI_RAM MIN_RAM + GUI_INSTALL_EXTRA_RAM #define EARLY_SWAP_RAM 512 * 1024 // 512 MB
See my comments.
-- Martin Sivák msivak@redhat.com Red Hat Czech Anaconda team / Brno, CZ
+def gtk_warning(title, reason):
- import gtk
- dialog = gtk.MessageDialog(type = gtk.MESSAGE_ERROR,
buttons = gtk.BUTTONS_CLOSE,
message_format=reason)
- dialog.set_title(title)
- dialog.run()
- sys.exit(1)
You should replace sys.exit(1) with dialog.destroy() to hide the dialog and let the calling method to do the exit.
if opts.liveinst:
stdoutLog.warning(reason)
gtk_warning(livecd_title, reason)
else:
reason += reboot_extra
screen = SnackScreen()
ButtonChoiceWindow(screen, _('Fatal Error'),
reason,
buttons = (_("OK"),))
screen.finish()
sys.exit(1)
Here..
)
dialog.set_title(title)
dialog.run()
if opts.liveinst:
reason += livecd_extra
stdoutLog.warning(reason)
title = livecd_title
gtk_warning(title, reason) sys.exit(1)
And here..
anaconda-devel@lists.stg.fedoraproject.org