def __init__(self): windowWidth = 200 windowHeight = 270 # amount area self.w = vanilla.FloatingWindow((windowWidth, windowHeight), "AdjustMargins") self.w.amountText = vanilla.TextBox((15, 17, 65, 22), "Amount:", sizeStyle="small") self.w.amountTextBox = vanilla.EditText((70, 12, -15, 22)) # divider self.w.divider1 = vanilla.HorizontalLine((15, 48, -15, 1)) # glyphs scope area self.w.iconAllGlyphs = vanilla.ImageView((15, 65, 12, 13)) self.w.iconAllGlyphs.setImage(imagePath="../resources/allGlyphs.png") self.w.iconSelGlyphs = vanilla.ImageView((15, 91, 12, 13)) self.w.iconSelGlyphs.setImage( imagePath="../resources/selectedGlyphs.png") self.w.glyphsRadioGroup = vanilla.RadioGroup( (32, 60, -15, 50), ["All Glyphs", "Selected Glyphs"], sizeStyle="small") self.w.glyphsRadioGroup.set(1) # default to just selected glyphs # divider self.w.divider2 = vanilla.HorizontalLine((15, 121, -15, 1)) # margins area self.w.iconBothMargins = vanilla.ImageView((15, 137, 12, 12)) self.w.iconBothMargins.setImage( imagePath="../resources/bothMargins.png") self.w.iconLeftMargin = vanilla.ImageView((15, 161, 12, 12)) self.w.iconLeftMargin.setImage(imagePath="../resources/leftMargin.png") self.w.iconRightMargin = vanilla.ImageView((15, 185, 12, 12)) self.w.iconRightMargin.setImage( imagePath="../resources/rightMargin.png") self.w.marginSelectionGroup = vanilla.RadioGroup( (32, 133, -15, 70), ["Both Margins", "Left Margin Only", "Right Margin Only"], sizeStyle="small") self.w.marginSelectionGroup.set(0) # default both margins # divider self.w.divider3 = vanilla.HorizontalLine((15, 216, -15, 1)) # commit button self.w.commitButton = vanilla.Button( (15, 232, -15, 20), "Commit Adjustments", sizeStyle="small", callback=self.commitButtonCallback) self.w.open() # go go gadget window
def __init__( self ): windowWidth = 400 windowHeight = 280 self.w = vanilla.FloatingWindow( ( windowWidth, windowHeight ), # default window size "ALL YOUR @BASE BELONG TO US.", # window title autosaveName = "com.Tosche.BatchMetricKey.mainwindow" # stores last window position and size ) # UI elements: self.w.presetText = vanilla.TextBox( ( 12, 13, 55, 17), "Presets:", sizeStyle='regular' ) self.w.presetPopup = vanilla.PopUpButton( (14+58, 13, -15, 17), [str(x) for x in presets], callback=self.setField, sizeStyle='regular' ) self.w.keyTextField = vanilla.EditText( (14, 45, -15, 22), re.sub(" .*", "", presets[0]), sizeStyle = 'regular') self.w.setToText = vanilla.TextBox( ( 12, 78, 50, 17), "Set to:", sizeStyle='regular' ) self.w.applyL = vanilla.CheckBox( ( 12+50, 78, 50, 22), "Left", value=True, sizeStyle='regular') self.w.applyR = vanilla.CheckBox( ( 12+50+50, 78, 56, 22), "Right", value=True, sizeStyle='regular') self.w.avoidNest = vanilla.CheckBox( ( 275, 78, 115, 22), "Adoid Nesting", value=True, sizeStyle='regular') self.w.radioQText = vanilla.TextBox( ( 12, 115, 100, 17), "If there is Q:", sizeStyle='regular' ) self.w.radioQ = vanilla.RadioGroup( (100, 115, 350, 19), ["Use width of O (no key)", "Use RSB of Q"], sizeStyle='regular', isVertical=False) self.w.radioQ.set(0) self.w.line = vanilla.HorizontalLine((12, 190, -10, 1)) self.w.explain = vanilla.TextBox( ( 12, 200, 350, 80), "@base is a glyph without suffix of the selected glyph.\n@base of hsuperior is h\n@Base of a.smcp is A\[email protected] of one.numr is one.smcp", sizeStyle='regular' ) # Run Button: self.w.setButton = vanilla.Button((290, 145, 90, 34), "Set", sizeStyle='regular', callback=self.BatchMetricKeyMain ) self.w.setDefaultButton( self.w.setButton ) # Open window and focus on it: self.w.open() self.w.makeKey()
def __init__(self, tool, event, view): self.tool = tool self.drawingChoices = [RECT_MODE, OVAL_MODE, COMPONENT_MODE] self.view = vanilla.Group((0, 0, 0, 0)) self.view.gridText = vanilla.TextBox((10, 12, 100, 22), "Pixel Size:") self.view.gridInput = vanilla.EditText((120, 10, -10, 22), self.tool.size, callback=self.gridInputCallback) self.view.drawingMode = vanilla.RadioGroup((10, 40, -10, 100), self.drawingChoices, isVertical=True, callback=self.drawingModeCallback) if self.tool.drawingMode in self.drawingChoices: self.view.drawingMode.set(self.drawingChoices.index(self.tool.drawingMode)) self.view.componentName = vanilla.EditText((120, 113, -10, 22), self.tool.componentName, callback=self.drawingModeCallback) self.view.componentName.show(self.tool.drawingMode == COMPONENT_MODE) self.view.useGrid = vanilla.CheckBox((11, 145, -10, 22), "Use Grid", value=self.tool.useGrid, callback=self.drawingModeCallback) nsView = self.view.getNSView() nsView.setFrame_(NSMakeRect(0, 0, 195, 175)) menu = NSMenu.alloc().init() settingsItem = NSMenuItem.alloc().initWithTitle_action_keyEquivalent_("doodle.guideView", None, "") settingsItem.setView_(nsView) menu.addItem_(settingsItem) NSMenu.popUpContextMenu_withEvent_forView_(menu, event, view)
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 ): # Window 'self.w': x, y, p = self.padding txtH = 14 windowWidth = 350 windowHeight = 144 self.w = vanilla.FloatingWindow( ( windowWidth, windowHeight ), # default window size "Remove Detached Corners", # window title autosaveName = "com.mekkablue.RemoveDetachedCorners.mainwindow" # stores last window position and size ) # UI elements: self.w.backgroundLayersChBox = vanilla.CheckBox( (x, y, -p, txtH), "Apply to Background Layers", sizeStyle='small' ) y += p + txtH self.w.allMastersChBox = vanilla.CheckBox( (x, y, -p, txtH), "Apply to All Masters", sizeStyle='small' ) y += p + txtH self.w.fromWhere = vanilla.RadioGroup((x, y, -p, 40), [ "from all selected glyphs", "from all glyphs in the font" ], callback=self.SavePreferences, sizeStyle = 'small' ) self.w.fromWhere.set( 0 ) y += p + 40 # Run Button: self.w.runButton = vanilla.Button((x+220, y, -p, 22), "Remove", sizeStyle='regular', callback=self.removeDetachedCornersMain ) self.w.setDefaultButton( self.w.runButton ) # Load Settings: if not self.LoadPreferences(): print("Note: 'Remove Detached Corners' 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': textY = 19 spaceX = 10 spaceY = 10 buttonX = 90 buttonY = 20 windowWidth = spaceX*4+buttonX*3 windowHeight = spaceY*6+textY*2+buttonY self.w = vanilla.FloatingWindow( ( windowWidth, windowHeight ), # default window size "Set Kerning Groups", # window title ) self.w.textLower = vanilla.TextBox((spaceX, spaceY, 200, textY), "Lowercase style?", sizeStyle='regular') self.w.normalButton = vanilla.Button((spaceX, spaceY*2+textY, buttonX, buttonY), "Normal", sizeStyle='regular', callback=self.SetKernPairsMain ) self.w.cursiveButton = vanilla.Button((spaceX*2+buttonX, spaceY*2+textY, buttonX, buttonY), "Cursive", sizeStyle='regular', callback=self.SetKernPairsMain ) self.w.allcapButton = vanilla.Button((spaceX*3+buttonX*2, spaceY*2+textY, buttonX, buttonY), "All Cap", sizeStyle='regular', callback=self.SetKernPairsMain ) self.w.line = vanilla.HorizontalLine((spaceX, spaceX*4+textY*2, -spaceX, 1)) self.w.radioButton = vanilla.RadioGroup((spaceX, spaceY*5+textY*2, 300, textY), ["All Glyphs", "Selected Glyphs"], sizeStyle='regular', isVertical=False) # Open window and focus on it: self.w.open() self.w.radioButton.set(0) self.w.makeKey()
def __init__( self ): # Window 'self.w': windowWidth = 350 windowHeight = 130 windowWidthResize = 200 # 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 Component from Selected Glyphs", # window title minSize = ( windowWidth, windowHeight ), # minimum size (for resizing) maxSize = ( windowWidth + windowWidthResize, windowHeight + windowHeightResize ), # maximum size (for resizing) autosaveName = "com.mekkablue.RemoveComponentfromSelectedGlyphs.mainwindow" # stores last window position and size ) # UI elements: self.w.text1 = vanilla.TextBox( (15, 12+3, 130, 14), "Remove component", sizeStyle='small' ) self.w.componentName = vanilla.ComboBox((15+130, 12, -15, 19), self.glyphList(), sizeStyle='small' ) self.w.fromWhere = vanilla.RadioGroup((15, 40, -15, 40), [ "from all selected glyphs", "from all glyphs in the font" ], callback=self.SavePreferences, sizeStyle = 'small' ) self.w.fromWhere.set( 0 ) # Run Button: self.w.runButton = vanilla.Button((-100-15, -20-15, -15, -15), "Remove", sizeStyle='regular', callback=self.RemoveComponentfromSelectedGlyphsMain ) self.w.setDefaultButton( self.w.runButton ) # Load Settings: if not self.LoadPreferences(): print("Note: 'Remove Component from Selected 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': edY = 22 txY = 17 sp = 10 btnX = 100 btnY = 22 windowWidth = 300 windowHeight = sp*5+edY*2+edY+btnY+sp # 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 "Search Glyph In Class Features", # window title # minSize = ( windowWidth, windowHeight ), # minimum size (for resizing) # maxSize = ( windowWidth, windowHeight ), # maximum size (for resizing) autosaveName = "com.Tosche.SearchGlyphInClassFeatures.mainwindow" # stores last window position and size ) listOfOptions = [ "Check which alternates are unused", "Check if/where the selected glyph is used", "Same as the above, but by name" ] self.w.radioButtons = vanilla.RadioGroup( (sp, sp, -sp, edY*len(listOfOptions) ), listOfOptions, sizeStyle = 'regular', callback=self.radio ) self.w.edit_1 = vanilla.EditText( (sp+20, sp*1.5+edY*len(listOfOptions), -sp, edY), "", sizeStyle = 'regular') # Run Button: self.w.runButton = vanilla.Button((-sp-btnX, sp*5+edY*2+edY, -sp, btnY), "Check", sizeStyle='regular', callback=self.Search ) self.w.setDefaultButton( self.w.runButton ) # Open window and focus on it: self.w.radioButtons.set( 0 ) self.w.edit_1.enable(False) self.w.open() self.w.makeKey()
def __init__( self ): windowWidth = 240 windowHeight = 560 windowWidthResize = 0 # 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 "Start-from-scratch", # window title minSize = ( windowWidth, windowHeight ), # minimum size (for resizing) maxSize = ( windowWidth + windowWidthResize, windowHeight + windowHeightResize ), # maximum size (for resizing) autosaveName = "com.pedroarilla.StartFromScratch.mainwindow" # stores last window position and size ) # UI elements: self.w.text_1 = vanilla.TextBox( (15, 20*1, -15, 20), "Delete:", sizeStyle='regular' ) self.w.cleanAnchors = vanilla.CheckBox( (15, 20*2+10, -15, 20), "Anchors", value=False, callback=self.SavePreferences, sizeStyle='regular' ) self.w.cleanAnnotations = vanilla.CheckBox( (15, 20*3+10, -15, 20), "Annotations", value=False, callback=self.SavePreferences, sizeStyle='regular' ) self.w.cleanBackgrounds = vanilla.CheckBox( (15, 20*4+10, -15, 20), "Backgrounds", value=False, callback=self.SavePreferences, sizeStyle='regular' ) self.w.cleanGuidelines = vanilla.CheckBox( (15, 20*5+10, -15, 20), "Guidelines", value=False, callback=self.SavePreferences, sizeStyle='regular' ) self.w.cleanImages = vanilla.CheckBox( (15, 20*6+10, -15, 20), "Images", value=False, callback=self.SavePreferences, sizeStyle='regular' ) self.w.cleanKerning = vanilla.CheckBox( (15, 20*7+10, -15, 20), "Kerning groups", value=False, callback=self.SavePreferences, sizeStyle='regular' ) self.w.cleanLabels = vanilla.CheckBox( (15, 20*8+10, -15, 20), "Labels", value=False, callback=self.SavePreferences, sizeStyle='regular' ) self.w.cleanMetrics = vanilla.CheckBox( (15, 20*9+10, -15, 20), "Metric keys", value=False, callback=self.SavePreferences, sizeStyle='regular' ) self.w.cleanLayers = vanilla.CheckBox( (15, 20*10+10, -15, 20), "Non-master layers", value=False, callback=self.SavePreferences, sizeStyle='regular' ) self.w.cleanPaths = vanilla.CheckBox( (15, 20*11+10, -15, 20), "Paths and components", value=False, callback=self.SavePreferences, sizeStyle='regular' ) self.w.text_2 = vanilla.TextBox( (15, 20*13, -15, 20), "Apply to glyphs:", sizeStyle='regular' ) self.w.applyToGlyphs = vanilla.RadioGroup( (35, 20*14+10, -15, 20*2), ["Only selected glyphs", "All the glyphs in font"], isVertical = True, sizeStyle='regular', callback=self.SavePreferences ) self.w.text_3 = vanilla.TextBox( (15, 20*17, -15, 20), "Apply to masters:", sizeStyle='regular' ) self.w.applyToMasters = vanilla.RadioGroup( (35, 20*18+10, -15, 20*2), ["Only selected master", "All the masters"], isVertical = True, sizeStyle='regular', callback=self.SavePreferences ) self.w.text_4 = vanilla.TextBox( (15, 20*21, -15, 20), "Apply to layers:", sizeStyle='regular' ) self.w.applyToLayers = vanilla.RadioGroup( (35, 20*22+10, -15, 20*2), ["Only master layers", "All the layers"], isVertical = True, sizeStyle='regular', callback=self.SavePreferences ) # Run Button: self.w.runButton = vanilla.Button( (-240+15, -20-15, -15, -15), "Are you sure? START!", sizeStyle='regular', callback=self.StartFromScratchMain ) self.w.setDefaultButton( self.w.runButton ) # Load Settings: if not self.LoadPreferences(): print("Note: 'Start-from-scratch' could not load preferences. Will resort to defaults") # Open window and focus on it: self.w.open() self.w.makeKey()
def __init__(self): addObserver(self, "_curvePreview", "draw") addObserver(self, "_curvePreview", "drawInactive") addObserver(self, "_currentGlyphChanged", "currentGlyphChanged") self.methods = { 0: "fl", 4: "free", } self.methodNames = [ "Tension:" ] height = 80 self.w = vanilla.FloatingWindow((300, height), "Hobby's Spline") y = -200 self.w.hobbyMethodSelector = vanilla.RadioGroup((10, y, -10, 108), titles = "Circle", callback=self._changeMethod, sizeStyle="small" ) y = 10 self.w.HobbySlider = Slider((15, y, -15, 25), tickMarkCount=4, callback=self._changetension, minValue=0.5, maxValue=1.0, sizeStyle="small", continuous=True ) y = height - 32 self.w.hobbycurveButton = vanilla.Button((60, y , -60, 25), "transform selected curves", callback=self._hobbycurve, sizeStyle="small", ) self.w.hobbyMethodSelector.set(getExtensionDefault("%s.%s" %(extensionID, "method"), 0)) self.method = self.methods[self.w.hobbyMethodSelector.get()] self._checkSecondarySelectors() self.w.HobbySlider.set(getExtensionDefault("%s.%s" %(extensionID, "tension"), 0.5)) self.tension = self.w.HobbySlider.get() self.tmp_glyph = RGlyph() UpdateCurrentGlyphView() self.setUpBaseWindowBehavior() self.w.open()
def __init__(self, parent): self.parent = parent self.w = vanilla.FloatingWindow( (150, 130), "Speed Punk %s" % VERSION, closable=False, autosaveName='de.yanone.speedPunk.%s.prefWindow' % (environment), ) from AppKit import NSHUDWindowMask, NSUtilityWindowMask, NSTitledWindowMask, NSBorderlessWindowMask self.w.getNSWindow().setStyleMask_(0 << 1 | 0 << 2 | NSUtilityWindowMask | NSTitledWindowMask | NSBorderlessWindowMask) self.w.illustrationPositionRadioGroup = vanilla.RadioGroup( (10, 10, -10, 40), ["Outside of glyph", "Outer side of curve"], callback=self.radioGroupCallback, sizeStyle="small") self.w.curveGainTextBox = vanilla.TextBox((10, 60, -10, 17), "Gain", sizeStyle="mini") self.w.curveGainSlider = vanilla.Slider( (10, 70, -10, 25), tickMarkCount=5, callback=self.curveGainSliderCallback, sizeStyle="small", minValue=curveGain[0], maxValue=curveGain[1], value=self.parent.getPreference('curveGain')) if self.parent.getPreference( 'illustrationPosition') == "outsideOfGlyph": self.w.illustrationPositionRadioGroup.set(0) if self.parent.getPreference( 'illustrationPosition') == "outsideOfCurve": self.w.illustrationPositionRadioGroup.set(1) self.w.faderCheckBox = vanilla.CheckBox( (10, 100, -10, 17), "Fader", sizeStyle="small", callback=self.faderCheckBoxCallback) self.w.faderSlider = vanilla.Slider( (10, 125, -10, 25), sizeStyle="small", minValue=0, maxValue=1.0, value=1.0, callback=self.faderSliderCallback, ) self.w.gradientImage = vanilla.ImageView((10, 150, -10, 15)) self.w.histogramImage = vanilla.ImageView((10, 150, -10, 15))
def __init__(self): windowWidth = 200 windowHeight = 240 self.w = vanilla.FloatingWindow((50, 50, windowWidth, windowHeight), "CopySidebearings") self.fonts = [(makeDefaultIDString(font), font) for font in AllFonts()] fontNames = [i[0] for i in self.fonts] # dropdowns self.w.sourceUFOText = vanilla.TextBox((15, 15, 90, 22), "Source UFO:", sizeStyle="small") self.w.sourceUFODropDown = vanilla.PopUpButton((15, 30, 170, 20), fontNames) self.w.sourceUFODropDown.set(0) self.w.destinationUFOText = vanilla.TextBox((15, 60, 90, 22), "Destination UFO:", sizeStyle="small") self.w.destinationUFODropDown = vanilla.PopUpButton((15, 75, 170, 20), fontNames) self.w.destinationUFODropDown.set(1) # divider self.w.divider1 = vanilla.HorizontalLine((15, 108, -15, 1)) # glyphs scope area self.w.iconAllGlyphs = vanilla.ImageView((15, 123, 12, 13)) self.w.iconAllGlyphs.setImage(imagePath="../resources/allGlyphs.png") self.w.iconSelGlyphs = vanilla.ImageView((15, 149, 12, 13)) self.w.iconSelGlyphs.setImage( imagePath="../resources/selectedGlyphs.png") self.w.glyphsRadioGroup = vanilla.RadioGroup( (32, 118, -15, 50), ["All Glyphs", "Selected Glyphs"], sizeStyle="small") self.w.glyphsRadioGroup.set(0) # default to all glyphs # divider self.w.divider2 = vanilla.HorizontalLine((15, 176, -15, 1)) # commit button self.w.commitButton = vanilla.Button( (15, 188, -15, 20), "Copy Sidebearings", sizeStyle="small", callback=self._commitButtonCallback) # note self.w.note = vanilla.TextBox((15, 215, -15, 15), "Open output window for results.", sizeStyle="mini", alignment="center") self.w.open() # go go gadget window
def __init__(self): if lang=="ja": posX= 10 else: posX= 21 self.w = vanilla.FloatingWindow((120, 28), Direction, autosaveName="com.tama-san.SwitchDirection.mainwindow") self.w.radioGroup1 = vanilla.RadioGroup((posX, 0, -10, 28), [H, V], isVertical=False, callback=self.switchAction) self.setButtonSelecion() self.w.open()
def __init__(self): # Window 'self.w': editX = 180 editY = 22 textY = 17 spaceX = 10 spaceY = 10 windowWidth = spaceX * 3 + editX * 2 + 85 windowHeight = 150 self.w = vanilla.FloatingWindow( (windowWidth, windowHeight), # default window size "Rename Kerning Groups", # window title minSize=(windowWidth, windowHeight), # minimum size (for resizing) maxSize=(windowWidth + 100, windowHeight), # maximum size (for resizing) autosaveName= "com.Tosche.RenameKerningGroups.mainwindow" # stores last window position and size ) # UI elements: self.w.radio = vanilla.RadioGroup((spaceX + 130, spaceY, 120, textY), ["Left", "Right"], isVertical=False, sizeStyle='regular', callback=self.switchList) self.w.radio.set(0) self.w.text1 = vanilla.TextBox( (spaceX, spaceY * 2 + textY, 120, textY), "Rename this Group", sizeStyle='regular') self.w.text2 = vanilla.TextBox( (spaceX, spaceY * 3 + editY + textY, 120, textY), "to this", sizeStyle='regular') self.w.popup = vanilla.PopUpButton( (spaceX + 130, spaceY * 2 + textY, -15, editY), [str(x) for x in sorted(groupsL)], sizeStyle='regular') self.w.newName = vanilla.EditText( (spaceX + 130, spaceY * 3 + editY + textY, -15, editY), "", sizeStyle='regular') # Run Button: self.w.runButton = vanilla.Button( (-80 - 15, spaceY * 4 + editY * 3, -15, -15), "Run", sizeStyle='regular', callback=self.RenameKerningGroupsMain) self.w.setDefaultButton(self.w.runButton) # Open window and focus on it: self.w.open() self.w.makeKey()
def __init__(self): global can_display_ui if not can_display_ui: return try: import vanilla except ImportError: Message(message=("Please install vanilla to enable UI dialogs for " "Master Grid. You can install vanilla through " "Glyphs > Preferences > Addons > Modules."), title="Missing Module") can_display_ui = False return self.w = vanilla.Window( (220, 160), "Master Grid", ) y = 8 self.w.master_name = vanilla.TextBox( (8, y, -8, 35), "Set local grid for master:\nNone") y += 46 x = 8 self.w.label_x = vanilla.TextBox((x, y, 30, 17), "X:") self.w.x = vanilla.EditText((x + 22, y - 3, 40, 24)) x = 88 self.w.label_y = vanilla.TextBox((x, y, 30, 17), "Y:") self.w.y = vanilla.EditText((x + 22, y - 3, 40, 24)) y += 28 self.w.grid_type_label = vanilla.TextBox((8, y, 66, 17), "Grid is in:") self.w.grid_type = vanilla.RadioGroup( (74, y, -8, 40), ["Absolute font units", "UPM subdivision"], isVertical=True, ) self.w.button_delete = vanilla.Button( (10, -30, 102, -10), "Remove Grid", callback=self.callback_delete, ) self.w.button_set = vanilla.Button( (118, -30, 74, -10), "Set Grid", callback=self.callback_set, ) self.update() 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': 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): self.w = vanilla.FloatingWindow((200, 120), "Sidebearings EQ") self.w.iconAll = vanilla.ImageView((15, 16, 13, 10)) self.w.iconAll.setImage(imagePath="allglyphs.png") self.w.iconSelected = vanilla.ImageView((15, 43, 13, 10)) self.w.iconSelected.setImage(imagePath="selectedglyphs.png") self.w.scopeRadioGroup = vanilla.RadioGroup( (35, 10, -15, 50), ["All Glyphs", "Selected Glyphs"], sizeStyle="small") self.w.scopeRadioGroup.set(1) self.w.divider1 = vanilla.HorizontalLine((15, 70, -15, 1)) self.w.applyButton = vanilla.Button((15, 85, -15, 20), "Equalize Sidebearings", sizeStyle="small", callback=self.applyButtonCallback) self.w.open()
def __init__( self ): # Window 'self.w': edY = 22 txY = 17 sp = 10 btnX = 120 btnY = 20 windowWidth = 430 windowHeight = sp*8+edY*3+txY*2+btnY+20 windowWidthResize = 600 # 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 "Permutation Text Generator", # window title minSize = ( windowWidth, windowHeight ), # minimum size (for resizing) maxSize = ( windowWidth + windowWidthResize, windowHeight + windowHeightResize ), # maximum size (for resizing) autosaveName = "com.Tosche.PermutationTextGenerator.mainwindow" # stores last window position and size ) # UI elements: self.w.text_A = vanilla.TextBox( (sp, sp+2, 70, txY), "List A", sizeStyle='regular' ) self.w.edit_A = vanilla.EditText( (sp*2+70, sp, -15, edY), "", sizeStyle = 'small') self.w.text_C = vanilla.TextBox( (sp, sp*2+edY+2, 70, txY), "between c", sizeStyle='regular' ) self.w.edit_C = vanilla.EditText( (sp*2+70, sp*2+edY, -15, edY), "", sizeStyle = 'small') self.w.text_B = vanilla.TextBox( (sp, sp*3+edY*2+2, 70, txY), "List B", sizeStyle='regular' ) self.w.edit_B = vanilla.EditText( (sp*2+70, sp*3+edY*2, -15, edY), "", sizeStyle = 'small') self.w.text_3 = vanilla.TextBox( (sp, sp*4+edY*3, 85, txY), "Pattern:", sizeStyle='regular' ) self.w.radio = vanilla.RadioGroup((sp*2+70, sp*4+edY*3, 320, txY), ["BABABAB", "AcB AcB AcB", "BcA BcA BcA"], isVertical = False, sizeStyle='regular', callback=self.dupeControl) self.w.edit_3 = vanilla.EditText( (sp*2+70, sp*5+edY*3+txY-2, 40, edY), "0", sizeStyle = 'regular') self.w.text_4 = vanilla.TextBox( (sp*2+115, sp*5+edY*3+txY, 200, txY), "pairs per line", sizeStyle='regular' ) self.w.dupe = vanilla.CheckBox( (sp*3+210, sp*5+edY*3+txY, 200, txY), "Remove Duplicates", sizeStyle='regular', value=False) # Run Button: self.w.outputButton = vanilla.Button((sp*2+70, -sp*2-btnY, btnX, btnY), "Macro Panel", sizeStyle='regular', callback=self.Main ) self.w.viewButton = vanilla.Button((sp*3+70+btnX, -sp*2-btnY, btnX, btnY), "Edit View", sizeStyle='regular', callback=self.Main ) self.w.setDefaultButton( self.w.viewButton ) # Load Settings: if not self.LoadPreferences(): print("Note: 'Permutation Text Generator' could not load preferences. Will resort to defaults") # Open window and focus on it: self.w.open() self.w.makeKey() self.dupeControl(self.w.radio)
def __init__(self): windowWidth = 240 windowHeight = 200 windowWidthResize = 0 # 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 "Set default figures", # window title minSize=(windowWidth, windowHeight), # minimum size (for resizing) maxSize=(windowWidth + windowWidthResize, windowHeight + windowHeightResize), # maximum size (for resizing) autosaveName= "com.pedroarilla.setDefaultFigures.mainwindow" # stores last window position and size ) # UI elements: self.w.text = vanilla.TextBox((15, 20, -15, 20), "Choose set of figures:", sizeStyle='regular') self.w.optionFigures = vanilla.RadioGroup( (35, 50, -15, 20 * 4), [ "Lining figures", "Old style figures", "Tabular lining figures", "Tabular old style figures" ], isVertical=True, sizeStyle='regular', callback=self.SavePreferences) # Run Button: self.w.runButton = vanilla.Button((-240 + 15, -20 - 15, -15, -15), "Set default figures", sizeStyle='regular', callback=self.setDefaultFiguresMain) self.w.setDefaultButton(self.w.runButton) # Load Settings: if not self.LoadPreferences(): print( "Note: 'Set default figures' could not load preferences. Will resort to defaults" ) # Open window and focus on it: self.w.open() self.w.makeKey()
def __init__( self ): global presets try: fd = codecs.open('MasterBlaster-presets.txt','r',encoding='utf-8') data = fd.read() presets = data.split("\n") except: # if txt file doesn't load presets = [ u"arrowroot,barley,chervil,dumpling,endive,flaxseed,garbanzo,hijiki,ishtu,jicama,kale,lychee,marjioram,nectarine,oxtail,pizza,quinoa,roquefort,squash,tofu,uppuma,vanilla,wheat,xergis,yogurt,zweiback", u"Arrowroot,Barley,Chervil,Dumpling,Endive,Flaxseed,Garbanzo,Hijiki,Ishtu,Jicama,Kale,Lychee,Marjioram,Nectarine,Oxtail,Pizza,Quinoa,Roquefort,Squash,Tofu,Uppuma,Vanilla,Wheat,Xergis,Yogurt,Zweiback", u"ARROWROOT,BARLEY,CHERVIL,DUMPLING,ENDIVE,FLAXSEED,GARBANZO,HIJIKI,ISHTU,JICAMA,KALE,LYCHEE,MARJIORAM,NECTARINE,OXTAIL,PIZZA,QUINOA,ROQUEFORT,SQUASH,TOFU,UPPUMA,VANILLA,WHEAT,XERGIS,YOGURT,ZWEIBACK", "00000,00100,00200,00300,00400,00500,00600,00700,00800,00900" ] wlist = "" windowWidth = 340 windowHeight = 380 self.w = vanilla.FloatingWindow( ( windowWidth, windowHeight ), # default window size "MasterBlaster", # window title autosaveName = "com.LNP.MasterBlaster.mainwindow" # stores last window position and size ) self.w.titleCustom = vanilla.TextBox((20, 15, -10, 17), "Comma separated list:") self.w.inputCustom = vanilla.EditText( (20, 45, 300, 20), "", sizeStyle = 'small') self.w.titlePreset = vanilla.TextBox((20, 75, -10, 17), "OR Select preset from local txt file:") self.w.presets = vanilla.List((20, 105, 305, 180), presets, doubleClickCallback=self.GoDblC, autohidesScrollers = False, allowsEmptySelection = True, showColumnTitles=True) self.w.radioGroup = vanilla.RadioGroup((20, 285, 250, 40),["Stacked", "Side-by-side"],isVertical = False, sizeStyle='regular') self.w.runButton = vanilla.Button((20, 330, 120, 30), "List as Masters", sizeStyle='regular', callback=self.GoButton ) self.w.radioGroup.set(1) # Load Settings: if not self.LoadP(): print("Could not load preferences. Will resort to defaults") self.w.open() self.w.makeKey()
def __init__(self): self.w = vanilla.Window( (300, 160), "Master Grid", ) y = 8 self.w.master_name = vanilla.TextBox((8, y, -8, 17), "Set local grid for master: None") y += 28 x = 8 self.w.label_x = vanilla.TextBox((x, y, 30, 17), "X:") self.w.x = vanilla.EditText((x + 22, y - 3, 40, 24)) x = 88 self.w.label_y = vanilla.TextBox((x, y, 30, 17), "Y:") self.w.y = vanilla.EditText((x + 22, y - 3, 40, 24)) y += 32 self.w.grid_type_label = vanilla.TextBox((8, y, 66, 17), "Grid is in:") self.w.grid_type = vanilla.RadioGroup( (74, y, -8, 40), ["Absolute font units", "UPM subdivision"], isVertical=True, ) self.w.button_cancel = vanilla.Button( (-272, -30, -204, -10), "Cancel", callback=self.callback_cancel, ) self.w.button_delete = vanilla.Button( (-196, -30, -92, -10), "Remove Grid", callback=self.callback_delete, ) self.w.button_set = vanilla.Button( (-84, -30, -8, -10), "Set Grid", callback=self.callback_set, ) self.update() self.w.open() self.w.makeKey()
def __init__(self): self.w = vanilla.FloatingWindow((175, 235), "Warp Starter") step = 10 self.w.decomposeAllButton = vanilla.SquareButton( (10, step, -10, 25), "Decomp/Deoverlap All", sizeStyle="small", callback=self.doDecompose) self.w.decomposeAllButton.id = "all" step += 30 self.w.decomposeSomeButton = vanilla.SquareButton( (10, step, -10, 25), "Decomp/Deverlap Mixed", sizeStyle="small", callback=self.doDecompose) self.w.decomposeSomeButton.id = "mixed" step += 30 self.w.curveButton = vanilla.SquareButton((10, step, -10, 25), "Flat to Curve Segments", sizeStyle="small", callback=self.doCurve) step += 30 self.w.warpHButton = vanilla.SquareButton((10, step, -10, 25), "AutoWarp H", sizeStyle="small", callback=self.doWarp) step += 24 self.w.warpHButton.id = "H" self.w.warpHVButton = vanilla.SquareButton((10, step, -10, 25), "AutoWarp H&V", sizeStyle="small", callback=self.doWarp) self.w.warpHVButton.id = "HV" step += 30 self.w.warpAngle = vanilla.EditText((10, step, 58, 25), "-35") self.w.floatDist = vanilla.EditText((72, step, 58, 25), "120") step += 35 self.w.selectionChoice = vanilla.RadioGroup( (10, step, -10, 35), ["Current Glyph", "Selected Glyphs"], sizeStyle="small") self.w.selectionChoice.set(0) self.w.open()
def __init__(self): self.methods = { 0: "fl", 1: "thirds", 2: "quad", 3: "adjust", 4: "free", } self.methodNames = [ "Circle", "Rule of thirds", "TT (experimental)", "Adjust fixed:", "Adjust free:" ] self.curvatures = { 0: 0.552, 1: 0.577, 2: 0.602, 3: 0.627, 4: 0.652, } height = 160 self.w = vanilla.FloatingWindow((200, height), "Curve EQ") y = 8 self.w.eqMethodSelector = vanilla.RadioGroup( (10, y, -10, 108), titles=self.methodNames, callback=self._changeMethod, sizeStyle="small") y -= 91 self.w.eqCurvatureSelector = vanilla.RadioGroup( (104, y, -8, 14), isVertical=False, titles=["", "", "", "", ""], callback=self._changeCurvature, sizeStyle="small") y += 22 self.w.eqCurvatureSlider = vanilla.Slider( (104, y, -8, 14), callback=self._changeCurvatureFree, minValue=0.5, maxValue=1.0, #value=self.curvatures[self.w.eqCurvatureSelector.get()], sizeStyle="small", ) y = height - 32 self.w.eqSelectedButton = vanilla.Button( (10, y, -10, 25), "Equalize selected", callback=self._eqSelected, sizeStyle="small", ) # default method self.w.eqMethodSelector.set( getExtensionDefault("%s.%s" % (extensionID, "method"), 0)) self.method = self.methods[self.w.eqMethodSelector.get()] self._checkSecondarySelectors() # default curvature self.w.eqCurvatureSelector.set( getExtensionDefault("%s.%s" % (extensionID, "curvature"), 0)) self.curvature = self.curvatures[self.w.eqCurvatureSelector.get()] # default curvature for slider self.w.eqCurvatureSlider.set( getExtensionDefault("%s.%s" % (extensionID, "curvatureFree"), 0.5)) self.curvatureFree = self.w.eqCurvatureSlider.get() addObserver(self, "_curvePreview", "draw") #addObserver(self, "_curvePreview", "drawPreview") addObserver(self, "_curvePreview", "drawInactive") addObserver(self, "_currentGlyphChanged", "currentGlyphChanged") self.tmpGlyph = RGlyph() UpdateCurrentGlyphView() self.setUpBaseWindowBehavior() self.w.open()
def __init__(self): # Window 'self.w': editX = 180 editY = 22 textY = 17 spaceX = 10 spaceY = 10 buttonSizeX = 60 windowWidth = spaceX * 3 + editX * 2 + 85 windowHeight = 260 self.w = vanilla.FloatingWindow( (windowWidth, windowHeight), # default window size "Copy Kerning Pairs", # window title autosaveName= "com.Tosche.CopyKerningPairs.mainwindow" # stores last window position and size ) # UI elements: self.w.tabs = vanilla.Tabs((10, 10, -10, -20 - 30), ["Pair", "Preset"]) tab1 = self.w.tabs[0] tab1.text0 = vanilla.TextBox((spaceX, 0, 260, textY), "Copy the kerning pair between...", sizeStyle='regular') tab1.editL0 = vanilla.EditText((spaceX, spaceY + textY, editX, editY), "", sizeStyle='regular', callback=self.checkField) tab1.editR0 = vanilla.EditText( (spaceX * 3 + editX + 20, spaceY + textY, editX, editY), "", sizeStyle='regular', callback=self.checkField) tab1.checkL0 = vanilla.TextBox( (spaceX + editX + 5, spaceY + textY + 2, 40, textY), u"Any", sizeStyle='regular') tab1.checkR0 = vanilla.TextBox( (spaceX * 3 + editX * 2 + 25, spaceY + textY + 2, 40, textY), u"Any", sizeStyle='regular') tab1.text1 = vanilla.TextBox( (spaceX, spaceY * 2 + textY + editY, 200, textY), "...to this pair", sizeStyle='regular') tab1.editL1 = vanilla.EditText( (spaceX, spaceY * 3 + textY * 2 + editY, editX, editY), "", sizeStyle='regular', callback=self.checkField) tab1.editR1 = vanilla.EditText( (spaceX * 3 + editX + 20, spaceY * 3 + textY * 2 + editY, editX, editY), "", sizeStyle='regular', callback=self.checkField) tab1.checkL1 = vanilla.TextBox( (spaceX + editX + 5, spaceY * 3 + textY * 2 + editY + 2, 40, textY), u"Any", sizeStyle='regular') tab1.checkR1 = vanilla.TextBox( (spaceX * 3 + editX * 2 + 25, spaceY * 3 + textY * 2 + editY + 2, 40, textY), u"Any", sizeStyle='regular') tab1.text2 = vanilla.TextBox( (spaceX, spaceY * 5 + textY * 3 + editY, 400, textY * 2), "Groups will be automatically detected.\nYou can also type group name with @ prefix (e.g. @A)", sizeStyle='regular') tab2 = self.w.tabs[1] tab2.radio = vanilla.RadioGroup((spaceX, 2, 80, 78), ["Letter", "Numeral"], isVertical=True, sizeStyle='regular', callback=self.checkRadio) tab2.popLetter = vanilla.PopUpButton((spaceX + 100, spaceY, 320, 20), [ "Caps to Small Caps", "Caps & Lowercase to Superscript", "Caps & Lowercase to Subscript", "Cap to Lowercase", "Punctuation to Small Caps" ], sizeStyle='regular') tab2.popNum1 = vanilla.PopUpButton( (spaceX + 100, spaceY + 40, 140, 20), [ "Lining Proportional", "Small Cap", "Numerator", "Denominator", "Superscript", "Subscript", "Default" ], sizeStyle='regular') tab2.popNum2 = vanilla.PopUpButton( (spaceX + 100 + 180, spaceY + 40, 140, 20), [ "Lining Proportional", "Small Cap", "Numerator", "Denominator", "Superscript", "Subscript", "Default" ], sizeStyle='regular') tab2.textTo = vanilla.TextBox( (spaceX + 100 + 151, spaceY + 40, 20, textY), "to", sizeStyle='regular') tab2.textScale = vanilla.TextBox((spaceX, spaceY + 80, 100, textY), "Scale\t\t%", sizeStyle='regular') tab2.editScale = vanilla.EditText( (spaceX + 40, spaceY + 77, 40, editY), '100', sizeStyle='regular') tab2.textSkip = vanilla.TextBox( (spaceX + 120, spaceY + 80, 400, textY), "Ignore pair values smaller than units", sizeStyle='regular') tab2.editSkip = vanilla.EditText( (spaceX + 321, spaceY + 77, 30, editY), '10', sizeStyle='regular') tab2.textNote = vanilla.TextBox( (spaceX, spaceY * 3 + textY + 76, 360, textY * 2), "It only copies pairs between the groups.\nBut regular punctuations and symbols are taken care of.", sizeStyle='regular') # Common: self.w.allMaster = vanilla.CheckBox((spaceX, -20 - 15, 100, -15), "All masters", sizeStyle='regular') self.w.runButton = vanilla.Button((-80 - 15, -20 - 15, -15, -15), "Run", sizeStyle='regular', callback=self.CopyKerningPairsMain) # Load Settings: if not self.LoadPreferences(): print "Note: 'Copy Kerning Pairs' could not load preferences. Will resort to defaults" # Open window and focus on it: self.w.open() tab2.radio.set(0) tab2.popNum1.enable(False) tab2.popNum2.enable(False) self.w.makeKey()
def __init__(self): self.w = vanilla.FloatingWindow( (310, 264 + 28), Make_Rect_Path, autosaveName="com.tama-san.MakeRectPath.mainwindow") self.w.bind("should close", self.savePreferences) self.w.label1 = vanilla.TextBox((0, 18, 122, 20), Target_Glyph, alignment="right") self.w.radioTarget = vanilla.RadioGroup((125, 18, -10, 20), [Selection, All], isVertical=False) self.w.radioTarget.set(0) self.w.label2 = vanilla.TextBox((0, 46, 122, 20), Rectangle_Type, alignment="right") self.w.radioType = vanilla.RadioGroup((125, 46, -10, 20), [White, Black], isVertical=False, callback=self.changeTypeAction) self.w.radioType.set(0) self.w.label3 = vanilla.TextBox((0, 75, 122, 22), Line_Width, alignment="right", sizeStyle='small') self.w.fieldLineWidth = ArrowEditText( (125, 70, 50, 22), "10", continuous=True, callback=self.changeLineWidthAction) self.w.label4 = vanilla.TextBox((0, 102, 122, 20), Rectangle_Size, alignment="right") self.w.radioSize = vanilla.RadioGroup((125, 102, -10, 20), [Body, Bounds], isVertical=False, callback=self.changeSizeAction) self.w.radioSize.set(0) self.w.label5 = vanilla.TextBox((0, 130, 122, 22), Offset_Value, alignment="right", sizeStyle='small') self.w.fieldOffset = ArrowEditText((125, 125, 50, 22), "0", continuous=True) self.w.checkMetricV = vanilla.CheckBox((125, 150, -0, 22), Reflect_MetricV, sizeStyle='small') self.w.checkEmpty = vanilla.CheckBox((20, 186, -0, 20), Empty_the_glyph) self.w.checkCorrect = vanilla.CheckBox((20, 186 + 28, -0, 20), Correct_path_direction) self.w.button1 = vanilla.Button((-95, -40, 80, 20), Run, callback=self.runButtonAction) #### self.readPreferences() #### self.w.open() # remove focus self.w.getNSWindow().endEditingFor_( self.w.fieldLineWidth.getNSTextField())
def __init__(self): self.w = vanilla.FloatingWindow( (360, 350), "Insert weight instances", minSize=(360, 350), maxSize=(360, 500), autosaveName="com.mekkablue.InstanceMaker.mainwindow") self.w.text_1 = vanilla.TextBox((15 - 1, 12 + 2, 75, 14), "Insert", sizeStyle='small') self.w.numberOfInstances = vanilla.PopUpButton( (15 + 40, 12, 50, 17), [str(x) for x in range(3, 12)], callback=self.UpdateSample, sizeStyle='small') self.w.text_2 = vanilla.TextBox((15 + 40 + 55, 12 + 2, 120, 14), "instances with prefix", sizeStyle='small') self.w.prefix = vanilla.EditText((15 + 40 + 55 + 120, 12 - 1, -15, 19), "A-", callback=self.UpdateSample, sizeStyle='small') self.w.text_3 = vanilla.TextBox((15 - 1, 40 + 2, 60, 14), "from:", sizeStyle='small') self.w.master1 = vanilla.ComboBox((15 + 40, 40 - 1, 50, 19), self.MasterList(1), callback=self.UpdateSample, sizeStyle='small') self.w.text_4 = vanilla.TextBox((15 + 40 + 55, 40 + 2, 55, 14), "through:", sizeStyle='small') self.w.master2 = vanilla.ComboBox((15 + 40 + 55 + 55, 40 - 1, 50, 19), self.MasterList(-1), callback=self.UpdateSample, sizeStyle='small') self.w.text_5 = vanilla.TextBox( (15 + 40 + 55 + 55 + 55, 40 + 2, 55, 14), "at width:", sizeStyle='small') self.w.width = vanilla.EditText( (15 + 40 + 45 + 55 + 55 + 65, 40 - 1, -15, 19), "100", callback=self.SavePreferences, sizeStyle='small') self.w.text_6 = vanilla.TextBox((15 - 1, 68 + 2, 60, 14), "using", sizeStyle='small') self.w.algorithm = vanilla.PopUpButton((15 + 40, 68, 80, 17), ["Pablo", "Luc(as)", "linear"], callback=self.UpdateSample, sizeStyle='small') self.w.text_7 = vanilla.TextBox((15 + 40 + 85, 68 + 2, 110, 14), "distribution:", sizeStyle='small') self.w.help_instances = vanilla.HelpButton((-15 - 21, 68 + 2, -15, 20), callback=self.openURL) self.w.existingInstances = vanilla.RadioGroup( (15 + 30, 100, -10, 60), [ "Leave existing instances as they are", "Deactivate existing instances", "Delete existing instances" ], callback=self.SavePreferences, sizeStyle='small') self.w.existingInstances.set(0) self.w.maciej = vanilla.CheckBox((15, 170, 160, 19), "Maciej y distribution from:", value=False, callback=self.UpdateSample, sizeStyle='small') self.w.maciej_light = vanilla.ComboBox((15 + 165, 170 - 2, 50, 19), self.MasterList(1), callback=self.UpdateSample, sizeStyle='small') self.w.text_maciej_1 = vanilla.TextBox( (15 + 165 + 55, 170 + 2, 55, 19), "through:", sizeStyle='small') self.w.maciej_bold = vanilla.ComboBox( (15 + 165 + 55 + 55, 170 - 2, -15, 19), self.MasterList(-1), callback=self.UpdateSample, sizeStyle='small') self.w.text_maciej_2 = vanilla.TextBox( (15 + 15, 170 + 2 + 20, -40, 40), "Provide horizontal stem widths in extreme masters to interpolate contrast rather than stems.", sizeStyle='small', selectable=True) self.w.help_maciej = vanilla.HelpButton( (-15 - 21, 170 + 6 + 20, -15, 20), callback=self.openURL) self.w.sample = vanilla.Box((15, 170 + 30 + 40, -15, -30 - 15)) self.w.sample.text = vanilla.TextBox((5, 5, -5, -5), "", sizeStyle='small') self.w.createButton = vanilla.Button((-80 - 15, -20 - 15, -15, -15), "Create", sizeStyle='regular', callback=self.CreateInstances) self.w.setDefaultButton(self.w.createButton) if not self.LoadPreferences(): print "Error: Could not load preferences. Will resort to defaults." self.w.open() self.UpdateSample(self) self.w.makeKey()
def __init__(self): self.fontList = [] self.fontNames = [] self.fontStems = [] self.estimatedStems = None # Estimated stem measurements for the resulting font # Glyph groups self.groups = [] # Case info, normalized after editing self.normalizedInfo = {} self.dataNorms = { "scaleH": dict(default=100, dataType=float, scale=0.01), "scaleV": dict(default=100, dataType=float, scale=0.01), "interpH": dict(default=100, dataType=float, scale=0.01), "interpV": dict(default=100, dataType=float, scale=0.01), "tracking": dict(default=0, dataType=float, scale=1) } self.w = vanilla.Window((317, 700), "Scale And Interpolate %s" % VERSION, minSize=(317, 300), maxSize=(317, 969), autosaveName="ScaleAndInterp") # 882 height self.g = vanilla.Group((0, 0, 300, 900)) step = 10 self.g.font0title = vanilla.TextBox((10, step, -10, 25), colorText("Lightest Master (0%)", style="bold")) self.g.font0choice = vanilla.PopUpButton( (10, step + 20, -10, 25), self.fontNames, callback=self.fontChoiceChanged) step += 50 self.g.font0stemTextUC = vanilla.TextBox((20, step, -10, 20), "") self.g.font0stemTextLC = vanilla.TextBox((20, step + 20, -10, 20), "") step += 50 self.g.font1title = vanilla.TextBox((10, step, -10, 25), colorText("Heaviest Master (100%)", style="bold")) self.g.font1choice = vanilla.PopUpButton( (10, step + 20, -10, 25), self.fontNames, callback=self.fontChoiceChanged) step += 50 self.g.font1stemTextUC = vanilla.TextBox((20, step, -10, 20), "") self.g.font1stemTextLC = vanilla.TextBox((20, step + 20, -10, 20), "") step += 50 self.g.hr1 = vanilla.HorizontalLine((10, step, -10, 1)) step += 15 self.g.capsTitle = vanilla.TextBox((10, step, -10, 25), colorText("Caps", style="bold")) step += 25 self.g.ucGroups = vanilla.PopUpButton((10, step, -10, 25), []) step += 35 columnDescriptions = [ dict(title="Name"), dict(title="Value", editable=True, width=50) ] capInfo = [ dict(Name="Scale Horizontal %", attr="scaleH", Value=100), dict(Name="Scale Vertical %", attr="scaleV", Value=100), dict(Name="Interpolate Horizontal %", attr="interpH", Value=100), dict(Name="Interpolate Vertical %", attr="interpV", Value=100), dict(Name="Units of tracking", attr="tracking", Value=0) ] self.g.ucInfo = vanilla.List((10, step, -10, 100), capInfo, columnDescriptions=columnDescriptions, showColumnTitles=False, editCallback=self.dataChanged) step += 110 self.g.resultStemTextUC = vanilla.TextBox((20, step, -10, 20), "") step += 30 self.g.lcTitle = vanilla.TextBox((10, step, -10, 25), colorText("Lowercase", style="bold")) step += 25 self.g.lcGroups = vanilla.PopUpButton((10, step, -10, 25), []) step += 35 lcInfo = [ dict(Name="Scale Horizontal %", attr="scaleH", Value=100), dict(Name="Scale Vertical %", attr="scaleV", Value=100), dict(Name="Interpolate Horizontal %", attr="interpH", Value=100), dict(Name="Interpolate Vertical %", attr="interpV", Value=100), dict(Name="Units of tracking", attr="tracking", Value=0) ] self.g.lcInfo = vanilla.List((10, step, -10, 100), lcInfo, columnDescriptions=columnDescriptions, showColumnTitles=False, editCallback=self.dataChanged) step += 110 self.g.resultStemTextLC = vanilla.TextBox((20, step, -10, 20), "") step += 30 self.g.otherTitle = vanilla.TextBox((10, step, -10, 25), colorText("Other glyphs", style="bold")) step += 25 self.g.otherRadio = vanilla.RadioGroup((10, step, -10, 70), [ "Copy from the lightest master", "Process at 50% of UC and LC settings", "Skip any other glyphs" ], callback=self.dataChanged) self.g.otherRadio.set(2) step += 80 self.g.loadButton = vanilla.SquareButton((100, step, -10, 25), "Load settings from UFO", callback=self.loadSettings) step += 35 self.g.hr2 = vanilla.HorizontalLine((10, step, -10, 1)) step += 15 self.g.skewBox = vanilla.CheckBox( (10, step, -10, 25), "Skew Italic glyphs upright before scaling") self.g.skewBox.set(True) step += 25 self.g.infoBox = vanilla.CheckBox( (10, step, -10, 25), "Interpolate Font Info whenever possible") self.g.infoBox.set(True) step += 25 self.g.scaleComponentBox = vanilla.CheckBox( (10, step, -10, 25), "Don’t scale component positions") self.g.scaleComponentBox.set(True) step += 25 self.g.doKernBox = vanilla.CheckBox((10, step, -10, 25), "Process Kerning") self.g.doKernBox.set(True) step += 3 self.g.testKernButton = vanilla.SquareButton( (135, step, -10, 25), "Compatibility Test", callback=self.kernCompatibilityTestCallback) #step += 40 self.w.buildButton = vanilla.SquareButton( (10, -35, -10, 25), "Make Font", callback=self.makeFontCallback) # Add the group to a ScrollView view = self.g.getNSView() self.w.sv = vanilla.ScrollView( (0, 0, -0, -45), view, hasHorizontalScroller=False, hasVerticalScroller=True, autohidesScrollers=False, drawsBackground=False ) #backgroundColor=NSColor.windowBackgroundColor()) # Update the font info before opening self.fontsChanged() self.dataChanged() addObserver(self, "fontsChanged", "fontDidOpen") addObserver(self, "fontsChanged", "newFontDidOpen") addObserver(self, "fontsChanged", "fontDidClose") self.w.bind("close", self.windowClosed) self.w.open()
def __init__(self): # Window 'self.w': edY = 22 txX = 116 txY = 17 spX = 14 spY = 12 btnX = 60 btnY = 20 windowWidth = 260 windowHeight = 300 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 "Make Bubble Layers", # window title autosaveName= "com.Tosche.MakeBubbleLayers.mainwindow" # stores last window position and size ) # Offset values: self.w.textH = vanilla.TextBox((spX, spY, txX, txY), "Horizontal Offset:") self.w.textV = vanilla.TextBox((spX, spY * 2 + txY, txX, txY), "Vertical Offset:") self.w.editH = vanilla.EditText((-spX - 80, spY, -spX, edY), "60") self.w.editV = vanilla.EditText((-spX - 80, spY * 2 + txY, -spX, edY), "60") self.w.line1 = vanilla.HorizontalLine( (0, spY * 3 + txY * 2 + 5, -0, 1)) # Sidebearing modification: self.w.adhereToSB = vanilla.CheckBox( (spX, spY * 4 + txY * 2, -spX, edY), "Adhere to Sidebearigs", callback=self.checkBoxCallback, value=True) self.w.excess = vanilla.TextBox( (spX + 16, spY * 5 + txY * 3 - 7, -spX, txY), "Exceeding outlines are:") self.w.excessRadio = vanilla.RadioGroup( (spX + 16, spY * 6 + txY * 4 - 14, 160, edY), ["Nudged", "Trimmed"], isVertical=False, ) self.w.line2 = vanilla.HorizontalLine( (0, spY * 6 + txY * 5 - 4, -0, 1)) # Overwrite Behaviour: self.w.textOverwrite = vanilla.TextBox( (spX, spY * 7 + txY * 5 - 8, -spX, txY), "Overwrite existing?") self.w.overwriteRadio = vanilla.RadioGroup( (spX, spY * 8 + txY * 6 - 11, -spX, edY), ["Never", "If Empty", "Always"], isVertical=False, ) self.w.line3 = vanilla.HorizontalLine( (0, spY * 9 + txY * 7 - 8, -0, 1)) # Master preference self.w.masterRadio = vanilla.RadioGroup( (spX, spY * 9 + txY * 7, 0, edY), ["Current Master", "All Masters"], isVertical=False, ) # Run Button: self.w.runButton = vanilla.Button((-80 - 15, -20 - 15, -15, -15), "Go!", sizeStyle='regular', callback=self.MakeBubbleLayersMain) self.w.setDefaultButton(self.w.runButton) # Load Settings: if not self.LoadPreferences(): self.w.excessRadio.set(0) self.w.overwriteRadio.set(1) self.w.masterRadio.set(1) print "Note: 'Make Bubble 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 = 360 windowHeight = 390 windowWidthResize = 0 # user can resize width by this value windowHeightResize = 300 # user can resize height by this value self.w = vanilla.FloatingWindow( (windowWidth, windowHeight), # default window size "Insert weight instances", # window title minSize=(windowWidth, windowHeight), # minimum size (for resizing) maxSize=(windowWidth + windowWidthResize, windowHeight + windowHeightResize), # maximum size (for resizing) autosaveName= "com.mekkablue.InstanceMaker.mainwindow" # stores last window position and size ) inset, lineheight = 15, 12 self.w.text_1 = vanilla.TextBox((inset - 1, lineheight + 2, 75, 14), "Insert", sizeStyle='small') self.w.numberOfInstances = vanilla.PopUpButton( (inset + 40, lineheight, 50, 17), [str(x) for x in range(3, 12)], callback=self.UpdateSample, sizeStyle='small') self.w.numberOfInstances.getNSPopUpButton().setToolTip_( "Choose how many instances you want to add. A full weight spectrum has 9 weights." ) self.w.text_2 = vanilla.TextBox( (inset + 40 + 55, lineheight + 2, 120, 14), "instances with prefix", sizeStyle='small') self.w.prefix = vanilla.EditText( (inset + 40 + 55 + 120, lineheight - 1, -inset, 19), "A-", callback=self.UpdateSample, sizeStyle='small') self.w.prefix.getNSTextField().setToolTip_( u"Choose text that is added at the beginning of each instance, e.g., ‘Condensed’." ) lineheight += 28 self.w.text_3 = vanilla.TextBox((inset - 1, lineheight + 2, 60, 14), "from:", sizeStyle='small') self.w.master1 = vanilla.ComboBox((inset + 35, lineheight - 1, 62, 19), self.MasterList(1), callback=self.UpdateSample, sizeStyle='small') self.w.master1.getNSComboBox().setToolTip_( "Weight value for the first instance being added, typically the stem width of your lightest weight." ) self.w.text_4 = vanilla.TextBox( (inset + 50 + 55 * 1, lineheight + 2, 55, 14), "through:", sizeStyle='small') self.w.master2 = vanilla.ComboBox( (inset + 50 + 55 * 2, lineheight - 1, 62, 19), self.MasterList(-1), callback=self.UpdateSample, sizeStyle='small') self.w.master2.getNSComboBox().setToolTip_( "Weight value for the last instance being added, typically the stem width of your boldest weight." ) self.w.text_5 = vanilla.TextBox( (inset + 65 + 55 * 3, lineheight + 2, 55, 14), "at width:", sizeStyle='small') self.w.width = vanilla.EditText( (inset + 65 + 55 * 4, lineheight - 1, -inset, 19), "100", callback=self.UpdateSample, sizeStyle='small') self.w.width.getNSTextField().setToolTip_( "The Width value for the instances being added. Default is 100. Adapt accordingly if you are adding condensed or extended instances." ) lineheight += 28 self.w.text_6 = vanilla.TextBox((inset - 1, lineheight + 2, 60, 14), "using", sizeStyle='small') self.w.algorithm = vanilla.PopUpButton( (inset + 35, lineheight, 90, 17), ("linear", "Pablo", "Schneider", "Abraham", "Luc(as)"), callback=self.UpdateSample, sizeStyle='small') self.w.algorithm.getNSPopUpButton().setToolTip_( "The way the Weight values are distributed between the first and last master values you entered above. Linear means equal steps between instances. Luc(as) (after Lucas de Groot) means the same growth percentage between instances. Pablo (after Pablo Impallari) is like Luc(as) at first, then becomes increasingly linear, i.e., flat in the periphery and steep in the middle. Schneider (after Lukas Schneider) is half way between Pablo and Luc(as) algorithms. Abraham (after Abraham Lee) is linear at first, then becomes incresingly like Luc(as), i.e. steep in the periphery, flat in the middle.\nFor a wide spectrum, try Pablo or Schneider. For spectrums that do not grow too bold, try Abraham or Luc(as). The latter tend to have large jumps at the end, which are usually found in the center of the weight spectrum (between Regular and Semibold). Smaller jumps are preferable in the periphery, i.e., for very light and very dark weights." ) self.w.text_7 = vanilla.TextBox( (inset + 40 + 85 + 5, lineheight + 2, 110, 14), "distribution.", sizeStyle='small') self.w.help_instances = vanilla.HelpButton( (-15 - 21, lineheight + 2, -inset, 20), callback=self.openURL) lineheight += 32 self.w.existingInstances = vanilla.RadioGroup( (inset + 20, lineheight, -10, 60), ("Leave existing instances as they are", "Deactivate existing instances", "Delete existing instances"), callback=self.SavePreferences, sizeStyle='small') self.w.existingInstances.set(0) lineheight += 70 self.w.naturalNames = vanilla.CheckBox( (inset, lineheight, inset + 225, 19), u"Use ‘natural’ weight names, starting at:", value=False, callback=self.UpdateSample, sizeStyle='small') self.w.naturalNames.getNSButton().setToolTip_( "Prefill with standard names and style linking. If turned off, will use the Weight number as instance name." ) self.w.firstName = vanilla.PopUpButton( (inset + 225, lineheight, -inset, 17), naturalNames, callback=self.UpdateSample, sizeStyle='small') self.w.firstName.getNSPopUpButton().setToolTip_( "If you use natural weight names, choose here the name of your lightest weight." ) try: # workaround for macOS 10.9 self.w.firstName.enable( self.w.naturalNames.getNSButton().isEnabled()) except: pass lineheight += 20 self.w.italicStyle = vanilla.CheckBox( (inset + 20, lineheight, -inset, 20), u"Italic suffixes and style linking", value=False, callback=self.UpdateSample, sizeStyle='small') self.w.italicStyle.getNSButton().setToolTip_( u"If enabled, will add the word ‘Italic’ to all instances, and also add italic style linking." ) lineheight += 24 self.w.maciej = vanilla.CheckBox((inset, lineheight - 1, 160, 19), "Maciej y distribution from:", value=False, callback=self.UpdateSample, sizeStyle='small') self.w.maciej.getNSButton().setToolTip_( "An algorithm proposed by Maciej Ratajski, which introduces slightly different interpolation for y coordinates. Will add interpolationWeightY parameters to the instances. If these value differ greatly from the weight interpolation values, interpolation of your diagonals may suffer." ) self.w.text_maciej_1 = vanilla.TextBox( (inset + 165 + 55, lineheight + 2, 55, 19), "through:", sizeStyle='small') self.w.text_maciej_2 = vanilla.TextBox( (inset + 15, lineheight + 2 + 20, -40, 40), "Provide horizontal stem widths in extreme masters to interpolate contrast rather than stems.", sizeStyle='small', selectable=True) self.w.maciej_light = vanilla.ComboBox( (inset + 160, lineheight - 1, 55, 19), self.MasterList(1), callback=self.UpdateSample, sizeStyle='small') self.w.maciej_bold = vanilla.ComboBox( (inset + 160 + 55 + 55, lineheight - 1, -inset, 19), self.MasterList(-1), callback=self.UpdateSample, sizeStyle='small') self.w.help_maciej = vanilla.HelpButton( (-inset - 21, lineheight + 6 + 20, -inset, 20), callback=self.openURL) self.w.help_maciej.getNSButton().setToolTip_( "Will open a website with a detailed description of the Maciej algorithm. Requires an internet connection." ) lineheight += 60 self.w.shouldRound = vanilla.CheckBox((inset, lineheight, -inset, 19), "Round all interpolation values", value=True, callback=self.UpdateSample, sizeStyle='small') self.w.shouldRound.getNSButton().setToolTip_( "If enabled, will round all calculated weight values to integers. Usually a good idea." ) lineheight += 30 self.w.sample = vanilla.Box((inset, lineheight, -inset, -30 - inset)) self.w.sample.text = vanilla.TextBox((5, 5, -5, -5), "", sizeStyle='small') self.w.createButton = vanilla.Button( (-90 - inset, -20 - inset, -inset, -inset), "Insert", sizeStyle='regular', callback=self.CreateInstances) self.w.setDefaultButton(self.w.createButton) if not self.LoadPreferences(): print( "Error: Could not load preferences. Will resort to defaults.") self.w.open() self.UpdateSample(self) self.w.makeKey()