예제 #1
0
 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)
예제 #2
0
 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)
예제 #3
0
 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)
예제 #4
0
#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:
예제 #5
0
 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)