Skip to content

Commit

Permalink
Use xvfb-run for rendering mgp to images
Browse files Browse the repository at this point in the history
  • Loading branch information
mgedmin committed Dec 5, 2014
1 parent 9728a2d commit c483d46
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,17 @@ def choose_tempdir(filename):
'.compare-' + os.path.basename(filename))


def mgp_to_images(filename):
def mgp_to_images(filename, use_xvfb=True):
tempdir = choose_tempdir(filename)
timestampfile = os.path.join(tempdir, 'timestamp')
if newer(filename, timestampfile):
try_mkdir(tempdir)
touch(timestampfile)
inform("Converting %s to images" % filename)
system(MGP, '-U', '-E', 'png', '-D', tempdir, filename)
command = (MGP, '-o', '-g', '1024x768', '-U', '-E', 'png', '-D', tempdir, filename)
if use_xvfb:
command = ('xvfb-run', '-a', '-s', '-screen 0 1280x800x24') + command
system(*command)
return sorted(glob.glob(os.path.join(tempdir, 'mgp?????.png')))


Expand Down

0 comments on commit c483d46

Please sign in to comment.