Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _run(self):
# Make sure there is an NSApplication instance
self._app = AppKit.NSApplication.sharedApplication()
# Make sure we have a delegate to handle the acttion events
self._delegate = IconDelegate.alloc().init()
self._delegate.icon = self
self._status_bar = AppKit.NSStatusBar.systemStatusBar()
self._status_item = self._status_bar.statusItemWithLength_(
AppKit.NSVariableStatusItemLength)
self._status_item.button().setTarget_(self._delegate)
self._status_item.button().setAction_(self._ACTION_SELECTOR)
# Notify the setup callback
self._mark_ready()
def sigint(*args):
self.stop()
if previous_sigint:
previous_sigint(*args)