Properly update docstrings with optional/default parameters

This commit is contained in:
baldurk
2026-08-13 17:46:45 +01:00
parent ce8941150f
commit 4f3dab116b
6 changed files with 58 additions and 49 deletions
+10 -6
View File
@@ -665,12 +665,12 @@ IMiniQtHelper &CaptureContext::GetMiniQtHelper()
void CaptureContext::MessageDialog(const rdcstr &text, const rdcstr &title)
{
RDDialog::information(m_MainWindow, title, text);
RDDialog::information(m_MainWindow, title.isEmpty() ? "Python Extension Message" : title, text);
}
void CaptureContext::ErrorDialog(const rdcstr &text, const rdcstr &title)
{
RDDialog::critical(m_MainWindow, title, text);
RDDialog::critical(m_MainWindow, title.isEmpty() ? "Python Extension Error" : title, text);
}
DialogButton CaptureContext::QuestionDialog(const rdcstr &text, const rdcarray<DialogButton> &options,
@@ -679,22 +679,26 @@ DialogButton CaptureContext::QuestionDialog(const rdcstr &text, const rdcarray<D
QMessageBox::StandardButtons buttons;
for(DialogButton b : options)
buttons |= (QMessageBox::StandardButton)b;
return (DialogButton)RDDialog::question(m_MainWindow, title, text, buttons);
return (DialogButton)RDDialog::question(
m_MainWindow, title.isEmpty() ? "Python Extension Prompt" : title, text, buttons);
}
rdcstr CaptureContext::OpenFileName(const rdcstr &caption, const rdcstr &dir, const rdcstr &filter)
{
return RDDialog::getOpenFileName(m_MainWindow, caption, dir, filter);
return RDDialog::getOpenFileName(m_MainWindow, caption.isEmpty() ? "Open a file" : caption, dir,
filter);
}
rdcstr CaptureContext::OpenDirectoryName(const rdcstr &caption, const rdcstr &dir)
{
return RDDialog::getExistingDirectory(m_MainWindow, caption, dir);
return RDDialog::getExistingDirectory(m_MainWindow,
caption.isEmpty() ? "Open a directory" : caption, dir);
}
rdcstr CaptureContext::SaveFileName(const rdcstr &caption, const rdcstr &dir, const rdcstr &filter)
{
return RDDialog::getSaveFileName(m_MainWindow, caption, dir, filter);
return RDDialog::getSaveFileName(m_MainWindow, caption.isEmpty() ? "Save a file" : caption, dir,
filter);
}
void CaptureContext::AddSortedMenuItem(QMenu *menu, bool rootMenu, const rdcarray<rdcstr> &items,
+8 -9
View File
@@ -95,19 +95,18 @@ public:
IMiniQtHelper &GetMiniQtHelper() override;
void MessageDialog(const rdcstr &text, const rdcstr &title = "Python Extension Message") override;
void ErrorDialog(const rdcstr &text, const rdcstr &title = "Python Extension Error") override;
void MessageDialog(const rdcstr &text, const rdcstr &title = "") override;
void ErrorDialog(const rdcstr &text, const rdcstr &title = "") override;
DialogButton QuestionDialog(const rdcstr &text, const rdcarray<DialogButton> &options,
const rdcstr &title = "Python Extension Prompt") override;
const rdcstr &title = "") override;
rdcstr OpenFileName(const rdcstr &caption = "Open a file", const rdcstr &dir = rdcstr(),
const rdcstr &filter = rdcstr()) override;
rdcstr OpenFileName(const rdcstr &caption = "", const rdcstr &dir = "",
const rdcstr &filter = "") override;
rdcstr OpenDirectoryName(const rdcstr &caption = "Open a directory",
const rdcstr &dir = rdcstr()) override;
rdcstr OpenDirectoryName(const rdcstr &caption = "", const rdcstr &dir = "") override;
rdcstr SaveFileName(const rdcstr &caption = "Save a file", const rdcstr &dir = rdcstr(),
const rdcstr &filter = rdcstr()) override;
rdcstr SaveFileName(const rdcstr &caption = "", const rdcstr &dir = "",
const rdcstr &filter = "") override;
//////////////////////////////////////////////////////////////////////////////
// Control functions
+19 -21
View File
@@ -1200,60 +1200,58 @@ struct IExtensionManager
DOCUMENT(R"(Display a simple informational message dialog.
:param str text: The text of the dialog itself, required.
:param str title: The dialog title, optional.
:param str title="": **Optional parameter**. The dialog title.
)");
virtual void MessageDialog(const rdcstr &text,
const rdcstr &title = "Python Extension Message") = 0;
virtual void MessageDialog(const rdcstr &text, const rdcstr &title = "") = 0;
DOCUMENT(R"(Display an error message dialog.
:param str text: The text of the dialog itself, required.
:param str title: The dialog title, optional.
:param str title="": **Optional parameter**. The dialog title.
)");
virtual void ErrorDialog(const rdcstr &text, const rdcstr &title = "Python Extension Error") = 0;
virtual void ErrorDialog(const rdcstr &text, const rdcstr &title = "") = 0;
DOCUMENT(R"(Display an error message dialog.
:param str text: The text of the dialog itself, required.
:param List[DialogButton] options: The buttons to display on the dialog.
:param str title: The dialog title, optional.
:param str title="": **Optional parameter**. The dialog title.
:return: The button that was clicked on.
:rtype: DialogButton
)");
virtual DialogButton QuestionDialog(const rdcstr &text, const rdcarray<DialogButton> &options,
const rdcstr &title = "Python Extension Prompt") = 0;
const rdcstr &title = "") = 0;
DOCUMENT(R"(Browse for a filename to open.
:param str caption: The dialog title, optional.
:param str dir: The starting directory for browsing, optional.
:param str filter: The filter to apply for filenames, optional.
:param str caption="": **Optional parameter**. The dialog title.
:param str dir="": **Optional parameter**. The starting directory for browsing.
:param str filter="": **Optional parameter**. The filter to apply for filenames.
:return: The filename selected, or an empty string if nothing was selected.
:rtype: str
)");
virtual rdcstr OpenFileName(const rdcstr &caption = "Open a file", const rdcstr &dir = rdcstr(),
const rdcstr &filter = rdcstr()) = 0;
virtual rdcstr OpenFileName(const rdcstr &caption = "", const rdcstr &dir = "",
const rdcstr &filter = "") = 0;
DOCUMENT(R"(Browse for a directory to open.
:param str caption: The dialog title, optional.
:param str dir: The starting directory for browsing, optional.
:param str caption="": **Optional parameter**. The dialog title.
:param str dir="": **Optional parameter**. The starting directory for browsing.
:return: The directory selected, or an empty string if nothing was selected.
:rtype: str
)");
virtual rdcstr OpenDirectoryName(const rdcstr &caption = "Open a directory",
const rdcstr &dir = rdcstr()) = 0;
virtual rdcstr OpenDirectoryName(const rdcstr &caption = "", const rdcstr &dir = "") = 0;
DOCUMENT(R"(Browse for a filename to save to.
:param str caption: The dialog title, optional.
:param str dir: The starting directory for browsing, optional.
:param str filter: The filter to apply for filenames, optional.
:param str caption="": **Optional parameter**. The dialog title.
:param str dir="": **Optional parameter**. The starting directory for browsing.
:param str filter="": **Optional parameter**. The filter to apply for filenames.
:return: The filename selected, or an empty string if nothing was selected.
:rtype: str
)");
virtual rdcstr SaveFileName(const rdcstr &caption = "Save a file", const rdcstr &dir = rdcstr(),
const rdcstr &filter = rdcstr()) = 0;
virtual rdcstr SaveFileName(const rdcstr &caption = "", const rdcstr &dir = "",
const rdcstr &filter = "") = 0;
#if !defined(SWIG) && !defined(SWIG_GENERATED)
// not exposed to SWIG, only used internally. For when a menu is displayed dynamically in a panel,
+10 -8
View File
@@ -871,14 +871,16 @@ QWidget.
DOCUMENT(R"(Scroll to the given row in the given stage's data.
:param int row: the row to scroll to.
:param renderdoc.MeshDataStage stage: The stage of the geometry pipeline to scroll within.
:param renderdoc.MeshDataStage stage=renderdoc.MeshDataStage.VSIn: **Optional parameter**. The stage of the
geometry pipeline to scroll within. Ignored for non-mesh buffer viewers.
)");
virtual void ScrollToRow(int32_t row, MeshDataStage stage = MeshDataStage::VSIn) = 0;
DOCUMENT(R"(Scroll to the given column in the given stage's data.
:param int column: the column to scroll to.
:param renderdoc.MeshDataStage stage: The stage of the geometry pipeline to scroll within.
:param renderdoc.MeshDataStage stage=renderdoc.MeshDataStage.VSIn: **Optional parameter**. The stage of the
geometry pipeline to scroll within. Ignored for non-mesh buffer viewers.
)");
virtual void ScrollToColumn(int32_t column, MeshDataStage stage = MeshDataStage::VSIn) = 0;
@@ -1376,8 +1378,8 @@ QWidget.
DOCUMENT(R"(Toggles a breakpoint at a given instruction.
:param int instruction: The instruction to toggle breakpoint at. If this is ``-1`` the nearest
instruction after the current caret position is used.
:param int instruction=-1: **Optional parameter**. The instruction to toggle breakpoint at.
If this is ``-1`` the nearest instruction after the current caret position is used.
)");
virtual void ToggleBreakpointOnInstruction(int32_t instruction = -1) = 0;
@@ -2057,7 +2059,7 @@ The capture must be available locally, if it's not this function will fail.
:meth:`CaptureViewer.OnSelectedEventChanged` for more information.
:param int eventId: The new current :data:`eventId <renderdoc.APIEvent.eventId>`. See
:meth:`CaptureViewer.OnEventChanged` for more information.
:param bool force: Optional parameter, if ``True`` then the replay will 'move' even if it is moving
:param bool force=False: **Optional parameter**. if ``True`` then the replay will 'move' even if it is moving
to the same :data:`eventId <renderdoc.APIEvent.eventId>` as it's currently on.
)");
virtual void SetEventID(const rdcarray<ICaptureViewer *> &exclude, uint32_t selectedEventId,
@@ -2951,7 +2953,7 @@ This function should not be used to view the entirety of a descriptor store - in
:param int byteOffset: The offset in bytes to the start of the buffer data to show.
:param int byteSize: The number of bytes in the buffer to show.
:param renderdoc.ResourceId id: The ID of the buffer to fetch data from.
:param str format: Optionally a HLSL/GLSL style formatting string.
:param str format="": **Optional parameter**. A HLSL/GLSL style formatting string.
:return: The new :class:`BufferViewer` window opened, but not shown.
:rtype: BufferViewer
)");
@@ -2963,7 +2965,7 @@ bytes.
:param renderdoc.ResourceId id: The ID of the texture itself.
:param renderdoc.Subresource sub: The subresource within this texture to use.
:param str format: Optionally a HLSL/GLSL style formatting string.
:param str format="": **Optional parameter**. A HLSL/GLSL style formatting string.
:return: The new :class:`BufferViewer` window opened, but not shown.
:rtype: BufferViewer
)");
@@ -3030,7 +3032,7 @@ currently docked.
:param DockReference ref: The location to add the new window, possibly relative to ``refWindow``.
:param QWidget refWindow: The window to refer to if the new window is being added relative, or can
be ``None`` if the new location is absolute.
:param float percentage: Optionally the percentage to split the area. If omitted, a 50% split is
:param float percentage=0.5: **Optional parameter**. The percentage to split the area. If omitted, a 50% split is
used.
)");
virtual void AddDockWindow(QWidget *newWindow, DockReference ref, QWidget *refWindow,
+6
View File
@@ -5264,6 +5264,9 @@ void BufferViewer::ScrollToRow(int32_t row, MeshDataStage stage)
return;
}
if(!m_MeshView)
stage = MeshDataStage::VSIn;
ScrollToRow(tableForStage(stage), row);
if(m_MeshView)
@@ -5275,6 +5278,9 @@ void BufferViewer::ScrollToRow(int32_t row, MeshDataStage stage)
void BufferViewer::ScrollToColumn(int32_t column, MeshDataStage stage)
{
if(!m_MeshView)
stage = MeshDataStage::VSIn;
ScrollToColumn(tableForStage(stage), column);
m_Scroll[(int)stage].setX(column);
+5 -5
View File
@@ -351,7 +351,7 @@ convenience of access.
DOCUMENT(R"(Retrieves all descriptor information for all descriptors accessed at the current event.
:param bool onlyUsed: Omit descriptors bound or declared but not accessed.
:param bool onlyUsed=False: **Optional parameter**. Omit descriptors bound or declared but not accessed.
:return: All descriptors accessed at the current event.
:rtype: List[UsedDescriptor]
)");
@@ -371,7 +371,7 @@ convenience of access.
DOCUMENT(R"(Retrieves the constant blocks used by a particular shader stage.
:param ShaderStage stage: The shader stage to fetch from.
:param bool onlyUsed: Omit descriptors bound or declared but not accessed.
:param bool onlyUsed=False: **Optional parameter**. Omit descriptors bound or declared but not accessed.
:return: The currently bound constant blocks.
:rtype: List[UsedDescriptor]
)");
@@ -380,7 +380,7 @@ convenience of access.
DOCUMENT(R"(Retrieves the read-only resources used by a particular shader stage.
:param ShaderStage stage: The shader stage to fetch from.
:param bool onlyUsed: Omit descriptors bound or declared but not accessed.
:param bool onlyUsed=False: **Optional parameter**. Omit descriptors bound or declared but not accessed.
:return: The currently bound read-only resources.
:rtype: List[UsedDescriptor]
)");
@@ -389,7 +389,7 @@ convenience of access.
DOCUMENT(R"(Retrieves the samplers bound to a particular shader stage.
:param ShaderStage stage: The shader stage to fetch from.
:param bool onlyUsed: Omit descriptors bound or declared but not accessed.
:param bool onlyUsed=False: **Optional parameter**. Omit descriptors bound or declared but not accessed.
:return: The currently bound sampler resources.
:rtype: List[UsedDescriptor]
)");
@@ -398,7 +398,7 @@ convenience of access.
DOCUMENT(R"(Retrieves the read/write resources used by a particular shader stage.
:param ShaderStage stage: The shader stage to fetch from.
:param bool onlyUsed: Omit descriptors bound or declared but not accessed.
:param bool onlyUsed=False: **Optional parameter**. Omit descriptors bound or declared but not accessed.
:return: The currently bound read/write resources.
:rtype: List[UsedDescriptor]
)");