summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--text.py89
-rw-r--r--xserver.py54
2 files changed, 54 insertions, 89 deletions
diff --git a/text.py b/text.py
index bf030bba9..ed72a7472 100644
--- a/text.py
+++ b/text.py
@@ -38,6 +38,7 @@ from packages_text import PackageDepWindow
from timezone_text import TimezoneWindow
from bootdisk_text import BootDiskWindow
from bootdisk_text import MakeBootDiskWindow
+from mouse_text import MouseWindow, MouseDeviceWindow
import installclass
@@ -94,90 +95,6 @@ class LanguageWindow:
return INSTALL_OK
-class MouseDeviceWindow:
- def __call__(self, screen, todo):
- choices = { _("/dev/ttyS0 (COM1 under DOS)") : "ttyS0",
- _("/dev/ttyS1 (COM2 under DOS)") : "ttyS1",
- _("/dev/ttyS2 (COM3 under DOS)") : "ttyS2",
- _("/dev/ttyS3 (COM4 under DOS)") : "ttyS3" }
-
- i = 0
- default = 0
- mouse = todo.mouse.getDevice()
- if (mouse[0:4] != "ttyS"): return INSTALL_NOOP
-
- l = choices.keys()
- l.sort()
- for choice in l:
- if choices[choice] == mouse:
- default = i
- break
- i = i + 1
-
- (button, result) = ListboxChoiceWindow(screen, _("Device"),
- _("What device is your mouse located on? %s %i") % (mouse, default), l,
- [ _("Ok"), _("Back") ], help = "mousedevice", default = default )
- if (button == string.lower(_("Back"))): return INSTALL_BACK
-
- todo.mouse.setDevice(choices[l[result]])
-
- #import sys; sys.exit(0)
-
- return INSTALL_OK
-
-class MouseWindow:
- def __call__(self, screen, todo):
- if todo.serial:
- return INSTALL_NOOP
- mice = todo.mouse.available ().keys ()
- mice.sort ()
- (default, emulate) = todo.mouse.get ()
- if default == "Sun - Mouse":
- return INSTALL_NOOP
- default = mice.index (default)
-
- bb = ButtonBar(screen, [_("OK"), _("Back")])
- t = TextboxReflowed(40,
- _("Which model mouse is attached to this computer?"))
- l = Listbox(8, scroll = 1, returnExit = 0)
-
- key = 0
- for mouse in mice:
- l.append(mouse, key)
- key = key + 1
- l.setCurrent(default)
-
- c = Checkbox(_("Emulate 3 Buttons?"), isOn = emulate)
-
- g = GridFormHelp(screen, _("Mouse Selection"), "mousetype", 1, 4)
- g.add(t, 0, 0)
- g.add(l, 0, 1, padding = (0, 1, 0, 1))
- g.add(c, 0, 2, padding = (0, 0, 0, 1))
- g.add(bb, 0, 3, growx = 1)
-
- rc = g.runOnce()
-
- button = bb.buttonPressed(rc)
-
- if button == string.lower (_("Back")):
- return INSTALL_BACK
-
- choice = l.current()
- emulate = c.selected()
-
- todo.mouse.set(mice[choice], emulate)
-
- oldDev = todo.mouse.getDevice()
- if (oldDev):
- newDev = todo.mouse.available()[mice[choice]][2]
- if ((oldDev[0:4] == "ttyS" and newDev[0:4] == "ttyS") or
- (oldDev == newDev)):
- pass
- else:
- todo.mouse.setDevice(newDev)
-
- return INSTALL_OK
-
class KeyboardWindow:
def __call__(self, screen, todo):
if todo.serial:
@@ -989,9 +906,9 @@ class InstallInterface:
"network"],
[N_("Network Setup"), NetworkWindow, (self.screen, todo),
"network"],
- [N_("Mouse Configuration"), MouseWindow, (self.screen, todo),
+ [N_("Mouse Configuration"), MouseWindow, (self.screen, todo.mouse),
"mouse" ],
- [N_("Mouse Configuration"), MouseDeviceWindow, (self.screen, todo),
+ [N_("Mouse Configuration"), MouseDeviceWindow, (self.screen, todo.mouse),
"mouse" ],
[N_("Time Zone Setup"), TimezoneWindow,
(self.screen, todo, test), "timezone" ],
diff --git a/xserver.py b/xserver.py
index 65bc00b42..e5362b3da 100644
--- a/xserver.py
+++ b/xserver.py
@@ -8,7 +8,56 @@ from xf86config import *
from kbd import Keyboard
from mouse import Mouse
import time
+from snack import *
+from translate import _
+from constants_text import *
+from mouse_text import MouseWindow, MouseDeviceWindow
+def mouseWindow(mouse):
+ screen = SnackScreen()
+
+ STEP_MESSAGE = 0
+ STEP_TYPE = 1
+ STEP_DEVICE = 2
+ STEP_DONE = 3
+ step = 0
+ while step < STEP_DONE:
+ if step == STEP_MESSAGE:
+ button = ButtonChoiceWindow(screen, _("Mouse Not Detected"),
+ _("Your mouse was not automatically "
+ "detected. To proceed in the graphical "
+ "installation mode, please proceed to "
+ "the next screen and provide your mouse "
+ "information. You may also use text mode "
+ "installation which does not require a mouse."),
+ buttons = [ _("OK"), _("Use text mode") ])
+ if button == string.lower (_("Use text mode")):
+ screen.finish ()
+ return 0
+ else:
+ step = STEP_TYPE
+ continue
+
+ if step == STEP_TYPE:
+ rc = MouseWindow()(screen, mouse)
+ if rc == INSTALL_BACK:
+ step = STEP_MESSAGE
+ continue
+ else:
+ step = STEP_DEVICE
+ continue
+
+ if step == STEP_DEVICE:
+ rc = MouseDeviceWindow()(screen, mouse)
+ if rc == INSTALL_BACK:
+ step = STEP_TYPE
+ continue
+ else:
+ step = STEP_DONE
+ continue
+ screen.finish()
+ return 1
+
def startX():
global serverPath
global mode
@@ -20,9 +69,8 @@ def startX():
mouse = Mouse()
if not mouse.probe ():
- print "No mouse detected, GUI startup can not continue."
- time.sleep (1)
- print "Falling back to Text mode"
+ if not mouseWindow(mouse):
+ raise RuntimeError, "failed to get a mouse for X startup"
x = XF86Config (mouse)
x.probe ()