Logo Search packages:      
Sourcecode: kde-hal-device-manager version File versions  Download package

def Representation::Representation::get_icon (   self,

Given a Device object return an icon to display

Definition at line 46 of file Representation.py.

00046                               :
        """Given a Device object return an icon to display"""

        # Default to abstract icon
        icon = self.icons["abstract"]

            product = device.properties["info.product"]
        except KeyError:
            product = "Unknown"
        except TypeError:
            return icon
        if product=="Computer":
            return self.icons["computer"]

        # First look at bus type, every device got Bus property
        if device.properties.has_key("info.bus"):
          bus = device.properties["info.bus"]
          if bus=="usb_device":
            icon = self.icons["bus_usb"]
          elif bus=="pci":
            icon = self.icons["bus_pci"]
          bus = "unknown"

        # Then look at Category, if available
        if not device.properties.has_key("info.category"):
            return icon
        cat = device.properties["info.category"]
        if cat=="input.mouse":
            icon = self.icons["mouse"]
        elif cat=="input.keyboard":
            icon = self.icons["keyboard"]
        elif cat=="pcmcia_socket":
            icon = self.icons["cardbus"]
        elif cat=="multimedia":
            icon = self.icons["video"]
        elif cat=="camera":
            icon = self.icons["camera"]
        elif cat=="storage" or cat=="storage.removable":
            if device.properties.has_key("storage.drive_type"):
                media = device.properties["storage.drive_type"]
                if media=="cdrom":
                    icon = self.icons["cdrom"]
                elif media=="floppy":
                    icon = self.icons["floppy"]
                elif media=="disk":
                    icon = self.icons["harddisk"]
                elif media=="flash":
                    icon = self.icons["flash"]
        elif cat=="net" or cat=="net.80211":
            icon = self.icons["network"]
        elif cat=="multimedia.audio":
            icon = self.icons["audio"]
        elif cat=="serial":
            icon = self.icons["serial"]

        return icon
        return icon

Generated by  Doxygen 1.6.0   Back to index