Exemplo n.º 1
0
def selectSSIDsDialog(devssids):
    """Dialog for access point selection.

    devssids - dict iface->[ssid1, ssid2, ssid3, ...]
    returns  - dict iface->[ssidX] or None on Cancel
    """

    # If there are no choices, don't ask
    for dev, ssids in devssids.items():
        if len(ssids) > 1:
            break
    else:
        return devssids

    rv = {}
    dialog = gtk.Dialog(_("Select APs"))
    dialog.add_button('gtk-cancel', gtk.RESPONSE_CANCEL)
    dialog.add_button('gtk-ok', 1)
    dialog.set_position(gtk.WIN_POS_CENTER)
    gui.addFrame(dialog)

    dialog.vbox.pack_start(
        gui.WrappingLabel(_("Select APs for wireless devices")))

    table = gtk.Table(len(devssids), 2)
    table.set_row_spacings(5)
    table.set_col_spacings(5)

    combos = {}
    for i, (dev, ssids) in enumerate(devssids.items()):

        label = gtk.Label(dev)
        table.attach(label, 0, 1, i, i + 1, gtk.FILL, gtk.FILL)

        combo = gtk.combo_box_new_text()
        for ssid in ssids:
            combo.append_text(ssid)
        table.attach(combo, 1, 2, i, i + 1, gtk.FILL, gtk.FILL)
        combo.set_active(0)
        combos[dev] = combo

    dialog.vbox.pack_start(table)

    dialog.show_all()

    rc = dialog.run()

    # cancel
    if rc in [gtk.RESPONSE_CANCEL, gtk.RESPONSE_DELETE_EVENT]:
        rv = None
    else:
        for dev, combo in combos.items():
            rv[dev] = [combo.get_active_text()]

    dialog.destroy()
    return rv
Exemplo n.º 2
0
    def getScreen (self, anaconda):
        hbox = gtk.HBox (False, 5)
        
        pix = gui.readImageFromFile ("done.png")
        if pix:
            a = gtk.Alignment ()
            a.add (pix)
            a.set (0.5, 0.5, 1.0, 1.0)
	    a.set_size_request(200, -1)
            hbox.pack_start (a, False, False, 36)

        if isinstance(anaconda.platform, platform.S390):
            txt = _("Congratulations, your %s installation is complete.\n\n") % (productName,)

            if not anaconda.canReIPL:
                self.rebootButton.set_label(_("Shutdown"))

                txt = txt + _("Please shutdown to use the installed system.\n")
            else:
                txt = txt + _("Please reboot to use the installed system.\n")

            if not anaconda.reIPLMessage is None:
                txt = txt + "\n" + anaconda.reIPLMessage + "\n\n"

            txt = txt + _("Note that updates may be available to ensure the proper "
                          "functioning of your system and installation of these "
                          "updates is recommended after the reboot.")
        else:
            txt = _("Congratulations, your %s installation is complete.\n\n"
                    "Please reboot to use the installed system.  "
                    "Note that updates may be available to ensure the proper "
                    "functioning of your system and installation of these "
                    "updates is recommended after the reboot.") %(productName,)

	label = gui.WrappingLabel(txt)
        label.set_size_request(250, -1)

        hbox.pack_start (label, True, True)

        gtk.gdk.beep()
        return hbox
    def getScreen(self, anaconda):
        self.intf = anaconda.intf
        if anaconda.dir == DISPATCH_BACK:
            self.intf.icw.prevClicked()
            return

        self.pixmaps = self._getRnotes()

        # Create vbox to contain components of UI
        vbox = gtk.VBox(False, 12)

        # Create rnote area
        self.adpix = None
        self.adbox = None
        pix = gui.readImageFromFile("progress_first.png")
        if pix:
            frame = gtk.Frame()
            frame.set_shadow_type(gtk.SHADOW_NONE)
            box = gtk.EventBox()
            self.adpix = pix
            box.add(self.adpix)
            self.adbox = box
            frame.add(box)
            vbox.pack_start(frame, False)

        self.progress = gtk.ProgressBar()
        vbox.pack_start(self.progress, False)

        self.infolabel = gui.WrappingLabel("")
        self.infolabel.set_alignment(0, 0)
        vbox.pack_start(self.infolabel)

        # All done with creating components of UI
        self.intf.setPackageProgressWindow(self)
        self.intf.setInstallProgressClass(self)

        vbox.set_border_width(6)

        return vbox
    def editOther(self, oldDevice, oldLabel, isDefault, isRoot = 0):
        dialog = gtk.Dialog(_("Image"), self.parent)
        dialog.add_button('gtk-cancel', gtk.RESPONSE_CANCEL)
        dialog.add_button('gtk-ok', 1)
        dialog.set_position(gtk.WIN_POS_CENTER)
        gui.addFrame(dialog)

        dialog.vbox.pack_start(gui.WrappingLabel(
            _("Enter a label for the boot loader menu to display. The "
	      "device (or hard drive and partition number) is the device "
	      "from which it boots.")))

        table = gtk.Table(2, 5)
        table.set_row_spacings(5)
        table.set_col_spacings(5)

        label = gui.MnemonicLabel(_("_Label"))
        table.attach(label, 0, 1, 1, 2, gtk.FILL, 0, 10)
        labelEntry = gtk.Entry(32)
        label.set_mnemonic_widget(labelEntry)
        table.attach(labelEntry, 1, 2, 1, 2, gtk.FILL, 0, 10)
        if oldLabel:
            labelEntry.set_text(oldLabel)

        label = gui.MnemonicLabel(_("_Device"))
        table.attach(label, 0, 1, 2, 3, gtk.FILL, 0, 10)
        if not isRoot:
            parts = []

            for part in self.storage.partitions:
                if part.partedPartition.getFlag(parted.PARTITION_LVM) or \
                   part.partedPartition.getFlag(parted.PARTITION_RAID) or \
                   not part.partedPartition.active:
                    continue

                parts.append(part)

            deviceCombo = datacombo.DataComboBox()
            defindex = 0
            i = 0
            for part in parts:
                deviceCombo.append(part.path, part.name)
                if oldDevice and oldDevice == part.name:
                    defindex = i
                i = i + 1


            deviceCombo.set_active(defindex)
            
            table.attach(deviceCombo, 1, 2, 2, 3, gtk.FILL, 0, 10)
            label.set_mnemonic_widget(deviceCombo)
        else:
            table.attach(gtk.Label(oldDevice), 1, 2, 2, 3, gtk.FILL, 0, 10)

        default = gtk.CheckButton(_("Default Boot _Target"))
        table.attach(default, 0, 2, 3, 4, gtk.FILL, 0, 10)
        if isDefault != 0:
            default.set_active(True)

        if self.numentries == 1 and oldDevice != None:
            default.set_sensitive(False)
        else:
            default.set_sensitive(True)
        
        dialog.vbox.pack_start(table)
        dialog.show_all()

        while 1:
            rc = dialog.run()

            # cancel
            if rc in [gtk.RESPONSE_CANCEL, gtk.RESPONSE_DELETE_EVENT]:
                break

            label = labelEntry.get_text()

            if not isRoot:
                dev = deviceCombo.get_active_value()
            else:
                dev = oldDevice

            if not dev:
                self.intf.messageWindow(_("Error"),
                                        _("You must select a device."),
                                        type="warning")
                continue

            if not label:
                self.intf.messageWindow(_("Error"),
                                        _("You must specify a label for the "
                                          "entry"),
                                        type="warning")
                continue

            foundBad = 0
            for char in self.illegalChars:
                if char in label:
                    self.intf.messageWindow(_("Error"),
                                            _("Boot label contains illegal "
                                              "characters"),
                                            type="warning")
                    foundBad = 1
                    break
            if foundBad:
                continue

            # verify that the label hasn't been used
            foundBad = 0
            for key in self.imagelist.keys():
                if dev == key:
                    continue
                if self.blname == "GRUB":
                    thisLabel = self.imagelist[key][1]
                else:
                    thisLabel = self.imagelist[key][0]

                # if the label is the same as it used to be, they must
                # have changed the device which is fine
                if thisLabel == oldLabel:
                    continue

                if thisLabel == label:
                    self.intf.messageWindow(_("Duplicate Label"),
                                            _("This label is already in "
                                              "use for another boot entry."),
                                            type="warning")
                    foundBad = 1
                    break
            if foundBad:
                continue

            # they could be duplicating a device, which we don't handle
            if dev in self.imagelist.keys() and (not oldDevice or
                                                 dev != oldDevice):
                self.intf.messageWindow(_("Duplicate Device"),
                                        _("This device is already being "
                                          "used for another boot entry."),
                                        type="warning")
                continue

            # if we're editing a previous, get what the old info was for
            # labels.  otherwise, make it something safe for grub and the
            # device name for lilo for lack of any better ideas
            if oldDevice:
                (oldshort, oldlong, oldisroot) = self.imagelist[oldDevice]
            else:
                (oldshort, oldlong, oldisroot) = (dev, label, None)
                
            # if we're editing and the device has changed, delete the old
            if oldDevice and dev != oldDevice:
                del self.imagelist[oldDevice]
                
            # go ahead and add it
            if self.blname == "GRUB":
                self.imagelist[dev] = (oldshort, label, isRoot)
            else:
                self.imagelist[dev] = (label, oldlong, isRoot)

            if default.get_active():
                self.defaultDev = dev

            # refill the os list store
            self.fillOSList()
            break
        
        dialog.destroy()
Exemplo n.º 5
0
    def passwordWindow(self, *args):
        dialog = gtk.Dialog(_("Enter Boot Loader Password"), self.parent)
        dialog.add_button('gtk-cancel', gtk.RESPONSE_CANCEL)
        dialog.add_button('gtk-ok', 1)
        dialog.set_position(gtk.WIN_POS_CENTER)
        gui.addFrame(dialog)

        label = gui.WrappingLabel(
            _("Enter a boot loader password and then confirm it.  (Note that your BIOS keymap may be different than the actual keymap you are used to.)"
              ))
        label.set_alignment(0.0, 0.0)
        dialog.vbox.pack_start(label)

        table = gtk.Table(2, 2)
        table.set_row_spacings(5)
        table.set_col_spacings(5)
        label = gui.MnemonicLabel(_("_Password:"******"Con_firm:"))
        table.attach(label, 0, 1, 3, 4, gtk.FILL, 0, 10)
        confirmEntry = gtk.Entry(16)
        confirmEntry.set_visibility(False)
        label.set_mnemonic_widget(confirmEntry)
        table.attach(confirmEntry, 1, 2, 3, 4, gtk.FILL, 0, 10)
        dialog.vbox.pack_start(table)

        # set the default
        if self.password:
            pwEntry.set_text(self.password)
            confirmEntry.set_text(self.password)

        dialog.show_all()

        while 1:
            rc = dialog.run()
            if rc in [gtk.RESPONSE_CANCEL, gtk.RESPONSE_DELETE_EVENT]:
                rc = False
                break

            if pwEntry.get_text() != confirmEntry.get_text():
                self.intf.messageWindow(_("Passwords don't match"),
                                        _("Passwords do not match"),
                                        type='warning')
                continue

            thePass = pwEntry.get_text()
            if not thePass:
                continue
            if len(thePass) < 6:
                ret = self.intf.messageWindow(
                    _("Warning"),
                    _("Your boot loader password is shorter than "
                      "six characters.  We recommend a longer "
                      "boot loader password."
                      "\n\n"
                      "Would you like to continue with this "
                      "password?"),
                    type="yesno")
                if ret == 0:
                    continue

            self.password = thePass
            rc = True
            break

        dialog.destroy()
        return rc
Exemplo n.º 6
0
def selectInstallNetDeviceDialog(network, devices=None):

    devs = devices or network.netdevices.keys()
    if not devs:
        return None
    devs.sort()

    dialog = gtk.Dialog(_("Select network interface"))
    dialog.add_button('gtk-cancel', gtk.RESPONSE_CANCEL)
    dialog.add_button('gtk-ok', 1)
    dialog.set_position(gtk.WIN_POS_CENTER)
    gui.addFrame(dialog)

    dialog.vbox.pack_start(
        gui.WrappingLabel(
            _("This requires that you have an active "
              "network connection during the installation "
              "process.  Please configure a network interface.")))

    combo = gtk.ComboBox()
    cell = gtk.CellRendererText()
    combo.pack_start(cell, True)
    combo.set_attributes(cell, text=0)
    cell.set_property("wrap-width", 525)
    combo.set_size_request(480, -1)
    store = gtk.TreeStore(gobject.TYPE_STRING, gobject.TYPE_STRING)
    combo.set_model(store)

    ksdevice = network.getKSDevice()
    if ksdevice:
        ksdevice = ksdevice.iface
    preselected = None

    for dev in devices:
        i = store.append(None)
        if not preselected:
            preselected = i

        desc = network.netdevices[dev].description
        if desc:
            desc = "%s - %s" % (dev, desc)
        else:
            desc = "%s" % (dev, )

        hwaddr = network.netdevices[dev].get("HWADDR")

        if hwaddr:
            desc = "%s - %s" % (
                desc,
                hwaddr,
            )

        if ksdevice and ksdevice == dev:
            preselected = i

        store[i] = (desc, dev)

    combo.set_active_iter(preselected)
    dialog.vbox.pack_start(combo)

    dialog.show_all()

    rc = dialog.run()

    if rc in [gtk.RESPONSE_CANCEL, gtk.RESPONSE_DELETE_EVENT]:
        install_device = None
    else:
        active = combo.get_active_iter()
        install_device = combo.get_model().get_value(active, 1)

    dialog.destroy()
    return install_device