Exemplo n.º 1
0
    def __init__(self):
        glade_file = "hardwaretype.glade"

        if not os.path.exists(glade_file):
            glade_file = GLADEPATH + glade_file
        if not os.path.exists(glade_file):
            glade_file = NETCONFDIR + glade_file

        self.xml = gtk.glade.XML(glade_file, None, domain=PROGNAME)
        xml_signal_autoconnect(self.xml,
            {
            "on_okButton_clicked" : self.on_okButton_clicked,
            "on_cancelButton_clicked" : self.on_cancelButton_clicked,
            })

        self.dialog = self.xml.get_widget("Dialog")
        load_icon("network.xpm", self.dialog)
        self.Type = None
        machine = os.uname()[4]
        hardwarelist = NCHardwareList.getHardwareList()
        if machine == 's390' or machine == 's390x':
            devicetypes = [ ETHERNET, TOKENRING, QETH ]
        else:
            df = getHardwareFactory()
            devicetypes = df.keys()

        for hw in hardwarelist:
            if hw.Type == ISDN:
                devicetypes.remove(ISDN)
                break


        self.xml.get_widget(
            'hardwareTypeCombo').set_popdown_strings(devicetypes)
        self.hydrate()
Exemplo n.º 2
0
    def getDevices(self, udi):
        obj = self._dbusBus.get_object("org.freedesktop.Hal", udi)
        category = self.getProperty(obj, "linux.subsystem")
        if category == "net" and self.getProperty(obj, "net.interface"):
            arp_proto_hw_id = self.getProperty(obj, "net.arp_proto_hw_id")
            if arp_proto_hw_id >= 256:
                return None

            from netconfpkg.NCHardwareFactory import getHardwareFactory
            hwf = getHardwareFactory()
            name = self.getProperty(obj, "net.interface")
            htype = getDeviceType(name)
            hwc = hwf.getHardwareClass(htype)
            if hwc:
                hw = hwc()
                hw.Card = Card()
                hw.Name = name
                hw.Type = htype
                hw.Description = ""
                try:
                    vendor = self.getVendor(udi)
                    if vendor:
                        hw.Description = "%s %s" % vendor
                except:
                    pass

                hw.Status = HW_SYSTEM

                index = self.getProperty(obj, "net.physical_device")
                if index != None:

                    hw.Card.ModuleName = self.getDriver(index)

                return hw
        return None
    def addHardware(self, mtype = None):
        from netconfpkg.NCHardwareFactory import getHardwareFactory
#        i = HardwareList_base.addHardware(self)
        
        hwf = getHardwareFactory()
        hwc = hwf.getHardwareClass(mtype)
        if hwc:
            newhw = hwc()
            self.append(newhw)
#        else: # FIXME: !!
#            raise TypeError
        return len(self)-1
def register_plugin():
    __df = getHardwareFactory()
    __df.register(HwEthernet, ETHERNET)
def register_plugin():
    __df = getHardwareFactory()
    __df.register(HwWireless, WIRELESS)
def register_plugin():
    import os
    machine = os.uname()[4]
    if machine == 's390' or machine == 's390x':
        __df = getHardwareFactory()
        __df.register(HwQeth, QETH)
def register_plugin():
    __df = getHardwareFactory()
    __df.register(HwTokenring, TOKENRING)
def register_plugin():
    __df = getHardwareFactory()
    __df.register(HwIsdn, ISDN)
Exemplo n.º 9
0
def register_plugin():
    __df = getHardwareFactory()
    __df.register(HwModem, MODEM)
Exemplo n.º 10
0
        modules = getMyConfModules()
        dic = modules[self.Name]
        dic['alias'] = self.Card.ModuleName
        modules[self.Name] = dic

    def isType(self, hardware):
        if hardware.Type == LCS:
            return True
        if getHardwareType(hardware.Hardware) == LCS:
            return True
        return False


def setHwLcsDialog(dialog):
    global _hwLcsDialog
    _hwLcsDialog = dialog


def setHwLcsWizard(wizard):
    global _hwLcsWizard
    _hwLcsWizard = wizard


import os
machine = os.uname()[4]
if machine == 's390' or machine == 's390x':
    df = getHardwareFactory()
    df.register(HwLcs, LCS)

__author__ = "Harald Hoyer <*****@*****.**>"