Changeset 218

Show
Ignore:
Timestamp:
07/24/2008 05:51:26 PM (6 months ago)
Author:
funkiedamouse
Message:

Modified docstrings in examplewm.py to more closely match PEP 8.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/examples/examplewm.py

    r217 r218  
    1919#    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
    2020 
    21 ''' Example PLWM window manager 
     21""" Example PLWM window manager 
    2222 
    2323This example demonstrates basic window manager construction and some of the 
    2424more common window manager concepts such as a mode window, multiple views, 
    2525and window decorations. 
    26 ''' 
     26 
     27""" 
    2728 
    2829import sys 
     
    5354               outline.XorOutlineClient, 
    5455               modestatus.ModeFocusedTitleClient): 
    55     ''' Example client class 
     56    """ Example client class 
    5657 
    5758    This class adds an XOR outline for moving/resizing windows and a hook to 
     
    6061    (withdrawn) state and specifies default pointer positions for a couple of 
    6162    programs. 
    62     ''' 
     63 
     64    """ 
    6365 
    6466    # Put a frame around all client windows 
     
    7779               views.XMW_ViewHandler, 
    7880               modestatus.ModeFocusedTitleScreen): 
    79     ''' Example screen class 
     81    """ Example screen class 
    8082 
    8183    This class adds support for colors(FIXME), views, and a mode window, and 
     
    8385    movement and resizing information, the current view, and the title of the 
    8486    currently-focused window. 
    85     ''' 
     87 
     88    """ 
    8689 
    8790    view_always_visible_clients = Or(name('XClock'), 
     
    9093 
    9194class WMConfig: 
    92     ''' Example window manager configuration class 
     95    """ Example window manager configuration class 
    9396 
    9497    Installs the BasicKeys key map into the window manager. 
    9598 
    9699    TODO: Why is this not included in PLWM below? Should it be moved there? 
    97     ''' 
     100 
     101    """ 
     102 
    98103    def __wm_init__(self): 
    99104        # Install the basic key map 
     
    109114           inspect.InspectServer, 
    110115           WMConfig): 
    111     ''' Example window manager class 
     116    """ Example window manager class 
    112117 
    113118    This class sets up the configuration for the window manager, including font 
     
    115120    for the mode window, and inspection support. It also sets the client class 
    116121    and screen class to use. 
    117     ''' 
     122 
     123    """ 
    118124 
    119125    client_class = MyClient 
     
    122128 
    123129class BasicKeys(keys.KeyHandler): 
    124     ''' Basic key bindings 
     130    """ Basic key bindings 
    125131 
    126132    This class defines all key-bindings for the example window manager. 
    127     ''' 
     133 
     134    """ 
    128135 
    129136    def F1(self, event): 
    130         ''' Find a view containing an XTerm. 
    131         ''' 
     137        """ Find a view containing an XTerm. 
     138        """ 
     139 
    132140        self.wm.current_screen.view_find_with_client(name('XTerm')) 
    133141 
    134142    def S_F1(self, event): 
    135         ''' Start an XTerm. 
    136         ''' 
     143        """ Start an XTerm. 
     144        """ 
     145 
    137146        self.wm.system('xterm -geometry 80x50+200+100') 
    138147 
    139148    def C_S_F1(self, event): 
    140         ''' Start an XTerm in a new view. 
    141         ''' 
     149        """ Start an XTerm in a new view. 
     150        """ 
     151 
    142152        self.wm.current_screen.view_new() 
    143153        self.wm.system('xterm -geometry 80x50+200+100') 
    144154 
    145155    def F2(self, event): 
    146         ''' Find a view containing an Emacs window. 
    147         ''' 
     156        """ Find a view containing an Emacs window. 
     157        """ 
     158 
    148159        self.wm.current_screen.view_find_with_client(name('Emacs')) 
    149160 
    150161    def S_F2(self, event): 
    151         ''' Start Emacs. 
    152         ''' 
     162        """ Start Emacs. 
     163        """ 
     164 
    153165        self.wm.system('emacs') 
    154166 
    155167    def C_S_F2(self, event): 
    156         ''' Start Emacs in a new view. 
    157         ''' 
     168        """ Start Emacs in a new view. 
     169        """ 
     170 
    158171        self.wm.current_screen.view_new() 
    159172        self.wm.system('emacs') 
    160173 
    161174    def F3(self, event): 
    162         ''' Find a view containing a Netscape window. 
    163         ''' 
     175        """ Find a view containing a Netscape window. 
     176        """ 
     177 
    164178        self.wm.current_screen.view_find_with_client(name('Netscape')) 
    165179 
    166180    def S_F3(self, event): 
    167         ''' Start Netscape. 
    168         ''' 
     181        """ Start Netscape. 
     182        """ 
     183 
    169184        self.wm.system('netscape') 
    170185 
    171186    def C_S_F3(self, event): 
    172         ''' Start Netscape in a new view. 
    173         ''' 
     187        """ Start Netscape in a new view. 
     188        """ 
     189 
    174190        self.wm.current_screen.view_new() 
    175191        self.wm.system('netscape') 
    176192 
    177193    def F5(self, event): 
    178         ''' Switch to the next view with the tag 'F5'. 
    179         ''' 
     194        """ Switch to the next view with the tag 'F5'. 
     195        """ 
     196 
    180197        self.wm.current_screen.view_find_tag('F5') 
    181198 
    182199    def S_F5(self, event): 
    183         ''' Set the current view's tag to 'F5'. 
    184         ''' 
     200        """ Set the current view's tag to 'F5'. 
     201        """ 
     202 
    185203        self.wm.current_screen.view_tag('F5') 
    186204 
    187205    def F6(self, event): 
    188         ''' Switch to the next view with the tag 'F6'. 
    189         ''' 
     206        """ Switch to the next view with the tag 'F6'. 
     207        """ 
     208 
    190209        self.wm.current_screen.view_find_tag('F6') 
    191210 
    192211    def S_F6(self, event): 
    193         ''' Set the current view's tag to 'F6'. 
    194         ''' 
     212        """ Set the current view's tag to 'F6'. 
     213        """ 
     214 
    195215        self.wm.current_screen.view_tag('F6') 
    196216 
    197217    def F7(self, event): 
    198         ''' Switch to the next view with the tag 'F7'. 
    199         ''' 
     218        """ Switch to the next view with the tag 'F7'. 
     219        """ 
     220 
    200221        self.wm.current_screen.view_find_tag('F7') 
    201222 
    202223    def S_F7(self, event): 
    203         ''' Set the current view's tag to 'F7'. 
    204         ''' 
     224        """ Set the current view's tag to 'F7'. 
     225        """ 
     226 
    205227        self.wm.current_screen.view_tag('F7') 
    206228 
    207229    def F8(self, event): 
    208         ''' Switch to the next view with the tag 'F8'. 
    209         ''' 
     230        """ Switch to the next view with the tag 'F8'. 
     231        """ 
     232 
    210233        self.wm.current_screen.view_find_tag('F8') 
    211234 
    212235    def S_F8(self, event): 
    213         ''' Set the current view's tag to 'F8'. 
    214         ''' 
     236        """ Set the current view's tag to 'F8'. 
     237        """ 
     238 
    215239        self.wm.current_screen.view_tag('F8') 
    216240 
    217241    # Simulate mouse clicks 
    218242    def Any_F9(self, evt): 
    219         ''' Simulate a primary (usually, left) mouse button click. 
    220         ''' 
     243        """ Simulate a primary (usually, left) mouse button click. 
     244        """ 
     245 
    221246        self.wm.fake_button_click(1) 
    222247 
    223248    def Any_F10(self, evt): 
    224         ''' Simulate a secondary (usually, right) mouse button click. 
    225         ''' 
     249        """ Simulate a secondary (usually, right) mouse button click. 
     250        """ 
     251 
    226252        self.wm.fake_button_click(2) 
    227253 
    228254    def Any_F11(self, evt): 
    229         ''' Simulate a tertiary (usually, middle) mouse button click. 
    230         ''' 
     255        """ Simulate a tertiary (usually, middle) mouse button click. 
     256        """ 
     257 
    231258        self.wm.fake_button_click(3) 
    232259 
    233260 
    234261    def F12(self, evt): 
    235         ''' Toggle inspect mode. 
    236         ''' 
     262        """ Toggle inspect mode. 
     263        """ 
     264 
    237265        self.wm.inspect_toggle() 
    238266 
    239267    def S_F12(self, evt): 
    240         ''' Toggle inspect mode, forcing if needed. 
    241         ''' 
     268        """ Toggle inspect mode, forcing if needed. 
     269        """ 
     270 
    242271        self.wm.inspect_toggle(force = 1) 
    243272 
    244273    def S_Pause(self, evt): 
    245         ''' Drop all keygrabs until Scroll_Lock is pressed again. 
     274        """ Drop all keygrabs until Scroll_Lock is pressed again. 
    246275 
    247276        Allows clients to recieve keys used by plwm. 
    248         ''' 
     277        """ 
     278 
    249279        wmanager.debug('keys', 'dropping keygrabs temporarily') 
    250280 
     
    257287 
    258288    def KP_Begin(self, event): 
    259         ''' Start moving / resizing the current window. 
    260         ''' 
     289        """ Start moving / resizing the current window. 
     290        """ 
     291 
    261292        MyMoveResizeKeys(self, event) 
    262293 
    263294 
    264295    def C_Tab(self, event): 
    265         ''' Cycle through minimized windows. 
    266         ''' 
     296        """ Cycle through minimized windows. 
     297        """ 
     298 
    267299        CycleUMKeys(self, event) 
    268300 
    269301    def KP_Insert(self, event): 
    270         ''' Iconify the current window. 
    271         ''' 
     302        """ Iconify the current window. 
     303        """ 
     304 
    272305        wmanager.debug('keys', 'Iconifying') 
    273306        if self.wm.current_client: 
     
    275308 
    276309    def KP_Subtract(self, event): 
    277         ''' Switch to the previous view. 
    278         ''' 
     310        """ Switch to the previous view. 
     311        """ 
     312 
    279313        wmanager.debug('keys', 'Prev view') 
    280314        self.wm.current_screen.view_prev() 
    281315 
    282316    def KP_Add(self, event): 
    283         ''' Switch to the next view. 
    284         ''' 
     317        """ Switch to the next view. 
     318        """ 
     319 
    285320        wmanager.debug('keys', 'Next view') 
    286321        self.wm.current_screen.view_next() 
    287322 
    288323    def C_KP_Add(self, event): 
    289         ''' Create a new view. 
    290         ''' 
     324        """ Create a new view. 
     325        """ 
     326 
    291327        wmanager.debug('keys', 'New view') 
    292328        self.wm.current_screen.view_new() 
    293329 
    294330    def KP_Left(self, event): 
    295         ''' Move the pointer to the left. 
    296         ''' 
     331        """ Move the pointer to the left. 
     332        """ 
     333 
    297334        self.wm.display.warp_pointer(-delta.get(event.time), 0) 
    298335 
    299336    def KP_Right(self, event): 
    300         ''' Move the pointer to the right. 
    301         ''' 
     337        """ Move the pointer to the right. 
     338        """ 
     339 
    302340        self.wm.display.warp_pointer(delta.get(event.time), 0) 
    303341 
    304342    def KP_Up(self, event): 
    305         ''' Move the pointer up. 
    306         ''' 
     343        """ Move the pointer up. 
     344        """ 
     345 
    307346        self.wm.display.warp_pointer(0, -delta.get(event.time)) 
    308347 
    309348    def KP_Down(self, event): 
    310         ''' Move the pointer down. 
    311         ''' 
     349        """ Move the pointer down. 
     350        """ 
     351 
    312352        self.wm.display.warp_pointer(0, delta.get(event.time)) 
    313353 
    314354    def KP_Home(self, event): 
    315         ''' Move the pointer up and to the left. 
    316         ''' 
     355        """ Move the pointer up and to the left. 
     356        """ 
     357 
    317358        d = delta.get(event.time) 
    318359        self.wm.display.warp_pointer(-d, -d) 
    319360 
    320361    def KP_End(self, event): 
    321         ''' Move the pointer down and to the left. 
    322         ''' 
     362        """ Move the pointer down and to the left. 
     363        """ 
     364 
    323365        d = delta.get(event.time) 
    324366        self.wm.display.warp_pointer(-d, d) 
    325367 
    326368    def KP_Prior(self, event): 
    327         ''' Move the pointer up and to the right. 
    328         ''' 
     369        """ Move the pointer up and to the right. 
     370        """ 
     371 
    329372        d = delta.get(event.time) 
    330373        self.wm.display.warp_pointer(d, -d) 
    331374 
    332375    def KP_Next(self, event): 
    333         ''' Move the pointer down and to the right. 
    334         ''' 
     376        """ Move the pointer down and to the right. 
     377        """ 
     378 
    335379        d = delta.get(event.time) 
    336380        self.wm.display.warp_pointer(d, d) 
    337381 
    338382    def KP_Enter(self, event): 
    339         ''' Raise or lower the current window. 
    340         ''' 
     383        """ Raise or lower the current window. 
     384        """ 
     385 
    341386        if self.wm.current_client: 
    342387            self.wm.current_client.raiselower() 
     
    346391 
    347392    def C_KP_Subtract(self, event): 
    348         ''' Lock the screen with xlock. 
    349         ''' 
     393        """ Lock the screen with xlock. 
     394        """ 
     395 
    350396        self.wm.system('xlock -mode blank') 
    351397 
    352398    def C_M_Escape(self, event): 
    353         ''' Quit the window manager. 
    354         ''' 
     399        """ Quit the window manager. 
     400        """ 
     401 
    355402        self.wm.quit() 
    356403 
    357404    def C_KP_Delete(self, event): 
    358         ''' Close the current window. 
    359         ''' 
     405        """ Close the current window. 
     406        """ 
     407 
    360408        if self.wm.current_client: 
    361409            self.wm.current_client.delete(1) 
    362410 
    363411    def C_S_KP_Delete(self, event): 
    364         ''' Kill the current client. 
    365         ''' 
     412        """ Kill the current client. 
     413        """ 
     414 
    366415        if self.wm.current_client: 
    367416            self.wm.current_client.destroy() 
    368417 
    369418    def C_KP_Left(self, event): 
    370         ''' Focus the next window to the left of the current one. 
    371         ''' 
     419        """ Focus the next window to the left of the current one. 
     420        """ 
     421 
    372422        self.wm.move_focus(focus.MOVE_LEFT) 
    373423 
    374424    def C_KP_Right(self, event): 
    375         ''' Focus the next window to the right of the current one. 
    376         ''' 
     425        """ Focus the next window to the right of the current one. 
     426        """ 
     427 
    377428        self.wm.move_focus(focus.MOVE_RIGHT) 
    378429 
    379430    def C_KP_Up(self, event): 
    380         ''' Focus the next window above the current one. 
    381         ''' 
     431        """ Focus the next window above the current one. 
     432        """ 
     433 
    382434        self.wm.move_focus(focus.MOVE_UP) 
    383435 
    384436    def C_KP_Down(self, event): 
    385         ''' Focus the next window below the current one. 
    386         ''' 
     437        """ Focus the next window below the current one. 
     438        """ 
     439 
    387440        self.wm.move_focus(focus.MOVE_DOWN) 
    388441 
    389442    def C_less(self, event): 
    390         ''' Focus the next window to the left of the current one. 
    391         ''' 
     443        """ Focus the next window to the left of the current one. 
     444        """ 
     445 
    392446        self.wm.move_focus(focus.MOVE_LEFT) 
    393447 
    394448    def C_S_less(self, event): 
    395         ''' Focus the next window to the right of the current one. 
    396         ''' 
     449        """ Focus the next window to the right of the current one. 
     450        """ 
     451 
    397452        self.wm.move_focus(focus.MOVE_RIGHT) 
    398453 
    399454 
    400455class BypassHandler(keys.KeyHandler): 
    401     ''' Surrogate key handler to bypass the window manager's key bindings. 
     456    """ Surrogate key handler to bypass the window manager's key bindings. 
    402457 
    403458    Allows clients to receive key presses normally handled by the WM. 
    404     ''' 
     459 
     460    """ 
     461 
    405462    propagate_keys = 0 
    406463 
     
    413470 
    414471    def Pause(self, evt): 
    415         ''' Restore normal key bindings. 
    416         ''' 
     472        """ Restore normal key bindings. 
     473        """ 
     474 
    417475        wmanager.debug('keys', 'reinstalling keygrabs') 
    418476 
     
    434492 
    435493class MyMoveResizeKeys(MoveResizeKeys): 
    436     ''' Keys for moving and resizing the current window. 
    437     ''' 
     494    """ Keys for moving and resizing the current window. 
     495    """ 
     496 
    438497    KP_Left  = MoveResizeKeys._move_w 
    439498    KP_Right = MoveResizeKeys._move_e 
     
    472531 
    473532class CycleUMKeys(CycleKeys): 
    474     ''' Keys to cycle through all iconified windows. 
    475     ''' 
     533    """ Keys to cycle through all iconified windows. 
     534    """ 
     535 
    476536    _cycle_filter = iconified 
    477537