From e6692a2fd09af288feeab530da6f4fdba976dfa0 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Thu, 4 Sep 2025 19:59:57 +0200 Subject: [PATCH] Added LayoutView#layer_list_name as read access for LayoutView#rename_layer_list --- .../laybasic/gsiDeclLayLayoutViewBase.cc | 17 +++++++++-------- testdata/ruby/layLayers.rb | 2 ++ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/laybasic/laybasic/gsiDeclLayLayoutViewBase.cc b/src/laybasic/laybasic/gsiDeclLayLayoutViewBase.cc index 1f5b9b50f..86892f3c1 100644 --- a/src/laybasic/laybasic/gsiDeclLayLayoutViewBase.cc +++ b/src/laybasic/laybasic/gsiDeclLayLayoutViewBase.cc @@ -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 -get_config_names (lay::LayoutViewBase *view) -{ - std::vector 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 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. " diff --git a/testdata/ruby/layLayers.rb b/testdata/ruby/layLayers.rb index 447f3fd16..168ab141c 100644 --- a/testdata/ruby/layLayers.rb +++ b/testdata/ruby/layLayers.rb @@ -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)