def __init__(self): # Window 'self.w': windowWidth = 300 windowHeight = 160 windowWidthResize = 300 # user can resize width by this value windowHeightResize = 0 # user can resize height by this value self.w = vanilla.FloatingWindow( (windowWidth, windowHeight), # default window size "New Tab with Anchor", # window title minSize=(windowWidth, windowHeight), # minimum size (for resizing) maxSize=(windowWidth + windowWidthResize, windowHeight + windowHeightResize), # maximum size (for resizing) autosaveName= "com.mekkablue.NewTabWithAnchor.mainwindow" # stores last window position and size ) # UI elements: self.w.text_1 = vanilla.TextBox((15, 15, 100, 14), "Look for anchor", sizeStyle='small') self.w.anchorName = vanilla.EditText((110, 12, -15, 20), "ogonek", sizeStyle='small') self.w.text_2 = vanilla.TextBox( (15, 38, -15, 14), "and open a tab with all glyphs containing it.", sizeStyle='small') self.w.allLayers = vanilla.CheckBox( (15, 60, -15, 20), "Look on all layers (otherwise only on current master)", value=False, callback=self.SavePreferences, sizeStyle='small') self.w.keepWindowOpen = vanilla.CheckBox((15, 80, -15, 20), "Keep window open", value=False, callback=self.SavePreferences, sizeStyle='small') # Run Button: self.w.runButton = vanilla.Button((-80 - 15, -20 - 15, -15, -15), "Open Tab", sizeStyle='regular', callback=self.NewTabWithAnchorMain) self.w.setDefaultButton(self.w.runButton) # Load Settings: if not self.LoadPreferences(): print( "Note: 'New Tab with Anchor' could not load preferences. Will resort to defaults" ) # Open window and focus on it: self.w.open() self.w.makeKey()
def __init__( self ): # Window 'self.w': windowWidth = 250 windowHeight = 240 windowWidthResize = 300 # user can resize width by this value windowHeightResize = 0 # user can resize height by this value self.w = vanilla.FloatingWindow( ( windowWidth, windowHeight ), # default window size "New Tab with Small Paths", # window title minSize = ( windowWidth, windowHeight ), # minimum size (for resizing) maxSize = ( windowWidth + windowWidthResize, windowHeight + windowHeightResize ), # maximum size (for resizing) autosaveName = "com.mekkablue.FindSmallPaths.mainwindow" # stores last window position and size ) # UI elements: linePos, inset, lineHeight = 12, 15, 22 self.w.text_1 = vanilla.TextBox( (inset, linePos, -inset, 30), u"Open new tab with glyphs that contain paths with an area smaller than:", sizeStyle='small' ) linePos += lineHeight*1.7 self.w.minArea = vanilla.TextBox( (inset, linePos, -inset, 15+3), u"1000 square units", sizeStyle = 'small', alignment="center") linePos += lineHeight self.w.sliderMin = vanilla.EditText( ( inset, linePos, 50, 19), "10", sizeStyle='small', callback=self.SliderUpdate ) self.w.sliderMax = vanilla.EditText( (-inset-50, linePos, -inset, 19), "10000", sizeStyle='small', callback=self.SliderUpdate ) self.w.areaSlider= vanilla.Slider((inset+50+10, linePos, -inset-50-10, 19), value=0.1, minValue=0.0, maxValue=1.0, sizeStyle='small', callback=self.SliderUpdate ) linePos += lineHeight self.w.deleteThemRightAway = vanilla.CheckBox( (inset, linePos, -inset, 20), u"Delete Small Paths Right Away", value=False, callback=self.CheckBoxUpdate, sizeStyle='small' ) linePos += lineHeight self.w.afterOverlapRemoval = vanilla.CheckBox( (inset, linePos, -inset, 20), u"After Decomposition and Overlap Removal (slower)", value=True, callback=self.CheckBoxUpdate, sizeStyle='small' ) linePos += lineHeight self.w.allFonts = vanilla.CheckBox( (inset, linePos, -inset, 20), u"Apply to all open fonts", value=False, callback=self.SavePreferences, sizeStyle='small' ) linePos += lineHeight self.w.progress = vanilla.ProgressBar((inset, linePos, -inset, 16)) self.w.progress.set(0) # set progress indicator to zero linePos+=lineHeight # Run Button: self.w.runButton = vanilla.Button((-120, -20-inset, -inset, -inset), u"Open Tab", sizeStyle='regular', callback=self.FindSmallPathsMain ) self.w.setDefaultButton( self.w.runButton ) # Load Settings: if not self.LoadPreferences(): print "Note: 'Find Small Paths' could not load preferences. Will resort to defaults" self.CheckBoxUpdate(None) self.SliderUpdate(None) # Open window and focus on it: self.w.open() self.w.makeKey()
def __init__( self ): # Window 'self.w': windowWidth = 280 windowHeight = 240 windowWidthResize = 100 # user can resize width by this value windowHeightResize = 0 # user can resize height by this value self.w = vanilla.FloatingWindow( ( windowWidth, windowHeight ), # default window size "Fix Arrow Positioning", # window title minSize = ( windowWidth, windowHeight ), # minimum size (for resizing) maxSize = ( windowWidth + windowWidthResize, windowHeight + windowHeightResize ), # maximum size (for resizing) autosaveName = "com.mekkablue.FixArrowPositioning.mainwindow" # stores last window position and size ) # UI elements: linePos, inset, lineHeight = 12, 15, 22 self.w.explanation = vanilla.TextBox( (inset, linePos+2, -inset, 14), "Fixes position and spacing of arrows.", sizeStyle='small', selectable=True ) linePos += lineHeight self.w.referenceForHorizontalArrowsText = vanilla.TextBox( (inset, linePos+2, 130, 14), "Reference for H arrows:", sizeStyle='small' ) self.w.referenceForHorizontalArrows = vanilla.PopUpButton( (inset+130, linePos, -inset, 17), self.hArrows, callback=self.SavePreferences, sizeStyle='small' ) linePos += lineHeight self.w.referenceForVerticalArrowsText = vanilla.TextBox( (inset, linePos+2, 130, 14), "Reference for V arrows:", sizeStyle='small' ) self.w.referenceForVerticalArrows = vanilla.PopUpButton( (inset+130, linePos, -inset, 17), self.vArrows, callback=self.SavePreferences, sizeStyle='small' ) linePos += lineHeight self.w.referenceForDiagonalArrowsText = vanilla.TextBox( (inset, linePos+2, 130, 14), "Reference for D arrows:", sizeStyle='small' ) self.w.referenceForDiagonalArrows = vanilla.PopUpButton( (inset+130, linePos, -inset, 17), self.dArrows, callback=self.SavePreferences, sizeStyle='small' ) linePos += lineHeight self.w.suffixText = vanilla.TextBox( (inset, linePos+2, 70, 14), "Dot suffix:", sizeStyle='small', selectable=False ) self.w.suffix = vanilla.EditText( (inset+70, linePos, -inset, 19), "", sizeStyle='small' ) linePos += lineHeight self.w.verticalPosOfHorizontalArrows = vanilla.CheckBox( (inset, linePos-1, -inset, 20), "Fix vertical positioning of horizontal arrows", value=True, callback=self.SavePreferences, sizeStyle='small' ) linePos += lineHeight self.w.verticalPosOfDiagonalArrows = vanilla.CheckBox( (inset, linePos-1, -inset, 20), "Fix vertical positioning of diagonal arrows", value=True, callback=self.SavePreferences, sizeStyle='small' ) linePos += lineHeight self.w.addAndUpdateMetricsKeys = vanilla.CheckBox( (inset, linePos-1, -inset, 20), "Add and update metrics keys", value=True, callback=self.SavePreferences, sizeStyle='small' ) linePos += lineHeight # Run Button: self.w.runButton = vanilla.Button( (-80-inset, -20-inset, -inset, -inset), "Fix", sizeStyle='regular', callback=self.FixArrowPositioningMain ) self.w.setDefaultButton( self.w.runButton ) # Load Settings: if not self.LoadPreferences(): print("Note: 'Fix Arrow Positioning' could not load preferences. Will resort to defaults") # Open window and focus on it: self.w.open() self.w.makeKey()
def __init__( self ): # Window 'self.w': windowWidth = 400 windowHeight = 235 windowWidthResize = 400 # user can resize width by this value windowHeightResize = 0 # user can resize height by this value self.w = vanilla.FloatingWindow( ( windowWidth, windowHeight ), # default window size "Build Small Figures", # window title minSize = ( windowWidth, windowHeight ), # minimum size (for resizing) maxSize = ( windowWidth + windowWidthResize, windowHeight + windowHeightResize ), # maximum size (for resizing) autosaveName = "com.mekkablue.smallFigureBuilder.mainwindow" # stores last window position and size ) # UI elements: inset, linePos, lineHeight = 15, 10, 24 self.w.text_0 = vanilla.TextBox( (inset, linePos+2, -inset, 60), "Takes the Default Suffix figures (e.g. .dnom) and builds compound copies with suffixes in Derivatives (comma-separated suffix:yOffset pairs). Respects Italic Angle when placing components.", sizeStyle='small', selectable=True ) linePos += round(lineHeight*2.2) self.w.text_1 = vanilla.TextBox( (inset-1, linePos+3, 100, 14), "Default Suffix:", sizeStyle='small' ) self.w.default = vanilla.EditText( (100, linePos, -inset, 20), "", sizeStyle = 'small', callback=self.SavePreferences ) self.w.default.getNSTextField().setToolTip_(u"Small figures with this suffix will be used as components in the derivative figures.") linePos += lineHeight self.w.text_2 = vanilla.TextBox( (inset-1, linePos+3, 75, 14), "Derivatives:", sizeStyle='small' ) self.w.derive = vanilla.EditText( (100, linePos, -inset, 20), "", sizeStyle = 'small', callback=self.SavePreferences ) self.w.derive.getNSTextField().setToolTip_(u"Add suffix:offset pairs (with a colon in between), separated by commas, e.g., ‘.numr:250, superior:350, inferior:-125’. Include the dot if the suffix is a dot suffix. The script will create the figure glyphs or overwrite existing ones.") linePos += lineHeight self.w.currentMasterOnly = vanilla.CheckBox( (inset, linePos-1, -inset, 20), "Only apply to current master (uncheck for all masters)", value=False, callback=self.SavePreferences, sizeStyle='small' ) self.w.currentMasterOnly.getNSButton().setToolTip_(u"If checked, will only process the currently selected master in the frontmost font. Useful if you want to use different values for different masters.") linePos += lineHeight self.w.decomposeDefaultFigures = vanilla.CheckBox( (inset, linePos-1, -inset, 20), u"Decompose small figures with Default Suffix", value=False, callback=self.SavePreferences, sizeStyle='small' ) self.w.decomposeDefaultFigures.getNSButton().setToolTip_(u"If checked, will decompose the small figures with the suffix entered in ‘Default Suffix’, before placing them as components in the derivatives. Useful if the current defaults are e.g. numr, and you want to reset it to dnom, and keep all others (numr, superior, inferior) as compounds.") linePos += lineHeight self.w.openTab = vanilla.CheckBox( (inset, linePos-1, -inset, 20), u"Open tab with affected glyphs", value=True, callback=self.SavePreferences, sizeStyle='small' ) self.w.openTab.getNSButton().setToolTip_(u"If checked, will open a new tab with all figures that have default and derivative suffixes. Useful for checking.") linePos += lineHeight # Run Button: self.w.reportButton = vanilla.Button((-200-15, -20-15, -95, -15), "Open Report", sizeStyle='regular', callback=self.openMacroWindow ) self.w.runButton = vanilla.Button((-70-15, -20-15, -15, -15), "Build", sizeStyle='regular', callback=self.smallFigureBuilderMain ) self.w.setDefaultButton( self.w.runButton ) # Load Settings: if not self.LoadPreferences(): print("Note: 'Build Small Figures' could not load preferences. Will resort to defaults") # Open window and focus on it: self.w.open() self.w.makeKey()
def __init__(self, posSize): super(TTFAutoHintGroup, self).__init__(posSize) self.getNSView().setFrame_((((0, 0), (400, 400)))) self.options = dict() updateWithDefaultValues(self.options, defaultOptions) column = 180 gutter = 15 y = 10 self.hintRangeMininmumText = vanilla.TextBox((10, y+2, column, 22), "Hint Set Range Minimum:", alignment="right") self.hintRangeMinimum = SliderEditStepper((column + gutter, y, -10, 22), self.options["hintRangeMinimum"], callback=self.hintRangeMinimumMaximumCallback) y += 32 self.hintRangeMaximumText = vanilla.TextBox((10, y+2, column, 22), "Hint Set Range Maximum:", alignment="right") self.hintRangeMaximum = SliderEditStepper((column + gutter, y, -10, 22), self.options["hintRangeMaximum"], callback=self.hintRangeMinimumMaximumCallback) y += 42 self.hintingLimitText = vanilla.TextBox((10, y+2, column, 22), "Hinting Limit:", alignment="right") self.hintingLimit = SliderEditStepper((column + gutter, y, -10, 22), self.options["hintingLimit"]) y += 22 self.noHintingLimit = vanilla.CheckBox((column + gutter, y, -10, 22), "No Hinting Limit", callback=self.noHintingLimitCallback, sizeStyle="small") y += 32 self.xHeightIncreaseLimitText = vanilla.TextBox((10, y+2, column, 22), "X Height Increase Limit:", alignment="right") self.xHeightIncreaseLimit = SliderEditStepper((column + gutter, y, -10, 22), self.options["xHeightIncreaseLimit"]) y += 32 self.noXHeightIncreaseLimit = vanilla.CheckBox((column + gutter, y, -10, 22), "No X Height Increase Limit", callback=self.noXHeightIncreaseLimitCallback, sizeStyle="small") y += 32 self.fallbackScript = vanilla.CheckBox((column + gutter, y, -10, 22), "Fallback Script (Latin)", value=self.options["fallbackScript"]) y += 22 self.preHinting = vanilla.CheckBox((column + gutter, y, -10, 22), "Pre Hinted", value=self.options["preHinting"]) y += 22 self.symbolFont = vanilla.CheckBox((column + gutter, y, -10, 22), "Symbol Font", value=self.options["symbolFont"]) y += 22 self.addTTFAutoHintInfo = vanilla.CheckBox((column + gutter, y, -10, 22), "Add ttfautohint Info", value=self.options["addTTFAutoHintInfo"]) y += 22 self.overRideFontLicense = vanilla.CheckBox((column + gutter, y, -10, 22), "Override Font License Restrictions", value=self.options["overRideFontLicense"]) y += 32 self.stemWidthAndStemPos = vanilla.TextBox((0, y, column+10, 22), "Stem Width and Positioning:", alignment="right") self.grayScale = vanilla.CheckBox((column + gutter, y, -10, 22), "Gray Scale", value=self.options["grayScale"]) y += 22 self.gdiClearType = vanilla.CheckBox((column + gutter, y, -10, 22), "GDI ClearType", value=self.options["gdiClearType"]) y += 22 self.dwClearType = vanilla.CheckBox((column + gutter, y, -10, 22), "DW ClearType", value=self.options["dwClearType"])
def __init__( self ): # Window 'self.w': windowWidth = 380 windowHeight = 155 windowWidthResize = 300 # user can resize width by this value windowHeightResize = 0 # user can resize height by this value self.w = vanilla.FloatingWindow( ( windowWidth, windowHeight ), # default window size "Populate Layer Backgrounds with Component", # window title minSize = ( windowWidth, windowHeight ), # minimum size (for resizing) maxSize = ( windowWidth + windowWidthResize, windowHeight + windowHeightResize ), # maximum size (for resizing) autosaveName = "com.mekkablue.PopulateAllBackgroundswithComponent.mainwindow" # stores last window position and size ) # UI elements: linePos, inset, lineHeight = 10, 15, 22 self.w.descriptionText = vanilla.TextBox( (inset, linePos+2, -inset, 14), "In selected glyphs, insert component in all layer backgrounds:", sizeStyle='small', selectable=True ) linePos += lineHeight self.w.text_1 = vanilla.TextBox( (inset-1, linePos+2, 100, 14), "Add component:", sizeStyle='small' ) self.w.componentName = vanilla.EditText( (inset+100, linePos, -inset-25, 19), "a", sizeStyle='small', callback=self.SavePreferences) self.w.componentName.getNSTextField().setToolTip_("Name of the glyph that should be inserted as component in the background of all layers of the selected glyph(s).") self.w.updateButton = vanilla.SquareButton( (-inset-20, linePos, -inset, 18), u"↺", sizeStyle='small', callback=self.update ) self.w.updateButton.getNSButton().setToolTip_("Guess the component name. Hold down OPTION to ignore the suffix.") linePos += lineHeight self.w.alignRight = vanilla.CheckBox( (inset, linePos-1, -inset, 20), "Align with right edge of layer", value=False, callback=self.SavePreferences, sizeStyle='small' ) self.w.alignRight.getNSButton().setToolTip_("Right-aligns the component width with the layer width. Useful for the e in ae or oe, for example.") linePos += lineHeight self.w.replaceBackgrounds = vanilla.CheckBox( (inset, linePos-1, -inset, 20), "Replace existing backgrounds", value=False, callback=self.SavePreferences, sizeStyle='small' ) self.w.replaceBackgrounds.getNSButton().setToolTip_("Deletes existing background content before it inserts the component. Recommended if you want to align selected nodes with the background.") linePos += lineHeight # Run Button: self.w.runButton = vanilla.Button( (-100-inset, -20-inset, -inset, -inset), "Populate", sizeStyle='regular', callback=self.PopulateAllBackgroundswithComponentMain ) self.w.runButton.getNSButton().setToolTip_("Inserts the specified component in ALL layers of the current glyph(s).") self.w.setDefaultButton( self.w.runButton ) self.w.alignButton = vanilla.Button( (-220-inset, -20-inset, -110-inset, -inset), "Align Nodes", sizeStyle='regular', callback=self.AlignNodesMain ) self.w.alignButton.getNSButton().setToolTip_("Aligns selected nodes with the (original) nodes in the background components. Only does this on the CURRENT layer.") self.w.nextMasterButton = vanilla.Button( (-340-inset, -20-inset, -230-inset, -inset), "Next Master", sizeStyle='regular', callback=self.NextMasterMain ) self.w.nextMasterButton.getNSButton().setToolTip_("Switches the current tab to the next master. Useful if you want to align the same nodes in every master.") # Load Settings: if not self.LoadPreferences(): print("Note: 'Populate All Backgrounds with Component' could not load preferences. Will resort to defaults") # Open window and focus on it: self.w.open() self.w.makeKey()
def __init__( self ): # Window 'self.w': windowWidth = 290 windowHeight = 250 windowWidthResize = 300 # user can resize width by this value windowHeightResize = 0 # user can resize height by this value self.w = vanilla.FloatingWindow( ( windowWidth, windowHeight ), # default window size "Find Shapeshifting Glyphs", # window title minSize = ( windowWidth, windowHeight ), # minimum size (for resizing) maxSize = ( windowWidth + windowWidthResize, windowHeight + windowHeightResize ), # maximum size (for resizing) autosaveName = "com.mekkablue.FindShapeshiftingGlyphs.mainwindow" # stores last window position and size ) # UI elements: linePos, inset, lineHeight = 12, 15, 22 self.w.descriptionText = vanilla.TextBox( (inset, linePos+2, -inset, 28), u"Reports glyphs that change number of cw/ccw paths (‘shapeshift’) in interpolation.", sizeStyle='small', selectable=True ) linePos += int(lineHeight*1.7) self.w.text_1 = vanilla.TextBox( (inset, linePos+2, 85, 14), "Count paths in", sizeStyle='small' ) self.w.checkInstances = vanilla.PopUpButton( (inset+85, linePos, -inset, 17), ("constructed instances midway between masters", "all active instances in font", "all active and inactive instances in font"), callback=self.SavePreferences, sizeStyle='small' ) linePos += lineHeight self.w.alsoCheckMasters = vanilla.CheckBox( (inset, linePos-1, -inset, 20), "Add masters as instances", value=False, callback=self.SavePreferences, sizeStyle='small' ) linePos += lineHeight self.w.onlyCheckSelection = vanilla.CheckBox( (inset, linePos-1, -inset, 20), "Limit to selected glyphs (otherwise all glyphs)", value=False, callback=self.SavePreferences, sizeStyle='small' ) linePos += lineHeight self.w.ignoreGlyphsWithoutPaths = vanilla.CheckBox( (inset, linePos-1, -inset, 20), "Ignore glyphs without paths", value=False, callback=self.SavePreferences, sizeStyle='small' ) linePos += lineHeight self.w.ignoreNonexportingGlyphs = vanilla.CheckBox( (inset, linePos-1, -inset, 20), "Ignore glyphs that do not export", value=False, callback=self.SavePreferences, sizeStyle='small' ) linePos += lineHeight self.w.openTab = vanilla.CheckBox( (inset, linePos-1, -inset, 20), "Open found shapeshifters in a new tab", value=True, callback=self.SavePreferences, sizeStyle='small' ) linePos += lineHeight self.w.progress = vanilla.ProgressBar((inset, linePos, -inset, 16)) self.w.progress.set(0) # set progress indicator to zero linePos+=lineHeight # Run Button: self.w.runButton = vanilla.Button( (-80-inset, -20-inset, -inset, -inset), "Find", sizeStyle='regular', callback=self.FindShapeshiftingGlyphsMain ) self.w.setDefaultButton( self.w.runButton ) # Load Settings: if not self.LoadPreferences(): print("Note: 'Find Shapeshifting Glyphs' could not load preferences. Will resort to defaults") # Open window and focus on it: self.w.open() self.w.makeKey()
def __init__(self): # Window 'self.w': windowWidth = 250 windowHeight = 120 windowWidthResize = 100 # user can resize width by this value windowHeightResize = 0 # user can resize height by this value self.w = vanilla.FloatingWindow( (windowWidth, windowHeight), # default window size "New Tab with Short Segments", # window title minSize=(windowWidth, windowHeight), # minimum size (for resizing) maxSize=(windowWidth + windowWidthResize, windowHeight + windowHeightResize), # maximum size (for resizing) autosaveName= "com.mekkablue.FindShortSegmentsInFont.mainwindow" # stores last window position and size ) # UI elements: self.w.text_1 = vanilla.TextBox((15 - 1, 12 + 2, 160, 14), "Find segments up to length:", sizeStyle='small') self.w.maxDistance = vanilla.EditText((175, 12, -15, 15 + 3), "5", callback=self.SavePreferences, sizeStyle='small') self.w.allFonts = vanilla.CheckBox((15, 34, -15, 20), "Include all open fonts", value=False, callback=self.SavePreferences, sizeStyle='small') self.w.selectSegments = vanilla.CheckBox((15, 54, -15, 20), "Select segments", value=False, callback=self.SavePreferences, sizeStyle='small') # Run Button: self.w.runButton = vanilla.Button( (-80 - 15, -20 - 15, -15, -15), "Find", sizeStyle='regular', callback=self.FindShortSegmentsInFontMain) self.w.setDefaultButton(self.w.runButton) # Load Settings: if not self.LoadPreferences(): print( "Note: 'New Tab with Short Segments' could not load preferences. Will resort to defaults" ) # Open window and focus on it: self.w.open() self.w.makeKey()
def __init__(self): # Window 'self.w': windowWidth = 300 windowHeight = 140 windowWidthResize = 100 # user can resize width by this value windowHeightResize = 0 # user can resize height by this value self.w = vanilla.FloatingWindow( (windowWidth, windowHeight), # default window size "Show Large Kerning Pairs in this Master", # window title minSize=(windowWidth, windowHeight), # minimum size (for resizing) maxSize=(windowWidth + windowWidthResize, windowHeight + windowHeightResize), # maximum size (for resizing) autosaveName= "com.mekkablue.ShowLargeKerningPairs.mainwindow" # stores last window position and size ) # UI elements: self.w.text_1 = vanilla.TextBox((15 - 1, 12 + 2, 190, 14), "New tab with kern pairs beyond:", sizeStyle='small') self.w.threshold = vanilla.EditText((190, 12 - 1, -15, 20), "100", sizeStyle='small') self.w.positive = vanilla.CheckBox((15, 40, -15, 20), "Positive pairs", value=True, callback=self.SavePreferences, sizeStyle='small') self.w.negative = vanilla.CheckBox((15, 60, -15, 20), "Negative pairs", value=True, callback=self.SavePreferences, sizeStyle='small') # Run Button: self.w.runButton = vanilla.Button( (-80 - 15, -20 - 15, -15, -15), "Open Tab", sizeStyle='regular', callback=self.ShowLargeKerningPairsMain) self.w.setDefaultButton(self.w.runButton) # Load Settings: if not self.LoadPreferences(): print( "Note: 'Show Large Kerning Pairs' could not load preferences. Will resort to defaults" ) # Open window and focus on it: self.w.open() self.w.makeKey()
def __init__(self): self.w = vanilla.FloatingWindow( (430, 60), "Change Metrics of Selected Glyphs by Percentage", minSize=(430, 60), maxSize=(600, 60), autosaveName="com.mekkablue.ChangeMetricsbyPercentage.mainwindow") self.w.text_1 = vanilla.TextBox((15, 12 + 2, 50, 14), "Increase", sizeStyle='small') self.w.text_2 = vanilla.TextBox((155, 12 + 2, 20, 14), "by", sizeStyle='small') self.w.text_3 = vanilla.TextBox((-190, 12 + 2, -170, 14), "%", sizeStyle='small') self.w.LSB = vanilla.CheckBox((15 + 55, 12, 40, 18), "LSB", value=True, sizeStyle='small', callback=self.SavePreferences) self.w.RSB = vanilla.CheckBox((15 + 55 + 45, 12, 40, 18), "RSB", value=True, sizeStyle='small', callback=self.SavePreferences) self.w.changeValue = vanilla.EditText((180, 12, -196, 15 + 3), "+10.0", sizeStyle='small') self.w.runButton = vanilla.Button( (-90, 12 - 1, -15, 19), "Change", sizeStyle='small', callback=self.ChangeMetricsbyPercentageMain) self.w.revertButton = vanilla.Button( (-90 - 80, 12 - 1, -95, 19), "Revert", sizeStyle='small', callback=self.ChangeMetricsbyPercentageMain) self.w.setDefaultButton(self.w.runButton) try: self.LoadPreferences() except: pass self.w.open()
def __init__( self ): # Window 'self.w': windowWidth = 290 windowHeight = 200 windowWidthResize = 100 # user can resize width by this value windowHeightResize = 0 # user can resize height by this value self.w = vanilla.FloatingWindow( ( windowWidth, windowHeight ), # default window size "Find and Replace in Font Info", # window title minSize = ( windowWidth, windowHeight ), # minimum size (for resizing) maxSize = ( windowWidth + windowWidthResize, windowHeight + windowHeightResize ), # maximum size (for resizing) autosaveName = "com.mekkablue.FindAndReplaceInFontInfo.mainwindow" # stores last window position and size ) # UI elements: linePos, inset, lineHeight = 12, 15, 22 self.w.searchForText = vanilla.TextBox( (inset, linePos+2, 80, 14), "Search for:", sizeStyle='small', selectable=True ) self.w.searchFor = vanilla.EditText( (inset+80, linePos-1, -inset, 19), "", callback=self.SavePreferences, sizeStyle='small' ) linePos += lineHeight self.w.replaceWithText = vanilla.TextBox( (inset, linePos+2, 80, 14), "Replace with:", sizeStyle='small', selectable=True ) self.w.replaceWith = vanilla.EditText( (inset+80, linePos-1, -inset, 19), "", callback=self.SavePreferences, sizeStyle='small' ) linePos += lineHeight self.w.completeWordsOnly = vanilla.CheckBox( (inset, linePos, -inset, 20), "Complete words only", value=False, callback=self.SavePreferences, sizeStyle='small' ) linePos += lineHeight self.w.allFonts = vanilla.CheckBox( (inset, linePos, -inset, 20), "⚠️ Include all open fonts", value=False, callback=self.SavePreferences, sizeStyle='small' ) linePos += lineHeight self.w.includeInstances = vanilla.CheckBox( (inset, linePos, 120, 20), "Include instances", value=False, callback=self.SavePreferences, sizeStyle='small' ) self.w.includeInactiveInstances = vanilla.CheckBox( (inset+120, linePos, -inset, 20), "Also inactive instances", value=False, callback=self.SavePreferences, sizeStyle='small' ) linePos += lineHeight self.w.includeCustomParameters = vanilla.CheckBox( (inset, linePos, -inset, 20), "Include Custom Parameters", value=False, callback=self.SavePreferences, sizeStyle='small' ) linePos += lineHeight # Run Button: self.w.runButton = vanilla.Button( (-90-inset, -20-inset, -inset, -inset), "Replace", sizeStyle='regular', callback=self.FindAndReplaceInFontInfoMain ) self.w.setDefaultButton( self.w.runButton ) # Load Settings: if not self.LoadPreferences(): print("Note: 'Find and Replace in Font Info' could not load preferences. Will resort to defaults") # Open window and focus on it: self.updateUI() self.w.open() self.w.makeKey()
def __init__(self): # Window 'self.w': edY = 22 txY = 17 sp = 10 btnX = 160 btnY = 22 self.w = vanilla.FloatingWindow( (300, sp * 13 + txY * 8 + btnY), # default window size "Clear Backgrounds in Selected Layers...", # window title autosaveName= "com.Tosche.ClearBackgroundsInSelectedLayersmainwindow" # stores last window position and size ) # UI elements: self.w.text_1 = vanilla.TextBox((sp, sp, -sp, txY), "Where?", sizeStyle='regular') self.w.radio = vanilla.RadioGroup( (sp * 2, sp * 2 + txY, -sp, txY * 4 + sp * 3), [ "Current master layers only", "All master & special layers", "All backup layers", "All layers" ]) self.w.text_2 = vanilla.TextBox((sp, sp * 6 + txY * 5, -sp, txY), "What to decompose?", sizeStyle='regular') self.w.compoCheck = vanilla.CheckBox( (sp * 2, sp * 7 + txY * 6, -sp, txY), "Regular Components", value=True) self.w.cornerCheck = vanilla.CheckBox( (sp * 2, sp * 8 + txY * 7, -sp, txY), "Corner/Cap/Segment Components", value=True) self.w.smartCheck = vanilla.CheckBox( (sp * 2, sp * 9 + txY * 8, -sp, txY), "Smart/Part Components", value=True) # Run Button: self.w.runButton = vanilla.Button( (-sp - btnX, -sp - btnY, -sp, btnY), "Clear", sizeStyle='regular', callback=self.DecomposeComponentsInSelectedLayersMain) self.w.setDefaultButton(self.w.runButton) # Open window and focus on it: self.w.open() self.w.makeKey()
def __init__(self): # Window 'self.w': edY = 22 txY = 17 sp = 10 btnX = 160 btnY = 22 self.w = vanilla.FloatingWindow( (300, sp * 13 + txY * 8 + btnY), # default window size "Clear Backgrounds in Selected Layers...", # window title autosaveName= "com.Tosche.ClearBackgroundsInSelectedLayersmainwindow" # stores last window position and size ) # UI elements: self.w.text_1 = vanilla.TextBox((sp, sp, -sp, txY), "Where?", sizeStyle='regular') self.w.radio = vanilla.RadioGroup( (sp * 2, sp * 2 + txY, -sp, txY * 4 + sp * 3), [ "Current master layers only", "All master & special layers", "All backup layers", "All layers" ]) self.w.text_2 = vanilla.TextBox((sp, sp * 6 + txY * 5, -sp, txY), "What to delete?", sizeStyle='regular') self.w.pathCheck = vanilla.CheckBox( (sp * 2, sp * 7 + txY * 6, -sp, txY), "Paths (incl. corner & cap components)", value=True) self.w.compoCheck = vanilla.CheckBox( (sp * 2, sp * 8 + txY * 7, -sp, txY), "Components", value=True) self.w.anchorCheck = vanilla.CheckBox( (sp * 2, sp * 9 + txY * 8, -sp, txY), "Anchors", value=True) # Run Button: self.w.runButton = vanilla.Button( (-sp - btnX, -sp - btnY, -sp, btnY), "Clear", sizeStyle='regular', callback=self.ClearBackgroundsInSelectedLayersMain) self.w.setDefaultButton(self.w.runButton) # Load Settings: # if not self.LoadPreferences(): # print("Note: 'Clear Backgrounds in Selected Layers...' could not load preferences. Will resort to defaults") # Open window and focus on it: self.w.open() self.w.makeKey()
def __init__( self ): # Window 'self.w': windowWidth = 320 windowHeight = 160 windowWidthResize = 100 # user can resize width by this value windowHeightResize = 0 # user can resize height by this value self.w = vanilla.FloatingWindow( ( windowWidth, windowHeight ), # default window size "Alignment Manager", # window title minSize = ( windowWidth, windowHeight ), # minimum size (for resizing) maxSize = ( windowWidth + windowWidthResize, windowHeight + windowHeightResize ), # maximum size (for resizing) autosaveName = "com.mekkablue.AutoAlignmentManager.mainwindow" # stores last window position and size ) # UI elements: linePos, inset, lineHeight = 12, 15, 22 self.w.descriptionText = vanilla.TextBox( (inset, linePos+2, -inset, 14), u"Manage component alignment in selected glyphs:", sizeStyle='small', selectable=True ) linePos += lineHeight self.w.includeAllGlyphs = vanilla.CheckBox( (inset, linePos-1, -inset, 20), u"Include all glyphs in font, i.e., ignore glyph selection", value=False, callback=self.SavePreferences, sizeStyle='small' ) self.w.includeAllGlyphs.getNSButton().setToolTip_("No matter what your glyph selection is, will enable/disable component alignment for ALL glyphs in the font.") linePos += lineHeight self.w.includeAllLayers = vanilla.CheckBox( (inset, linePos-1, -inset, 20), u"Include all masters and special layers", value=True, callback=self.SavePreferences, sizeStyle='small' ) self.w.includeAllLayers.getNSButton().setToolTip_("If enabled, will enable/disable automatic alignment not only for the currently selected masters/layers, but for ALL master layers, brace layers and bracket layers of selected glyphs. Will still ignore backup layers (the ones with a timestamp in their names).") linePos += lineHeight self.w.differentiationText = vanilla.TextBox( (inset, linePos+2, 75, 14), u"Differentiate:", sizeStyle='small', selectable=True ) self.w.differentiation = vanilla.PopUpButton( (inset+75, linePos, -inset, 17), (u"Treat all components equally", u"Ignore first component", u"Only apply to first component"), sizeStyle='small', callback=self.SavePreferences ) self.w.differentiation.getNSPopUpButton().setToolTip_(u"You can choose to exclude the first component (usually the base letter) from toggling auto-alignment. This can be useful if you want to keep the diacritic marks aligned to the base, but still move the base. Or if you want to keep the base letter aligned, and place the marks freely.") linePos += lineHeight # Run Button: self.w.enableButton = vanilla.Button( (-90-inset, -20-inset, -inset, -inset), u"тЬЕ Enable", sizeStyle='regular', callback=self.AutoAlignmentManagerMain ) self.w.enableButton.getNSButton().setToolTip_("Enables automatic alignment with the current span and settings.") self.w.disableButton = vanilla.Button( (-190-inset, -20-inset, -100-inset, -inset), u"ЁЯЪл Disable", sizeStyle='regular', callback=self.AutoAlignmentManagerMain ) self.w.disableButton.getNSButton().setToolTip_("Disables automatic alignment with the current span and settings.") self.w.rotateButton = vanilla.Button( (-290-inset, -20-inset, -200-inset, -inset), u"ЁЯФД Rotate", sizeStyle='regular', callback=self.rotateComponents ) self.w.rotateButton.getNSButton().setToolTip_("Moves the last component into first place. Useful if you quickly want to fix component order without leaving he script UI.") # Load Settings: if not self.LoadPreferences(): print("Note: 'Auto Alignment Manager' could not load preferences. Will resort to defaults") # Open window and focus on it: self.w.open() self.w.makeKey() self.updateUI()
def __init__( self ): # Window 'self.w': windowWidth = 320 windowHeight = 190 windowWidthResize = 100 # user can resize width by this value windowHeightResize = 0 # user can resize height by this value self.w = vanilla.FloatingWindow( ( windowWidth, windowHeight ), # default window size "Zero Kerner", # window title minSize = ( windowWidth, windowHeight ), # minimum size (for resizing) maxSize = ( windowWidth + windowWidthResize, windowHeight + windowHeightResize ), # maximum size (for resizing) autosaveName = "com.mekkablue.ZeroKerner.mainwindow" # stores last window position and size ) # UI elements: linePos, inset, lineHeight = 12, 15, 22 self.w.descriptionText = vanilla.TextBox( (inset, linePos+2, -inset, 44), u"Add zero-value group-to-group kernings for pairs that are missing in one master but present in others. Helps preserve interpolatable kerning in OTVars.", sizeStyle='small', selectable=True ) linePos += lineHeight*2.5 self.w.limitToCurrentMaster = vanilla.CheckBox( (inset, linePos-1, -inset, 20), u"Limit to current master only (otherwise, all masters)", value=False, callback=self.SavePreferences, sizeStyle='small' ) self.w.limitToCurrentMaster.getNSButton().setToolTip_("Will apply zero kernings only to the currently selected master. Uncheck if all masters should be zero-kerned.") linePos += lineHeight self.w.reportInMacroWindow = vanilla.CheckBox( (inset, linePos-1, -inset, 20), u"Detailed report in Macro Window", value=False, callback=self.SavePreferences, sizeStyle='small' ) self.w.reportInMacroWindow.getNSButton().setToolTip_("If checked, will write a progress report in the Macro Window (Cmd-Opt-M).") linePos += lineHeight self.w.progress = vanilla.ProgressBar((inset, linePos, -inset, 16)) self.w.progress.set(0) # set progress indicator to zero linePos+=lineHeight self.w.status = vanilla.TextBox( (inset, -20-inset, -120-inset, 14), u"", sizeStyle='small', selectable=True ) linePos += lineHeight # Run Button: self.w.removeButton = vanilla.Button( (-160-inset, -20-inset, -80-inset, -inset), "Remove", sizeStyle='regular', callback=self.ZeroKernerMain ) self.w.addButton = vanilla.Button( (-70-inset, -20-inset, -inset, -inset), "Add", sizeStyle='regular', callback=self.ZeroKernerMain ) self.w.setDefaultButton( self.w.addButton ) # Load Settings: if not self.LoadPreferences(): print("Note: 'Zero Kerner' could not load preferences. Will resort to defaults") # Open window and focus on it: self.w.open() self.w.makeKey()
def __init__( self ): # Window 'self.w': windowWidth = 320 windowHeight = 200 windowWidthResize = 100 # user can resize width by this value windowHeightResize = 0 # user can resize height by this value self.w = vanilla.FloatingWindow( ( windowWidth, windowHeight ), # default window size "Compare Glyph Heights of Frontmost Fonts", # window title minSize = ( windowWidth, windowHeight ), # minimum size (for resizing) maxSize = ( windowWidth + windowWidthResize, windowHeight + windowHeightResize ), # maximum size (for resizing) autosaveName = "com.mekkablue.CompareGlyphHeightsOfFrontmostFonts.mainwindow" # stores last window position and size ) # UI elements: linePos, inset, lineHeight = 12, 15, 22 self.w.descriptionText = vanilla.TextBox( (inset, linePos+2, -inset, 28), u"Lists all glyphs that differ in height more than the given threshold. Detailed report in Macro Window.", sizeStyle='small', selectable=True ) linePos += lineHeight*2 self.w.tolerateText = vanilla.TextBox( (inset, linePos+2, 140, 14), u"Tolerate difference up to:", sizeStyle='small', selectable=True ) self.w.tolerate = vanilla.EditText( (inset+140, linePos, -inset, 19), "5", callback=self.SavePreferences, sizeStyle='small' ) self.w.tolerate.getNSTextField().setToolTip_("How much of a difference is OK. Hint: overshoot size is a good idea for this one.") linePos += lineHeight self.w.heights = vanilla.CheckBox( (inset, linePos-1, -inset, 20), u"Compare top bounds (‘heights’)", value=True, callback=self.SavePreferences, sizeStyle='small' ) self.w.heights.getNSButton().setToolTip_("Measures and compares the heights of the top edges (bbox maximum).") linePos += lineHeight self.w.depths = vanilla.CheckBox( (inset, linePos-1, -inset, 20), u"Compare bottom bounds (‘depths’)", value=False, callback=self.SavePreferences, sizeStyle='small' ) self.w.depths.getNSButton().setToolTip_("Measures and compares the heights of the bottom edges (bbox minimum).") linePos += lineHeight self.w.includeNonExporting = vanilla.CheckBox( (inset, linePos-1, -inset, 20), u"Include non-exporting glyphs", value=False, callback=self.SavePreferences, sizeStyle='small' ) self.w.includeNonExporting.getNSButton().setToolTip_("If enabled, also measures glyphs that are set to not export.") linePos += lineHeight # Run Button: self.w.runButton = vanilla.Button( (-120-inset, -20-inset, -inset, -inset), "Compare", sizeStyle='regular', callback=self.CompareGlyphHeightsOfFrontmostFontsMain ) self.w.setDefaultButton( self.w.runButton ) # Load Settings: if not self.LoadPreferences(): print("Note: 'Compare Glyph Heights of Frontmost Fonts' could not load preferences. Will resort to defaults") # Open window and focus on it: self.w.open() self.w.makeKey()
def __init__(self): # Window 'self.w': edY = 22 txX = 128 txY = 17 sp = 12 btnX = 80 btnY = 22 windowWidth = sp * 4 + txX + 224 + btnX windowHeight = sp * 6.5 + txY self.w = vanilla.FloatingWindow( (windowWidth, windowHeight), # default window size "adhesiontext Arabic, Layer Color", # window title autosaveName= "com.simonthi.adhesiontextArabic.mainwindow" # stores last window position and size ) arabicDic = open(dicFileLocation, 'r') # UI elements: self.w.text1 = vanilla.TextBox((sp, sp * 1 + txY * 0, txX, txY), "Words: 25", sizeStyle='regular') self.w.words = vanilla.Slider((sp + txX, sp * 1 + txY * 0, 195, txY), value=25, minValue=5, maxValue=200, callback=self.sliderCallback) #UI check color self.w.check = vanilla.CheckBox((sp, sp * 1 + txY * 1.5, txX, txY), "Include color", sizeStyle='regular') # UI color elements: self.w.text2 = vanilla.TextBox((sp, sp * 1 + txY * 3, txX, txY), "Color: red", sizeStyle='regular') self.w.color = vanilla.Slider((sp + txX, sp * 1 + txY * 3, 195, txY), value=0, minValue=0, maxValue=11, callback=self.sliderCallback1) # Run Button: self.w.runButton = vanilla.Button( (-sp - btnX, sp + txY * 3, -sp, btnY), "Get text", sizeStyle='regular', callback=self.typeset) self.w.setDefaultButton(self.w.runButton) # Load Settings: if not self.LoadPreferences(): print "Note: 'adhesiontext Arabic' could not load preferences. Will resort to defaults" # Open window and focus on it: self.w.open() self.w.makeKey()
def __init__( self ): # Window 'self.w': windowWidth = 240 windowHeight = 110 windowWidthResize = 300 # user can resize width by this value windowHeightResize = 0 # user can resize height by this value self.w = vanilla.FloatingWindow( ( windowWidth, windowHeight ), # default window size "Remove Anchors", # window title minSize = ( windowWidth, windowHeight ), # minimum size (for resizing) maxSize = ( windowWidth + windowWidthResize, windowHeight + windowHeightResize ), # maximum size (for resizing) autosaveName = "com.mekkablue.AnchorDeleter.mainwindow" # stores last window position and size ) # UI elements: linePos, inset, lineHeight = 12, 15, 22 self.w.text_1 = vanilla.TextBox( (inset-1, linePos+2, 80, 14), "Delete anchor", sizeStyle='small' ) self.w.updateButton = vanilla.SquareButton( (-inset-20, linePos, -inset, 18), u"↺", sizeStyle='small', callback=self.updateAnchors ) self.w.anchorPopup = vanilla.PopUpButton( (inset+80, linePos, -inset-25, 17), self.updateAnchors(None), callback=self.SavePreferences, sizeStyle='small' ) linePos += lineHeight self.w.selectedAnchorsOnly = vanilla.CheckBox( (inset, linePos, -inset, 20), "In selected glyphs only", value=False, callback=self.SavePreferences, sizeStyle='small' ) # Run Button: self.w.runButton = vanilla.Button((-80-inset, -20-inset, -inset, -inset), "Delete", sizeStyle='regular', callback=self.AnchorDeleterMain ) self.w.setDefaultButton( self.w.runButton ) # Load Settings: if not self.LoadPreferences(): print "Note: 'Delete Anchors' could not load preferences. Will resort to defaults" # Open window and focus on it: self.w.open() self.w.makeKey()
def fillSheet(self): self.w.namesCaption = vanilla.TextBox((5, 10, -10, 20), "Add these glyphs") self.w.markGlyphsCheck = vanilla.CheckBox((5, 40, 150, 20), "Mark new glyphs", value=True) self.w.selectGlyphsCheck = vanilla.CheckBox((5, 60, 150, 20), "Select new glyphs", value=True) cD = [ { 'title': u"Unicode", 'key': 'value', 'width': 80}, { 'title': u"Char", 'key': 'string', 'width': 60}, { 'title': u"GNUFL Name", 'key': 'name', 'width': 200}, ] self.w.proposedNames = vanilla.List((0, 90, 0, -50), [], columnDescriptions=cD)
def __init__( self ): editX = 55 editY = 22 textY = 17 spaceX = 10 spaceY = 10 buttonSizeX = 60 windowWidth = spaceX*2+editX*2+160 windowHeight = 150 self.w = vanilla.FloatingWindow( (windowWidth, windowHeight), "Transform Images with Proper Maths", autosaveName="com.Tosche.TransformImagesWithRealMaths.mainwindow" ) self.w.checkAbsolute = vanilla.CheckBox( (spaceX, spaceY, 75, textY), "Absolute", sizeStyle='regular', callback=self.changeAbsolute ) self.w.move_text1 = vanilla.TextBox( (spaceX, spaceY*2+editY+2, 100, textY), "Move x/y to:", sizeStyle='regular' ) self.w.move_X = vanilla.EditText( (spaceX+88, spaceY*2+editY, editX, editY), "0", sizeStyle = 'regular') self.w.move_Y = vanilla.EditText( (spaceX+88+editX+5, spaceY*2+editY, editX, editY), "0", sizeStyle = 'regular') self.w.move_text2 = vanilla.TextBox( (spaceX+88+editX*2+10, spaceY*2+editY+2, -15, textY), "units", sizeStyle='regular' ) self.w.scale_text1 = vanilla.TextBox( (spaceX, spaceY*3+editY*2+2, 100, textY), "Scale x/y to:", sizeStyle='regular' ) self.w.scale_X = vanilla.EditText( (spaceX+88, spaceY*3+editY*2, editX, editY), "100", sizeStyle = 'regular') self.w.scale_Y = vanilla.EditText( (spaceX+88+editX+5, spaceY*3+editY*2, editX, editY), "100", sizeStyle = 'regular') self.w.scale_text2 = vanilla.TextBox( (spaceX+88+editX*2+10, spaceY*3+editY*2+2, -15, textY), "%", sizeStyle='regular' ) self.w.runButton = vanilla.Button((-60-15, -20-15, -15, -15), "Go", sizeStyle='regular', callback=self.TransformImagesMain ) self.w.setDefaultButton( self.w.runButton ) try: self.LoadPreferences( ) except: pass self.w.checkAbsolute.set(True) self.w.open()
def __init__(self, glyph, construction, decompose): self.glyph = glyph width = 350 height = 120 editorWindow = CurrentGlyphWindow() (editorX, editorY, editorW, editorH), screen = getGlyphEditorRectAndScreen(editorWindow) x = editorX + ((editorW - width) / 2) y = editorY + ((editorH - height) / 2) self.w = StatusInteractivePopUpWindow((x, y, width, height), screen=screen) self.w.constructionEditor = vanilla.EditText((15, 15, -15, 22), construction) self.w.decomposeCheckBox = vanilla.CheckBox((15, 45, -15, 22), "Decompose", value=decompose) self.w.open() self.w.line = vanilla.HorizontalLine((15, -45, -15, 1)) self.w.cancelButton = vanilla.Button( (-165, -35, 70, 20), "Cancel", callback=self.cancelButtonCallback) self.w.okButton = vanilla.Button((-85, -35, 70, 20), "OK", callback=self.okButtonCallback) self.w.setDefaultButton(self.w.okButton) self.w.cancelButton.bind(".", ["command"]) self.w.getNSWindow().makeFirstResponder_( self.w.constructionEditor.getNSTextField()) self.w.open()
def getWindow(self): #open window w = vanilla.FloatingWindow( ( self.windowWidth, self.windowHeight ), # default window size SCRIPT_NAME + " " + VERSION, # window title minSize = ( self.windowWidth, self.windowHeight ), # minimum size (for resizing) maxSize = ( self.windowWidth + 540, self.windowHeight + 140), # maximum size (for resizing) autosaveName = "com.OdOka.kerningPairdUnlocker.mainwindow" # stores last window position and size ) #UI height = self.spaceY #radio select w.text0 = vanilla.TextBox( (self.spaceX, height, 120, self.textY), "Lock position:", sizeStyle='regular' ) w.side = vanilla.RadioGroup( (self.spaceX+130, height, 120, self.textY), ["Left", "Right"], isVertical = False, sizeStyle='regular' ) w.side.set(0) height += self.textY*2 w.text2 = vanilla.TextBox( (self.spaceX, height, 120, self.textY), "Specify correction:", sizeStyle='regular' ) w.specifyCorrection = vanilla.EditText( (self.spaceX + 130, height, -15, 20), "0", sizeStyle = 'regular' ) height += self.spaceY*2 #editbox w.text1 = vanilla.TextBox( (self.spaceX, height, -self.spaceX, self.textY*2), "Define pairs to unlock\n(use glyph names)", sizeStyle='regular' ) height += self.spaceY*2 w.pairsDefinition = vanilla.EditText( (self.spaceX, height, -self.spaceX, -self.spaceY-35), "", continuous=False, placeholder = "Paste pairs here\nOne pair per line", sizeStyle = 'regular' ) height += self.spaceY*8 #unheck to process only current master w.allMasters = vanilla.CheckBox((self.spaceX, -self.spaceY-20, -self.spaceX - 80, -self.spaceY), "Process all masters", value=True, sizeStyle = 'regular') height += self.spaceY*2 #process button w.buttonProcess = vanilla.Button((-15 - 40, -15 - 20, -15, -15), "Go", sizeStyle = 'regular', callback=self.process) w.setDefaultButton(w.buttonProcess) #spinner w.spinner = vanilla.ProgressSpinner((15, -15 - 16, 16, 16), sizeStyle = 'regular') return w
def __init__(self): self.drawing = False self.showLabels = False self.errors = {} self.w = vanilla.FloatingWindow((140, 86), "RedArrow") y = 5 self.w.showGlyphStatusButton = vanilla.Button( (10, y, -10, 25), "Show red arrows", callback=self.checkGlyphStatus, sizeStyle="small", ) y += 26 self.w.clearGlyphStatusButton = vanilla.Button( (10, y, -10, 25), "Clear red arrows", callback=self.uncheckGlyphStatus, sizeStyle="small", ) y += 28 self.w.drawLabels = vanilla.CheckBox( (10, y, -10, 25), "Show labels", callback=self.toggleShowLabels, sizeStyle="small", ) self.w.clearGlyphStatusButton.enable(False) #self.w.showGlyphStatusButton.enable(True) self.setUpBaseWindowBehavior() self.w.open()
def __init__(self): # Window 'self.w': windowWidth = 200 windowHeight = 130 windowWidthResize = 300 # user can resize width by this value windowHeightResize = 0 # user can resize height by this value self.w = vanilla.FloatingWindow( ( windowWidth, windowHeight ), # default window size "Find and Replace in Layer Names", # window title minSize = ( windowWidth, windowHeight ), # minimum size (for resizing) maxSize = ( windowWidth + windowWidthResize, windowHeight + windowHeightResize ), # maximum size (for resizing) autosaveName = "com.mekkablue.FindAndReplaceInLayerNames.mainwindow" # stores last window position and size ) self.w.textSearch = vanilla.TextBox((15, 15, 67, 14), "Search for:", sizeStyle='small') self.w.searchFor = vanilla.EditText((15+67, 12, -15, 19), "[130]", sizeStyle='small', callback=self.SavePreferences) self.w.textReplace = vanilla.TextBox((15, 15+22, 67, 14), "Replace by:", sizeStyle='small') self.w.replaceBy = vanilla.EditText((15+67, 12+22, -15, 19), "[150]", sizeStyle='small', callback=self.SavePreferences) self.w.allGlyphs = vanilla.CheckBox( (15, 15+44, -15, 20), "Include all glyphs in font", value=True, callback=self.SavePreferences, sizeStyle='small' ) self.w.replaceButton = vanilla.Button((-80, -40, -15, -5), "Replace", sizeStyle='small', callback=self.buttonCallback) self.LoadPreferences() self.w.setDefaultButton( self.w.replaceButton ) self.w.open() self.w.makeKey()
def _build_ui(self): self.height = 20 + 26 * len(self.settings) self.w = vanilla.Window((self.width, self.height), self._name) i = 0 for key in self.settings_list: setting = self.settings[key] ui_objects = [] if type(setting.default_value) == bool: checkbox = vanilla.CheckBox( (self.column + 10, 10 + 26 * i, -10, 22), setting.name, value = setting.value, callback = self._edit_value, ) setting.ui_object = checkbox ui_objects.append(checkbox) elif type(setting.default_value) == float: slider = vanilla.Slider( (self.column + 10, 10 + 26 * i, -10, 22), value = setting.value, callback = self._edit_value, continuous = False, ) setting.ui_object = slider ui_objects.append(slider) ui_objects.append( vanilla.TextBox( (10, 10 + 26 * i, self.column, 22), setting.name, ) ) for j in range(len(ui_objects)): setattr(self.w, "%s_%i" % (setting.key, j), ui_objects[j]) i += 1
def __init__(self): self.w = vanilla.FloatingWindow( (300, windowHeight), "BlueFuzzer", minSize=(250, windowHeight), maxSize=(500, windowHeight), autosaveName="com.mekkablue.BlueFuzzer.mainwindow") self.w.text_1 = vanilla.TextBox((15, 12 + 2, 120, 18), "Extend zones by", sizeStyle='small') self.w.fuzzValue = vanilla.EditText((120, 12, -15, 18), "1", sizeStyle='small') self.w.allMasters = vanilla.CheckBox((15, 35, -15, 20), "Apply to all masters", value=True, callback=self.SavePreferences, sizeStyle='small') self.w.runButton = vanilla.Button((-80 - 15, -20 - 15, -15, -15), "Fuzz", sizeStyle='regular', callback=self.BlueFuzzerMain) self.w.setDefaultButton(self.w.runButton) try: self.LoadPreferences() except: pass self.w.open()
def __init__( self ): # Window 'self.w': windowWidth = 250 windowHeight = 120 windowWidthResize = 150 # user can resize width by this value windowHeightResize = 0 # user can resize height by this value self.w = vanilla.FloatingWindow( ( windowWidth, windowHeight ), # default window size "Layers for Rotating Components", # window title minSize = ( windowWidth, windowHeight ), # minimum size (for resizing) maxSize = ( windowWidth + windowWidthResize, windowHeight + windowHeightResize ), # maximum size (for resizing) autosaveName = "com.mekkablue.InsertBraceLayersForComponentRotation.mainwindow" # stores last window position and size ) # UI elements: self.w.text_1 = vanilla.TextBox( (14, 12+2, 170, 14), "Insert steps between masters:", sizeStyle='small' ) self.w.steps = vanilla.EditText( (185, 11, -15, 20), "5", sizeStyle = 'small') self.w.replace = vanilla.CheckBox( (15, 38, -15, 16), "Replace existing Brace Layers", value=True, callback=self.SavePreferences, sizeStyle='small' ) # Run Button: self.w.runButton = vanilla.Button((-80-15, -20-15, -15, -15), "Insert", sizeStyle='regular', callback=self.InsertBraceLayersForComponentRotationMain ) self.w.setDefaultButton( self.w.runButton ) # Load Settings: if not self.LoadPreferences(): print("Note: 'Insert Brace Layers for Component Rotation' could not load preferences. Will resort to defaults") # Open window and focus on it: self.w.open() self.w.makeKey()
def __init__( self ): # Window 'self.w': windowWidth = 250 windowHeight = 130 windowWidthResize = 300 # user can resize width by this value windowHeightResize = 0 # user can resize height by this value self.w = vanilla.Window( ( windowWidth, windowHeight ), # default window size "Change Width Centered", # window title minSize = ( windowWidth, windowHeight ), # minimum size (for resizing) maxSize = ( windowWidth + windowWidthResize, windowHeight + windowHeightResize ), # maximum size (for resizing) autosaveName = "com.kylewaynebenson.ChangeWidthCentered.mainwindow" # stores last window position and size ) # UI elements: self.w.text_1 = vanilla.TextBox( (15, 10, -15, 30), "Change new width to:", sizeStyle='small' ) self.w.newWidth = vanilla.EditText( ( 15, 40-1, 50, 21), "750", sizeStyle='regular' ) self.w.checkBox = vanilla.CheckBox((-120, 40, 0, 20), "All layers", value=False) # Run Button: self.w.runButton = vanilla.Button((-130, -20-15, -15, -15), "Change Width", sizeStyle='regular', callback=self.changeWidth ) self.w.setDefaultButton( self.w.runButton ) self.w.open() self.w.makeKey()
def __init__(self): self.w = vanilla.FloatingWindow((250, 300), "Ramsay St. Settings", minSize=(250, 250), maxSize=(400, 700)) self.w.showPreview = vanilla.CheckBox( (10, 10, -10, 22), "Show Preview", value=RamsayStData.showPreview, callback=self.showPreviewCallback) self.w.fillColorText = vanilla.TextBox((10, 40, 110, 22), "Fill Color:") self.w.fillColor = vanilla.ColorWell((10, 60, 110, 40), color=RamsayStData.fillColor, callback=self.fillColorCallback) self.w.strokeColorText = vanilla.TextBox((130, 40, -10, 22), "Stroke Color:") self.w.strokeColor = vanilla.ColorWell( (130, 60, -10, 40), color=RamsayStData.strokeColor, callback=self.strokeColorCallback) items = RamsayStData.getItems() columnDescriptions = [ dict(title="Glyph Name", key="glyphName"), dict(title="Left", key="left"), dict(title="Right", key="right"), ] self.w.dataList = vanilla.List((10, 110, -10, -40), items, columnDescriptions=columnDescriptions, editCallback=self.dataListEditCallback) segmentDescriptions = [dict(title="+"), dict(title="-")] self.w.addDel = vanilla.SegmentedButton((12, -30, 60, 20), segmentDescriptions, selectionStyle="momentary", callback=self.addDelCallback) self.w.addDel.getNSSegmentedButton().setSegmentStyle_( NSSegmentStyleSmallSquare) self.w.okButton = vanilla.Button((-70, -30, -15, 20), "Apply", callback=self.okCallback, sizeStyle="small") self.w.setDefaultButton(self.w.okButton) self.w.closeButton = vanilla.Button((-140, -30, -80, 20), "Cancel", callback=self.closeCallback, sizeStyle="small") self.w.closeButton.bind(".", ["command"]) self.w.closeButton.bind(unichr(27), []) self.w.open()
def __init__( self ): # Window 'self.w': windowWidth = 350 windowHeight = 135 windowWidthResize = 100 # user can resize width by this value windowHeightResize = 0 # user can resize height by this value self.w = vanilla.FloatingWindow( ( windowWidth, windowHeight ), # default window size "Find Negative Overkerns in This Master", # window title minSize = ( windowWidth, windowHeight ), # minimum size (for resizing) maxSize = ( windowWidth + windowWidthResize, windowHeight + windowHeightResize ), # maximum size (for resizing) autosaveName = "com.mekkablue.FindOverkerns.mainwindow" # stores last window position and size ) # UI elements: self.w.text_1 = vanilla.TextBox( (15-1, 12+2, 220, 14), "Open tab with kerns beyond threshold:", sizeStyle='small' ) self.w.threshold = vanilla.EditText( (225, 12-1, -15, 20), "40", sizeStyle = 'small') self.w.text_2 = vanilla.TextBox( (15-1, 12+25, -15, 14), "(Maximum percentage of letter widths that may be kerned.)", sizeStyle='small' ) self.w.limitToExportingGlyphs = vanilla.CheckBox( (15, 12+50, 150, 20), "Limit to exporting glyphs", value=True, callback=self.SavePreferences, sizeStyle='small' ) # Run Button: self.w.runButton = vanilla.Button((-100-15, -20-15, -15, -15), "Open Tab", sizeStyle='regular', callback=self.FindOverkernsMain ) self.w.setDefaultButton( self.w.runButton ) # Load Settings: if not self.LoadPreferences(): print "Note: 'Find Overkerns' could not load preferences. Will resort to defaults" # Open window and focus on it: self.w.open() self.w.makeKey()