.. include:: headings.inc .. _PlatformInfo: ========================================================================================================================================== |phoenix_title| **PlatformInfo** ========================================================================================================================================== This class holds informations about the operating system, the toolkit and the basic architecture of the machine where the application is currently running. This class does not only have `getters` for the informations above, it also has `setters`. This allows you to e.g. save the current platform informations in a data file (maybe in string form) so that when you later load it, you can easily retrieve (see the static getters for string->enum conversion functions) and store inside a :ref:`PlatformInfo` instance (using its setters) the signature of the system which generated it. In general however you only need to use the static :meth:`~PlatformInfo.Get` function and then access the various informations for the current platform: :: wx.LogMessage("This application is running under %s." % wx.PlatformInfo.Get().GetOperatingSystemIdName()) .. seealso:: :func:`GetOsVersion`, :func:`IsPlatformLittleEndian`, :func:`IsPlatform64Bit`, :ref:`AppTraits`, | |class_hierarchy| Inheritance Diagram ===================================== Inheritance diagram for class **PlatformInfo** .. raw:: html

Inheritance diagram of PlatformInfo

| |method_summary| Methods Summary ================================ ================================================================================ ================================================================================ :meth:`~PlatformInfo.__init__` Initializes the instance with the values corresponding to the currently running platform. :meth:`~PlatformInfo.CheckOSVersion` Returns ``True`` if the OS version is at least ``major.minor`` . :meth:`~PlatformInfo.CheckToolkitVersion` Returns ``True`` if the toolkit version is at least ``major.minor`` . :meth:`~PlatformInfo.Get` Returns the global :ref:`PlatformInfo` object, initialized with the values for the currently running platform. :meth:`~PlatformInfo.GetArch` Converts the given string to a Architecture enum value or to ``ARCH_INVALID`` if the given string is not a valid architecture string (i.e. :meth:`~PlatformInfo.GetArchName` Returns the name for the architecture of this :ref:`PlatformInfo` instance. :meth:`~PlatformInfo.GetArchitecture` Returns the architecture ``ID`` of this :ref:`PlatformInfo` instance. :meth:`~PlatformInfo.GetDesktopEnvironment` Returns the desktop environment associated with this :ref:`PlatformInfo` instance. :meth:`~PlatformInfo.GetEndianness` Returns the endianness ``ID`` of this :ref:`PlatformInfo` instance. :meth:`~PlatformInfo.GetEndiannessName` Returns the name for the endianness of this :ref:`PlatformInfo` instance. :meth:`~PlatformInfo.GetLinuxDistributionInfo` Returns the Linux distribution info associated with this :ref:`PlatformInfo` instance. :meth:`~PlatformInfo.GetOSMajorVersion` Returns the run-time major version of the OS associated with this :ref:`PlatformInfo` instance. :meth:`~PlatformInfo.GetOSMinorVersion` Returns the run-time minor version of the OS associated with this :ref:`PlatformInfo` instance. :meth:`~PlatformInfo.GetOperatingSystemDescription` Returns the description of the operating system of this :ref:`PlatformInfo` instance. :meth:`~PlatformInfo.GetOperatingSystemDirectory` Returns the operating system directory. :meth:`~PlatformInfo.GetOperatingSystemFamilyName` Returns the operating system family name of the OS associated with this :ref:`PlatformInfo` instance. :meth:`~PlatformInfo.GetOperatingSystemId` Returns the operating system ``ID`` of this :ref:`PlatformInfo` instance. :meth:`~PlatformInfo.GetOperatingSystemIdName` Returns the operating system name of the OS associated with this :ref:`PlatformInfo` instance. :meth:`~PlatformInfo.GetPortId` Returns the wxWidgets port ``ID`` associated with this :ref:`PlatformInfo` instance. :meth:`~PlatformInfo.GetPortIdName` Returns the name of the wxWidgets port ``ID`` associated with this :ref:`PlatformInfo` instance. :meth:`~PlatformInfo.GetPortIdShortName` Returns the short name of the wxWidgets port ``ID`` associated with this :ref:`PlatformInfo` instance. :meth:`~PlatformInfo.GetToolkitMajorVersion` Returns the run-time major version of the toolkit associated with this :ref:`PlatformInfo` instance. :meth:`~PlatformInfo.GetToolkitMinorVersion` Returns the run-time minor version of the toolkit associated with this :ref:`PlatformInfo` instance. :meth:`~PlatformInfo.IsOk` Returns ``True`` if this instance is fully initialized with valid values. :meth:`~PlatformInfo.IsUsingUniversalWidgets` Returns ``True`` if this :ref:`PlatformInfo` describes wxUniversal build. :meth:`~PlatformInfo.SetArchitecture` Sets the architecture enum value associated with this :ref:`PlatformInfo` instance. :meth:`~PlatformInfo.SetDesktopEnvironment` Sets the desktop environment associated with this :ref:`PlatformInfo` instance. :meth:`~PlatformInfo.SetEndianness` Sets the endianness enum value associated with this :ref:`PlatformInfo` instance. :meth:`~PlatformInfo.SetLinuxDistributionInfo` Sets the linux distribution info associated with this :ref:`PlatformInfo` instance. :meth:`~PlatformInfo.SetOSVersion` Sets the version of the operating system associated with this :ref:`PlatformInfo` instance. :meth:`~PlatformInfo.SetOperatingSystemDescription` Sets the operating system description associated with this :ref:`PlatformInfo` instance. :meth:`~PlatformInfo.SetOperatingSystemId` Sets the operating system associated with this :ref:`PlatformInfo` instance. :meth:`~PlatformInfo.SetPortId` Sets the wxWidgets port ``ID`` associated with this :ref:`PlatformInfo` instance. :meth:`~PlatformInfo.SetToolkitVersion` Sets the version of the toolkit associated with this :ref:`PlatformInfo` instance. :meth:`~PlatformInfo.__ne__` Inequality operator. :meth:`~PlatformInfo.__eq__` Equality operator. ================================================================================ ================================================================================ | |property_summary| Properties Summary ===================================== ================================================================================ ================================================================================ :attr:`~PlatformInfo.ArchName` See :meth:`~PlatformInfo.GetArchName` :attr:`~PlatformInfo.Architecture` See :meth:`~PlatformInfo.GetArchitecture` and :meth:`~PlatformInfo.SetArchitecture` :attr:`~PlatformInfo.DesktopEnvironment` See :meth:`~PlatformInfo.GetDesktopEnvironment` and :meth:`~PlatformInfo.SetDesktopEnvironment` :attr:`~PlatformInfo.Endianness` See :meth:`~PlatformInfo.GetEndianness` and :meth:`~PlatformInfo.SetEndianness` :attr:`~PlatformInfo.EndiannessName` See :meth:`~PlatformInfo.GetEndiannessName` :attr:`~PlatformInfo.LinuxDistributionInfo` See :meth:`~PlatformInfo.GetLinuxDistributionInfo` and :meth:`~PlatformInfo.SetLinuxDistributionInfo` :attr:`~PlatformInfo.OSMajorVersion` See :meth:`~PlatformInfo.GetOSMajorVersion` :attr:`~PlatformInfo.OSMinorVersion` See :meth:`~PlatformInfo.GetOSMinorVersion` :attr:`~PlatformInfo.OperatingSystemDescription` See :meth:`~PlatformInfo.GetOperatingSystemDescription` and :meth:`~PlatformInfo.SetOperatingSystemDescription` :attr:`~PlatformInfo.OperatingSystemFamilyName` See :meth:`~PlatformInfo.GetOperatingSystemFamilyName` :attr:`~PlatformInfo.OperatingSystemId` See :meth:`~PlatformInfo.GetOperatingSystemId` and :meth:`~PlatformInfo.SetOperatingSystemId` :attr:`~PlatformInfo.OperatingSystemIdName` See :meth:`~PlatformInfo.GetOperatingSystemIdName` :attr:`~PlatformInfo.PortId` See :meth:`~PlatformInfo.GetPortId` and :meth:`~PlatformInfo.SetPortId` :attr:`~PlatformInfo.PortIdName` See :meth:`~PlatformInfo.GetPortIdName` :attr:`~PlatformInfo.PortIdShortName` See :meth:`~PlatformInfo.GetPortIdShortName` :attr:`~PlatformInfo.ToolkitMajorVersion` See :meth:`~PlatformInfo.GetToolkitMajorVersion` :attr:`~PlatformInfo.ToolkitMinorVersion` See :meth:`~PlatformInfo.GetToolkitMinorVersion` ================================================================================ ================================================================================ | |api| Class API =============== .. class:: PlatformInfo(object) This class holds informations about the operating system, the toolkit and the basic architecture of the machine where the application is currently running. **Possible constructors**:: PlatformInfo() PlatformInfo(pid, tkMajor=-1, tkMinor=-1, id=OS_UNKNOWN, osMajor=-1, osMinor=-1, arch=ARCH_INVALID, endian=ENDIAN_INVALID) .. method:: __init__(self, *args, **kw) |overload| **Overloaded Implementations**: **~~~** **__init__** `(self)` Initializes the instance with the values corresponding to the currently running platform. This is a fast operation because it only requires to copy the values internally cached for the currently running platform. .. seealso:: :meth:`Get` **~~~** **__init__** `(self, pid, tkMajor=-1, tkMinor=-1, id=OS_UNKNOWN, osMajor=-1, osMinor=-1, arch=ARCH_INVALID, endian=ENDIAN_INVALID)` Initializes the object using given values. :param `pid`: :type `pid`: PortId :param `tkMajor`: :type `tkMajor`: int :param `tkMinor`: :type `tkMinor`: int :param `id`: :type `id`: OperatingSystemId :param `osMajor`: :type `osMajor`: int :param `osMinor`: :type `osMinor`: int :param `arch`: :type `arch`: Architecture :param `endian`: :type `endian`: Endianness **~~~** .. method:: CheckOSVersion(self, major, minor) Returns ``True`` if the OS version is at least ``major.minor`` . :param `major`: :type `major`: int :param `minor`: :type `minor`: int :rtype: `bool` .. seealso:: :meth:`GetOSMajorVersion` , :meth:`GetOSMinorVersion` , :meth:`CheckToolkitVersion` .. method:: CheckToolkitVersion(self, major, minor) Returns ``True`` if the toolkit version is at least ``major.minor`` . :param `major`: :type `major`: int :param `minor`: :type `minor`: int :rtype: `bool` .. seealso:: :meth:`GetToolkitMajorVersion` , :meth:`GetToolkitMinorVersion` , :meth:`CheckOSVersion` .. staticmethod:: Get() Returns the global :ref:`PlatformInfo` object, initialized with the values for the currently running platform. :rtype: :ref:`PlatformInfo` .. staticmethod:: GetArch(arch) Converts the given string to a Architecture enum value or to ``ARCH_INVALID`` if the given string is not a valid architecture string (i.e. does not contain nor ``32`` nor ``64`` strings). :param `arch`: :type `arch`: string :rtype: :ref:`Architecture` .. method:: GetArchName(self, *args, **kw) Returns the name for the architecture of this :ref:`PlatformInfo` instance. .. method:: GetArchitecture(self) Returns the architecture ``ID`` of this :ref:`PlatformInfo` instance. :rtype: :ref:`Architecture` .. method:: GetDesktopEnvironment(self) Returns the desktop environment associated with this :ref:`PlatformInfo` instance. See :meth:`AppTraits.GetDesktopEnvironment` for more info. :rtype: `string` .. method:: GetEndianness(self, *args, **kw) Returns the endianness ``ID`` of this :ref:`PlatformInfo` instance. .. method:: GetEndiannessName(self, *args, **kw) Returns the name for the endianness of this :ref:`PlatformInfo` instance. .. method:: GetLinuxDistributionInfo(self) Returns the Linux distribution info associated with this :ref:`PlatformInfo` instance. See :func:`GetLinuxDistributionInfo` for more info. :rtype: :ref:`LinuxDistributionInfo` .. method:: GetOSMajorVersion(self) Returns the run-time major version of the OS associated with this :ref:`PlatformInfo` instance. :rtype: `int` .. seealso:: :func:`GetOsVersion`, :meth:`CheckOSVersion` .. method:: GetOSMinorVersion(self) Returns the run-time minor version of the OS associated with this :ref:`PlatformInfo` instance. :rtype: `int` .. seealso:: :func:`GetOsVersion`, :meth:`CheckOSVersion` .. method:: GetOperatingSystemDescription(self) Returns the description of the operating system of this :ref:`PlatformInfo` instance. See GetOSDescription() for more info. :rtype: `string` .. staticmethod:: GetOperatingSystemDirectory() Returns the operating system directory. See :func:`GetOSDirectory` for more info. :rtype: `string` .. method:: GetOperatingSystemFamilyName(self, *args, **kw) Returns the operating system family name of the OS associated with this :ref:`PlatformInfo` instance. .. method:: GetOperatingSystemId(self, *args, **kw) Returns the operating system ``ID`` of this :ref:`PlatformInfo` instance. See :func:`GetOsVersion` for more info. .. method:: GetOperatingSystemIdName(self, *args, **kw) Returns the operating system name of the OS associated with this :ref:`PlatformInfo` instance. .. method:: GetPortId(self, *args, **kw) Returns the wxWidgets port ``ID`` associated with this :ref:`PlatformInfo` instance. .. method:: GetPortIdName(self, *args, **kw) Returns the name of the wxWidgets port ``ID`` associated with this :ref:`PlatformInfo` instance. .. method:: GetPortIdShortName(self, *args, **kw) Returns the short name of the wxWidgets port ``ID`` associated with this :ref:`PlatformInfo` instance. .. method:: GetToolkitMajorVersion(self) Returns the run-time major version of the toolkit associated with this :ref:`PlatformInfo` instance. Note that if :meth:`GetPortId` returns ``PORT_BASE`` , then this value is zero (unless externally modified with :meth:`SetToolkitVersion` ); that is, no native toolkit is in use. See :meth:`AppTraits.GetToolkitVersion` for more info. :rtype: `int` .. seealso:: :meth:`CheckToolkitVersion` .. method:: GetToolkitMinorVersion(self) Returns the run-time minor version of the toolkit associated with this :ref:`PlatformInfo` instance. Note that if :meth:`GetPortId` returns ``PORT_BASE`` , then this value is zero (unless externally modified with :meth:`SetToolkitVersion` ); that is, no native toolkit is in use. See :meth:`AppTraits.GetToolkitVersion` for more info. :rtype: `int` .. seealso:: :meth:`CheckToolkitVersion` .. method:: IsOk(self) Returns ``True`` if this instance is fully initialized with valid values. :rtype: `bool` .. method:: IsUsingUniversalWidgets(self) Returns ``True`` if this :ref:`PlatformInfo` describes wxUniversal build. :rtype: `bool` .. method:: SetArchitecture(self, n) Sets the architecture enum value associated with this :ref:`PlatformInfo` instance. :param `n`: :type `n`: Architecture .. method:: SetDesktopEnvironment(self, de) Sets the desktop environment associated with this :ref:`PlatformInfo` instance. :param `de`: :type `de`: string .. method:: SetEndianness(self, n) Sets the endianness enum value associated with this :ref:`PlatformInfo` instance. :param `n`: :type `n`: Endianness .. method:: SetLinuxDistributionInfo(self, di) Sets the linux distribution info associated with this :ref:`PlatformInfo` instance. :param `di`: :type `di`: LinuxDistributionInfo .. method:: SetOSVersion(self, major, minor) Sets the version of the operating system associated with this :ref:`PlatformInfo` instance. :param `major`: :type `major`: int :param `minor`: :type `minor`: int .. method:: SetOperatingSystemDescription(self, desc) Sets the operating system description associated with this :ref:`PlatformInfo` instance. :param `desc`: :type `desc`: string .. method:: SetOperatingSystemId(self, n) Sets the operating system associated with this :ref:`PlatformInfo` instance. :param `n`: :type `n`: OperatingSystemId .. method:: SetPortId(self, n) Sets the wxWidgets port ``ID`` associated with this :ref:`PlatformInfo` instance. :param `n`: :type `n`: PortId .. method:: SetToolkitVersion(self, major, minor) Sets the version of the toolkit associated with this :ref:`PlatformInfo` instance. :param `major`: :type `major`: int :param `minor`: :type `minor`: int .. method:: __ne__(self) Inequality operator. Tests all class' internal variables. :param `t`: :type `t`: PlatformInfo .. method:: __eq__(self) Equality operator. Tests all class' internal variables. :param `t`: :type `t`: PlatformInfo .. attribute:: ArchName See :meth:`~PlatformInfo.GetArchName` .. attribute:: Architecture See :meth:`~PlatformInfo.GetArchitecture` and :meth:`~PlatformInfo.SetArchitecture` .. attribute:: DesktopEnvironment See :meth:`~PlatformInfo.GetDesktopEnvironment` and :meth:`~PlatformInfo.SetDesktopEnvironment` .. attribute:: Endianness See :meth:`~PlatformInfo.GetEndianness` and :meth:`~PlatformInfo.SetEndianness` .. attribute:: EndiannessName See :meth:`~PlatformInfo.GetEndiannessName` .. attribute:: LinuxDistributionInfo See :meth:`~PlatformInfo.GetLinuxDistributionInfo` and :meth:`~PlatformInfo.SetLinuxDistributionInfo` .. attribute:: OSMajorVersion See :meth:`~PlatformInfo.GetOSMajorVersion` .. attribute:: OSMinorVersion See :meth:`~PlatformInfo.GetOSMinorVersion` .. attribute:: OperatingSystemDescription See :meth:`~PlatformInfo.GetOperatingSystemDescription` and :meth:`~PlatformInfo.SetOperatingSystemDescription` .. attribute:: OperatingSystemFamilyName See :meth:`~PlatformInfo.GetOperatingSystemFamilyName` .. attribute:: OperatingSystemId See :meth:`~PlatformInfo.GetOperatingSystemId` and :meth:`~PlatformInfo.SetOperatingSystemId` .. attribute:: OperatingSystemIdName See :meth:`~PlatformInfo.GetOperatingSystemIdName` .. attribute:: PortId See :meth:`~PlatformInfo.GetPortId` and :meth:`~PlatformInfo.SetPortId` .. attribute:: PortIdName See :meth:`~PlatformInfo.GetPortIdName` .. attribute:: PortIdShortName See :meth:`~PlatformInfo.GetPortIdShortName` .. attribute:: ToolkitMajorVersion See :meth:`~PlatformInfo.GetToolkitMajorVersion` .. attribute:: ToolkitMinorVersion See :meth:`~PlatformInfo.GetToolkitMinorVersion`