def drawRect_(self, rect): NSImageView.drawRect_(self, rect) if self.cropRectangle: rect = NSZeroRect rect.size = self.frame().size NSColor.whiteColor().set() NSFrameRect(self.cropRectangle) clip = NSBezierPath.bezierPathWithRect_(rect) clip.setWindingRule_(NSEvenOddWindingRule) clip.appendBezierPathWithRect_(self.cropRectangle) clip.addClip() NSColor.blackColor().colorWithAlphaComponent_(0.6).set() NSBezierPath.bezierPathWithRect_(rect).fill()
def createDragWindowForTab_(self, tabItem): rect = tabItem.frame() window = NSWindow.alloc().initWithContentRect_styleMask_backing_defer_(rect, NSBorderlessWindowMask, NSBackingStoreBuffered, False) window.setAlphaValue_(0.8) imageView = NSImageView.alloc().initWithFrame_(rect) imageView.setImage_(tabItem.dragImage()) window.setContentView_(imageView) window.setReleasedWhenClosed_(False) return window
def createDragWindowForTab_(self, tabItem): rect = tabItem.frame() window = NSWindow.alloc().initWithContentRect_styleMask_backing_defer_( rect, NSBorderlessWindowMask, NSBackingStoreBuffered, False) window.setAlphaValue_(0.8) imageView = NSImageView.alloc().initWithFrame_(rect) imageView.setImage_(tabItem.dragImage()) window.setContentView_(imageView) window.setReleasedWhenClosed_(False) return window
def updateDockTile(self): if self.missedCalls > 0 or self.missedChats > 0: icon = NSImage.imageNamed_("Blink") image = NSImageView.alloc().initWithFrame_(NSMakeRect(0, 0, 32, 32)) image.setImage_(icon) if self.missedCalls > 0 and self.missedChats > 0: NSApp.dockTile().setBadgeLabel_("%i / %i" % (self.missedCalls, self.missedChats)) else: NSApp.dockTile().setBadgeLabel_("%i" % (self.missedCalls + self.missedChats)) NSApp.dockTile().setContentView_(image) else: NSApp.dockTile().setBadgeLabel_("") NSApp.dockTile().setContentView_(None) icon = None NSApp.setApplicationIconImage_(icon) NSApp.dockTile().display()