summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xgui.py104
-rw-r--r--iw/account.py45
-rw-r--r--iw/auth.py52
-rw-r--r--iw/iw.py1
-rw-r--r--iw/keyboard.py30
-rw-r--r--iw/language.py13
-rw-r--r--iw/mouse.py49
-rw-r--r--iw/rootpartition.py57
8 files changed, 255 insertions, 96 deletions
diff --git a/gui.py b/gui.py
index a4b247955..746ab2b2b 100755
--- a/gui.py
+++ b/gui.py
@@ -6,6 +6,11 @@ from iw.welcome import *
from iw.progress import *
from iw.package import *
from iw.network import *
+from iw.account import *
+from iw.rootpartition import *
+from iw.auth import *
+from iw.mouse import *
+from iw.keyboard import *
import sys
import GdkImlib
@@ -43,88 +48,6 @@ class NetworkConfigWindow:
vbox.pack_start (hbox, FALSE, padding=10)
return vbox
-class PartitionWindow:
- def back(self, win):
- self.rc = -1
- mainquit()
-
- def next(self, win):
- self.rc = 0
- mainquit()
-
- def __init__(self):
- self.rc = 0
-
- def run(self, todo):
- if (not todo.setupFilesystems): return -2
-
- window = GtkWindow()
- window.set_border_width(10)
- window.set_title("Choose a partition")
-
- label = GtkLabel("What partition would you like to use for your root "
- "partition?")
- label.set_line_wrap (TRUE)
-
- hbox = GtkHBox (FALSE, 10)
-
- device = 'hda'
-
- buttons = {}
- buttons[0] = None;
- numext2 = 0
-
- try:
- isys.makeDevInode(device, '/tmp/' + device)
- table = _balkan.readTable('/tmp/' + device)
- if len(table) - 1 > 0:
- partbox = GtkVBox (FALSE, 5)
- for i in range(0, len(table) - 1):
- (type, start, size) = table[i]
- if (type == 0x83 and size):
- buttons[numext2] = GtkRadioButton(buttons[0],
- '/dev/%s%d' % (device, i + 1))
- partbox.pack_start(buttons[numext2], FALSE, FALSE, 0)
- numext2 = numext2 + 1
- hbox.pack_start(partbox, FALSE, FALSE, 0)
- hbox.pack_start(label, FALSE, FALSE, 0)
- except:
- label = GtkLabel("Unable to read partition information")
- hbox.pack_start(label, TRUE, TRUE, 0)
- print "unable to read partitions"
-
- buttonbox = GtkHButtonBox()
- buttonbox.set_spacing(5)
- buttonbox.set_layout(BUTTONBOX_END)
- button = GtkButton("<- Back")
- button.connect("clicked", self.back)
- buttonbox.add(button)
- button = GtkButton("Next ->")
- button.connect("clicked", self.next)
- buttonbox.add(button)
-
- vbox = GtkVBox (FALSE, 10)
- vbox.pack_start(hbox, TRUE, TRUE, 0)
- vbox.pack_start(buttonbox, FALSE, FALSE, 0)
-
- window.add(vbox)
- window.set_position(WIN_POS_CENTER)
- window.show_all()
-
- sleep (20);
-
-
- rootpart = ""
- for i in range(0, numext2):
- if buttons[i].active:
- rootpart = "%s%d" % (device, i + 1)
-
- todo.addMount(rootpart, '/')
-
- window.destroy()
-
- return self.rc
-
class WaitWindow:
def __init__(self, title, text):
threads_enter ()
@@ -171,19 +94,13 @@ class InstallInterface:
traceback.print_exception (type, value, tb)
def run (self, todo):
- sys.setcheckinterval (0)
start_new_thread (GtkMainThread ().run, ())
- steps = [
- ["Welcome", WelcomeWindow, ()],
- ["Partition", PartitionWindow, (todo,)]
- ]
-
- steps = [WelcomeWindow, LanguageWindow, NetworkWindow,
- PackageSelectionWindow, InstallProgressWindow]
+ steps = [WelcomeWindow, LanguageWindow, MouseWindow, KeyboardWindow, NetworkWindow, PartitionWindow,
+ PackageSelectionWindow, AuthWindow, AccountWindow, InstallProgressWindow]
- windows = [WelcomeWindow, LanguageWindow, NetworkWindow,
- PackageSelectionWindow, IndividualPackageSelectionWindow,
+ windows = [WelcomeWindow, LanguageWindow, MouseWindow, KeyboardWindow, NetworkWindow, PartitionWindow,
+ PackageSelectionWindow, AuthWindow, AccountWindow, IndividualPackageSelectionWindow,
InstallProgressWindow]
icw = InstallControlWindow (self, steps, windows, todo)
@@ -238,6 +155,7 @@ class InstallControlWindow:
self.bin.remove (self.installFrame)
self.table.attach (self.installFrame, 1, 3, 0, 1)
self.bin.add (self.table)
+ self.html.source (self.currentScreen.getICS ().getHTML ())
self.hideHelpButton.show ()
self.showHelpButton.set_state (STATE_NORMAL)
@@ -411,6 +329,7 @@ class InstallControlState:
return self.title
def setPrevEnabled (self, value):
+ if value == self.prevEnabled: return
self.prevEnabled = value
self.cw.update (self)
@@ -420,6 +339,7 @@ class InstallControlState:
return FALSE
def setNextEnabled (self, value):
+ if value == self.nextEnabled: return
self.nextEnabled = value
self.cw.update (self)
diff --git a/iw/account.py b/iw/account.py
new file mode 100644
index 000000000..a66a9b8df
--- /dev/null
+++ b/iw/account.py
@@ -0,0 +1,45 @@
+from gtk import *
+from iw import *
+
+class AccountWindow (InstallWindow):
+
+ def __init__ (self, ics):
+ InstallWindow.__init__ (self, ics)
+
+ self.todo = ics.getToDo ()
+ ics.setTitle ("Account Configuration")
+ ics.setHTML ("<HTML><BODY>Enter a root password. The password "
+ "must be at least six characters in length."
+ "<p>The \"Next\" button will become enabled when both entry fields match."
+ "</BODY></HTML>")
+
+ def getNext (self):
+ self.todo.rootpassword.set (self.pw.get_text ())
+ return None
+
+ def passwordsMatch (self, *args):
+ pw = self.pw.get_text ()
+ confirm = self.confirm.get_text ()
+
+ if pw == confirm and len (pw) >= 6:
+ self.ics.setNextEnabled (TRUE)
+ else:
+ self.ics.setNextEnabled (FALSE)
+
+ def getScreen (self):
+ box = GtkVBox ()
+ table = GtkTable (2, 2)
+ table.attach (GtkLabel ("Root Password: "), 0, 1, 0, 1)
+ table.attach (GtkLabel ("Confirm: "), 0, 1, 1, 2)
+ self.pw = GtkEntry (8)
+ self.pw.connect ("changed", self.passwordsMatch)
+ self.pw.set_visibility (FALSE)
+ self.confirm = GtkEntry (8)
+ self.confirm.set_visibility (FALSE)
+ self.confirm.connect ("changed", self.passwordsMatch)
+ table.attach (self.pw, 1, 2, 0, 1)
+ table.attach (self.confirm, 1, 2, 1, 2)
+
+ box.pack_start (table, FALSE)
+
+ return box
diff --git a/iw/auth.py b/iw/auth.py
new file mode 100644
index 000000000..43d958aeb
--- /dev/null
+++ b/iw/auth.py
@@ -0,0 +1,52 @@
+from gtk import *
+from iw import *
+
+class AuthWindow (InstallWindow):
+
+ def __init__ (self, ics):
+ InstallWindow.__init__ (self, ics)
+
+ self.todo = ics.getToDo ()
+ ics.setTitle ("Authentication Configuration")
+ ics.setHTML ("<HTML><BODY>Select authentication methods"
+ "</BODY></HTML>")
+ ics.setNextEnabled (TRUE)
+
+ def getScreen (self):
+ box = GtkVBox (FALSE, 10)
+ self.md5 = GtkCheckButton ("Enable MD5 passwords")
+ self.shadow = GtkCheckButton ("Enable shadow passwords")
+
+ self.nis = GtkCheckButton ("Enable NIS")
+ self.nisBroadcast = GtkCheckButton ("Use broadcast to find NIS server")
+ self.nisDomain = GtkEntry ()
+ self.nisServer = GtkEntry ()
+
+ domainLabel = GtkLabel ("NIS Domain: ")
+ domainLabel.set_alignment (0, 0)
+ serverLabel = GtkLabel ("NIS Server: ")
+ serverLabel.set_alignment (0, 0)
+
+ hbox1 = GtkHBox ()
+ hbox1.pack_start (domainLabel, FALSE)
+ hbox1.pack_start (self.nisDomain)
+
+ hbox2 = GtkHBox ()
+ hbox2.pack_start (serverLabel, FALSE)
+ hbox2.pack_start (self.nisServer)
+
+ a = GtkAlignment (0, 0)
+ a.add (self.nisBroadcast)
+
+ table = GtkTable (10, 4)
+ table.attach (self.nis, 0, 10, 0, 1)
+ table.attach (hbox1, 2, 10, 1, 2)
+ table.attach (a, 2, 10, 2, 3, xoptions = EXPAND|FILL)
+ table.attach (hbox2, 4, 10, 3, 4)
+
+ box.pack_start (self.md5, FALSE)
+ box.pack_start (self.shadow, FALSE)
+ box.pack_start (table, FALSE)
+
+ return box
+
diff --git a/iw/iw.py b/iw/iw.py
index fc6dc7438..5b3a22a5c 100644
--- a/iw/iw.py
+++ b/iw/iw.py
@@ -1,6 +1,7 @@
class InstallWindow:
def __init__ (self,ics):
self.ics = ics
+ self.todo = ics.getToDo ()
def getNext (self):
return None
diff --git a/iw/keyboard.py b/iw/keyboard.py
new file mode 100644
index 000000000..9f0bb708d
--- /dev/null
+++ b/iw/keyboard.py
@@ -0,0 +1,30 @@
+from gtk import *
+from iw import *
+
+class KeyboardWindow (InstallWindow):
+
+ def __init__ (self, ics):
+ InstallWindow.__init__ (self, ics)
+
+ ics.setTitle ("Keyboard Configuration")
+ ics.setHTML ("<HTML><BODY>Select your keyboard."
+ "</BODY></HTML>")
+ ics.setNextEnabled (TRUE)
+
+ def getNext (self):
+ self.todo.keyboard.set (self.keyboardList.get_selection ()[0].children ()[0].get ())
+ return None
+
+ def getScreen (self):
+
+ 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
diff --git a/iw/language.py b/iw/language.py
index 9b5b315b9..2c38b71a9 100644
--- a/iw/language.py
+++ b/iw/language.py
@@ -11,10 +11,11 @@ class LanguageWindow (InstallWindow):
ics.setHTML ("<HTML><BODY>Select which language you would like"
"to use for the system default.</BODY></HTML>")
- self.languages = ["English", "German", "French", "Spanish",
- "Hungarian", "Japanese", "Chinese", "Korean"]
self.question = ("What language should be used during the "
"installation process?")
+
+ def languageSelected (self, button, locale):
+ self.todo.language.set (locale)
def getScreen (self):
mainBox = GtkVBox (FALSE, 10)
@@ -22,10 +23,14 @@ class LanguageWindow (InstallWindow):
label.set_alignment (0.5, 0.5)
box = GtkVBox (FALSE, 10)
- language1 = GtkRadioButton (None, self.languages[0])
+ language_keys = self.todo.language.available ().keys ()
+ language1 = GtkRadioButton (None, language_keys[0])
+ language1.connect ("clicked", self.languageSelected, language_keys[0])
+ self.todo.language.set (language_keys[0])
box.pack_start (language1, FALSE)
- for locale in self.languages[1:]:
+ for locale in language_keys[1:]:
language = GtkRadioButton (language1, locale)
+ language.connect ("clicked", self.languageSelected, locale)
box.pack_start (language, FALSE)
align = GtkAlignment (0.5, 0.5)
diff --git a/iw/mouse.py b/iw/mouse.py
new file mode 100644
index 000000000..90f7d2b71
--- /dev/null
+++ b/iw/mouse.py
@@ -0,0 +1,49 @@
+from gtk import *
+from iw import *
+
+class MouseWindow (InstallWindow):
+
+ def __init__ (self, ics):
+ InstallWindow.__init__ (self, ics)
+
+ ics.setTitle ("Mouse Configuration")
+ ics.setHTML ("<HTML><BODY>Select your mouse."
+ "</BODY></HTML>")
+ ics.setNextEnabled (TRUE)
+
+ def getNext (self):
+ self.todo.mouse.set (self.typeList.get_selection ()[0].children ()[0].get ())
+ return None
+
+ def getScreen (self):
+ box = GtkVBox (FALSE, 5)
+
+ sw = GtkScrolledWindow ()
+ sw.set_border_width (5)
+ sw.set_policy (POLICY_AUTOMATIC, POLICY_AUTOMATIC)
+ self.locList = GtkList ()
+ self.locList.set_selection_mode (SELECTION_BROWSE)
+ devs = ("PS/2 Port (psaux)", "COM 1 (ttyS0)",
+ "COM 2 (ttyS1)", "COM 3 (ttyS2)", "COM 4 (ttyS3)")
+ self.locList.append_items (map (GtkListItem, devs))
+ frame = GtkFrame ()
+ frame.set_shadow_type (SHADOW_IN)
+ frame.add (self.locList)
+ frame.set_border_width (5)
+ box.pack_start (frame, FALSE)
+
+ sw = GtkScrolledWindow ()
+ sw.set_border_width (5)
+ sw.set_policy (POLICY_AUTOMATIC, POLICY_AUTOMATIC)
+ self.typeList = GtkList ()
+ self.typeList.set_selection_mode (SELECTION_BROWSE)
+ sorted_mice = self.todo.mouse.available ()
+ sorted_mice.sort ()
+ self.typeList.append_items (map (GtkListItem, sorted_mice))
+ sw.add_with_viewport (self.typeList)
+ box.pack_start (sw)
+
+ return box
+
+
+
diff --git a/iw/rootpartition.py b/iw/rootpartition.py
new file mode 100644
index 000000000..9598abeed
--- /dev/null
+++ b/iw/rootpartition.py
@@ -0,0 +1,57 @@
+from gtk import *
+from iw import *
+import isys
+import _balkan
+
+class PartitionWindow (InstallWindow):
+
+ def __init__ (self, ics):
+ InstallWindow.__init__ (self, ics)
+
+ self.todo = ics.getToDo ()
+ ics.setTitle ("Root Partition Selection")
+ ics.setHTML ("<HTML><BODY>Select a root partition"
+ "</BODY></HTML>")
+ ics.setNextEnabled (TRUE)
+
+ def getNext (self):
+ for i in self.buttons.keys ():
+ if self.buttons[i].active:
+ rootpart = "%s%d" % (self.device, i + 1)
+
+ self.todo.addMount(rootpart, '/')
+ return None
+
+ def getScreen (self):
+ label = GtkLabel("What partition would you like to use for your root "
+ "partition?")
+ label.set_line_wrap (TRUE)
+
+ hbox = GtkVBox (FALSE, 10)
+
+ self.device = 'hda'
+
+ self.buttons = {}
+ self.buttons[0] = None
+ numext2 = 0
+
+ try:
+ isys.makeDevInode(self.device, '/tmp/' + self.device)
+ table = _balkan.readTable('/tmp/' + self.device)
+ if len(table) - 1 > 0:
+ partbox = GtkVBox (FALSE, 5)
+ for i in range(0, len(table) - 1):
+ (type, start, size) = table[i]
+ if (type == 0x83 and size):
+ button = GtkRadioButton(self.buttons[0],
+ '/dev/%s%d' % (self.device, i + 1))
+ self.buttons[i] = button
+ partbox.pack_start(button, FALSE, FALSE, 0)
+ hbox.pack_start(label, FALSE, FALSE, 0)
+ hbox.pack_start(partbox, FALSE, FALSE, 0)
+ except:
+ label = GtkLabel("Unable to read partition information")
+ hbox.pack_start(label, TRUE, TRUE, 0)
+ print "unable to read partitions"
+
+ return hbox