FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Gentoo > Gentoo User

 
 
LinkBack Thread Tools
 
Old 08-26-2010, 01:08 PM
Ales Kozumplik
 
Default memory: check_memory() displays GUI dialog on livecd (#624534).

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.
' % product.productName)
+ reason_method = _('You do not have enough RAM to install %s '
+ 'on this machine using this install method.
' %
+ product.productName)
+ reason_graphical = _('You do not have enough RAM to use the graphical '
+ 'installer.')
+ reboot_extra = _('
'
+ 'Press <return> to reboot your system.
')
+ livecd_title = _("Not enough RAM")
+ livecd_extra =_(" Try the text mode installer by running:

"
+ "'/usr/bin/liveinst -T'

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.
'
- '
'
- 'Press <return> to reboot your system.
')
- %(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:

"
- "'/usr/bin/liveinst -T'

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)

--
1.7.1.1

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 

Thread Tools




All times are GMT. The time now is 01:53 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org