Fedora Linux Support Community & Resources Center
  #1  
Old 18th November 2006, 11:15 PM
Firewing1's Avatar
Firewing1 Offline
Administrator
 
Join Date: Dec 2004
Location: Canada
Age: 22
Posts: 9,224
Screensavers, previews and python

Hey,
I'm trying to figure out how to make a screensaver preview program in Python. I've been looking at the gnome-screensaver code, and it seems because it's in C it can use Gdk functions python can't.
Anyone know way to make a little box that shown the preview of a screensaver in there with Python?
Firewing1
__________________
[+] My open source software and blog
[+] Some of my howtos: (for full list, click here)
Reply With Quote
  #2  
Old 29th January 2007, 12:41 AM
Firewing1's Avatar
Firewing1 Offline
Administrator
 
Join Date: Dec 2004
Location: Canada
Age: 22
Posts: 9,224
Anyone? The C code uses GtkDrawable as the widget - How would I map the screensaver to display there?
Firewing1
__________________
[+] My open source software and blog
[+] Some of my howtos: (for full list, click here)
Reply With Quote
  #3  
Old 29th January 2007, 12:45 AM
bob's Avatar
bob Online
Administrator (yeah, back again)
 
Join Date: Jul 2004
Location: Colton, NY; Junction of Heaven & Earth (also Routes 56 & 68).
Age: 67
Posts: 21,215
Please read the Guidelines and note the invisible rules about bumping your post. After all, it's only been two and a half months. Give it time....
__________________
Linux & Beer - That TOTALLY Computes!
Registered Linux User #362651


Don't use any of my solutions on working computers or near small children.
Reply With Quote
  #4  
Old 29th January 2007, 12:59 AM
mwette Offline
Registered User
 
Join Date: Nov 2005
Location: Los Angeles area
Posts: 887
Code:
#!/usr/bin/env python

import gtk

def destroy(*args): gtk.main_quit()
def expose(wid, *args): wid.show()

if 1:
  window = gtk.Window(gtk.WINDOW_TOPLEVEL)
  image = gtk.Image()
  image.set_from_file('/usr/share/icons/Bluecurve/96x96/mimetypes/file.png')
  window.add(image)

  window.connect("destroy", destroy)
  window.connect('expose_event', expose)
  window.show_all()
  gtk.main()
Also, try the tutorial .

[EDIT: of course you may want to use things like scrollable windows, but it should be doable]
Reply With Quote
  #5  
Old 29th January 2007, 02:38 AM
Firewing1's Avatar
Firewing1 Offline
Administrator
 
Join Date: Dec 2004
Location: Canada
Age: 22
Posts: 9,224
That works for a single icon, though - I'd (ideally) like for it to be a real-time preview of the screensaver.
Firewing1
__________________
[+] My open source software and blog
[+] Some of my howtos: (for full list, click here)
Reply With Quote
  #6  
Old 29th January 2007, 03:27 AM
Firewing1's Avatar
Firewing1 Offline
Administrator
 
Join Date: Dec 2004
Location: Canada
Age: 22
Posts: 9,224
Was looking at the gnome-screensaver code, turn out they use their own custom widget (that's what the Drawable's for).
gdk_spawn_on_screen_with_pipes - The C function that does exactly what I want to do... Except I can't find it for python!
Firewing1
__________________
[+] My open source software and blog
[+] Some of my howtos: (for full list, click here)
Reply With Quote
  #7  
Old 29th January 2007, 04:56 AM
mwette Offline
Registered User
 
Join Date: Nov 2005
Location: Los Angeles area
Posts: 887
Quote:
Originally Posted by Firewing1
That works for a single icon, though - I'd (ideally) like for it to be a real-time preview of the screensaver.
Firewing1
Well you DID say
Quote:
I'm trying to figure out how to make a screensaver preview program in Python.
implying that you want to do the work

You can always generate a c hook for that routine. But what do you want it to do?
There is lots of pygtk capability. Many GDK routines are bound into pygtk.
Reply With Quote
  #8  
Old 29th January 2007, 05:20 AM
Firewing1's Avatar
Firewing1 Offline
Administrator
 
Join Date: Dec 2004
Location: Canada
Age: 22
Posts: 9,224
Just show a miniature version of the screensaver in a widget - I asked on #pygtk, they said the same thing ('subprocess' module in Python). Hopefully I'll figure out some simple C code and then just run the helper command as a child.
Firewing1
__________________
[+] My open source software and blog
[+] Some of my howtos: (for full list, click here)
Reply With Quote
  #9  
Old 29th January 2007, 05:26 AM
brunson Offline
Registered User
 
Join Date: Jun 2005
Location: Westminster, Colorado
Posts: 2,304
I think you're searching from the wrong direction.

All of the screen savers are executable, you can run then and they display in their own window. It's probably a default behavior if not given any other display directives. They also have to be written to an API specified by xscreensaver. You'd have to reimplement the environment (pix buffer, whatever) and the call them the same way xscreensaver does. Whether that's doable with the pyGTK bindings, I don't know, but there doesn't seem to be anything xscreensaver specific they're dynamically linked against, though they may have to be compiled against statically.

I'd recommend looking at how to write a plugin for xscreensaver, you'll probably discover more about the the hooks they require to be run by another application.
__________________
Registered Linux User #4837
411th in line to get sued by Micro$oft
Quote:
Basically, to learn Unix you learn to understand and apply a small set of key ideas and achieve expertise by expanding both the set of ideas and your ability to apply them - Paul Murphy
Reply With Quote
  #10  
Old 31st January 2007, 12:09 AM
Firewing1's Avatar
Firewing1 Offline
Administrator
 
Join Date: Dec 2004
Location: Canada
Age: 22
Posts: 9,224
Yeah - I'll look into it, but the thing is I'm going this for gnome-screensaver...
Firewing1
__________________
[+] My open source software and blog
[+] Some of my howtos: (for full list, click here)
Reply With Quote
  #11  
Old 31st January 2007, 12:22 AM
brunson Offline
Registered User
 
Join Date: Jun 2005
Location: Westminster, Colorado
Posts: 2,304
They're interchangable. gnome-screensaver is pretty much a port of xscreensaver to the gnome environment. Plus, I'm pretty sure the modules are compatible.
__________________
Registered Linux User #4837
411th in line to get sued by Micro$oft
Quote:
Basically, to learn Unix you learn to understand and apply a small set of key ideas and achieve expertise by expanding both the set of ideas and your ability to apply them - Paul Murphy
Reply With Quote
  #12  
Old 31st January 2007, 02:48 AM
Firewing1's Avatar
Firewing1 Offline
Administrator
 
Join Date: Dec 2004
Location: Canada
Age: 22
Posts: 9,224
I've been looking, there's no way in python to do it. I even checked the GTK/PYGTK sources, the gdk_spawn_* commands are in the .override ignore lists
Firewing1
__________________
[+] My open source software and blog
[+] Some of my howtos: (for full list, click here)
Reply With Quote
  #13  
Old 31st January 2007, 03:00 AM
mwette Offline
Registered User
 
Join Date: Nov 2005
Location: Los Angeles area
Posts: 887
Are you trying to write something like gnome-screensaver-preferences?
Reply With Quote
  #14  
Old 31st January 2007, 03:48 AM
Firewing1's Avatar
Firewing1 Offline
Administrator
 
Join Date: Dec 2004
Location: Canada
Age: 22
Posts: 9,224
Yes, but this program will generate custom .desktop files so that one can easily customize a xscreensaver and then use it in gnome-screensaver.
Firewing1
__________________
[+] My open source software and blog
[+] Some of my howtos: (for full list, click here)
Reply With Quote
  #15  
Old 17th February 2007, 05:45 PM
Firewing1's Avatar
Firewing1 Offline
Administrator
 
Join Date: Dec 2004
Location: Canada
Age: 22
Posts: 9,224
Found it! I can use a plug and socket to embed windows into one another. Basically I'll have a Drawable area that acts like a my virtual window, then I'll sock-plug the xscreensaver into it.
Firewing1
__________________
[+] My open source software and blog
[+] Some of my howtos: (for full list, click here)
Reply With Quote
Reply

Tags
previews, python, screensavers

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Disable File Previews mmarino Using Fedora 0 14th November 2007 03:35 PM
Konqueror and cr2 previews. bowens44 Using Fedora 0 15th October 2007 04:57 PM
KDE Thumbnail Previews... Fuhzy Wuzzie Using Fedora 2 13th January 2006 03:50 AM
KDE Image Previews Core 2 DoubleHelix Using Fedora 3 5th September 2004 07:25 AM
thumbnail previews monkotronic Using Fedora 3 1st September 2004 04:14 PM


Current GMT-time: 21:31 (Wednesday, 22-05-2013)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat