def testExport(self): schema = omnigraffle.OmniGraffle().open(self.path) tmpfile = self.genTempFileName('pdf') self.assertTrue(omnigraffle_export.export_one(schema, tmpfile, 'Canvas 1')) self.assertFalse(omnigraffle_export.export_one(schema, tmpfile, 'Canvas 1')) self.files_to_remove.append(tmpfile)
def testExportWithForceOption(self): schema = omnigraffle.OmniGraffle().open(self.path) tmpfile = self.genTempFileName('pdf') self.assertTrue(omnigraffle_export.export_one(schema, tmpfile, 'Canvas 1')) time.sleep(2) self.assertTrue(omnigraffle_export.export_one(schema, tmpfile, 'Canvas 1', force=True)) self.files_to_remove.append(tmpfile)
def testGetCanvasList(self): schema = omnigraffle.OmniGraffle().open(self.path) self.assertEqual(['Canvas 1', 'Canvas 2'], schema.get_canvas_list())
try: objc.lookUpClass('NSUserNotificationCenter') log = log_osx except objc.nosuchclass_error: try: # using Growl to notify about the results # requires gntp # install using pip install gntp # TODO: add system notification import gntp.notifier log = log_growl except Exception: # otherwise notify using log = log_std og = omnigraffle.OmniGraffle() schema = og.active_document() if schema == None: sys.exit(0) schema_path = schema.path if schema_path == None: schema_path = "Untitled" schema_fname = os.path.basename(schema_path) schema_dir = os.path.dirname(schema_path) target_path = None format = 'pdf' canvas_name = schema.active_canvas_name()