Module wmii :: Class WMII
[show private | hide private]
[frames | no frames]

Type WMII

object --+    
         |    
  WMIIBase --+
             |
            WMII


Python interface to WMII

The following 'magic attributes' are available, marked (r) for read-only, (w) for write-only and (rw) for read/write:
Method Summary
  __init__(self, **kw)
Creates WMII interface
  __getattr__(self, attr)
If a ctl attribute, get it from /ctl, otherwise defer to base method
  __setattr__(self, attr, val)
If the attribute is one of the /ctl attributes, write it to wmii, otherwise use the parent method
  actionmenu(self)
pops up the action menu
  after(self, delay, action, *args)
Schedules an action to occur after a given delay.
  bindkey(self, key, hdlr, *args)
binds a key to an action
  colMode(self, mode)
sets column mode to one of 'default', 'stack', 'max'
  colModeDefault(self)
changes to default column view mode
  colModeMax(self)
changes to max column view mode
  colModeStack(self)
changes to stack column view mode
  eventLoop(self)
Runs the main event loop of this interface
  float(self, winid)
If no argument given, toggles between framed and float focus
  focus(self, direction)
Changes focus in the given direction, 'up', 'down', 'left', 'right'
  focusDown(self)
change focus to window below
  focusLeft(self)
change focus to column to the left
  focusNext(self)
transfers focus to the next window in the current view
  focusRight(self)
change focus to column to the right
  focusUp(self)
change focus to window above
  get(self, key)
retrieves a key from shared data area
  getActionPath(self, name)
returns the full pathname of an action name, or None if no valid action exists by that name
  getActionsList(self)
returns a list of action names
  getClient(self, winid)
returns a WMIIClient object for a given window id
  gotoNextTag(self)
switch to the next tag
  gotoPrevTag(self)
switch to the previous tag
  gotoTag(self, tagid)
switch to viewing the tag 'tagid'
  initTagsBar(self)
Sets up the tags bar
  kill(self, winid)
Kills the client with the given window id, or the current window if no id given
  loadBindings(self, path)
Reloads the key bindings from a file
  on_CreateTag(self, tag)
default handler for tag create events
  on_DestroyTag(self, tag)
default handler for tag destroy events
  on_FocusTag(self, tag)
default handler for tag focus events
  on_Key(self, key)
handles a keystroke
  on_LeftBarClick(self, button, tagid)
picks up when user clicks on a tag label
  on_PyWmiiStatus(self, *args)
display a message on status bar
  on_UnfocusTag(self, tag)
default handler for tag unfocus events
  onEvent(self, name, *args)
handle an event, dispatching to on_EVENTNAME if the handler exists, or onUnknownEvent if it doesn't
  onUnknownEvent(self, name, *args)
default handler for unhandled events
  onUnknownKey(self, key)
this gets executed when an unknown key event happens
  popupMenu(self, choices)
Displays a popup menu offering a set of choices, and returns the result or None if no choice was made
  progmenu(self)
display program menu, execute program
  put(self, key, value)
Saves a value to shared data area
  run(self)
Default method for running pywmii.
  runAction(self, name)
Executes an 'action' script (any executable file in one of the WMII_CONFPATH directories, whigh a purely alphanumeric name
  search(self, **kw)
Searches for client window(s) matching a given set of parameters, including:
  statusResume(self, freq)
Resumes the periodical status bar update, with the existing feed
  statusStart(self, freq, colors)
Starts the statusbar updater function
  statusStop(self)
Stops the status bar updater
  statusUpdate(self, wmii)
Returns the text to display on the status bar
  statusWrite(self, msg, delay, urgent)
Queues up a message to be displayed on the status bar next time it updates.
  stop(self)
Break out of event loop, by writing a custom terminate event which tells the event loop to break.
  unbindkey(self, key)
Deletes a key binding
    Inherited from object
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __hash__(x)
x.__hash__() <==> hash(x)
  __new__(T, S, ...)
T.__new__(S, ...) -> a new object with type S, a subtype of T
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle
  __repr__(x)
x.__repr__() <==> repr(x)
  __str__(x)
x.__str__() <==> str(x)

Property Summary
  clientids: list of ids of current clients
  clients: Dict of current clients - keys are clientid, values are WMIIClient instances
  colrules: list of (tag, percentages) tuples, controlling the sizing of columns on a per-tag basis
  keys: Currently grabbed keystrokes
  nextTag: The 'next' tag (view) in chain
  prevTag: The 'prev' tag (view) in chain
  sel: Currently selected window
  statusfunc: write-only - sets the function which will update the statusbar.
  tag: Currently visible tag
  tagrules: list of (regexp, tag) tuples, controlling the tagging of newly created windows according to their titlebar text
  tags: Current list of tags (views)

Class Variable Summary
type clientClass = wmii.WMIIClient
type columnClass = wmii.WMIIColumn
tuple defaultFocusColors = ('#000000', '#ffcc00', '#000000')
tuple defaultNormColors = ('#ffee44', '#000000', '#000000')
type p9Class = wmii.P9_wmiir
type viewClass = wmii.WMIIView

Method Details

__init__(self, **kw)
(Constructor)

Creates WMII interface
Overrides:
__builtin__.object.__init__

__getattr__(self, attr)
(Qualification operator)

If a ctl attribute, get it from /ctl, otherwise defer to base method
Overrides:
wmii.WMIIBase.__getattr__

__setattr__(self, attr, val)

If the attribute is one of the /ctl attributes, write it to wmii, otherwise use the parent method
Overrides:
wmii.WMIIBase.__setattr__

actionmenu(self)

pops up the action menu

after(self, delay, action, *args)

Schedules an action to occur after a given delay.

Arguments:
  • delay - time in seconds
  • action - a callable object
  • other args - will be passed to action

bindkey(self, key, hdlr, *args)

binds a key to an action

Arguments:
  • key - a key name, in the form:
       Mod1-[Shift-][Control-]letter
    
       eg, Mod4-Shift-n
    
  • hdlr - one of:
    • a callable object which will be invoked with one argument - the evt handler object - when the key is pressed, OR
    • a string, being a shell command

colMode(self, mode)

sets column mode to one of 'default', 'stack', 'max'

colModeDefault(self)

changes to default column view mode

colModeMax(self)

changes to max column view mode

colModeStack(self)

changes to stack column view mode

eventLoop(self)

Runs the main event loop of this interface

float(self, winid=None)

If no argument given, toggles between framed and float focus

If a window id is given, then toggles that window to/from float mode

focus(self, direction)

Changes focus in the given direction, 'up', 'down', 'left', 'right'

focusDown(self)

change focus to window below

focusLeft(self)

change focus to column to the left

focusNext(self)

transfers focus to the next window in the current view

focusRight(self)

change focus to column to the right

focusUp(self)

change focus to window above

get(self, key)

retrieves a key from shared data area

getActionPath(self, name)

returns the full pathname of an action name, or None if no valid action exists by that name

getActionsList(self)

returns a list of action names

getClient(self, winid)

returns a WMIIClient object for a given window id

gotoNextTag(self)

switch to the next tag

gotoPrevTag(self)

switch to the previous tag

gotoTag(self, tagid)

switch to viewing the tag 'tagid'

initTagsBar(self)

Sets up the tags bar

kill(self, winid='sel')

Kills the client with the given window id, or the current window if no id given

loadBindings(self, path=None)

Reloads the key bindings from a file

Arguments:
  • path - pathname of bindings file, defaults to ~/.wmiirc-<version>/keybindings.pywmii

on_CreateTag(self, tag)

default handler for tag create events

on_DestroyTag(self, tag)

default handler for tag destroy events

on_FocusTag(self, tag)

default handler for tag focus events

on_Key(self, key)

handles a keystroke

on_LeftBarClick(self, button, tagid)

picks up when user clicks on a tag label

on_PyWmiiStatus(self, *args)

display a message on status bar

on_UnfocusTag(self, tag)

default handler for tag unfocus events

onEvent(self, name, *args)

handle an event, dispatching to on_EVENTNAME if the handler exists, or onUnknownEvent if it doesn't

onUnknownEvent(self, name, *args)

default handler for unhandled events

onUnknownKey(self, key)

this gets executed when an unknown key event happens

popupMenu(self, choices)

Displays a popup menu offering a set of choices, and returns the result or None if no choice was made

Arguments:
  • choices - a sequence of options. Each item in the sequence may be a string, or a tuple (label, item1, [item2,...]), where 'label' is displayed to the user, and (item1, [item2,...]) is the tuple that gets returned if the user makes that choice

progmenu(self)

display program menu, execute program

put(self, key, value)

Saves a value to shared data area

run(self)

Default method for running pywmii.

Sets up the status bar, the tag labels, then enters the event loop

runAction(self, name)

Executes an 'action' script (any executable file in one of the WMII_CONFPATH directories, whigh a purely alphanumeric name

search(self, **kw)

Searches for client window(s) matching a given set of parameters, including:
  • id - window's real id (0xWhatever)
  • label - literal string or regexp or fnmatch string for window's title
  • class - window's 'class_' attribute
  • instance - window's 'instance' attribute
  • tag - a 'view name' to search
If no parameters are given, then a list of all open windows will be returned

statusResume(self, freq=None)

Resumes the periodical status bar update, with the existing feed

statusStart(self, freq=None, colors=None)

Starts the statusbar updater function

Arguments:
  • freq - frequency of update
  • colors - a list of 3 colors (or a string '#RRGGBB #RRGGBB #RRGGBB' for text/bkgnd/border

statusStop(self)

Stops the status bar updater

statusUpdate(self, wmii)

Returns the text to display on the status bar

Default method.

You can customise this by either:
  • overriding this method in your subclass, OR
  • calling .statusSetUpdater()

statusWrite(self, msg, delay=5, urgent=False)

Queues up a message to be displayed on the status bar next time it updates.

Arguments:
  • msg - the message to be displayed
  • delay - how long to show it for (default 5 seconds)

stop(self)

Break out of event loop, by writing a custom terminate event which tells the event loop to break.

unbindkey(self, key)

Deletes a key binding

Property Details

clientids

list of ids of current clients

clients

Dict of current clients - keys are clientid, values are WMIIClient instances

colrules

list of (tag, percentages) tuples, controlling the sizing of columns on a per-tag basis

keys

Currently grabbed keystrokes

nextTag

The 'next' tag (view) in chain

prevTag

The 'prev' tag (view) in chain

sel

Currently selected window

statusfunc

write-only - sets the function which will update the statusbar. If you assign a (func, delay) tuple, the func will be called every delay seconds. The func should return a string which will be displayed verbatim on the statusbar

tag

Currently visible tag

tagrules

list of (regexp, tag) tuples, controlling the tagging of newly created windows according to their titlebar text

tags

Current list of tags (views)

Class Variable Details

defaultFocusColors

Type:
tuple
Value:
('#000000', '#ffcc00', '#000000')                                      

defaultNormColors

Type:
tuple
Value:
('#ffee44', '#000000', '#000000')                                      

Generated by Epydoc 2.1 on Tue Jun 12 22:49:30 2007 http://epydoc.sf.net