def copy_(self, sender): if self.delegate is None: return pb = NSPasteboard.generalPasteboard() copy_text = format_identity_to_string(self.delegate.sessionController.remotePartyObject, check_contact=True, format='full') pb.declareTypes_owner_(NSArray.arrayWithObject_(NSStringPboardType), self) pb.setString_forType_(copy_text, NSStringPboardType)
def copy_(self, sender): if self.delegate is None: return pb = NSPasteboard.generalPasteboard() copy_text = format_identity_to_string( self.delegate.sessionController.remoteIdentity, check_contact=True, format='full') pb.declareTypes_owner_(NSArray.arrayWithObject_(NSStringPboardType), self) pb.setString_forType_(copy_text, NSStringPboardType)
def mouseDragged_(self, event): if self.delegate is None: return pos = event.locationInWindow() if abs(self.dragPos.x - pos.x) > 3 or abs(self.dragPos.y - pos.y) > 3: image = self.makeDragImage() pos.x -= image.size().width/2 pos.y -= image.size().height/2 pboard = NSPasteboard.pasteboardWithName_(NSDragPboard) pboard.declareTypes_owner_(NSArray.arrayWithObject_("x-blink-audio-session"), self) uri = format_identity_to_string(self.delegate.sessionController.remotePartyObject, check_contact=False, format='compact') pboard.setString_forType_(uri, "x-blink-audio-session") self.window().dragImage_at_offset_event_pasteboard_source_slideBack_(image, pos, NSZeroPoint, event, pboard, self, False) self.draggedOut = False
def mouseDragged_(self, event): if self.delegate is None: return pos = event.locationInWindow() if abs(self.dragPos.x - pos.x) > 3 or abs(self.dragPos.y - pos.y) > 3: image = self.makeDragImage() pos.x -= image.size().width / 2 pos.y -= image.size().height / 2 pboard = NSPasteboard.pasteboardWithName_(NSDragPboard) pboard.declareTypes_owner_( NSArray.arrayWithObject_("x-blink-audio-session"), self) uri = format_identity_to_string( self.delegate.sessionController.remoteIdentity, check_contact=False, format='compact') pboard.setString_forType_(uri, "x-blink-audio-session") self.window( ).dragImage_at_offset_event_pasteboard_source_slideBack_( image, pos, NSZeroPoint, event, pboard, self, False) self.draggedOut = False
def paste_(self, sender): pasteboard = NSPasteboard.generalPasteboard() digits = pasteboard.stringForType_("public.utf8-plain-text") dtmf_match_regexp = re.compile("^([0-9]#*)+$") if digits and dtmf_match_regexp.match(digits): call_in_thread('dtmf-io', self.send_dtmf, digits)
#MenuTitle: Special Paste # -*- coding: utf-8 -*- __doc__=""" Paste copied paths and components into current layers. """ # See https://gist.github.com/schriftgestalt/6ef3dda00264486cb479 from Foundation import NSPasteboard, NSString, NSUTF8StringEncoding GSFormatVersion = 3 pasteboard = NSPasteboard.generalPasteboard() typeName = pasteboard.availableTypeFromArray_(["Glyphs elements pasteboard type"]) if typeName == "Glyphs elements pasteboard type": data = pasteboard.dataForType_(typeName) dictionary = NSString.alloc().initWithData_encoding_(data, NSUTF8StringEncoding).propertyList() if "shapes" in dictionary: elements = dictionary["shapes"] for shapeDict in elements: path = GSPath.alloc().initWithDict_format_(shapeDict, GSFormatVersion) if path is not None: shape = path else: shape = GSComponent.alloc().initWithDict_format_(shapeDict, GSFormatVersion) for layer in Glyphs.font.selectedLayers: layer.shapes.append(shape.copy()) if "paths" in dictionary: elements = dictionary["paths"] for pathDict in elements: