Changeset 179
- Timestamp:
- 08/10/2005 08:30:38 AM (3 years ago)
- Location:
- trunk
- Files:
-
- 4 modified
-
examples/plpwm.py (modified) (8 diffs)
-
plwm/keys.py (modified) (2 diffs)
-
plwm/menu.py (modified) (2 diffs)
-
plwm/pane_utilities.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/examples/plpwm.py
r178 r179 1 1 #!/usr/bin/env python 2 # $Id: plpwm.py,v 1.3 8 2005-08-07 04:22:18mwm Exp $2 # $Id: plpwm.py,v 1.39 2005-08-10 13:30:36 mwm Exp $ 3 3 # 4 4 # plpwm.py -- Example PLWM window manager configuration with panes. … … 36 36 37 37 from plwm.pane_utilities import appmenu, codemenu, windowmenu, panesmenu, \ 38 runcommand, splitpane, numberpane, pullwindow, gotowindow, \38 runcommand, splitpane, numberpane, pullwindow, gotowindow, websearch, \ 39 39 split_pane, getapp 40 40 41 41 42 class MyMenuHandler(menu.MenuCharHandler): … … 97 98 98 99 100 class paneWindow(input.inputWindow): 101 bordercolor = "Goldenrod" 102 editHandler = MyEditHandler 103 104 105 class screenWindow(input.inputWindow): 106 borderwidth = 5 107 bordercolor = "Orange" 108 editHandler = MyEditHandler 109 110 99 111 class PaneKeys(keys.KeyHandler): 100 112 "The pane control keys." … … 146 158 getapp(my.wm.panes_list[my.wm.panes_current], "xclipboard") 147 159 160 def M4_d(my, event): 161 websearch(my.wm.panes_list[my.wm.panes_current], MyEditHandler, 162 "Google Directory", paneWindow, 163 "http://www.google.com/search?q=%s&it=ISO-8859-1&oe=ISO-8859-1&cat=gwd%%2FTop") 164 148 165 def M4_e(my, event): 149 166 my.wm.panes_goto(0) # always run emacs in pane 0. 150 167 getapp(my.wm.panes_list[my.wm.panes_current], "emacs", "xemacs") 151 168 169 def M4_f(my, event): 170 getapp(my.wm.panes_list[my.wm.panes_current], "Firefox", "firefox") 171 152 172 def M4_g(my, event): 173 websearch(my.wm.panes_list[my.wm.panes_current], MyEditHandler, 174 "Google", paneWindow, 175 'http://www.google.com/search?q=%s&hl=en&safe=off') 176 177 def M4_G(my, event): 153 178 getapp(my.wm.panes_list[my.wm.panes_current], 154 179 "GnuCash", "gnucash") 155 180 156 181 def M4_i(my, event): 182 def firefox(url): 183 assert "'" not in url 184 my.wm.system("firefox '%s' &" % url) 185 186 websearch(my.wm.panes_list[my.wm.panes_current], MyEditHandler, 187 "Google Images", paneWindow, 188 'http://images.google.com/images?q=%s&ie=ISO-8859-1&oe=ISO-8859-1', 189 firefox) 190 191 def M4_I(my, event): 157 192 getapp(my.wm.panes_list[my.wm.panes_current], 158 193 "/home/mwm/axhome/axMail/Inbox.sp", "applix -inbox") … … 161 196 getapp(my.wm.panes_list[my.wm.panes_current], "J-Pilot", "jpilot") 162 197 163 def M4_f(my, event): 164 getapp(my.wm.panes_list[my.wm.panes_current], "Mozilla", "mozilla") 198 def M4_t(my, event): 199 websearch(my.wm.panes_list[my.wm.panes_current], MyEditHandler, 200 "Webster Thesaurus", paneWindow, 201 "http://www.webster.com/cgi-bin/thesaurus?book=Thesaurus&va=%s") 202 203 def M4_w(my, event): 204 websearch(my.wm.panes_list[my.wm.panes_current], MyEditHandler, 205 "Webster Dictionary", paneWindow, 206 "http://www.webster.com/cgi-bin/dictionary?book=Dictionary&va=%s") 165 207 166 208 # Keystrokes for window manager operations … … 174 216 gotowindow(my.wm.panes_list[my.wm.panes_current], screenWindow) 175 217 176 def M4_ Return(my, event):218 def M4_space(my, event): 177 219 my.wm.panes_list[my.wm.panes_current].prev_window() 178 220 179 def S_M4_ Return(my, event):221 def S_M4_space(my, event): 180 222 my.wm.panes_list[my.wm.panes_current].next_window() 181 223 … … 194 236 def M4_x(my, event): 195 237 my.wm.panes_list[my.wm.panes_current].iconify_window() 196 197 # Aliases for some of the keystrokes198 M4_space = M4_Return199 S_M4_space = S_M4_Return200 238 201 239 … … 278 316 Any_g = Any_Escape = keys.KeyGrabKeyboard._timeout 279 317 280 281 class paneWindow(input.inputWindow):282 bordercolor = "Goldenrod"283 editHandler = MyEditHandler284 285 286 class screenWindow(input.inputWindow):287 borderwidth = 5288 bordercolor = "Orange"289 editHandler = MyEditHandler290 291 318 292 319 def restore(wm): -
trunk/plwm/keys.py
r103 r179 1 # $Id: keys.py,v 1. 8 2002-01-16 12:38:27 petliExp $1 # $Id: keys.py,v 1.9 2005-08-10 13:30:37 mwm Exp $ 2 2 # 3 3 # keys.py -- Base keypress handlers … … 142 142 143 143 144 wmanager.debug('mem', 'Initing keyhandler %s', self) 145 144 146 # Figure out if we have been added to a WindowManager, Screen 145 147 # or Client object. Set up KeygrabManager objects if not -
trunk/plwm/menu.py
r163 r179 1 # $Id: menu.py,v 1.1 2 2004-10-25 17:47:13 mtiggesExp $1 # $Id: menu.py,v 1.13 2005-08-10 13:30:38 mwm Exp $ 2 2 # 3 3 # menu.py -- Screen mixin to provide menus. … … 47 47 48 48 def _do(my, event): 49 my._cleanup() 49 50 my.menu.do() 50 my._cleanup()51 51 52 52 def _abort(my, event): -
trunk/plwm/pane_utilities.py
r178 r179 1 1 #!/usr/bin/env python 2 # $Id: pane_utilities.py,v 1. 2 2005-08-07 04:22:18 mwm Exp $2 # $Id: pane_utilities.py,v 1.3 2005-08-10 13:30:38 mwm Exp $ 3 3 # 4 4 # pane_utilities.py -- Utility clases and functions for use with panes … … 21 21 22 22 import cfilter 23 from webbrowser import open_new 24 from urllib import quote 23 25 24 26 class appmenu: … … 119 121 120 122 123 class websearch: 124 "Launch a browser with a web search from the user." 125 126 def __init__(my, pane, editHandler, name, winclass, format, browser = None): 127 my.format = format 128 my.browser = browser 129 my.pane = pane 130 window = winclass("Search %s: " % name, pane.screen, length = 50) 131 window.read(my, editHandler, pane.x, pane.y) 132 133 def __call__(my, string): 134 query = my.format % quote(string) 135 if my.browser: 136 my.browser(query) 137 else: 138 open_new(query) 139 140 121 141 class runcommand: 122 142 "Read a string from the user, and run it."
