Helper RAII
class ensuring that power resources are released.
A wx.PowerResourceBlocker object acquires a power resource in the constructor and releases it in the destructor making it impossible to forget to release the power resource (which would prevent suspending or screen power off until the application ends).
Example:
blocker = wx.PowerResourceBlocker( wx.POWER_RESOURCE_SYSTEM, "Downloading something important") if not blocker.IsInEffect(): # If the resource could not be acquired, tell the user that he has # to keep the system alive wx.LogMessage("Warning: system may suspend while downloading.") # Run an important download and the system will not suspend while downloading for i in range(download.size()): download.read_byte() del blocker # wx.POWER_RESOURCE_SYSTEM automatically released here.
Base
Added in version 4.1/wxWidgets-3.1.0.
Class Hierarchy¶Inheritance diagram for class
PowerResourceBlocker:
Methods Summary¶ Class API¶Possible constructors:
PowerResourceBlocker(kind, reason="") -> None
Helper RAII
class ensuring that power resources are released.
Acquires the power resource.
Uses the same parameters as wx.PowerResource.Acquire
.
kind (PowerResourceKind)
reason (string)
None
Returns whether the power resource could be acquired.
This can be used to inform the user that the application will not prevent automatic suspending.
bool
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4