MappView Compound widgets toolkit

Hello all!

We have developed an unofficial open source toolkit for “mappView - Compound Widgets”. Toolkit is written with Python.
Main idea came because we are currently lacking the graphical editor for editing compound widgets and we bumped into a task where editing widgets graphically was needed…

Python scripts basically transfer the “widgets” information between compound widgets library and autogenerated mappView content → like described in our help:
[B&R Online Help]

Scripts have been “wrapped” to automation studio sample project and moved to GitHub. Please find it from following link:

Cheers :slight_smile:

11 Likes

First Off awesome idea @markus.mustonen, thanks for implementing this and welcome to the community!

I have two things to note maybe something to expand the script with.

#1 I have multiple WidgetLib’s and they all have their own unique name but the script expects the default WidgetLib so it didn’t run. I changed the WidgetsDir path and now it’s running but I’m getting an error.

#2 Error in reading the attributes

Exception has occurred: KeyError
'id'
  File "C:\projects\IIOT\AS\Logical\Scripts\CompoundWidgetsToolkit\ReadWidgetsToVisu.py", line 24, in extract_compound_widget_attributes
    "id": root.attrib["id"],
  File "C:\projects\IIOT\AS\Logical\Scripts\CompoundWidgetsToolkit\ReadWidgetsToVisu.py", line 211, in create_content_from_widgets
    attributes = extract_compound_widget_attributes(LayoutPath + '\\' + LayoutFile)
  File "C:\projects\IIOT\AS\Logical\Scripts\CompoundWidgetsToolkit\ReadWidgetsToVisu.py", line 289, in <module>
    create_content_from_widgets(WidgetsDir, FindFilePrefix, VisuRootDir)
KeyError: 'id'

I didn’t see any restrictions AS4 vs. AS6 and based on the basic structure of xml content files they should be the same.

Any ideas?

2 Likes

Hello @marcel.voigt ,
Because this was my first post, I checked the issue asap.

There was some minor bug in the script, so it didn’t work as I had planned.
Please download and import the updated toolkit “CompoundWidgetsToolkit_V1.0.2.zip”.
This version accepts also library name in the settings, so it is more flexible in real life.
Hopefully this will fix your issue :slight_smile:

Cheers
Markus

1 Like

@markus.mustonen Thanks for reacting so quickly and fixing the bug and adding the parameter!

Unfortunately I ran into a new error

Exception has occurred: UnboundLocalError
local variable 'LayoutID' referenced before assignment
  File "C:\projects\IIOT\AS\Logical\Scripts\CompoundWidgetsToolkit\ReadWidgetsToVisu.py", line 217, in create_content_from_widgets
    createMappViewWidgetsFolder(pages_path,LayoutID)
  File "C:\projects\IIOT\AS\Logical\Scripts\CompoundWidgetsToolkit\ReadWidgetsToVisu.py", line 291, in <module>
    create_content_from_widgets(WidgetsDir, FindFilePrefix, VisuRootDir)
UnboundLocalError: local variable 'LayoutID' referenced before assignment

BUT I can tell why it happens!

I didn’t have local layouts under the Visualization, I only had global layouts.
Simply adding a layout to the local folder fixed that issue and the script ran fine.

It created content for each of the 6 compound widgets I have in that one library which is absolutely awesome!.

Actually I have a suggestion to maybe avoid the layout issue all together.
Instead of creating a page so you can then create the content under it, why not create an
“Area Content” package for the compound widgets.

mapp-view are you seeing this…

1 Like

@marcel.voigt You’re welcome and thank’s for the great feedback.

I will be checking for the improvements after the :santa: holidays.

I am just glad that you could find this “toolkit” usefull :slightly_smiling_face:

2 Likes

Thank you, enjoy the holidays and say Hei to Joulupukki for me :wink:

I actually have another suggestion.

Now that you have the WidgetLib name as parameter maybe name the page or area content package after the WidgetLib. That way in case you have multiple like I do it keeps them separated by library.

1 Like

Good point, I will check what I can do…

Have a nice holidays also,
I will forward your greetings to Korvatunturi … :gift:

1 Like

Hi @markus.mustonen, I find this toolkit very useful. I think there are some tips for improvement and extension. It would be great to upload it to BR or any other GitHub repository. This way, everything can be tracked, and users will always be able to download the latest version. Just an idea. Thank you for your contribution and I wish you a nice holiday time :slight_smile:

1 Like

Hi @kovarj ,
Thank’s for the encouraging feedback.
I realized this same thing yesterday. Right place for this “toolkit” would be gitHub. I will publish this there in near future, so it will be easier to share and track changes.

I will also add the link to this same thread, when ready.

Have a nice holidays also :slight_smile:

I have plans to test your toolkit and advertise it. Hope that you are ready to be popular :grinning:

If you test and find this usefull, I’m just really glad. Feel free to advertise… :grin:

Along with the fame comes the “bug list” , I also hope I’m ready :laughing:

2 Likes

Thank you @markus.mustonen for a great idea. I will also try to see how it works and let you know!

2 Likes

@Kolma You are welcome, can’t wait for the feedback :saluting_face:

Hello @kovarj , now scripts can be found from GitHub…
There is entire demo project available for easier testing (and development) of the scripts for the community users.
I also added “how to” - video to scripts folder, so it is easier to see how toolkit it is supposed to work.
Cheers :slight_smile:

3 Likes