Example #1
0
def get_plr_vers():
    '''
        Retrieves the version of the Scala Player software from the Registry.
        Returns:
            version string or None if not found.
    '''
    key = r'HKLM\SOFTWARE\Scala\InfoChannel Player 5\ProductVersion'
    try:
        value = st.get_regval(key)
    except:
        value = None
    return value
Example #2
0
def get_plr_vers():
    '''
        Retrieves the version of the Scala Player software from the Registry.
        Returns:
            version string or None if not found.
    '''
    key = r'HKLM\SOFTWARE\Scala\InfoChannel Player 5\ProductVersion'
    try:
        value = st.get_regval(key)
    except:
        value = None
    return value
Example #3
0
def get_monitor_res():
    '''
        This function attempts to retrieve the native hardware resolution of
        the first monitor returned by Windows.  It does this by looking for
        a connected monitor and then parsing its EDID information cached in
        the registry.
        Returns:
            Tuple containing, (W, H, Orientation)
            None on error.
        Note:
            If the resolution found is below 1024x768 it will be raised to
            that as a minimum fallback.
    '''
    import win32api as api, win32con as con, pywintypes
    res, curres, fsres = (0, 0), (0, 0), (1024, 768)
    dtd = 54  # start byte of detailed timing desc.
    try:  # preserve current settings, orientation of first display
        devmode = api.EnumDisplaySettings(None, con.ENUM_CURRENT_SETTINGS)
        res = (devmode.PelsWidth, devmode.PelsHeight)  # may differ bc of setup
        orient = devmode.DisplayOrientation
        _log.debug('Current display orientation from Win32api: %s' % orient)
    except pywintypes.error:
        orient = 0
    try:  # get PNP id to find EDID in registry
        for monitor in wmiquery('Select * from Win32_DesktopMonitor'):
            # http://msdn.microsoft.com/en-us/library/aa394122%28VS.85%29.aspx
            if monitor.Availability in (3, 7, 13, 14, 15, 16):  # connected
                curres = (monitor.ScreenWidth, monitor.ScreenHeight)
                _log.debug('Current monitor resolution from WMI: %s' %
                           (curres, ))
                regkey = ('HKLM\\SYSTEM\\CurrentControlSet\\Enum\\' +
                          monitor.PNPDeviceID + '\\Device Parameters\\EDID')
                edid = st.get_regval(regkey)
                if edid:
                    _log.debug('EDID Version: %s.%s' % (edid[18], edid[19]))
                    # upper nibble of byte x 2^8 combined with full byte
                    hres = ((edid[dtd + 4] >> 4) << 8) | edid[dtd + 2]
                    vres = ((edid[dtd + 7] >> 4) << 8) | edid[dtd + 5]
                    _log.debug('EDID DTD0: ' + str((hres, vres)))
                    res = (hres, vres)
                    break  # give up on first success
                else:
                    raise RuntimeError, 'EDID not found in registry'
    except RuntimeError, e:
        _log.error('%s.' % e)
Example #4
0
def get_monitor_res():
    '''
        This function attempts to retrieve the native hardware resolution of
        the first monitor returned by Windows.  It does this by looking for
        a connected monitor and then parsing its EDID information cached in
        the registry.
        Returns:
            Tuple containing, (W, H, Orientation)
            None on error.
        Note:
            If the resolution found is below 1024x768 it will be raised to
            that as a minimum fallback.
    '''
    import win32api as api, win32con as con, pywintypes
    res, curres, fsres = (0, 0), (0, 0), (1024, 768)
    dtd = 54  # start byte of detailed timing desc.
    try:  # preserve current settings, orientation of first display
        devmode = api.EnumDisplaySettings(None, con.ENUM_CURRENT_SETTINGS)
        res = (devmode.PelsWidth, devmode.PelsHeight)  # may differ bc of setup
        orient = devmode.DisplayOrientation
        _log.debug('Current display orientation from Win32api: %s' % orient)
    except pywintypes.error:
        orient = 0
    try:  # get PNP id to find EDID in registry
        for monitor in wmiquery('Select * from Win32_DesktopMonitor'):
            # http://msdn.microsoft.com/en-us/library/aa394122%28VS.85%29.aspx
            if monitor.Availability in (3, 7, 13, 14, 15, 16): # connected
                curres = (monitor.ScreenWidth, monitor.ScreenHeight)
                _log.debug('Current monitor resolution from WMI: %s' % (curres,))
                regkey = ('HKLM\\SYSTEM\\CurrentControlSet\\Enum\\' +
                    monitor.PNPDeviceID + '\\Device Parameters\\EDID')
                edid = st.get_regval(regkey)
                if edid:
                    _log.debug('EDID Version: %s.%s' % (edid[18], edid[19]))
                    # upper nibble of byte x 2^8 combined with full byte
                    hres = ((edid[dtd+4] >> 4) << 8) | edid[dtd+2]
                    vres = ((edid[dtd+7] >> 4) << 8) | edid[dtd+5]
                    _log.debug('EDID DTD0: ' + str((hres, vres)))
                    res = (hres, vres)
                    break  # give up on first success
                else:
                    raise RuntimeError, 'EDID not found in registry'
    except RuntimeError, e:
        _log.error('%s.' % e)
Example #5
0
import scalalib
import scalatools
svars = scalalib.sharedvars()

svars.results = scalatools.get_regval(svars.keypath)

Example #6
0
    _def_timing = (13, 1, 0)
    _def_loglevel = 'info'
    _warn_on_tries = 3
    _not_avail_msg = 'NOT_AVAILABLE'
    _ex_authstr = 'wsusr:pwd'
    _ex_network = 'Company'
    _ex_baseurl = 'http://myco.com:8080/ContentManager/'
    _svc_name = 'ScalaNetClient5'
    _ERR_BASE = 2
    _ERR_NET = 3
    _ERR_AUTH = 4
    _ERR_MISC = 5

    # check for proxy settings, py env vars have an effect as well.
    _proxy_url = ''
    if st.get_regval(r'HKCU\Software\Microsoft\Windows' +
                     r'\CurrentVersion\Internet Settings\ProxyEnable'):
        _proxy_url = st.get_regval(
            r'HKCU\Software\Microsoft' +
            r'\Windows\CurrentVersion\Internet Settings\ProxyServer')
        if ';' in _proxy_url:  # handle advanced... settings
            for purl in _proxy_url.split(';'):
                purl = purl.partition('=')
                if purl[0] == 'http':
                    _proxy_url = purl[2]
                    break
        _proxy_url = 'http://%s/' % _proxy_url

    _netic_templ = '''!ScalaScript500
// Created by Scala Provisioner (scalaprov.py), Version %(ver)s
{
    Optional Log.DaysToKeepLogs = 7;
Example #7
0
    _def_timing             = (13, 1, 0)
    _def_loglevel           = 'info'
    _warn_on_tries          = 3
    _not_avail_msg          = 'NOT_AVAILABLE'
    _ex_authstr             = 'wsusr:pwd'
    _ex_network             = 'Company'
    _ex_baseurl             = 'http://myco.com:8080/ContentManager/'
    _svc_name               = 'ScalaNetClient5'
    _ERR_BASE               = 2
    _ERR_NET                = 3
    _ERR_AUTH               = 4
    _ERR_MISC               = 5

    # check for proxy settings, py env vars have an effect as well.
    _proxy_url = ''
    if st.get_regval(r'HKCU\Software\Microsoft\Windows' +
        r'\CurrentVersion\Internet Settings\ProxyEnable'):
        _proxy_url = st.get_regval(r'HKCU\Software\Microsoft' +
            r'\Windows\CurrentVersion\Internet Settings\ProxyServer')
        if ';' in _proxy_url:  # handle advanced... settings
            for purl in _proxy_url.split(';'):
                purl = purl.partition('=')
                if purl[0] == 'http':
                    _proxy_url = purl[2]; break
        _proxy_url = 'http://%s/' % _proxy_url

    _netic_templ = '''!ScalaScript500
// Created by Scala Provisioner (scalaprov.py), Version %(ver)s
{
    Optional Log.DaysToKeepLogs = 7;
    Optional Log.DetailsLevel = 1;
    Optional NETIC.AlertIfNotPlaying = On;