+ # Export to image/HTML
+ def on_export_image (self, solution=False):
+ try:
+ sys.stdout.write (self.BLUE + "Exporting puzzle to image/HTML\n")
+ filename = raw_input (self.BRICKRED + "Filename (PNG): " + self.ENDCOL)
+
+ self.puzzle.export_image (filename, solution)
+ sys.stdout.write (self.BLUE + "Successfully exported to file: " +
+ filename + "\n" + self.ENDCOL)
+
+ except crosswordpuzzle.FrozenGridException:
+ sys.stderr.write ("Cannot export as grid is not frozen/finalized")
+
+ # Export to across lite
+ def on_export_acrosslite (self):
+ try:
+ sys.stdout.write (self.BLUE + "Exporting to AcrossLite(tm) Format\n" +
+ self.ENDCOL)
+ title = raw_input (self.BRICKRED + "Puzzle title: " + self.ENDCOL)
+ name = raw_input (self.BRICKRED + "Author name: " + self.ENDCOL)
+ copyright = raw_input (self.BRICKRED + "Copyright: " + self.ENDCOL)
+ exportfile = raw_input (self.BRICKRED + "Export to file: " + self.ENDCOL)
+
+ acrosslite_str = self.puzzle.export_acrosslite (title, name, copyright)
+ fexport = open (exportfile, "w")
+ fexport.write (acrosslite_str)
+ fexport.close ()
+ sys.stdout.write (self.BLUE + "Exported AcrossLite(tm) File: " +
+ exportfile + "\n" + self.ENDCOL)
+ except crosswordpuzzle.FrozenGridException:
+ sys.stderr.write ("Cannot export as grid is not frozen/finalized\n")
+ except crosswordpuzzle.NoWordsException:
+ sys.stderr.write ("No words to export!\n")
+