コード例 #1
0
    def __init__(self, parent):
        from eg.WinApi.SystemInformation import GetWindowsVersionString
        buildTime = time.strftime(
            Text.CreationDate,
            time.gmtime(eg.Version.buildTime)
        )
        totalMemory = GetRam()[0]
        pythonVersion = "%d.%d.%d %s %d" % tuple(sys.version_info)
        if is_stackless:
            pythonVersion = "Stackless Python " + pythonVersion
        self.sysInfos = [
            "Software",
            ("Program Version", eg.Version.string),
            ("Build Time", buildTime),
            ("Python Version", pythonVersion),
            ("wxPython Version", wx.VERSION_STRING),
            "\nSystem",
            ("Operating System", GetWindowsVersionString()),
            ("CPU", GetCpuName()),
            ("RAM", "%s GB" % totalMemory),
            "\nUSB-Devices",
        ]
        devices = eg.WinUsb.ListDevices()
        for hardwareId in sorted(devices.keys()):
            device = devices[hardwareId]
            self.sysInfos.append((device.name, device.hardwareId))
        lines = []
        for line in self.sysInfos:
            if isinstance(line, tuple):
                lines.append('<tr><td>%s:</td><td>%s</td></tr>' % line)
            else:
                lines.append('</table><p><b>%s</b><br><table>' % line)
        lines.append('</table>')
        page = "\n".join(lines)
        HtmlPanel.__init__(self, parent, page)
        self.htmlWindow.Bind(wx.EVT_RIGHT_DOWN, self.OnRightClick)
        self.htmlWindow.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown)

        contextMenu = wx.Menu()
        contextMenu.Append(wx.ID_COPY, eg.text.MainFrame.Menu.Copy)
        self.Bind(wx.EVT_MENU, self.OnCmdCopy, id=wx.ID_COPY)
        self.contextMenu = contextMenu
コード例 #2
0
    PBT_APMBATTERYLOW,
    PBT_APMOEMEVENT,
    # PBT_APMPOWERSTATUSCHANGE,
    PBT_APMQUERYSUSPEND,
    PBT_APMQUERYSUSPENDFAILED,
    PBT_APMRESUMEAUTOMATIC,
    PBT_APMRESUMECRITICAL,
    PBT_APMRESUMESUSPEND,
    PBT_APMSUSPEND,
    WM_POWERBROADCAST,
)

UCHAR = ctypes.c_ubyte
DWORD = ctypes.wintypes.DWORD

winVer = GetWindowsVersionString()[18:]
WIN_7 = not (winVer.startswith('10') or winVer.startswith('8'))

PBT_POWERSETTINGCHANGE = 0x8013

PWR_AC = 0x0
PWR_DC = 0x1
PWR_UPS = 0x2

MON_OFF = 0x0
MON_ON = 0x1
MON_DIM = 0x2

SVR_OFF = 0x0
SVR_ON = 0x1