def _lowlevelhandler(self, event): what, message, when, where, modifiers = event h, v = where if what == kHighLevelEvent: try: AE.AEProcessAppleEvent(event) except AE.Error, err: msg = "High Level Event: %r %r" % (hex(message), hex(h | (v<<16))) print 'AE error: ', err print 'in', msg traceback.print_exc() return
def lowlevelhandler(self, event): what, message, when, where, modifiers = event h, v = where if what == kHighLevelEvent: msg = 'High Level Event: %r %r' % (code(message), code(h | v << 16)) try: AE.AEProcessAppleEvent(event) except AE.Error as err: print 'AE error: ', err print 'in', msg traceback.print_exc() return if what == keyDown: c = chr(message & charCodeMask) if modifiers & cmdKey: if c == '.': raise KeyboardInterrupt, 'Command-period' if c == 'q': if hasattr(MacOS, 'OutputSeen'): MacOS.OutputSeen() self.quitting = 1 return elif what == mouseDown: partcode, window = Win.FindWindow(where) if partcode == inMenuBar: result = Menu.MenuSelect(where) id = result >> 16 & 65535 item = result & 65535 if id == self.appleid: if item == 1: EasyDialogs.Message(self.getabouttext()) elif item > 1 and hasattr(Menu, 'OpenDeskAcc'): name = self.applemenu.GetMenuItemText(item) Menu.OpenDeskAcc(name) elif id == self.quitid and item == 1: if hasattr(MacOS, 'OutputSeen'): MacOS.OutputSeen() self.quitting = 1 Menu.HiliteMenu(0) return if hasattr(MacOS, 'HandleEvent'): MacOS.HandleEvent(event) else: print 'Unhandled event:', event
"""MiniAEFrame - A minimal AppleEvent Application framework.
"""'echo' -- an AppleEvent handler which handles all events the same.
"""AEservertest - Test AppleEvent server interface
"""PythonSlave.py