mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-21 22:16:38 +00:00
Add a delayed callback helper for python
This commit is contained in:
@@ -1799,6 +1799,11 @@ void CaptureContext::RemoveBookmark(uint32_t EID)
|
||||
RefreshUIStatus({}, true, true);
|
||||
}
|
||||
|
||||
void CaptureContext::DelayedCallback(uint32_t milliseconds, std::function<void()> callback)
|
||||
{
|
||||
QTimer::singleShot(milliseconds, callback);
|
||||
}
|
||||
|
||||
void CaptureContext::SetModification(CaptureModifications mod)
|
||||
{
|
||||
m_CaptureMods |= mod;
|
||||
|
||||
@@ -205,6 +205,8 @@ public:
|
||||
void SetBookmark(const EventBookmark &mark) override;
|
||||
void RemoveBookmark(uint32_t EID) override;
|
||||
|
||||
void DelayedCallback(uint32_t milliseconds, std::function<void()> callback) override;
|
||||
|
||||
IMainWindow *GetMainWindow() override;
|
||||
IEventBrowser *GetEventBrowser() override;
|
||||
IAPIInspector *GetAPIInspector() override;
|
||||
|
||||
@@ -2390,6 +2390,14 @@ If no bookmark exists, this function will do nothing.
|
||||
)");
|
||||
virtual void RemoveBookmark(uint32_t eventId) = 0;
|
||||
|
||||
DOCUMENT(R"(Registers a delayed callback to be called after a certain number of milliseconds
|
||||
on the UI thread.
|
||||
|
||||
:param int milliseconds: The number of milliseconds (approximately) to wait before the callback.
|
||||
:param Callable[[], None] callback: The function to call
|
||||
)");
|
||||
virtual void DelayedCallback(uint32_t milliseconds, std::function<void()> callback) = 0;
|
||||
|
||||
DOCUMENT(R"(Retrieve the current singleton :class:`MainWindow`.
|
||||
|
||||
:return: The current window.
|
||||
|
||||
@@ -629,6 +629,7 @@ struct CaptureContextInvoker : ObjectForwarder<ICaptureContext>
|
||||
{
|
||||
InvokeVoidFunction(&ICaptureContext::AddMessages, msgs);
|
||||
}
|
||||
virtual void ClearMessages() override { InvokeVoidFunction(&ICaptureContext::ClearMessages); }
|
||||
virtual void SetResourceCustomName(ResourceId id, const rdcstr &name) override
|
||||
{
|
||||
InvokeVoidFunction(&ICaptureContext::SetResourceCustomName, id, name);
|
||||
@@ -646,6 +647,10 @@ struct CaptureContextInvoker : ObjectForwarder<ICaptureContext>
|
||||
{
|
||||
InvokeVoidFunction(&ICaptureContext::RemoveBookmark, EID);
|
||||
}
|
||||
virtual void DelayedCallback(uint32_t milliseconds, std::function<void()> callback) override
|
||||
{
|
||||
InvokeVoidFunction(&ICaptureContext::DelayedCallback, milliseconds, callback);
|
||||
}
|
||||
virtual IMainWindow *GetMainWindow() override
|
||||
{
|
||||
return InvokeRetFunction<IMainWindow *>(&ICaptureContext::GetMainWindow);
|
||||
|
||||
Reference in New Issue
Block a user