[pygtk] linsplit revolution!
For anybody with a large screen winsplit revolution is fantastic for organizing windows http://reptils.free.fr/ (win32 only though) Basically warps and resizes your windows so they're tiled with minimum effort. I've attached a first pass at a unix version (Just run from cmd line) and would appreciate any hints for the TODO items. 1) get the usable destkop area, minus dock area 2) why does wnck.set_geometry not work for gnome-terminal? 3) How can I get the current gdk time? (0 gives a warning) Stephen. #! /usr/bin/env python import wnck import gtk import gtk.gdk as gdk import deskbar.core.keybinder as keybinder wnck_WINDOW_CHANGE_ALL = ( wnck.WINDOW_CHANGE_X|wnck.WINDOW_CHANGE_Y|wnck.WINDOW_CHANGE_WIDTH|wnck.WINDOW_CHANGE_HEIGHT) def handle(num): screen = wnck.screen_get_default() screen.force_update() workspace = screen.get_active_workspace() window = screen.get_active_window() # TODO - get usable desktop size instead of hardcoding dx,dy, dw,dh = 0,25, workspace.get_width(), workspace.get_height()-25 if num in (1,3,7,9): w,h = dw/2, dh/2 elif num in (4,6): w,h = dw/2, dh elif num in (8,2): w,h = dw, dh/2 elif num in (5,):w,h = dw, dh if num in (1,4,7,2,5,8): x = 0 else:x = dw/2 if num in (7,8,9,4,5,6): y = 0 else:y = dh/2 # TODO - set_geometry does not work for gnome-terminal windows # or rather, it seems to work on the tabbed contents instead. print "%i pressed\nSet geometry of '%s' to %ix%i+%i+%i" % (num, window.get_name(), w,h,x,y) window.set_geometry(gdk.GRAVITY_NORTH_WEST, wnck_WINDOW_CHANGE_ALL, dx+x,dy+y,w,h) window.activate(0) # TODO - current gtk time print """Linsplit started: Use to move the active window Use to quit""" for i in range(1,10): keybinder.tomboy_keybinder_bind( "KP_%i"%i, lambda i=i: handle(i) ) keybinder.tomboy_keybinder_bind("KP_Enter", gtk.main_quit) gtk.main() ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] linsplit revolution!
On Sat, Nov 24, 2007 at 06:35:50PM +, Stephen Kennedy wrote: > For anybody with a large screen winsplit revolution is fantastic > for organizing windows http://reptils.free.fr/ (win32 only though) > > Basically warps and resizes your windows > so they're tiled with minimum effort. > > I've attached a first pass at a unix version (Just run from cmd line) > and would appreciate any hints for the TODO items. > > 1) get the usable destkop area, minus dock area That's the _NET_WM_WORKAREA property on the root window (see the EWMH spec for details), but I dunno if wnck exports it. > 2) why does wnck.set_geometry not work for gnome-terminal? Not sure, might be some strange interaction between how your window manager interprets resize requests and how it interprets gnome-terminal's request to be assigned only certain sizes. > 3) How can I get the current gdk time? (0 gives a warning) Create a gtk.gdk.Window, make sure it has PROPERTY_CHANGE_MASK enabled in its event mask, and then call gtk.gdk.x11_get_server_time(that_window) Alternatively, you can read it out of some X events, including keypress events. This is the Correct thing to use in your case, because it avoids race conditions, but I don't know if the tomboy code you're using to issue passive grabs gives any way to get at this information. In PyGTK generally you can call .get_time() on a gtk.gdk.Event of the appropriate type. A general alternative to something like winsplit, of course, is a naturally tiling window manager. You might also be interested in my project, http://partiwm.org, which attempts to become such a wm and is written in pygtk. -- Nathaniel -- "Of course, the entire effort is to put oneself Outside the ordinary range Of what are called statistics." -- Stephan Spender ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
[pygtk] Flashing widget background
Hi all, I'm looking to getting widgets in my program to flash, such as ardour does for it's record button. Currently my thinking is to create a new thread to keep changing the background colour. However I'm trying to find out if there's already implementations of this out there. I've looked at ardour's but I am finding tracing how they do it taking quite a bit of time given their project maturity. Cheers ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] Flashing widget background
Peter Brooks wrote: > Hi all, > I'm looking to getting widgets in my program to flash, such as ardour > does for it's record button. > > Currently my thinking is to create a new thread to keep changing the > background colour. However I'm trying to find out if there's already > implementations of this out there. > > I've looked at ardour's but I am finding tracing how they do it > taking quite a bit of time given their project maturity. Wouldn't a gobject.timeout_add() be enough? That call a function every X ms, in which you can change the color of your widget. -- Yann ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
[pygtk] Simple HTML editor
Are there any python bindings for libgtkhtml3? I see there are python bindings for libgtkhtml2 - they even come with Ubuntu. Does this version include any HTML editing functionality? I'd really like to either find, or write, a simple HTML editor - basically, a WYSIWYG word processor that reads and saves HTML, and probably nothing but HTML. I'm thinking something like evolution's HTML e-mail composer, but without all the e-mail related stuff - just HTML editing. Can libgtkhtml2 or libgtkhtml3 do this - and can they do it from python? Thanks! ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/