2 editor.py - S.Fourmanoit <syfou@users.sourceforge.net>, 2005
4 adesklets test script for editor launch, similar to what the Configure Menu
5 in many desklet returns, but with pause. You have to exit the editor for
6 the script to continue. Start with:
10 from os
import environ
, getenv
, system
, unlink
11 from os
.path
import join
, isfile
17 print >> file('/tmp/editor.txt','w'), msg
21 cmdline
= '%s -e %s /tmp/editor.txt' % (xterm
[0], editor
)
22 print "Command line is '%s'." % cmdline
23 print 'Command line returned %d (0 is OK)' % system(cmdline
)
25 print 'editor not found.'
27 print 'xterm not found.'
29 print 'display not found.'
31 # Get the pertinent information
33 display
= getenv('DISPLAY','')
34 xterm
= [join(p
,'xterm')
35 for p
in getenv('PATH','').split(':') if isfile(join(p
,'xterm'))]
36 editor
= getenv('EDITOR','')
38 # Display this information
40 print """=== System information ===
45 """ % (editor
, display
, xterm
)
47 # Now, let's test the launch.
49 launch('Launching editor in xterm without adesklets.')
50 environ
['ADESKLETS_ID'] = '0'; import adesklets
51 launch('Launching editor in xterm with adesklets.')