It is currently Thu Apr 24, 2014 10:35 pm




Post new topic Reply to topic  [ 5 posts ] 
 Slide Show 
Author Message
Cadet
Cadet

Joined: Tue Oct 09, 2007 6:54 am
Posts: 2
Post Slide Show
I have a need for a demo screen mounted on a wall that needs to show a slide show of random or predesigned selections of a projects windows. What is the best way to accomplish this. Also a non logged in viewer may need to be able to use the screens.

_________________
Darrel @ pnl.gov


Tue Oct 09, 2007 7:01 am
Profile
Moderator
Moderator

Joined: Wed Apr 18, 2007 11:00 am
Posts: 645
Location: Sacramento Ca.
Post 
Darrel,

There are a couple was to do this, but it sounds like your best bet is to have a link somewhere in your project to close all windows and open one small window with a timer and start/stop buttons. Set the buttons to toggle the "running" property on the timer. Then set the timer maximum to the number of windows you will be cycling through, and the delay to however long you want to pause at each screen. In the timer event configuration under propertyChange, put the following:

Code:
#list of windows to cycle through
windows = ["Window 1", "Window 2", "Window 3"]

if event.propertyName == "value":
   i = event.source.value
   #close the previous window
   if event.source.value == 0:
      fpmi.gui.closeWindow(windows[len(windows)-1])
   else:
      fpmi.gui.closeWindow(windows[i-1])
   #open the next window
   fpmi.gui.openWindow(windows[i])

You can also add items to the runtime menu to start and stop it for you. Something like
Code:
#open the window if it isnt open
fpmi.gui.openWindow("SlideShowControl")
#reset the value so you start at window1
fpmi.gui.getWindow("SlideShowControl").getRootContainer().getComponent('Timer').value=0
#start it running
fpmi.gui.getWindow("SlideShowControl").getRootContainer().getComponent('Timer').running=1


Hope that helps!

_________________
Robert McKenzie
Inductive Automation
Technical Support


Tue Oct 09, 2007 10:33 am
Profile WWW
Moderator
Moderator

Joined: Sun Apr 02, 2006 2:46 pm
Posts: 4016
Location: Sacramento, CA
Post 
Darrel, here is another way of doing it with a global timer script. In this way, it is totally automatic - the timer script senses if a user is active using the fpmi.system.getInactivitySeconds() function. Just put the list of window names you want to swap between in the windows variable. (Note - you need FactoryPMI 3.0 to use this script because of the use of the fpmi.nav module)

Put this script in a global timer script that runs every 15,000 milliseconds. It won't run the slideshow if the user has been active in the last 10 seconds. You can play with the timing to get the effect you want.

Code:
windows = ['Window 10', 'Window 11', 'Window 12', 'Window 13']

seconds = fpmi.system.getInactivitySeconds()
if seconds > 10:
   global position
   try:
      position = (position + 1) % len(windows)
   except NameError:
      # This will initialize it the first time
      position=1

   fpmi.nav.swapTo(windows[position])

_________________
Carl Gould
Software Development
Inductive Automation


Tue Oct 09, 2007 11:14 am
Profile WWW
Trooper
Trooper

Joined: Mon May 28, 2012 4:34 pm
Posts: 14
Post Re: Slide Show
I used the example shown above to change display. However, the swapwindow() method did not work. It did not clear the old windows from the display. The new windows showed up to the right of old window. I had three windows in my project. After two timer intervals, all three windows were showing on the screen. So, I ended up using the function calls closewindow/openwindow. Is there any window property that needs to be set to make the swapwindow() method work.


Sat Jun 09, 2012 9:50 am
Profile
General
General

Joined: Tue Mar 24, 2009 9:14 am
Posts: 785
Location: Hudson, MI
Post Re: Slide Show
Look at the help file for the swapTo method. :)

_________________
Jordan

Duct tape is like The Force. It has a light side, a dark side, and it holds the universe together.


Mon Jun 11, 2012 10:25 am
Profile
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: