Added LayoutView#layer_list_name as read access for LayoutView#rename_layer_list

This commit is contained in:
Matthias Koefferlein 2025-09-04 19:59:57 +02:00
parent 128f92c427
commit e6692a2fd0
2 changed files with 11 additions and 8 deletions

View File

@ -144,6 +144,11 @@ static std::string get_line_style (lay::LayoutViewBase *view, unsigned int index
return view->line_styles ().style (index).to_string ();
}
static std::string layer_list_name (lay::LayoutViewBase *view, unsigned int index)
{
return view->get_properties (index).name ();
}
static void transaction (lay::LayoutViewBase *view, const std::string &desc)
{
view->manager ()->transaction (desc);
@ -358,14 +363,6 @@ static QWidget *widget (lay::LayoutViewBase *view)
#endif
static std::vector<std::string>
get_config_names (lay::LayoutViewBase *view)
{
std::vector<std::string> names;
view->get_config_names (names);
return names;
}
static void
send_key_press_event (lay::LayoutViewBase *view, unsigned int key, unsigned int buttons)
{
@ -1574,6 +1571,10 @@ LAYBASIC_PUBLIC Class<lay::LayoutViewBase> decl_LayoutViewBase (decl_Dispatcher,
"@brief Sets the title of the given layer properties tab\n"
"This method has been introduced in version 0.21.\n"
) +
gsi::method_ext ("layer_list_name", &layer_list_name, gsi::arg ("index"),
"@brief Gets the title of the given layer properties tab\n"
"This method has been introduced in version 0.30.4.\n"
) +
gsi::method_ext ("remove_stipple", &remove_stipple, gsi::arg ("index"),
"@brief Removes the stipple pattern with the given index\n"
"The pattern with an index less than the first custom pattern cannot be removed. "

View File

@ -234,6 +234,8 @@ class LAYLayers_TestClass < TestBase
cv.insert_layer_list(1)
cv.rename_layer_list(1, "x")
assert_equal(cv.layer_list_name(1), "x")
assert_equal(cv.layer_list_name(10000), "") # must not crash
assert_equal(cv.current_layer_list, 1)
cv.set_current_layer_list(0)
assert_equal(cv.current_layer_list, 0)