Example #1
0
for details.

Copyright 1996 Barry A. Warsaw <*****@*****.**>

"""
__version__ = '1.0'

import os
import sys
import tempfile
import Fvwm
import Dialog
from Tkinter import *

if __name__ == '__main__':
    fvwm = Fvwm.FvwmModule(sys.argv)
    # the Dialog object doesn't do a proper global server grab, so we
    # need to use this kludge instead.  Yes, this is bogus, the
    # tempfile module doesn't exactly have the interface we want. :-(
    tempdir = os.path.split(tempfile.mktemp())[0]
    file = os.path.join(tempdir, 'Pyquiter-' + os.environ['DISPLAY'])
    if os.path.exists(file):
        fvwm.send('Beep', cont=0)
        sys.exit(0)
    #
    # create the lock file
    #
    try:
        fp = open(file, 'w')
        master = Tk(className='Pyquiter')
        master.withdraw()