def get_OSXApplication(): global macapp if macapp is None: try: import gtkosx_application #@UnresolvedImport macapp = gtkosx_application.Application() except: pass return macapp
def get_OSXApplication(): global macapp if macapp is None: try: import gtkosx_application #@UnresolvedImport macapp = gtkosx_application.Application() macapp.connect("NSApplicationWillTerminate", quit_handler) except: pass return macapp
def Application(): if sys.platform == "darwin": try: # This worked with the first runtime that we built. import gtk_osxapplication return gtk_osxapplication.OSXApplication() except ImportError: # This works with the second. We can find no explanation of the name change. import gtkosx_application return gtkosx_application.Application() else: return None
def Application(): return MockOSXAppObject() class MockOSXAppObject(object): def __getattr__(self, name): def method(*a): print ">>> OSX call:", name, a return method if gtkosx_application is None: gtkosx_application = MockOSXAppModule if gtkosx_application: # Global for all notebooks / windows, once per process _global_osx_application = gtkosx_application.Application() _global_items_initialized = False else: _global_osx_application = None _global_items_initialized = False class OSXmenubarPlugin(PluginClass): # This object just provides some information for the plugin manager # no real logic happening here. plugin_info = { 'name': _('macOS Menubar'), # T: plugin name 'description': _('This plugin provides a macOS menubar for zim.' ), # T: plugin description 'author': 'Brecht Machiels, Jaap Karssenberg',
def get_OSXApplication(): global macapp if macapp is None: macapp = gtkosx_application.Application() macapp.connect("NSApplicationWillTerminate", quit_handler) return macapp