diff --git a/mrv2/docs/HISTORY.md b/mrv2/docs/HISTORY.md index d255b0d38..66d6e49f8 100644 --- a/mrv2/docs/HISTORY.md +++ b/mrv2/docs/HISTORY.md @@ -9,6 +9,8 @@ v0.8.0 - Fixed a typo in Python's binding to sessios (oepenSession instead of openSession). - Made Save Session not save temporary EDLs in the session file. +- Added a __divider__ entry to Plug-in menus to add a divider line between + menu entries. v0.7.9 ====== diff --git a/mrv2/lib/mrvUI/mrvMenus.cpp b/mrv2/lib/mrvUI/mrvMenus.cpp index 6f2476b72..fdc848a65 100644 --- a/mrv2/lib/mrvUI/mrvMenus.cpp +++ b/mrv2/lib/mrvUI/mrvMenus.cpp @@ -1132,9 +1132,24 @@ namespace mrv } #ifdef MRV2_PYBIND11 + idx = -1; for (const auto& entry : pythonMenus) { - menu->add( + if (entry == "__divider__") + { + if (idx < 0) + { + LOG_ERROR( + _("__divider__ cannot be the first item in the menu.")); + } + else + { + item = (Fl_Menu_Item*)&(menu->menu()[idx]); + item->flags |= FL_MENU_DIVIDER; + } + continue; + } + idx = menu->add( entry.c_str(), 0, (Fl_Callback*)run_python_method_cb, (void*)&pythonMenus.at(entry)); } diff --git a/mrv2/python/plug-ins/mrv2_hello.py b/mrv2/python/plug-ins/mrv2_hello.py index 93d919f0b..ecf211953 100644 --- a/mrv2/python/plug-ins/mrv2_hello.py +++ b/mrv2/python/plug-ins/mrv2_hello.py @@ -87,6 +87,7 @@ def play(self): def menus(self): menus = { "Python/Play/Forwards" : self.play, # call a method + "__divider__" : None, # add a divider "Python/Play/Backwards" : timeline.playBackwards # call a function } return menus