示例#1
0
 def _exportSettings(self):
     path = PutFile()
     if path.split('.')[-1] != self.suffix:
         suffix = '.'+self.suffix
         path += suffix
     if self.hotkeys is None:
         hotkeys = {}
     data = dict(toolDescription=self.toolDescription,hotkeys=self.hotkeys)
     writePlist(data, path)
示例#2
0
 def exportThemeCallback(self, sender):
     if self.debug: print("exportThemeCallback")
     # Callback from the "Export" button
     # Pop open a "Save" dialog to get a file path, then call writeThemePlist()
     selectedIdx = self.getSelectedThemeIdx()
     if not selectedIdx == None:
         # Fetch the theme
         theme = self.themes[selectedIdx]
         # Format a filename to save this theme as
         name = theme["themeName"]
         fileName = "%s.roboFontTheme" % name
         # Open the PutFile window to see if the user can locate a path to save the file
         path = PutFile(fileName=fileName)
         # If they did choose a path, save it.
         # If they clicked cancel, there would be no path.
         if path:
             # Make a copy of the theme, fixing the item types (the plist has problems saving otherwise)
             themeCopy = {}
             for key, name, valueType in THEMEKEYS:
                 k = str(key)
                 v = valueType(theme[key])
                 themeCopy[k] = v
             themeCopy["themeName"] = str(theme["themeName"])
             themeCopy["themeType"] = "User"
             writePlist(themeCopy, path)
示例#3
0
def convertSuperpolatorToDesignSpace(path):
    # this a superpolator path and needs to be converted first
    newPathName = path.replace(".sp3", "_converted.designspace")
    newPathName = PutFile(
        message="Save this Superpolator document as Designspace:",
        fileName=os.path.basename(newPathName))
    if newPathName:
        ufoProcessor.sp3.sp3_to_designspace(path, newPathName)
    return newPathName
示例#4
0
 def exportPairList(self, sender=None):
     # Save the list of found touching pairs in a text file which can be read by MetricsMachine as a pair list
     path = PutFile(message="Choose save location",
                    fileName="TouchingPairs.txt")
     if path is not None:
         reportString = "#KPL:P: TouchingPairs\n"
         for g1, g2 in self.touchingPairs:
             reportString += "%s %s\n" % (g1, g2)
         with open(path, 'w+') as fi:
             try:
                 fi.write(reportString)
             except:  #py2!
                 fi.write(unicode(reportString))
 def exportCallback(self, sender):
     if len(self.fontList):
         fontChoice = self.w.fontChoice.get()
         f = self.fontList[fontChoice]
         if f.path:
             fileName = os.path.splitext(os.path.split(
                 f.path)[1])[0] + ".svg"
         else:
             fileName = "GlyphExport.svg"
         savePath = PutFile(
             message="Choose a location to save the glyph image...",
             fileName=fileName)
         if not savePath == None:
             self.doExport(f, savePath)
 def exportCallback(self, sender):
     '''Export spacing groups to .json file.'''
     font = CurrentFont()
     filePath = PutFile(message='export spacing groups',
                        fileName='spacingGroups.json')
     exportSpacingGroups(font, filePath)