diff options
-rwxr-xr-x | gui.py | 1 | ||||
-rw-r--r-- | iw/mouse_gui.py | 280 | ||||
-rw-r--r-- | text.py | 1 | ||||
-rw-r--r-- | textw/mouse_text.py | 118 |
4 files changed, 0 insertions, 400 deletions
@@ -61,7 +61,6 @@ mainWindow = None stepToClass = { "language" : ("language_gui", "LanguageWindow"), "keyboard" : ("kbd_gui", "KeyboardWindow"), - "mouse" : ("mouse_gui", "MouseWindow"), "welcome" : ("welcome_gui", "WelcomeWindow"), "zfcpconfig" : ("zfcp_gui", "ZFCPWindow"), "partitionmethod" : ("partmethod_gui", "PartitionMethodWindow"), diff --git a/iw/mouse_gui.py b/iw/mouse_gui.py deleted file mode 100644 index ac94bcf7b..000000000 --- a/iw/mouse_gui.py +++ /dev/null @@ -1,280 +0,0 @@ -# -# mouse_gui.py: gui mouse configuration. -# -# Copyright (C) 2000, 2001, 2002 Red Hat, Inc. All rights reserved. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. -# - -import gtk -import gobject -import gui -from iw_gui import * -from re import * -from rhpl.translate import _, N_ -from flags import flags - -class MouseWindow(InstallWindow): - windowTitle = N_("Mouse Configuration") - - def getNext(self): - self.mouse.setMouse(self.currentMouse,self.emulate3.get_active()) - - mouse = self.mice[self.currentMouse] - (make, model, gpmproto, xproto, device, emulate3) = mouse - - if device == "ttyS": - self.mouse.setDevice(self.serialDevice) - else: - self.mouse.setDevice(device) - - if self.flags.setupFilesystems: - self.mouse.setXProtocol() - - return None - - def selectDeviceType(self, selection, *args): - if self.ignoreEvents: - return - (model, iter) = selection.get_selected() - if iter: - self.serialDevice = model.get_value(iter, 1) - self.ics.setNextEnabled(True) - else: - self.serialDevice = None - - def selectMouseType(self, selection, *args): - if self.ignoreEvents: - return - (model, iter) = selection.get_selected() - if iter is None: - return - - if model.iter_has_child(iter): - self.devview.get_selection().unselect_all() - self.devview.set_sensitive(False) - self.emulate3.set_sensitive(False) - self.ics.setNextEnabled(False) - return - - cur = model.get_value(iter, 1) - - self.emulate3.set_sensitive(True) - (make, model, gpmproto, xproto, device, emulate) = self.mice[cur] - - if device == "ttyS": - self.setCurrent(self.serialDevice, cur, emulate, recenter=0) - else: - self.setCurrent(device, cur, emulate, recenter=0) - - def setupDeviceList(self): - deviceList = ((_("/dev/ttyS0 (COM1 under DOS)"), "ttyS0" ), - (_("/dev/ttyS1 (COM2 under DOS)"), "ttyS1" ), - (_("/dev/ttyS2 (COM3 under DOS)"), "ttyS2" ), - (_("/dev/ttyS3 (COM4 under DOS)"), "ttyS3" )) - - self.devstore = gtk.ListStore(gobject.TYPE_STRING, - gobject.TYPE_STRING) - for descrip, dev in deviceList: - iter = self.devstore.append() - self.devstore.set_value(iter, 0, descrip) - self.devstore.set_value(iter, 1, dev) - self.devstore.set_sort_column_id(0, gtk.SORT_ASCENDING) - self.devview = gtk.TreeView(self.devstore) - col = gtk.TreeViewColumn(_("_Device"), gtk.CellRendererText(), text=0) - self.devview.append_column(col) - selection = self.devview.get_selection() - selection.connect("changed", self.selectDeviceType) - - def setupMice(self): - self.mousestore = gtk.TreeStore(gobject.TYPE_STRING, - gobject.TYPE_STRING) - # go though and find all the makes that have more than 1 mouse - toplevels = {} - for key, value in self.mice.items(): - (make, model, gpmproto, xproto, device, emulate3) = value - make = _(make) - if toplevels.has_key(make): - toplevels[make] = toplevels[make] + 1 - else: - toplevels[make] = 1 - - # for each toplevel that has more than one mouse, make a parent - # node for it. - for make, count in toplevels.items(): - if count > 1: - parent = self.mousestore.append(None) - self.mousestore.set_value(parent, 0, make) - toplevels[make] = parent - else: - del toplevels[make] - - # now go and add each child node - for key, value in self.mice.items(): - (make, model, gpmproto, xproto, device, emulate3) = value - make = _(make) - model = _(model) - parent = toplevels.get(make) - iter = self.mousestore.append(parent) - # if there is a parent, put only the model in the tree - if parent: - self.mousestore.set_value(iter, 0, model) - else: - # otherwise, put the full device there. - self.mousestore.set_value(iter, 0, "%s %s" % (make, model)) - self.mousestore.set_value(iter, 1, key) - - self.mousestore.set_sort_column_id(0, gtk.SORT_ASCENDING) - self.mouseview = gtk.TreeView(self.mousestore) - self.mouseview.set_property("headers-visible", True) - col = gtk.TreeViewColumn(_("_Model"), gtk.CellRendererText(), text=0) - self.mouseview.append_column(col) - selection = self.mouseview.get_selection() - selection.connect("changed", self.selectMouseType) - - def setCurrent(self, currentDev, currentMouse, emulate3, recenter=1): - self.ignoreEvents = 1 - self.currentMouse = currentMouse - - parent = None - iter = self.mousestore.get_iter_first() - fndmouse = 0 - # iterate over the list, looking for the current mouse selection - while iter: - # if this is a parent node, get the first child and iter over them - if self.mousestore.iter_has_child(iter): - parent = iter - iter = self.mousestore.iter_children(parent) - continue - # if it's not a parent node and the mouse matches, select it. - elif self.mousestore.get_value(iter, 1) == currentMouse: - if parent: - path = self.mousestore.get_path(parent) - self.mouseview.expand_row(path, True) - selection = self.mouseview.get_selection() - selection.unselect_all() - selection.select_iter(iter) - path = self.mousestore.get_path(iter) - col = self.mouseview.get_column(0) - self.mouseview.set_cursor(path, col, False) - if recenter: - self.mouseview.scroll_to_cell(path, col, True, - 0.5, 0.5) - fndmouse = 1 - break - # get the next row. - iter = self.mousestore.iter_next(iter) - # if there isn't a next row and we had a parent, go to the node - # after the parent we've just gotten the children of. - if not iter and parent: - parent = self.mousestore.iter_next(parent) - iter = parent - - # set up the device list if we have a serial port - if currentDev and currentDev.startswith('ttyS'): - self.serialDevice = currentDev - selection = self.devview.get_selection() - path = (int(self.serialDevice[4]),) - selection.select_path(path) - col = self.devview.get_column(0) - self.devview.set_cursor(path, col, False) - if recenter: - self.devview.scroll_to_cell(path, col, True, 0.5, 0.5) - self.ics.setNextEnabled(True) - self.devview.set_sensitive(True) - elif currentDev: - self.devview.get_selection().unselect_all(); - self.devview.set_sensitive(False) - self.ics.setNextEnabled(True) - else: - # XXX - see if this is the 'No - mouse' case - if fndmouse: - cur = self.mousestore.get_value(iter, 1) - (make, model, gpmproto, xdev, device, emulate3) = self.mice[cur] - else: - xdev = None - - if xdev == "none": - self.devview.get_selection().unselect_all(); - self.devview.set_sensitive(False) - self.ics.setNextEnabled(True) - - else: - # otherwise disable the list - self.devview.get_selection().unselect_all(); - self.serialDevice = None - self.ics.setNextEnabled(False) - self.devview.set_sensitive(True) - - self.emulate3.set_active(emulate3) - self.ignoreEvents = 0 - - # MouseWindow tag="mouse" - def getScreen(self, mouse): - self.mouse = mouse - self.flags = flags - - self.ignoreEvents = 0 - - self.mice = mouse.mouseModels - self.serialDevice = None - - currentDev = mouse.getDevice() - currentMouse, emulate3 = mouse.getMouse() - - # populate the big widgets with the available selections - self.setupMice() - self.setupDeviceList() - self.emulate3 = gtk.CheckButton(_("_Emulate 3 buttons")) - self.setCurrent(currentDev, currentMouse, emulate3) - - # set up the box for this screen - box = gtk.VBox(False, 5) - box.set_border_width(5) - - # top header, includes graphic and instructions - hbox = gtk.HBox(False, 5) - pix = gui.readImageFromFile ("gnome-mouse.png") - if pix: - a = gtk.Alignment() - a.add(pix) - a.set(0.0, 0.0, 0.0, 0.0) - hbox.pack_start(a, False) - label = gui.MnemonicLabel(_("Select the appropriate mouse for the system.")) - label.set_line_wrap(True) - label.set_size_request(350, -1) - hbox.pack_start(label, False) - box.pack_start(hbox, False) - - # next is the mouse tree - sw = gtk.ScrolledWindow() - sw.set_shadow_type(gtk.SHADOW_IN) - sw.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC) - sw.add(self.mouseview) - box.pack_start(sw) - label.set_mnemonic_widget(self.mouseview) - - gui.setupTreeViewFixupIdleHandler(self.mouseview, self.mousestore) - - # then the port list - serial_sw = gtk.ScrolledWindow() - serial_sw.set_shadow_type(gtk.SHADOW_IN) - serial_sw.set_policy(gtk.POLICY_NEVER, gtk.POLICY_NEVER) - serial_sw.add(self.devview) - box.pack_start(serial_sw, False) - - # finally the emulate 3 buttons - box.pack_start(self.emulate3, False) - return box - @@ -46,7 +46,6 @@ log = logging.getLogger("anaconda") stepToClasses = { "language" : ("language_text", "LanguageWindow"), "keyboard" : ("keyboard_text", "KeyboardWindow"), - "mouse" : ("mouse_text", ("MouseWindow", "MouseDeviceWindow")), "welcome" : ("welcome_text", "WelcomeWindow"), "parttype" : ("partition_text", "PartitionTypeWindow"), "custom-upgrade" : ("upgrade_text", "UpgradeExamineWindow"), diff --git a/textw/mouse_text.py b/textw/mouse_text.py deleted file mode 100644 index 2bd736f81..000000000 --- a/textw/mouse_text.py +++ /dev/null @@ -1,118 +0,0 @@ -# -# mouse_text.py: text mode mouse selection dialog -# -# Copyright (C) 2000, 2001, 2002 Red Hat, Inc. All rights reserved. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. -# - -from snack import * -from constants_text import * -from rhpl.translate import _ - -class MouseDeviceWindow: - def __call__(self, screen, mouse): - 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 - mousedev = mouse.getDevice() - if (not mousedev or mousedev[0:4] != "ttyS"): return INSTALL_NOOP - - l = choices.keys() - l.sort() - for choice in l: - if choices[choice] == mousedev: - default = i - break - i = i + 1 - - (button, result) = ListboxChoiceWindow(screen, _("Device"), - _("What device is your mouse located on?"), l, - [ TEXT_OK_BUTTON, TEXT_BACK_BUTTON ], help = "mousedevice", default = default ) - if button == TEXT_BACK_CHECK: - return INSTALL_BACK - - mouse.setDevice(choices[l[result]]) - - return INSTALL_OK - -class MouseWindow: - def listcb(self): - if self.mice[self.micenames[self.l.current()]][3]: - self.c.setValue("*") - else: - self.c.setValue(" ") - - def __call__(self, screen, mouse): -# XXX ewt changed this and we can't figure out why -- we always -# want to display this dialog so that you can turn on 3 button emu -# if mouse.probed(): return - - self.mice = mouse.available () - mice = self.mice.keys () - mice.sort () - self.micenames = mice - (default, emulate) = mouse.get () - if default == "Sun - Mouse": - return INSTALL_NOOP - default = mice.index (default) - - bb = ButtonBar(screen, [TEXT_OK_BUTTON, TEXT_BACK_BUTTON]) - t = TextboxReflowed(40, - _("Which model mouse is attached to this computer?")) - l = Listbox(8, scroll = 1, returnExit = 0) - self.l = l - - key = 0 - for amouse in mice: - l.append(_(amouse), key) - key = key + 1 - l.setCurrent(default) - l.setCallback (self.listcb) - - c = Checkbox(_("Emulate 3 Buttons?"), isOn = emulate) - self.c = c - - 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 == TEXT_BACK_CHECK: - return INSTALL_BACK - - choice = l.current() - emulate = c.selected() - - mouse.set(mice[choice], emulate) - - oldDev = mouse.getDevice() - if (oldDev): - newDev = mouse.available()[mice[choice]][2] - if ((oldDev[0:4] == "ttyS" and newDev[0:4] == "ttyS") or - (oldDev == newDev)): - pass - else: - mouse.setDevice(newDev) - - return INSTALL_OK |