![]() |
|
Register | Forum Rules | FAQs | Members List | Social Groups | Downloads | Search | Today's Posts | Mark Forums Read |
SageTV Studio Discussion related to the SageTV Studio application produced by SageTV. Questions, issues, problems, suggestions, etc. relating to the Studio software application should be posted here. |
![]() |
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
![]()
Hi everyone,
I don't know if this is true for everyone, but since I started Studio development and writing my own plugins I soon discovered that certain tasks are always tedious and time consuming. To make my life easier I started to factor out certain functionality into java code which has grown to a java library over time. E.g., I found that a quite common task is to find an existing widget in the current STV which one will link to or modify. If it's a theme or a menu this is still relatively easy by using studio widgets (provided the name is unique), but to find arbitray nodes walking through the tree using widget code is quite cumbersome. A function in the library which takes a path to the widget makes this rather pretty easy: e.g. to get a reference to the 'TV Details' panel of the OSD menu you can simply write panel = df_sageutils_Import_findExistingWidget("MediaPlayer OSD/DisplayInfo/DetailedInfo/mf = GetCurrentMediaFile()/IsTVFile(mf)/true/TV Details") The path parameter consists of the names of all widgets along the path. If there is no ambiguity, you can use wildcards to save typing: panel = df_sageutils_Import_findExistingWidget("MediaPlayer OSD/Disp*/Detail*/mf =*/IsTV*/true/TV Details") You can even omit the intermediate path altogether (but not recommended for large subtrees which go into breadth instead of depth) : panel = df_sageutils_Import_findExistingWidget("MediaPlayer OSD//TV Details") This function alone saves me a lot of time compared to coding the same with Studio widgets. The library also contains a bunch of other useful functions like automatic linking of imported widgets (e.g. themes) to existing ones, a tree deletion routine which can handle loops and does not leave any orphaned nodes behind, or simple one-line calls to retrieve existing/imported menus, hooks, and themes by name. Just wanted to throw this out here in case anyone would be interested to use it. I haven't written any documentation yet, but I could generate some javadoc if there is demand for that. Dirk |
#2
|
|||
|
|||
Sound real good to me. I had to walk down 8 levels in my plugin for SageMC because that was the only unique widget available and I needed to apply a change there.
BobP. |
#3
|
|||
|
|||
Well, if someone is interested, I uploaded the library including javadoc and template STVi to the Download section.
Dirk |
#4
|
|||
|
|||
Thank you will try this out in a few days.
BobP. |
#5
|
|||
|
|||
OK have one question for you on this.
How does deleteWidgetTree handle code in other menus that the imported menu may be linked too? In otherwords does it stop the deletion when it gets to the link or should we unlink this prior to calling your deleteWidgetTree routine? BobP. |
#6
|
|||
|
|||
Quote:
as long as you link your code to existing widgets by using the df_sageutils_Import_defineLink() method, this get's handled automatically, you don't have to perform any manual unlinking prior to deleting trees. When the deleteWidgetTree() method encounters a link to existing code, it will stop deletion at this point and simply unlink the widget. Feel free to post any other questions you might have. Dirk |
#7
|
|||
|
|||
great helper code
Quote:
This is exactly what I need. I was having problems with updating the web radio plugin, removing old widget chains and also enabling reimporting the same version. I coudn't get it working correctly. This code really makes creating STVi's easier. thanks again, ![]() - Chris |
#8
|
|||
|
|||
Quote:
nice to see that this is useful for someone else. Especially when it helps further development of the webradio plugin, which is absolutely great, and one of my favorite plugins. ![]() I wanna thank you for that... Dirk |
#9
|
|||
|
|||
Quote:
the linkWidget method seems to stop after the first found placeholder. Is it true that when I have multiple Widget references to the same existing widget, I have to create a separate define link for each one of them? thanks, -Chris |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | Search this Thread |
Display Modes | |
|
|