Esempio n. 1
0
def log_std(msg):
	from AppKit import NSAlert, NSInformationalAlertStyle, NSRunningApplication, NSApplicationActivateIgnoringOtherApps

	# initialize
	# tip from: http://graphicsnotes.blogspot.fr/2010/01/programmatically-creating-window-in-mac.html
	NSApplication.sharedApplication()
	NSRunningApplication.currentApplication().activateWithOptions_(NSApplicationActivateIgnoringOtherApps);

	alert = NSAlert.alloc().init()
	alert.autorelease()
	alert.setAlertStyle_(NSInformationalAlertStyle)
	alert.setMessageText_(msg)
	alert.runModal()
Esempio n. 2
0
def get_executable_path():
    # Try to get the path from Cocoa
    r_app = NSRunningApplication.currentApplication()
    if r_app.bundleIdentifier().endswith(".ComputerTime"):
        path = r_app.executableURL().path()
    else:
        # Fallback to python script path
        path = os.path.abspath(__file__)
        logging.info("script file: %s", __file__)
    return path