|
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 |
#21
|
|||
|
|||
Quote:
Using v1.3. Works great ! thanks, Chris |
#22
|
|||
|
|||
I'm making an assumption that I hope is true with these utility functions. For Listener widgets it uses either the Widget Name or the ListenerEvent property when using findWidget, findExistingWidget or findImportedWidget. The reason I ask is that while some Listeners have both not all do. I have found some with just the property and some with just a name so you can't even count on the ListenerEvent property always being present. For example the Left command in the ARAdjustZoom menu in the default STV has the name Left but the ListenerEvent is blank. So is my assumption valid?
Thanks. BobP. |
#23
|
|||
|
|||
Quote:
yes your assumption is correct GetWidgetName() (which is used by the implementation of all find...() methods) first looks at the name, and if this is empty, returns the ListenerEvent property. Dirk |
#24
|
|||
|
|||
Possible bug but maybe it's just me.
Code first: Code:
existing code from previous import: Main Menu +-BeforeMenuLoad +-"REM FCL Main Menu code" Code in the import to remove the prior code (that works): +-"REM unlink Main Menu menu code" +-LinkLocation=df_sageutils_Import_findExistingWidget("Main Menu/BeforeMenuLoad") +-widget=df_sageutils_Import_findExistingWidget("Main Menu/BeforeMenuLoad/\"REM FCL Main Menu code*") +-If widget != null Code in the import to remove the same as above (that doesn't work - this is include in ZIP): +-"REM unlink Main Menu menu code" +-LinkLocation=df_sageutils_Import_findExistingWidget("Main Menu/BeforeMenuLoad") +-widget=df_sageutils_Import_findWidget(LinkLocation, "\"REM FCL Main Menu code*") +-If widget != null Now for the problem: The problem is that I get a Java error - sorry it's as a graphic (in zip) - too much to write. Also included is my log file from SageTV and the import itself. All in the same Zip file. The code has no problem on the first import. NO Java error. But when I re-import I get the included error. Edit: Opps forgot SageMC 6.6 and 1.3 of this import utility. Thanks. BobP. Last edited by BobPhoenix; 06-28-2006 at 07:16 PM. |
#25
|
|||
|
|||
Quote:
my Internet connection was down all evening, but I'll have a look at it tomorrow. Thanks for the detailed description. Dirk |
#26
|
|||
|
|||
Quote:
BobP. |
#27
|
|||
|
|||
I think I have a clue now as to why it didn't work for me. I have multiple links to widgets that existed in the STV before the first import. I unlinked them and reestablished the original links in an attempt to return it to what the STV was like before the first import. However I still have some left over links from the code in "Imported Nodes" to those objects. I then proceed to try to import new code and link it up and in the process it executes the code you had in the template for removing the old hook. I'm thinking my problem is that I need to unlink all widgets from those that I linked back into the STV and this problem might go away. I'm going to test this theory out tomorrow night when I get home from work - too late to start now.
If you do look at this maybe you will see what I did wrong if you get to it tomorrow. Also if you need anything else let me know but I really think it is just me and I'm just not using your routines correctly. Thanks. BobP. PS I'm taking a CBT on Java but other than what I've seen so far and in Studio it's still a foreign language. If it was COBOL I would be better off since that is what I do all day. |
#28
|
|||
|
|||
One last note on this. I did get all of my findWidget's converted to findExistingWidget's and that got rid of the Java errors but it still won't import correctly it actually destroy's the main menu - as in it is broken apart into multiple root level entries. As far as I can tell it should re-import correctly so anything you can suggest would be great.
Thanks. BobP. |
#29
|
|||
|
|||
Quote:
|
#30
|
|||
|
|||
Quote:
I think I found the problem in your code: you are deleting your old existing menu before calling the defineLink() methods, this way deleteWidgetTree() does not know about your linked widgets and will not stop deletion on widgets of the original STV you linked to ... After changing the order of defineLink() in your import I noticed the next issue: the defineLink() does not work for some widgets when re-importing, because the original target widget has been replaced with a different one: e.g. the defineLink("LinkToSetFocusForVariable", "Guide/MenuNeeds*/*/Ensure*/Has*/SetFocusForVariable*") works fine on the first import, but the import code replaces the SetFocusForVariable widget with "REM FCL Guide MenuNeedsDefaultFocus hook code", so that when the plugin is reimported again the defineLink() can't find the widget any more, and the automatic linking fails ... If you modify the link targets in such a way, you will either have to restore the original state before defining the links, or use manual linking for those widgets Dirk |
#31
|
|||
|
|||
Quote:
BobP. |
#32
|
||||
|
||||
So, using this import/Java routines, I could link to the CenteredDirectoryBrower OptionsMenu widget in the main SageTV STV? Assuming that the answer is yes, then how do I know which one to link to?
Currently, the "main" copy of it is in: Configuration Wizard - Set Video Recording Dirs/MenuContainer/MenuItems/Add New Directory/... a few more levels .../CenteredDirectoryBrower There are references to it in four other places, like: StorageDeviceAdded/if false/... more levels .../CenteredDirectoryBrower So, if I understand the JavaDoc correctly, could I just do something like this to link in CenteredDirectoryBrower from the main SageTV STV? df_sageutils_Import_defineLink("MTDirectoryBrowser", "//CenteredDirectoryBrower") The reason I ask is that the one that Sage considers to be the "main" one does not remain static, at any given time, it could be any of the five occurrences. ---------- Once I get that done, what do I put into my import to call the main CenteredDirectoryBrower OptionsMenu? Last edited by aperry; 07-09-2006 at 01:51 AM. |
#33
|
|||
|
|||
Quote:
the answer is: it doesn't matter to which occurence you link to, they are actually all the same widget... The concept of "primary reference'" (bold) and "secondary reference" (italic) is just a display thing inside of Studio. Quote:
Instead, to save typing, use the "*" wildcard in path expressions: for widgets with only one child, you can just use the "*" : Code:
For widgets with multiple children use as much of the widget name as is necessary to distinguish it from the other children: Code:
w1 +-w2Listener +-w3Action +w4 +-w3Item +-w2Hook w1/w2L*/w3A*/w4 Quote:
Dirk |
#34
|
||||
|
||||
Quote:
df_sageutils_Import_defineLink("MTDirectoryBrowser", "/path/CenteredDirectoryBrower") Inside my import, do I then just create an options menu item called "MTDirectoryBrowser"? If not, what do I put in my import so that once it gets imported, the CenteredDirectoryBrower gets called the way I would expect? Thanks! |
#35
|
|||
|
|||
Hi,
I wrote this in a seperate post, but no one answered, maybe you can help, since you already did thiss with DeleteWidgetTree. I am trying to do some cleanup after I broke some child parent relationship, and clean house. I am trying to do RemoveWidget but it fails with the following error: Code:
private static void removeLeftOvers() throws InvocationTargetException { ArrayList lst = new ArrayList(); // Object[] widgets =(Object[]) SageApi.Api("GetAllWidgets"); // int size = SageApi.IntApi("Size", new Object[]{widgets}); // log("all widgets = " +widgets+", " + size); // log("children size = " + size); List imported = Arrays.asList((Object[])_importedWidgets); for (Iterator iter = imported.iterator(); iter.hasNext();) { Object widget = (Object) iter.next(); Object[] parents =(Object[]) SageApi.Api("GetWidgetParents", new Object[]{widget}); // log("checking " + widget); if (parents.length>0) continue; ImportAction act = isImportActionsWidgets(widget); if (act != null) { lst.add(widget); log("found to delete " + widget); } } for (Iterator iter = lst.iterator(); iter.hasNext();) { Object widget = (Object) iter.next(); log("the widget to del = " + widget); SageApi.Api("RemoveWidget", new Object[]{widget});//line 109 } } Code:
found to delete TimerExport:null|Action:linkme to Menu, Main Menu Sun 7/9 13:18:02.580 the widget to del = TimerExport:null|Action:linkme to Menu, Main Menu java.lang.NullPointerException Sun 7/9 13:18:02.581 at sage.c.l$6.new(Unknown Source) Sun 7/9 13:18:02.582 at sage.at.a(Unknown Source) Sun 7/9 13:18:02.582 at sage.d.a(Unknown Source) Sun 7/9 13:18:02.583 at sage.SageTV.api(Unknown Source) Sun 7/9 13:18:02.584 at net.sf.sageplugins.sageutils.SageApi.Api(SageApi.java:17) Sun 7/9 13:18:02.585 at alon24.Utils.removeLeftOvers(Utils.java:109) Sun 7/9 13:18:02.585 at alon24.Utils.finish(Utils.java:74) Sun 7/9 13:18:02.586 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) Sun 7/9 13:18:02.586 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) Sun 7/9 13:18:02.586 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) Sun 7/9 13:18:02.587 at java.lang.reflect.Method.invoke(Unknown Source) Sun 7/9 13:18:02.587 at sage.d$d.a(Unknown Source) Sun 7/9 13:18:02.588 at sage.d.d.a(Unknown Source) Sun 7/9 13:18:02.588 at sage.d.c.a(Unknown Source) Sun 7/9 13:18:02.588 at sage.d.d.a(Unknown Source) Sun 7/9 13:18:02.589 at sage.d.m.a(Unknown Source) Sun 7/9 13:18:02.589 at sage.d.a(Unknown Source) Sun 7/9 13:18:02.589 at sage.a6.a(Unknown Source) Sun 7/9 13:18:02.590 at sage.a6.a(Unknown Source) Sun 7/9 13:18:02.590 at sage.a6.a(Unknown Source) Sun 7/9 13:18:02.591 at sage.d.a(Unknown Source) Sun 7/9 13:18:02.591 at tv.sage.b.k.a(Unknown Source) Sun 7/9 13:18:02.591 at tv.sage.c.a(Unknown Source) Sun 7/9 13:18:02.592 at sage.StudioFrame.actionPerformed(Unknown Source) Sun 7/9 13:18:02.592 at javax.swing.AbstractButton.fireActionPerformed(Unknown Source) Sun 7/9 13:18:02.593 at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source) Sun 7/9 13:18:02.593 at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source) Sun 7/9 13:18:02.594 at javax.swing.DefaultButtonModel.setPressed(Unknown Source) Sun 7/9 13:18:02.594 at javax.swing.AbstractButton.doClick(Unknown Source) Sun 7/9 13:18:02.595 at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source) Sun 7/9 13:18:02.595 at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source) Sun 7/9 13:18:02.596 at java.awt.Component.processMouseEvent(Unknown Source) Sun 7/9 13:18:02.596 at javax.swing.JComponent.processMouseEvent(Unknown Source) Sun 7/9 13:18:02.597 at java.awt.Component.processEvent(Unknown Source) Sun 7/9 13:18:02.598 at java.awt.Container.processEvent(Unknown Source) Sun 7/9 13:18:02.599 at java.awt.Component.dispatchEventImpl(Unknown Source) Sun 7/9 13:18:02.599 at java.awt.Container.dispatchEventImpl(Unknown Source) Sun 7/9 13:18:02.600 at java.awt.Component.dispatchEvent(Unknown Source) Sun 7/9 13:18:02.602 at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source) Sun 7/9 13:18:02.603 at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source) Sun 7/9 13:18:02.604 at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source) Sun 7/9 13:18:02.605 at java.awt.Container.dispatchEventImpl(Unknown Source) Sun 7/9 13:18:02.606 at java.awt.Window.dispatchEventImpl(Unknown Source) Sun 7/9 13:18:02.607 at java.awt.Component.dispatchEvent(Unknown Source) Sun 7/9 13:18:02.608 at java.awt.EventQueue.dispatchEvent(Unknown Source) Sun 7/9 13:18:02.609 at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source) Sun 7/9 13:18:02.610 at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) Sun 7/9 13:18:02.611 at java.awt.EventDispatchThread.pumpEvents(Unknown Source) Sun 7/9 13:18:02.612 at java.awt.EventDispatchThread.pumpEvents(Unknown Source) Sun 7/9 13:18:02.612 at java.awt.EventDispatchThread.run(Unknown Source) java.lang.reflect.InvocationTargetException Sun 7/9 13:18:02.616 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) Sun 7/9 13:18:02.616 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) Sun 7/9 13:18:02.617 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) Sun 7/9 13:18:02.617 at java.lang.reflect.Method.invoke(Unknown Source) Sun 7/9 13:18:02.618 at sage.d$d.a(Unknown Source) Sun 7/9 13:18:02.618 at sage.d.d.a(Unknown Source) Sun 7/9 13:18:02.618 at sage.d.c.a(Unknown Source) Sun 7/9 13:18:02.619 at sage.d.d.a(Unknown Source) Sun 7/9 13:18:02.619 at sage.d.m.a(Unknown Source) Sun 7/9 13:18:02.620 at sage.d.a(Unknown Source) Sun 7/9 13:18:02.620 at sage.a6.a(Unknown Source) Sun 7/9 13:18:02.621 at sage.a6.a(Unknown Source) Sun 7/9 13:18:02.621 at sage.a6.a(Unknown Source) Sun 7/9 13:18:02.621 at sage.d.a(Unknown Source) Sun 7/9 13:18:02.622 at tv.sage.b.k.a(Unknown Source) Sun 7/9 13:18:02.622 at tv.sage.c.a(Unknown Source) Sun 7/9 13:18:02.622 at sage.StudioFrame.actionPerformed(Unknown Source) Sun 7/9 13:18:02.623 at javax.swing.AbstractButton.fireActionPerformed(Unknown Source) Sun 7/9 13:18:02.623 at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source) Sun 7/9 13:18:02.624 at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source) Sun 7/9 13:18:02.624 at javax.swing.DefaultButtonModel.setPressed(Unknown Source) Sun 7/9 13:18:02.625 at javax.swing.AbstractButton.doClick(Unknown Source) Sun 7/9 13:18:02.625 at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source) Sun 7/9 13:18:02.625 at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source) Sun 7/9 13:18:02.626 at java.awt.Component.processMouseEvent(Unknown Source) Sun 7/9 13:18:02.626 at javax.swing.JComponent.processMouseEvent(Unknown Source) Sun 7/9 13:18:02.627 at java.awt.Component.processEvent(Unknown Source) Sun 7/9 13:18:02.627 at java.awt.Container.processEvent(Unknown Source) Sun 7/9 13:18:02.627 at java.awt.Component.dispatchEventImpl(Unknown Source) Sun 7/9 13:18:02.628 at java.awt.Container.dispatchEventImpl(Unknown Source) Sun 7/9 13:18:02.628 at java.awt.Component.dispatchEvent(Unknown Source) Sun 7/9 13:18:02.628 at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source) Sun 7/9 13:18:02.629 at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source) Sun 7/9 13:18:02.629 at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source) Sun 7/9 13:18:02.630 at java.awt.Container.dispatchEventImpl(Unknown Source) Sun 7/9 13:18:02.630 at java.awt.Window.dispatchEventImpl(Unknown Source) Sun 7/9 13:18:02.630 at java.awt.Component.dispatchEvent(Unknown Source) Sun 7/9 13:18:02.631 at java.awt.EventQueue.dispatchEvent(Unknown Source) Sun 7/9 13:18:02.631 at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source) Sun 7/9 13:18:02.631 at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) Sun 7/9 13:18:02.632 at java.awt.EventDispatchThread.pumpEvents(Unknown Source) Sun 7/9 13:18:02.632 at java.awt.EventDispatchThread.pumpEvents(Unknown Source) Sun 7/9 13:18:02.633 at java.awt.EventDispatchThread.run(Unknown Source) Sun 7/9 13:18:02.634 Caused by: java.lang.reflect.InvocationTargetException: Exception while executing SageApi: "RemoveWidget" numargs=1 Sun 7/9 13:18:02.634 at net.sf.sageplugins.sageutils.SageApi.Api(SageApi.java:20) Sun 7/9 13:18:02.635 at alon24.Utils.removeLeftOvers(Utils.java:109) Sun 7/9 13:18:02.635 at alon24.Utils.finish(Utils.java:74) Sun 7/9 13:18:02.636 ... 43 more Sun 7/9 13:18:02.636 Do you have any ideas? I need to do cleanup, I could also not break the parent but it wont delete it there either.
__________________
Server SageTv 6.3.5, Core2Duo 6300 ,2Gigs ,Saphire x1650, PVR250, 2*320GB + 160GB, java 1.6.1 Client SageTV Client 6.3.5 , AMD 3000, 1024Mb, Saphire x1600Pro256HDMI, java 1.6.1 Using Nielm's Web server 2.22 |
#36
|
||||
|
||||
Quote:
"REM CenteredDirectoryBrowser to me", then in the actions after this one you can use the result of the browser... In the import code, link the CenteredDirectoryBrowser to the imported text action
__________________
Check out my enhancements for Sage in the Sage Customisations and Sageplugins Wiki |
#37
|
||||
|
||||
Quote:
__________________
Check out my enhancements for Sage in the Sage Customisations and Sageplugins Wiki |
#38
|
|||
|
|||
Thanks Nielm, that did the trick.
Where can I find out the rules about the different context, and when to use them?
__________________
Server SageTv 6.3.5, Core2Duo 6300 ,2Gigs ,Saphire x1650, PVR250, 2*320GB + 160GB, java 1.6.1 Client SageTV Client 6.3.5 , AMD 3000, 1024Mb, Saphire x1600Pro256HDMI, java 1.6.1 Using Nielm's Web server 2.22 |
#39
|
|||
|
|||
Quote:
you just have to create a dummy widget (type doesn't matter) with the name "MTDirectoryBrowser" at exactly the place where you want the "CenteredDirectoryBrower' widget to appear. As Niel said, you first have to set up the variables used by the browser. It would look like: Code:
+- AddVideoDir = ... +- DirBrowseTitle = ... +- CurrentDirPath = ... +- UseLocalDirPaths = ... +- SelectedDirPath = null +- MTDirectoryBrowser <- dummy widget (any type, with name used in defineLink()) +- if SelectedDirPath != null +- do something Important: I discovered that linkWidgets() did not maintain the position of the link within the parent. Since the above code will not work if the position is not maintained, please download the current version 1.5 of the import library where this issue has been fixed. Dirk |
#40
|
||||
|
||||
You had previously mentioned to avoid using the // notation. However, can't it get used with little to no impact once you get into a structure like this:
Code:
-Menu +Thing1 -Thing2 -Thing21 -Thing211 -Thing2111 -ThingIWant This would be especially useful in a situation like what I have where there are 4 or 5 variables set before calling the CenteredDirectoryBrower, so if I could skip most of those variable setups for specifying my destination widget path, that would make it easier for me. Last edited by aperry; 07-09-2006 at 09:24 PM. |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|