def _NH_BlinkFileTransferDidEnd(self, sender, data): self.listView.relayout() # jump dock icon and bring window to front if not (isinstance(sender, IncomingFileTransferHandler) and sender.file_name.startswith("xscreencapture")): self.window.orderFront_(None) NSApp.requestUserAttention_(NSInformationalRequest) self.refresh_transfer_rate()
def _NH_BlinkFileTransferDidEnd(self, sender, data): self.listView.relayout() self.refresh_transfer_rate() if not data.error: # jump dock icon and bring window to front if isinstance(sender, IncomingFileTransferHandler): self.window.orderFront_(None) NSApp.requestUserAttention_(NSInformationalRequest) elif 'screencapture' not in sender.file_path: self.window.orderFront_(None) NSApp.requestUserAttention_(NSInformationalRequest)
def notify(title, message, bring_up=False): print title, message try: notification.notify(title, message) if system == 'Darwin': from AppKit import NSApp, NSApplication NSApplication.sharedApplication() app = NSApp() app.requestUserAttention_(0) # this should bounce the icon # the 0 should be replaced by the NSRequestUserAttentionType.NSCriticalRequest # imported from NSApplication? TODO # https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSApplication_Class/Reference/Reference.html#//apple_ref/doc/c_ref/NSRequestUserAttentionType if bring_up: app.activateIgnoringOtherApps_(True) # this should bring the app to the foreground except Exception as e: print e Logger.exception('Notification error:\n%s' % e)
def notify(title, message, bring_up=False): try: kwargs = {'title': title, 'message': message} if system == "Windows" or system == "Linux": kwargs['app_icon'] = os.path.abspath(get_icon_path()) kwargs['timeout'] = 4 notification.notify(**kwargs) if system == 'Darwin': from AppKit import NSApp, NSApplication NSApplication.sharedApplication() app = NSApp() app.requestUserAttention_(0) # this should bounce the icon # the 0 should be replaced by the NSRequestUserAttentionType.NSCriticalRequest # imported from NSApplication? TODO # https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSApplication_Class/Reference/Reference.html#//apple_ref/doc/c_ref/NSRequestUserAttentionType if bring_up: app.activateIgnoringOtherApps_(True) # this should bring the app to the foreground except Exception as e: print e Logger.exception('Notification error:\n%s' % e)
def show(self): self.panel.orderFront_(self) self.attention = NSApp.requestUserAttention_(NSCriticalRequest)
def noteMissedCall(self): self.missedCalls += 1 self.updateDockTile() NSApp.requestUserAttention_(NSInformationalRequest)