# Path: lanshark/configuration.py
# class Boolean(Key):
#     """Represents a bool"""
#     keytype = bool
#     def parse(self, value):
#         return (value.lower() != "false")
# 
# class Integer(Key):
#     """Represents a int"""
#     keytype = int
# 
# class String(Key):
#     """Represents a str"""
#     keytype = str
# 
# class StringList(List, String):
#     "list of strings"
#     pass
# 
# class Enum(String):
#     """Represents an enum"""
#     def __init__(self, default, values, doc):
#         """Creates new instance. `values` is a tuple of all valid enum
#         values"""
#         String.__init__(self, default, doc)
#         self.values = values
# 
#     def parse(self, value):
#         retval = String.parse(self, value)
#         if retval not in self.values:
#             raise ValueError('Invalid enum value %s' % retval)
#         return retval
# 
# Path: lanshark/configuration.py
# class Error(Exception):
# class Config(observable.Observable):
# class Key:
# class String(Key):
# class Integer(Key):
# class Float(float):
# class Boolean(Key):
# class Enum(String):
# class List:
# class StringList(List, String):
# class JSON(Key):
#     class TestConfig(Config):
#     def __init__(self, lineno, line, cause):
#     def __str__(self):
#     def __repr__(self):
#     def __init__(self):
#     def __setattr__(self, attr, value):
#     def load(self, f):
#     def _load(self, f):
#     def save(self, f):
#     def _save(self, f):
#     def __init__(self, default, doc):
#     def parse(self, value):
#     def dump(self, value):
#     def __repr__(self):
#     def parse(self, value):
#     def __init__(self, default, values, doc):
#     def parse(self, value):
#     def parse(self, value):
#         def parse(value):
#     def dump(self, value):
#         def dump(value):
#     def parse(self, value):
#     def dump(self, value):
# def test():


import os, sys
import socket
import locale
        import _winreg
                import psyco
import logging
from lanshark.configuration import Boolean, Integer, String, StringList, Enum
from lanshark import configuration
                try:
                    reg = _winreg.OpenKey(hkey, subkey)
                    value = _winreg.QueryValue(reg, name)
                    _winreg.CloseKey(reg)
                except _winreg.error:
                    pass
            return value
        player = '"%s"' % get_registry_value('Software\\VideoLAN','VLC') or ''
    else:
        player = select_app("gmplayer", "gxine", "totem", "kaffeine", "vlc",
                "mplayer", "xine")
    if player:
        player = player + " %s"
    return player

def get_imageviewer():
    return sys.platform.startswith("win") and "browser" or select_app(
            "kuickshow", "display") + " %s" or "browser"

def get_openfile():
    if sys.platform == "darwin":
        return "open"
    else:
        return select_app("xdg-open", "exo-open", "gnome-open") or ""

def get_sys_encoding():
    if sys.platform.startswith("win"):
        return "utf-8"
    return locale.getpreferredencoding()


# Path: lanshark/configuration.py
# class Boolean(Key):
#     """Represents a bool"""
#     keytype = bool
#     def parse(self, value):
#         return (value.lower() != "false")
# 
# class Integer(Key):
#     """Represents a int"""
#     keytype = int
# 
# class String(Key):
#     """Represents a str"""
#     keytype = str
# 
# class StringList(List, String):
#     "list of strings"
#     pass
# 
# class Enum(String):
#     """Represents an enum"""
#     def __init__(self, default, values, doc):
#         """Creates new instance. `values` is a tuple of all valid enum
#         values"""
#         String.__init__(self, default, doc)
#         self.values = values
# 
#     def parse(self, value):
#         retval = String.parse(self, value)
#         if retval not in self.values:
#             raise ValueError('Invalid enum value %s' % retval)
#         return retval
# 
# Path: lanshark/configuration.py
# class Error(Exception):
# class Config(observable.Observable):
# class Key:
# class String(Key):
# class Integer(Key):
# class Float(float):
# class Boolean(Key):
# class Enum(String):
# class List:
# class StringList(List, String):
# class JSON(Key):
#     class TestConfig(Config):
#     def __init__(self, lineno, line, cause):
#     def __str__(self):
#     def __repr__(self):
#     def __init__(self):
#     def __setattr__(self, attr, value):
#     def load(self, f):
#     def _load(self, f):
#     def save(self, f):
#     def _save(self, f):
#     def __init__(self, default, doc):
#     def parse(self, value):
#     def dump(self, value):
#     def __repr__(self):
#     def parse(self, value):
#     def __init__(self, default, values, doc):
#     def parse(self, value):
#     def parse(self, value):
#         def parse(value):
#     def dump(self, value):
#         def dump(value):
#     def parse(self, value):
#     def dump(self, value):
# def test():


# Path: lanshark/config.py
import os, sys
import socket
import locale
        import _winreg
                import psyco
import logging
from lanshark.configuration import Boolean, Integer, String, StringList, Enum
from lanshark import configuration

                try:
                    reg = _winreg.OpenKey(hkey, subkey)
                    value = _winreg.QueryValue(reg, name)
                    _winreg.CloseKey(reg)
                except _winreg.error:
                    pass
            return value
        player = '"%s"' % get_registry_value('Software\\VideoLAN','VLC') or ''
    else:
        player = select_app("gmplayer", "gxine", "totem", "kaffeine", "vlc",
                "mplayer", "xine")
    if player:
        player = player + " %s"
    return player

def get_imageviewer():
    return sys.platform.startswith("win") and "browser" or select_app(
            "kuickshow", "display") + " %s" or "browser"

def get_openfile():
    if sys.platform == "darwin":
        return "open"
    else:
        return select_app("xdg-open", "exo-open", "gnome-open") or ""

def get_sys_encoding():
    if sys.platform.startswith("win"):
        return "utf-8"
    return locale.getpreferredencoding()


class Config(configuration.Config):