Example #1
0
 def _addSets(self):
     sc = SmartSet()
     sc.name = self.scmModifiedSetName
     sc.glyphNames = self.headGlyphs.keys()
     addSmartSet(sc)
     
     su = SmartSet()
     su.name = self.scmUntrackedSetName
     su.glyphNames = self.untrackedGlyphs
     addSmartSet(su)
# RoboFont-SetOrganizer - Snippet
# Add set

from mojo.UI import SmartSet, addSmartSet

newSet = SmartSet()
newSet.name = 'New Set'
newSet.query = 'Name MATCHES "[a-z]"'

addSmartSet(newSet)
def activateSet(thisSet):
    addSmartSet(thisSet)
    activeSets.append(thisSet)
Example #4
0
#################################

### Modules
import os
from mojo.UI import SmartSet, addSmartSet


### Functions, procedures, constants
def catchFilesAndFolders(path, extension):
    items = [
        item for item in os.listdir(path) if item.endswith(extension) is True
    ]
    return items


### Variables
inputFolder = os.path.join('..', 'ttools', 'resources', 'smartSets')

### Instructions
txtPaths = catchFilesAndFolders(inputFolder, '.txt')
for eachPath in txtPaths:
    setName = os.path.splitext(eachPath)[0][3:]

    glyphs = open(inputFolder + os.sep + eachPath, 'r').readlines()
    glyphs = [item.replace('\n', '') for item in glyphs]

    smartSet = SmartSet()
    smartSet.name = setName
    smartSet.glyphNames = glyphs
    addSmartSet(smartSet)