SageTV Community  

Go Back   SageTV Community > SageTV Development and Customizations > SageTV Studio
Forum Rules FAQs Community Downloads Today's Posts Search

Notices

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.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 07-24-2009, 05:27 AM
tmiranda's Avatar
tmiranda tmiranda is offline
SageTVaholic
 
Join Date: Jul 2005
Location: Central Florida, USA
Posts: 5,851
Studio Programming Conventions and Editing Tips

Looking through the code from the default STV I see that the convention seems to be to always put widgets that are executed sequentially as children rather than as "siblings". For example, if there are three action widgets that are to be executed sequentially they are coded in studio as:

Code:
Widget 1
  Widget 2
    Widget 3
Rather than:

Code:
  Widget 1
  Widget 2
  Widget 3
Where the indented widgets are children widgets. Why? This seems to create a lot of clutter and difficulty in editing (see my next question). Don't the two example below do the same thing?

Example 1:
Code:
If Expression
true
  Widget 1
    Widget 2
      Widget 3
else
  Widget 4
Example 2:
Code:
If Expression
true
  Widget 1
  Widget 2
  Widget 3
else
  Widget 4
Why code things like example 1 when example 2 seems to be a lot "cleaner" and clearer (to me at least)?

Next, how do you most effectively add or delete widgets that are somewhere in the middle of one of these long chains of children widgets? For example, what is the easiest way to delete Widget 1 in example 1? The manual says not to delete a widget if it has children but rather delete from the "bottom" and work your way up. What I've been doing is "collapsing" the chain at Widget 2, selecting Widget 2, cutting and pasting it just after the "true" and then deleting Widget 1. Is this the best way to do things?

Likewise, what is the easist way to add a Widget that needs to be placed before Widget 1? If I add a Widget after the "true" it becomes a "sibling" of Widget 1. What I have been doing is collapsing the chain at Widget 1 and then cutting and pasting it as a child of the newly inserted Widget. Is this the best way?

Thanks,

Tom
__________________

Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders.
Reply With Quote
  #2  
Old 07-24-2009, 06:10 AM
Fuzzy's Avatar
Fuzzy Fuzzy is offline
SageTVaholic
 
Join Date: Sep 2005
Location: Jurupa Valley, CA
Posts: 9,957
It is just the way they implemented the system. It is unconventional, but works well for handling parallel tasks, as instead of a single execution point in the entire STV, it can fork to different processes, and those can run down their individual 'family tree' if you will.
__________________
Buy Fuzzy a beer! (Fuzzy likes beer)

unRAID Server: i7-6700, 32GB RAM, Dual 128GB SSD cache and 13TB pool, with SageTVv9, openDCT, Logitech Media Server and Plex Media Server each in Dockers.
Sources: HRHR Prime with Charter CableCard. HDHR-US for OTA.
Primary Client: HD-300 through XBoxOne in Living Room, Samsung HLT-6189S
Other Clients: Mi Box in Master Bedroom, HD-200 in kids room
Reply With Quote
  #3  
Old 07-24-2009, 08:18 AM
tmiranda's Avatar
tmiranda tmiranda is offline
SageTVaholic
 
Join Date: Jul 2005
Location: Central Florida, USA
Posts: 5,851
I'm not sure what you mean. Are you saying that it's done this way so at another point in the STV I can put a reference to a widget and effectively use that widget chain as a "subroutine"? How does this help when using parallel tasks via fork()?

The developers at Sage have obviously coded the STV this way on purpose and I want to know what that purpose is so I can get a better grasp of Studio programming. They certainly know a lot more about Studio than I do and I want to learn from their experience.

Tom
__________________

Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders.
Reply With Quote
  #4  
Old 07-24-2009, 08:39 AM
PLUCKYHD PLUCKYHD is offline
SageTVaholic
 
Join Date: Dec 2007
Posts: 6,257
You can code either way. I only use the tree effect if I am calling some menu or if statments after evaluation.
Reply With Quote
  #5  
Old 07-24-2009, 09:24 AM
Opus4's Avatar
Opus4 Opus4 is offline
Administrator
 
Join Date: Sep 2003
Location: NJ
Posts: 19,624
Quote:
Originally Posted by tmiranda View Post
Don't the two example below do the same thing?

Example 1:
Code:
If Expression
true
  Widget 1
    Widget 2
      Widget 3
else
  Widget 4
Example 2:
Code:
If Expression
true
  Widget 1
  Widget 2
  Widget 3
else
  Widget 4
Why code things like example 1 when example 2 seems to be a lot "cleaner" and clearer (to me at least)?
It depends on what the code is for; those examples may do the same thing, they may not. Have you read through the section of the Studio manual called "The Widget", starting around p. 13? If the above code is for a Process chain, they should accomplish the same thing. If the code is part of a UI chain, they will not.

BTW: your example 2 can get quite large & harder to collapse portions of it if you have many more widgets all placed as siblings.

Quote:
Next, how do you most effectively add or delete widgets that are somewhere in the middle of one of these long chains of children widgets? For example, what is the easiest way to delete Widget 1 in example 1? The manual says not to delete a widget if it has children but rather delete from the "bottom" and work your way up. What I've been doing is "collapsing" the chain at Widget 2, selecting Widget 2, cutting and pasting it just after the "true" and then deleting Widget 1. Is this the best way to do things?
Yes, you would move the children & deleted the now-childless widget...

Quote:
Likewise, what is the easist way to add a Widget that needs to be placed before Widget 1? If I add a Widget after the "true" it becomes a "sibling" of Widget 1. What I have been doing is collapsing the chain at Widget 1 and then cutting and pasting it as a child of the newly inserted Widget. Is this the best way?
Yes -- add the new widget, then move the other widget chain(s) to be its children.

Moving can be done easier with the mouse, in my opinion -- see "Moving and Copying Widgets" around p. 75.

But... for more widget manipulation tools, I suggest you check out GKusnick's Studio plugin:
New tools for Studio users

- Andy
__________________
SageTV Open Source v9 is available.
- Read the SageTV FAQ. Older PDF User's Guides mostly still apply: SageTV V7.0 & SageTV Studio v7.1.
- Hauppauge remote help: 1) Basics/Extending it 2) Replace it 3) Use it w/o needing focus
- HD Extenders: A) FAQs B) URC MX-700 remote setup
Note: This is a users' forum; see the Rules. For official tech support fill out a Support Request.
Reply With Quote
  #6  
Old 07-24-2009, 10:42 AM
tmiranda's Avatar
tmiranda tmiranda is offline
SageTVaholic
 
Join Date: Jul 2005
Location: Central Florida, USA
Posts: 5,851
Thanks Plucky and Andy.

I am talking about a process chain, not a UI chain.

I have installed GKusnick's tools, but so far I've only been using a few of its capabilities. (Searching mostly.) Time to read some more ....

Tom
__________________

Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders.
Reply With Quote
  #7  
Old 07-24-2009, 11:36 AM
PLUCKYHD PLUCKYHD is offline
SageTVaholic
 
Join Date: Dec 2007
Posts: 6,257
andy I got a question related


Say you are setting values for attributed in let's say a focus gained hook an you have

If value
True
Attribute = true
False
Attribute = false
Attribute 2 = true
Attribute 3 = true

Can you just call refresh for the area at the botto. If they are all in the same refresh area or do you have to call it after each attribute and chain of commands?

If I have a longer chain of code then above will it get executed fully before the refresh
Reply With Quote
  #8  
Old 07-24-2009, 11:45 AM
jaminben jaminben is offline
Sage Icon
 
Join Date: Sep 2007
Location: Norwich, UK
Posts: 1,754
Send a message via MSN to jaminben
Quote:
Originally Posted by PLUCKYHD View Post
andy I got a question related


Say you are setting values for attributed in let's say a focus gained hook an you have

If value
True
Attribute = true
False
Attribute = false
Attribute 2 = true
Attribute 3 = true

Can you just call refresh for the area at the botto. If they are all in the same refresh area or do you have to call it after each attribute and chain of commands?

If I have a longer chain of code then above will it get executed fully before the refresh
I've seen plenty of examples of user code where they place the refresh at the bottom but I don't ever recall seeing regular Sage code do this. I don't know if its right or wrong but it does seem to work just fine located at the bottom.
__________________
Server - Win7 64bit, 2.4Ghz Intel Core 2 Duo, TBS 6284 PCI-E Quad DVB-T2 Tuner, 3 x HD200 & 1 x HD300 extenders
Reply With Quote
  #9  
Old 07-24-2009, 12:06 PM
Opus4's Avatar
Opus4 Opus4 is offline
Administrator
 
Join Date: Sep 2003
Location: NJ
Posts: 19,624
Refreshes are fairly slow, as far as code execution goes, since it needs to re-evaluate and redraw everything on the screen. So, they should not be done after every line of code unless you really have a good reason for doing so. And, unless you really need to refresh the entire screen, you should refresh just the affected areas instead.

- Andy
__________________
SageTV Open Source v9 is available.
- Read the SageTV FAQ. Older PDF User's Guides mostly still apply: SageTV V7.0 & SageTV Studio v7.1.
- Hauppauge remote help: 1) Basics/Extending it 2) Replace it 3) Use it w/o needing focus
- HD Extenders: A) FAQs B) URC MX-700 remote setup
Note: This is a users' forum; see the Rules. For official tech support fill out a Support Request.
Reply With Quote
  #10  
Old 07-24-2009, 12:29 PM
PLUCKYHD PLUCKYHD is offline
SageTVaholic
 
Join Date: Dec 2007
Posts: 6,257
Quote:
Originally Posted by Opus4 View Post
Refreshes are fairly slow, as far as code execution goes, since it needs to re-evaluate and redraw everything on the screen. So, they should not be done after every line of code unless you really have a good reason for doing so. And, unless you really need to refresh the entire screen, you should refresh just the affected areas instead.

- Andy
Thanks andy yes I stopped using refresh and starting refeshing areas along time ago but always had a refresharea call after every line or tree of code and wondered if it was necessary
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Newbie Studio/programming questions. jaminben SageTV Studio 88 05-02-2009 10:02 AM


All times are GMT -6. The time now is 02:27 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, vBulletin Solutions Inc.
Copyright 2003-2005 SageTV, LLC. All rights reserved.