diff --git a/DearPyGui/dearpygui/_dearpygui.pyi b/DearPyGui/dearpygui/_dearpygui.pyi index 49bbac127..719e4e7e6 100644 --- a/DearPyGui/dearpygui/_dearpygui.pyi +++ b/DearPyGui/dearpygui/_dearpygui.pyi @@ -882,6 +882,10 @@ def get_mouse_pos(*, local: bool ='') -> Union[List[int], Tuple[int, ...]]: """Returns mouse position.""" ... +def get_platform() -> int: + """New in 1.6. Returns platform constant.""" + ... + def get_plot_mouse_pos() -> Union[List[int], Tuple[int, ...]]: """Returns mouse position in plot.""" ... @@ -1392,6 +1396,9 @@ mvComboHeight_Small=0 mvComboHeight_Regular=0 mvComboHeight_Large=0 mvComboHeight_Largest=0 +mvPlatform_Windows=0 +mvPlatform_Apple=0 +mvPlatform_Linux=0 mvColorEdit_AlphaPreviewNone=0 mvColorEdit_AlphaPreview=0 mvColorEdit_AlphaPreviewHalf=0 diff --git a/DearPyGui/dearpygui/_dearpygui_RTD.py b/DearPyGui/dearpygui/_dearpygui_RTD.py index f8685be0a..e74c7ff16 100644 --- a/DearPyGui/dearpygui/_dearpygui_RTD.py +++ b/DearPyGui/dearpygui/_dearpygui_RTD.py @@ -7493,6 +7493,16 @@ def get_mouse_pos(**kwargs): return internal_dpg.get_mouse_pos(**kwargs) +def get_platform(): + """ New in 1.6. Returns platform constant. + + Args: + Returns: + int + """ + + return internal_dpg.get_platform() + def get_plot_mouse_pos(): """ Returns mouse position in plot. @@ -8633,6 +8643,9 @@ def unstage(item): mvComboHeight_Regular=internal_dpg.mvComboHeight_Regular mvComboHeight_Large=internal_dpg.mvComboHeight_Large mvComboHeight_Largest=internal_dpg.mvComboHeight_Largest +mvPlatform_Windows=internal_dpg.mvPlatform_Windows +mvPlatform_Apple=internal_dpg.mvPlatform_Apple +mvPlatform_Linux=internal_dpg.mvPlatform_Linux mvColorEdit_AlphaPreviewNone=internal_dpg.mvColorEdit_AlphaPreviewNone mvColorEdit_AlphaPreview=internal_dpg.mvColorEdit_AlphaPreview mvColorEdit_AlphaPreviewHalf=internal_dpg.mvColorEdit_AlphaPreviewHalf diff --git a/DearPyGui/dearpygui/dearpygui.py b/DearPyGui/dearpygui/dearpygui.py index 8bc2f8384..fb99aec7f 100644 --- a/DearPyGui/dearpygui/dearpygui.py +++ b/DearPyGui/dearpygui/dearpygui.py @@ -8351,6 +8351,16 @@ def get_mouse_pos(*, local: bool =True, **kwargs) -> Union[List[int], Tuple[int, return internal_dpg.get_mouse_pos(local=local, **kwargs) +def get_platform(**kwargs) -> int: + """ New in 1.6. Returns platform constant. + + Args: + Returns: + int + """ + + return internal_dpg.get_platform(**kwargs) + def get_plot_mouse_pos(**kwargs) -> Union[List[int], Tuple[int, ...]]: """ Returns mouse position in plot. @@ -9503,6 +9513,9 @@ def unstage(item : Union[int, str], **kwargs) -> None: mvComboHeight_Regular=internal_dpg.mvComboHeight_Regular mvComboHeight_Large=internal_dpg.mvComboHeight_Large mvComboHeight_Largest=internal_dpg.mvComboHeight_Largest +mvPlatform_Windows=internal_dpg.mvPlatform_Windows +mvPlatform_Apple=internal_dpg.mvPlatform_Apple +mvPlatform_Linux=internal_dpg.mvPlatform_Linux mvColorEdit_AlphaPreviewNone=internal_dpg.mvColorEdit_AlphaPreviewNone mvColorEdit_AlphaPreview=internal_dpg.mvColorEdit_AlphaPreview mvColorEdit_AlphaPreviewHalf=internal_dpg.mvColorEdit_AlphaPreviewHalf diff --git a/DearPyGui/dearpygui/demo.py b/DearPyGui/dearpygui/demo.py index acea2c008..ffce47109 100644 --- a/DearPyGui/dearpygui/demo.py +++ b/DearPyGui/dearpygui/demo.py @@ -2804,3 +2804,10 @@ def _callback_manual_mutex(sender, app_data, user_data): dpg.configure_item(b1, user_data=dpg.last_item(), callback=_callback_auto_mutex) dpg.configure_item(b2, user_data=dpg.last_item(), callback=_callback_manual_mutex) dpg.configure_item(b3, user_data=dpg.last_item()) + if dpg.get_platform() == dpg.mvPlatform_Windows or dpg.get_platform() == dpg.mvPlatform_Linux: + with dpg.tree_node(label="Output Framebuffer"): + def _framebuffer_callback(sender, app_data): + dpg.show_item("__demo_texture_container") + dpg.add_dynamic_texture(app_data.get_width(), app_data.get_height(), app_data, parent="__demo_texture_container") + dpg.add_text("Outputs frame buffer an mvBuffer object, creates a dynamic texture, and shows the texture registry (check final item)") + dpg.add_button(label="Output Framebuffer", callback=lambda:dpg.output_frame_buffer(callback=_framebuffer_callback)) \ No newline at end of file diff --git a/DearPyGui/src/modules/dearpygui.cpp b/DearPyGui/src/modules/dearpygui.cpp index eddec518a..c2ef7e754 100644 --- a/DearPyGui/src/modules/dearpygui.cpp +++ b/DearPyGui/src/modules/dearpygui.cpp @@ -72,6 +72,10 @@ GetModuleConstants() ModuleConstants.push_back({"mvComboHeight_Large", 2L }); ModuleConstants.push_back({"mvComboHeight_Largest", 3L }); + ModuleConstants.push_back({"mvPlatform_Windows", 0L }); + ModuleConstants.push_back({"mvPlatform_Apple", 1L }); + ModuleConstants.push_back({"mvPlatform_Linux", 2L }); + ModuleConstants.push_back({"mvColorEdit_AlphaPreviewNone", 0L }); ModuleConstants.push_back({"mvColorEdit_AlphaPreview", ImGuiColorEditFlags_AlphaPreview }); ModuleConstants.push_back({"mvColorEdit_AlphaPreviewHalf", ImGuiColorEditFlags_AlphaPreviewHalf }); @@ -685,6 +689,7 @@ PyInit__dearpygui(void) MV_ADD_COMMAND(bind_item_font); MV_ADD_COMMAND(bind_item_theme); MV_ADD_COMMAND(capture_next_item); + MV_ADD_COMMAND(get_platform); methods.push_back({ NULL, NULL, 0, NULL }); diff --git a/DearPyGui/src/modules/dearpygui_commands.h b/DearPyGui/src/modules/dearpygui_commands.h index d94c33fd2..abd5dad83 100644 --- a/DearPyGui/src/modules/dearpygui_commands.h +++ b/DearPyGui/src/modules/dearpygui_commands.h @@ -4072,4 +4072,19 @@ get_clipboard_text(PyObject* self, PyObject* args, PyObject* kwargs) const char* text = ImGui::GetClipboardText(); return ToPyString(text); +} + +mv_internal mv_python_function +get_platform(PyObject* self, PyObject* args, PyObject* kwargs) +{ + + if (!GContext->manualMutexControl) std::lock_guard lk(GContext->mutex); + +#ifdef _WIN32 + return ToPyInt(0L); +#elif __APPLE__ + return ToPyInt(1L); +#else + return ToPyInt(2L); +#endif } \ No newline at end of file diff --git a/DearPyGui/src/modules/dearpygui_parsers.h b/DearPyGui/src/modules/dearpygui_parsers.h index bb47ff7c8..abe543a67 100644 --- a/DearPyGui/src/modules/dearpygui_parsers.h +++ b/DearPyGui/src/modules/dearpygui_parsers.h @@ -1897,4 +1897,16 @@ InsertParser_Block4(std::map& parsers) mvPythonParser parser = FinalizeParser(setup, args); parsers.insert({ "get_clipboard_text", parser }); } + + { + std::vector args; + + mvPythonParserSetup setup; + setup.about = "New in 1.6. Returns platform constant."; + setup.category = { "General" }; + setup.returnType = mvPyDataType::Integer; + + mvPythonParser parser = FinalizeParser(setup, args); + parsers.insert({ "get_platform", parser }); + } } \ No newline at end of file diff --git a/docs/source/documentation/plots.rst b/docs/source/documentation/plots.rst index f95b2bb05..1afbe34aa 100644 --- a/docs/source/documentation/plots.rst +++ b/docs/source/documentation/plots.rst @@ -441,7 +441,12 @@ Custom Series **New in 1.6**. Custom series allow you to control the way a series is rendered. -Under construction. Minimal example below. Channels must be between 2 and 5. +A custom series can currently have between 2 and 5 channels. A channel is an array/list of +data. Each channel must be the same length. The first 2 channels and channel count are +required arguments. Additional channels can be provided with the y1, y2, and y3 keywords. You must +also set the "callback" keyword. The second argument will be provided by DPG as a list. The first item being +useful information. The following items are the original data sent in but transformed into pixel space. The +combination of all this information can be used to create a custom series. See simple example below: .. code-block:: python