Beispiel #1
0
    def on_wireless_config_page_next(self, druid_page, druid):
        self.device.createWireless()
        wl = self.device.Wireless

        if self.xml.get_widget("essidAutoButton").get_active():
            wl.EssId = ""
        else:
            wl.EssId = self.xml.get_widget("essidEntry").get_text()
        row = self.xml.get_widget("modeCombo").get_active()
        wl.Mode = self.modestore[row][1]

        rate = self.xml.get_widget("rateEntry").get_text()
        if wl.Mode == _("Managed"):
            wl.Channel = ""
            wl.Rate = "auto"
        else:
            wl.Rate = rate
            channel = self.xml.get_widget("channelComboEntry").get_text()
            if channel == "Auto":
                wl.Channel = ""
            else:
                wl.Channel = channel

            rate = self.xml.get_widget("rateEntry").get_text()
            if rate == _("Auto"):
                wl.Rate = "auto"
            else:
                wl.Rate = rate

        # FIXME: [168036] check the key!
        wl.Key = self.xml.get_widget("keyEntry").get_text()
    def runIt(self, mscreen):
        """
        Show and run the screen, save files if necesarry
        """
        g1 = snack.Grid(1, 1)
        g2 = snack.Grid(2, 6)
        g2.setField(snack.Label(_("Name")), 0, 0, anchorLeft=1)
        g2.setField(snack.Label(_("Device")), 0, 1, anchorLeft=1)
        g2.setField(snack.Label(_("ISP Phonenumber")), 0, 2, anchorLeft=1)
        g2.setField(snack.Label(_("ISP Login")), 0, 3, anchorLeft=1)
        g2.setField(snack.Label(_("ISP Password")), 0, 4, anchorLeft=1)
        g2.setField(snack.Label(_("MSN")), 0, 5, anchorLeft=1)
        g2.setField(self.name, 1, 0, (1, 0, 0, 0))
        g2.setField(self.hwdev, 1, 1, (1, 0, 0, 0))
        g2.setField(self.phoneno, 1, 2, (1, 0, 0, 0), anchorLeft=1)
        g2.setField(self.login, 1, 3, (1, 0, 0, 0))
        g2.setField(self.password, 1, 4, (1, 0, 0, 0))
        g2.setField(self.msn, 1, 5, (1, 0, 0, 0))
        bb = snack.ButtonBar(mscreen,
                             ((_("Ok"), "ok"), (_("Cancel"), "cancel")))
        tl = snack.GridForm(mscreen, _("ISDN Configuration"), 1, 3)
        tl.add(g1, 0, 0, (0, 0, 0, 1), anchorLeft=1)
        tl.add(g2, 0, 1, (0, 0, 0, 1))
        tl.add(bb, 0, 2, growx=1)
        self.setState(self.isdn)
        while 1:
            res = tl.run()
            if bb.buttonPressed(res) == "cancel":
                mscreen.popWindow()
                return False

            elif bb.buttonPressed(res) == "ok":
                mscreen.popWindow()
                self.processInfo()
                return True
Beispiel #3
0
    def on_finish_page_prepare(self, druid_page,
                               druid):  # pylint: disable-msg=W0613
        hardwarelist = NCHardwareList.getHardwareList()
        for hw in hardwarelist:
            if hw.Type == self.connection_type:
                break

        dialup = self.device.Dialup
        # FIXME: Bad style for translation..
        s = str(
            _("You have selected the following information:") + "\n\n" +
            "    " + _("Ethernet device:") + "  " + dialup.EthDevice + "\n" +
            "    " + _("Provider name:") + "  " + dialup.ProviderName + "\n" +
            "    " + _("Login name:") + "  " + dialup.Login)
        druid_page.set_text(s)
    def __init__(self, device):
        DialupInterfaceDialog.__init__(self, device)

        page = self.noteBook.page_num(self.xml.get_widget("modemTab"))
        self.noteBook.get_nth_page(page).hide()

        self.dialog.set_title(_("ISDN Dialup Configuration"))
Beispiel #5
0
    def on_ipsecDruidLocalNetworkPage_next(self, druid_page, druid):
        if self.ipsec.EncryptionMode == "manual":
            for widget_name in [ "SPI_AH_IN_Entry", "SPI_ESP_IN_Entry" ]:
                widget = self.xml.get_widget(widget_name)
                val = widget.get_text()

                try:
                    val = int(val)
                    if val < 256:
                        raise ValueError
                except:
                    gui_error_dialog(
                        _("Please enter a unique security parameter "
                          "index between 256 and 4294967295."),
                                     self.druid, widget = druid,
                                     page = druid_page, broken_widget = widget)
                    return 1

        if self.xml.get_widget("hosttohostEncryptionRadio").get_active():
            return 0

        for widget in [ "localNetworkEntry", "localSubnetEntry",
                        "localGatewayEntry" ]:
            if not self.xml.get_widget(widget).get_text():
                return 1
        return 0
 def get_project_description(self):
     return _(
         "Create a new Modem connection.  This is a connection that uses a "
         "serial analog modem to dial into to your Internet Service Provider. "
         "These modems use sound over a normal copper telephone line to "
         "transmit data. These types of connections are available just about "
         "anywhere in the world where there is a phone system.")
    def dehydrate(self):
        DeviceConfigDialog.dehydrate(self)
        sharedtcpip.dhcp_dehydrate(self.sharedtcpip_xml, self.device)
        sharedtcpip.route_dehydrate(self.sharedtcpip_xml, self.device)
        sharedtcpip.hardware_dehydrate(self.sharedtcpip_xml, self.device)

        wl = self.device.Wireless
        if wl:
            if self.xml.get_widget("essidAutoButton").get_active():
                wl.EssId = ""
            else:
                wl.EssId = self.xml.get_widget("essidEntry").get_text()

            row = self.xml.get_widget("modeCombo").get_active()
            wl.Mode = self.modestore[row][1]

            if wl.Mode == "Managed":
                wl.Channel = ""
                wl.Rate = "auto"
            else:
                channel = self.xml.get_widget("channelEntry").get_text()
                if channel == "Auto":
                    wl.Channel = ""
                else:
                    wl.Channel = channel

                rate = self.xml.get_widget("rateEntry").get_text()
                if rate == _("Auto"):
                    wl.Rate = "auto"
                else:
                    wl.Rate = rate
            # FIXME: [168036] check the key!
            wl.Key = self.xml.get_widget("keyEntry").get_text()
Beispiel #8
0
    def saveModule(self):
        if not self.Card.ModuleName:
            return
        from netconfpkg.NCHardwareList import getMyConfModules, getHardwareList
        hl = getHardwareList()
        modules = getMyConfModules()
        dic = modules[self.Name]
        if dic:
            dic['alias'] = self.Card.ModuleName
            modules[self.Name] = dic
            log.lch(2, modules.filename,
                    "%s alias %s" % (self.Name, self.Card.ModuleName))
        # No, no, no... only delete known options!!!
        #WRONG: modules[self.Card.ModuleName] = {}
        #WRONG: modules[self.Card.ModuleName]['options'] = {}
        #
        # Better do it this way!

        if (modules.has_key(self.Card.ModuleName)
                and modules[self.Card.ModuleName].has_key('options')):
            for (key, confkey) in hl.keydict.items():
                if modules[self.Card.ModuleName]['options'].has_key(confkey):
                    del modules[self.Card.ModuleName]['options'][confkey]

        for (selfkey, confkey) in hl.keydict.items():
            if self.Card.__dict__[selfkey]:
                if (not (selfkey == 'IRQ' and (self.Card.IRQ == _('Unknown') or
                                               (self.Card.IRQ == 'Unknown')))):
                    dic = modules[self.Card.ModuleName]
                    if not dic.has_key('options'):
                        dic['options'] = {}

                    dic['options'][confkey] = str(self.Card.__dict__[selfkey])
                    modules[self.Card.ModuleName] = dic
    def on_okButton_clicked(self, button):
        HardwareDialog.on_okButton_clicked(self, button)
        cmd = ['/sbin/modprobe ', self.hw.Card.ModuleName]
        if self.hw.Card.IRQ:
            cmd.append(' irq=' + self.hw.Card.IRQ)
        if self.hw.Card.IoPort:
            cmd.append(' io=' + self.hw.Card.IoPort)
        if self.hw.Card.IoPort1:
            cmd.append(' io1=' + self.hw.Card.IoPort1)
        if self.hw.Card.IoPort2:
            cmd.append(' io2=' + self.hw.Card.IoPort2)
        if self.hw.Card.Mem:
            cmd.append(' mem=' + self.hw.Card.Mem)
        if self.hw.Card.DMA0:
            cmd.append(' dma=' + str(self.hw.Card.DMA0))
        if self.hw.Card.DMA1:
            cmd.append(' dma1=' + str(self.hw.Card.DMA1))

        (status, output) = gui_run_dialog('/sbin/modprobe',
                                          cmd,
                                          catchfd=(1, 2),
                                          dialog=self.dialog)
        if status != 0:
            generic_longinfo_dialog(
                _('The Token Ring card could not be initialized. '
                  'Please verify your settings and try again.'), output,
                self.dialog)
Beispiel #10
0
    def on_ipsecDruidFinishPage_prepare(self, druid_page, druid):
        for key, val in self.entries.items():
            widget = self.xml.get_widget(key)
            entry = (widget and widget.get_text()) or None
            if entry:
                setattr(self.ipsec, val, entry)

        if self.ipsec.EncryptionMode == "auto":
            self.ipsec.ESPKey = None
            self.ipsec.IKEKey = self.ipsec.AHKey
            self.ipsec.AHKey = None
            self.ipsec.SPI_AH_IN = None
            self.ipsec.SPI_AH_OUT = None
            self.ipsec.SPI_ESP_IN = None
            self.ipsec.SPI_ESP_OUT = None
        else:
            self.ipsec.IKEKey = None

        self.ipsec.OnBoot = self.xml.get_widget('onBootCB').get_active()

        if self.ipsec.ConnectionType == "Host2Host":
            for key in [ "LocalNetwork", "LocalNetmask", "LocalGateway",
                         "RemoteNetwork", "RemoteNetmask", "RemoteGateway"]:
                setattr(self.ipsec, key, None)

        s = _("You have selected the following information:") + "\n\n"
        s += str(self.ipsec)
        druid_page.set_text(s)
        return False
    def on_configureButton_clicked(self, button):  # pylint: disable-msg=W0613
        device = self.clist_get_nickname()
        if not device:
            return

        for dev in getDeviceList():
            if dev.DeviceId == device:
                break
        else:
            return

        # pylint: disable-msg=W0631

        (ret, msg) = dev.configure()

        if not self.dialog:
            return False

        if ret:
            errorString = _('Cannot configure network device %s')\
                          % (device)
            generic_longinfo_dialog(errorString, msg, self.dialog)

        # update dialog #83640
        # Re-read the device list
        self.devicelist = self.getProfDeviceList(refresh=True)
        self.activedevicelist = NetworkDevice().get()
        # Update the gui
        self.hydrateProfiles(refresh=True)
        self.hydrate()
        self.oldprofile = None  # forces a re-read of oldprofile
        self.update_dialog()
    def __init__(self, device):
        DialupInterfaceDialog.__init__(self, device)

        self.dialog.set_title(_("Modem Dialup Configuration"))
        page = self.noteBook.page_num(self.xml.get_widget("isdnTab"))
        self.noteBook.get_nth_page(page).hide()
        page = self.noteBook.page_num(self.xml.get_widget("callbackTab"))
        self.noteBook.get_nth_page(page).hide()
    def deactivate(self, dialog = None):
        command = '/sbin/ifdown'
        param = [command, self.IPsecId, "down"]

        try:
            (ret, msg) = generic_run_dialog(\
                command, param, 
                catchfd = (1, 2), 
                title = _('IPsec deactivating...'), 
                label = _('Deactivating IPsec connection %s, '
                          'please wait...') % (self.IPsecId), 
                errlabel = _('Cannot deactivate '
                             'IPsec connection %s!\n') % (self.IPsecId), 
                dialog = dialog)

        except RuntimeError, msg:
            ret = -1
    def deactivate(self, dialog=None):
        command = '/sbin/ifdown'
        param = [command, self.DeviceId, "down"]

        try:
            (ret, msg) = generic_run_dialog(
                command,
                param,
                catchfd=(1, 2),
                title=_('Network device deactivating...'),
                label=_('Deactivating network device %s, '
                        'please wait...') % (self.DeviceId),
                errlabel=_('Cannot deactivate '
                           'network device %s!\n') % (self.DeviceId),
                dialog=dialog)

        except RuntimeError, msg:
            ret = -1
    def on_finish_page_prepare(self, druid_page,
                               druid):  # pylint: disable-msg=W0613
        hardwarelist = NCHardwareList.getHardwareList()
        description = ""
        for hw in hardwarelist:
            if hw.Type == self.connection_type:
                description = hw.Description
                break
        dialup = self.device.createDialup()

        s = _("You have selected the following information:") + \
            "\n\n" + "    " + \
            _("Hardware:") + "  " + description + "\n" + "    " + \
            _("Provider name:") + "  " + dialup.ProviderName + \
            "\n" +  "    " + \
            _("Login name:") + "  " + dialup.Login + "\n" +  "    " + \
            _("Phone number:") + "  " + dialup.PhoneNumber

        druid_page.set_text(s)
Beispiel #16
0
 def get_project_description(self):
     return _(
         "Create an xDSL connection.  This is a connection that uses one of "
         "several types of broadband connections collective known as Digital "
         "Subscriber Lines.  This list includes ADSL (Asymmetric, faster "
         "downloads than uploads), IDSL (over an ISDN line for distance), SDSL "
         "(Symmetric, downloads and uploads at the same speed), and several "
         "others.  These types of connections are common in the United States, "
         "and are gaining acceptance elsewhere.  Speeds vary according to the "
         "technology used, but generally range from 144kbps to 1.0Mbps.")
    def on_profileActivateButton_clicked(self,
                                         button):  # pylint: disable-msg=W0613
        profile = self.get_active_profile().ProfileName

        generic_run_dialog(
            command="/usr/bin/system-config-network-cmd",
            argv=["system-config-network-cmd", "-a", "-p", profile],
            title=_("Switching Profiles"),
            label=_("Switching to profile %s") % profile,
            errlabel=_("Failed to switch to profile %s") % profile,
            dialog=self.dialog)

        # Re-read the device list
        self.devicelist = self.getProfDeviceList(refresh=True)
        self.activedevicelist = NetworkDevice().get()
        # Update the gui
        self.hydrate()
        self.oldprofile = None  # forces a re-read of oldprofile
        self.hydrateProfiles()
        self.update_dialog()
Beispiel #18
0
 def get_project_description(self):
     return _("Create a new ISDN connection. This is a connection "
              "that uses an Integrated Services Digital Network line "
              "to dial into to your Internet Service Provider. "
              "This type of technology requires a special phone line "
              "to be installed by your telephone company. "
              "It also requires a device known as a Terminal Adapter(TA) "
              "to terminate the ISDN connection from your ISP. "
              "This type of connection is popular in Europe and several "
              "other technologically advanced regions.  It is available "
              "but uncommon in the USA.  Speeds range from 64kbps to "
              "128kbps.")
    def on_infoButton_clicked(self, button):  # pylint: disable-msg=W0613
        from version import PRG_VERSION
        from version import PRG_NAME
        if not hasattr(gtk, "AboutDialog"):
            import gnome.ui
            dlg = gnome.ui.About(
                PRG_NAME, PRG_VERSION,
                _("Copyright (c) 2001-2005 Red Hat, Inc."),
                _("This software is distributed under the GPL. "
                  "Please Report bugs to Red Hat's Bug Tracking "
                  "System: http://bugzilla.redhat.com/"), [
                      "Harald Hoyer <*****@*****.**>",
                      "Than Ngo <*****@*****.**>",
                      "Philipp Knirsch <*****@*****.**>",
                      "Trond Eivind Glomsrød <*****@*****.**>",
                  ])
            dlg.set_transient_for(self.dialog)
            dlg.set_position(gtk.WIN_POS_CENTER_ON_PARENT)
            dlg.show()

        else:
            dlg = gtk.AboutDialog()
            dlg.set_name(PRG_NAME)
            dlg.set_version(PRG_VERSION)
            dlg.set_copyright(_("Copyright (c) 2001-2005 Red Hat, Inc."))
            dlg.set_authors([
                "Harald Hoyer <*****@*****.**>",
                "Than Ngo <*****@*****.**>",
                "Philipp Knirsch <*****@*****.**>",
                "Trond Eivind Glomsrød <*****@*****.**>",
            ])
            dlg.set_documenters(["Tammy Fox <*****@*****.**>"])
            dlg.set_copyright(
                _("This software is distributed under the GPL. \n"
                  "Please Report bugs to Red Hat's Bug Tracking \n"
                  "System: http://bugzilla.redhat.com/"))
            dlg.set_transient_for(self.dialog)
            dlg.set_position(gtk.WIN_POS_CENTER_ON_PARENT)
            dlg.run()
            dlg.destroy()
    def dehydrate(self):
        self.hw.Description = _('Generic Modem')
        self.hw.Modem.DeviceName = self.xml.get_widget(
            "modemDeviceEntry").get_text()
        if (len(self.hw.Modem.DeviceName) > 5
                and self.hw.Modem.DeviceName[:5] != '/dev/'):
            self.hw.Modem.DeviceName = str('/dev/' + self.hw.Modem.DeviceName)
        self.hw.Modem.BaudRate = int(
            self.xml.get_widget("baudrateEntry").get_text())
        flow = self.xml.get_widget("flowControlEntry").get_text()
        for i in modemFlowControls.keys():
            if modemFlowControls[i] == flow:
                self.hw.Modem.FlowControl = i
                break

        Item = self.xml.get_widget("volumeMenu").get_child().get_label()
        if Item == _("Off"):
            self.hw.Modem.ModemVolume = 0
        elif Item == _("Low"):
            self.hw.Modem.ModemVolume = 1
        elif Item == _("Medium"):
            self.hw.Modem.ModemVolume = 2
        elif Item == _("High"):
            self.hw.Modem.ModemVolume = 3
        elif Item == _("Very High"):
            self.hw.Modem.ModemVolume = 4
        else:
            self.hw.Modem.ModemVolume = 0

        if self.xml.get_widget("toneDialingCB").get_active():
            self.hw.Modem.DialCommand = "ATDT"
        else:
            self.hw.Modem.DialCommand = "ATDP"
 def dehydrate(self):
     self.hw.Name = self.xml.get_widget('ethernetDeviceEntry').get_text()
     self.hw.Description = self.xml.get_widget('adapterEntry').get_text()
     if not self.hw.Type:
         self.hw.Type = ETHERNET
     self.hw.createCard()
     modInfo = NCHardwareList.getModInfo()
     if not self.hw.Card.ModuleName or self.hw.Card.ModuleName == "":
         self.hw.Card.ModuleName = _('Unknown')
     for i in modInfo.keys():
         if modInfo[i].has_key('description') and \
                modInfo[i]['description'] == self.hw.Description:
             self.hw.Card.ModuleName = i
    def dehydrate(self):
        HardwareDialog.dehydrate(self)

        self.hw.Name = self.xml.get_widget('tokenringDeviceEntry').get_text()
        self.hw.Description = self.xml.get_widget('adapterEntry').get_text()
        self.hw.Type = 'Token Ring'
        self.hw.createCard()
        modInfo = NCHardwareList.getModInfo()
        if not self.hw.Card.ModuleName or self.hw.Card.ModuleName == "":
            self.hw.Card.ModuleName = _('Unknown')
        for i in modInfo.keys():
            if modInfo[i].has_key('description') and \
                   modInfo[i]['description'] == self.hw.Description:
                self.hw.Card.ModuleName = i
Beispiel #23
0
    def on_hw_config_page_prepare(self, druid_page,
                                  druid):  # pylint: disable-msg=W0613
        hardwarelist = NCHardwareList.getHardwareList()
        clist = self.xml.get_widget("hardwareList")
        clist.clear()
        self.devlist = []
        for hw in hardwarelist:
            if hw.Type == TOKENRING:
                desc = hw.Description + " (" + hw.Name + ")"
                clist.append([desc])
                self.devlist.append(hw.Name)

        clist.append([_("Other Tokenring Card")])
        clist.select_row(self.hw_sel, 0)
Beispiel #24
0
    def on_hw_config_page_prepare(self, druid_page, druid):
        hardwarelist = NCHardwareList.getHardwareList()
        hardwarelist.updateFromSystem()

        clist = self.xml.get_widget("hardwareList")
        clist.clear()
        self.devlist = []
        for hw in hardwarelist:
            if hw.Type == WIRELESS:
                desc = hw.Description + " (" + hw.Name + ")"
                clist.append([desc])
                self.devlist.append(hw.Name)

        clist.append([_("Other Wireless Card")])
        clist.select_row(self.hw_sel, 0)
    def on_Modem_prepare(self, druid_page, druid):
        if not ModemInterfaceWizard.modemList:
            # FIXME: [165331] Can't detect external modem on /dev/ttyS0
            dialog = gtk.Dialog(
                _('Modem probing...'), None,
                gtk.DIALOG_MODAL | gtk.DIALOG_NO_SEPARATOR
                | gtk.DIALOG_DESTROY_WITH_PARENT)
            dialog.set_border_width(10)
            label = gtk.Label(_('Probing for Modems, please wait...'))
            dialog.vbox.pack_start(label, False)  # pylint: disable-msg=E1101
            dialog.set_transient_for(self.toplevel)
            dialog.set_position(gtk.WIN_POS_CENTER_ON_PARENT)
            dialog.set_modal(True)
            label.show_now()
            dialog.show_all()
            dialog.show_now()
            gtk.gdk.flush()
            while gtk.events_pending():
                gtk.main_iteration(False)
            dlist = getModemList()
            ModemInterfaceWizard.modemList = dlist
            dialog.destroy()
            if dlist == []:
                generic_error_dialog(_('No modem was found on your system.'),
                                     self.toplevel)
                dlist = modemDeviceList
            ModemInterfaceWizard.modemList = dlist
        else:
            dlist = ModemInterfaceWizard.modemList

        self.xml.get_widget("modemDeviceEntryComBo").set_popdown_strings(dlist)
        # 460800 seems to be to high
        self.xml.get_widget("baudrateEntry").set_text("115200")
        self.xml.get_widget(\
                'flowControlEntry').set_text(\
                modemFlowControls[CRTSCTS])
Beispiel #26
0
    def on_hw_config_page_prepare(self, druid_page,
                                  druid):  # pylint: disable-msg=W0613
        hardwarelist = getHardwareList()
        hardwarelist.updateFromSystem()

        clist = self.xml.get_widget("hardwareList")
        clist.clear()
        self.devlist = []
        for hw in hardwarelist:
            if hw.Type == QETH:
                desc = hw.Description + " (" + hw.Name + ")"
                clist.append([desc])
                self.devlist.append(hw.Name)

        clist.append([_("Other QETH Device")])
        clist.select_row(self.hw_sel, 0)
    def updateFromModules(self):
        modules = getMyConfModules()
        modinfo = getModInfo()
        #
        # Read /etc/modprobe.d/network.conf
        #
        for mod in modules.keys():
            if modules[mod].has_key('alias'):
                module = modules[mod]['alias']
            else: module = None

            mtype = getDeviceType(mod, module)

            if mtype == _('Unknown'):
                continue

            h = None
            for h in self:
                if h.Name == mod:
                    break
            # pylint: disable-msg=W0631
            if h and h.Name == mod:
                continue

            i = self.addHardware(mtype)
            hw = self[i]
            hw.Name = mod
            hw.Description = module
            hw.Type = mtype
            hw.Card = Card()
            hw.Card.ModuleName = module
            hw.Status = HW_CONF
            if module and modinfo:
                for info in modinfo.keys():
                    if info == module:
                        if modinfo[info].has_key('description'):
                            hw.Description = modinfo[info]['description']

            for selfkey in self.keydict.keys():
                confkey = self.keydict[selfkey]
                if modules[hw.Card.ModuleName] and \
                       modules[hw.Card.ModuleName]['options'].has_key(confkey):
                    setattr(hw.Card, selfkey, 
                            modules[hw.Card.ModuleName]['options'][confkey])
    def do_init(self):
        # pylint: disable-msg=W0201
        xml_signal_autoconnect(
            self.xml, {
                "on_essidAutoButton_toggled": self.on_essidAutoButton_toggled,
            })

        window = self.sharedtcpip_xml.get_widget('dhcpWindow')
        frame = self.sharedtcpip_xml.get_widget('dhcpFrame')
        vbox = self.xml.get_widget('generalVbox')
        window.remove(frame)
        vbox.pack_start(frame)
        sharedtcpip.dhcp_init(self.sharedtcpip_xml, self.device)

        window = self.sharedtcpip_xml.get_widget('routeWindow')
        frame = self.sharedtcpip_xml.get_widget('routeFrame')
        vbox = self.xml.get_widget('routeVbox')
        window.remove(frame)
        vbox.pack_start(frame)
        sharedtcpip.route_init(self.sharedtcpip_xml, self.device, self.dialog)

        window = self.sharedtcpip_xml.get_widget('hardwareWindow')
        frame = self.sharedtcpip_xml.get_widget('hardwareFrame')
        vbox = self.xml.get_widget('hardwareVbox')
        window.remove(frame)
        vbox.pack_start(frame)
        sharedtcpip.hardware_init(self.sharedtcpip_xml, self.device)

        self.modestore = gtk.ListStore(gobject.TYPE_STRING,
                                       gobject.TYPE_STRING)
        for i in modeList:
            self.modestore.append(i)

        combo = self.xml.get_widget("modeCombo")
        combo.set_model(self.modestore)
        cell = gtk.CellRendererText()
        combo.pack_start(cell, True)
        combo.add_attribute(cell, 'text', 0)

        self.xml.get_widget("rateCombo").set_popdown_strings(
            (_("Auto"), "11M", "5.5M", "2M", "1M"))

        combo.connect("changed", self.on_modeChanged)
        self.initialized = True
    def hydrateProfiles(self, refresh=None):
        profilelist = getProfileList(refresh)

        self.no_profileentry_update = True
        omenu = self.xml.get_widget('profileOption')

        if len(profilelist) == 1:
            self.xml.get_widget('profileFrame').hide()

        if omenu:
            omenu.remove_menu()

        menu = gtk.Menu()
        history = 0
        i = 0
        for prof in profilelist:
            name = prof.ProfileName
            # change the default profile to a more understandable name
            if name == "default":
                name = DEFAULT_PROFILE_NAME
            if prof.Active == True:
                name += _(" (active)")
            menu_item = gtk.MenuItem(name)
            menu_item.show()
            menu_item.connect("activate", self.on_profileMenuItem_activated,
                              prof.ProfileName)
            menu.append(menu_item)
            if prof.ProfileName == self.get_active_profile().ProfileName:
                history = i
                if self.oldprofile == None:
                    self.oldprofile = prof.ProfileName
            i = i + 1
        if self.get_active_profile().ProfileName != self.oldprofile:
            self.xml.get_widget('interfaceClist').set_sensitive(False)
        else:
            self.xml.get_widget('interfaceClist').set_sensitive(True)
        menu.show()

        if omenu:
            omenu.set_menu(menu)
            omenu.set_history(history)

        menu.get_children()[history].activate()
        self.no_profileentry_update = False
Beispiel #30
0
    def dehydrate(self):
        hardwarelist = NCHardwareList.getHardwareList()

        self.hw.Description = _('Generic Modem')

        modem_list = []
        if not self.hw.Name:
            for i in hardwarelist:
                if i.Type == "Modem":
                    modem_list.append(i.Name)
            if modem_list:
                for i in xrange(100):
                    if modem_list.count("Modem" + str(i)) == 0:
                        self.hw.Name = "Modem" + str(i)
                        break
            else:
                self.hw.Name = "Modem0"

        self.hw.Modem.DeviceName = self.xml.get_widget(\
            "modemDeviceEntry").get_text()
        self.hw.Modem.BaudRate = int(\
            self.xml.get_widget("baudrateEntry").get_text())

        flow = self.xml.get_widget("flowControlEntry").get_text()
        for i in modemFlowControls.keys():
            if modemFlowControls[i] == flow:
                self.hw.Modem.FlowControl = i
                break

        Item = self.xml.get_widget("volumeMenu").get_child().get_label()
        if Item == _("Off"):
            self.hw.Modem.ModemVolume = 0
        elif Item == _("Low"):
            self.hw.Modem.ModemVolume = 1
        elif Item == _("Medium"):
            self.hw.Modem.ModemVolume = 2
        elif Item == _("High"):
            self.hw.Modem.ModemVolume = 3
        elif Item == _("Very High"):
            self.hw.Modem.ModemVolume = 4
        else:
            self.hw.Modem.ModemVolume = 0

        if self.xml.get_widget("toneDialingCB").get_active():
            self.hw.Modem.DialCommand = "ATDT"
        else:
            self.hw.Modem.DialCommand = "ATDP"

        if len(self.hw.Modem.DeviceName)>5 and \
               self.hw.Modem.DeviceName[:5] != '/dev/':
            self.hw.Modem.DeviceName = '/dev/' + self.hw.Modem.DeviceName