Example #1
0
def paste(flavorType='TEXT', verbose=False):
    try:
        scrap = GetCurrentScrap()
        return scrap.GetScrapFlavorData(flavorType)
    except MacOS.Error as e:
        if verbose or e[0] != -102:
            # -102 == noTypeErr
            raise
        return ""
Example #2
0
def list_flavors():
    scrap = GetCurrentScrap()
    return [(name, scrap.GetScrapFlavorSize(name))
            for name, flags in scrap.GetScrapFlavorInfoList()]
Example #3
0
def copy(text, flavorType='TEXT'):
    ClearCurrentScrap()
    scrap = GetCurrentScrap()
    scrap.PutScrapFlavor(flavorType, 0, text)
Example #4
0
 def set(text):
     ClearCurrentScrap()
     scrap = GetCurrentScrap()
     scrap.PutScrapFlavor('TEXT', 0, text)
Example #5
0
 def get():
     try:
         scrap = GetCurrentScrap()
         return scrap.GetScrapFlavorData('TEXT')
     except MacOS.Error, e:
         return ""
Example #6
0
def set_clipboard_text_mac(text):
    ClearCurrentScrap()
    scrap = GetCurrentScrap()
    scrap.PutScrapFlavor('TEXT', 0, text)
    # get clipboard
    if use_wx:
        try:
            clip = wx.Clipboard()
        except:
            dummy = wx.App(0)
            clip = wx.Clipboard()
        text = wx.TextDataObject()
        clip.Open()
        clip.GetData(text)
        clip.Close()
        clip_rows = text.GetText().encode('utf-8').splitlines()
    else:
        try:
            clip_rows = GetCurrentScrap().GetScrapFlavorData(
                'utf8').splitlines()
        except (TypeError, MacOS.Error):
            try:
                clip_rows = GetCurrentScrap().GetScrapFlavorData(
                    'TEXT').splitlines()
            except (TypeError, MacOS.Error):
                clip_rows = ['']
    if clip_rows:
        clip_columns = clip_rows.pop(0).split('\t')
        if 'base name' in clip_columns:
            dialog = FMX_glyph_table_paste.FMXdialog()
            dialog.select_master(FMX_glyph_table_copy.dialog_selected_master)
            if dialog.d.Run() == 1:
                fl.output = ''
                print 'Pasting table\n'
                FMX_glyph_table_paste.paste_table(clip_columns, clip_rows,