/usr/share/doc/bkchem/scripts/script1.py is in bkchem 0.13.0-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | import sys
# at first we check the command line
if len( sys.argv) <= 1:
print "you have to supply a filename"
sys.exit()
# then we import bkchem and threading
from bkchem.bkchem import bkchem
import threading
# bkchem.myapp is the application instance
app = bkchem.myapp
# we need to set batch mode = 1 if we want to suppress some interactive warnings,
# questions and mouse events
app.in_batch_mode = 1
# now we start the application in a separate thread to be able to manipulate it
t = threading.Thread( target=app.mainloop, name='app')
t.setDaemon( 1)
t.start()
# here comes the actual code
# we load the file
app.load_CDML( sys.argv[1])
# we take all molecules from the current paper, find all the double bonds,
# change their color to red and
for mol in app.paper.molecules:
for bond in mol.bonds:
if bond.order == 2:
bond.line_color = "#aa0000"
bond.redraw()
# finally we save the result and quit
app.save_CDML()
app.destroy()
|