def __init__(self, callback): super(JumpToLineWindow, self).__init__() self.callback = callback # init the window self.w = FloatingWindow((WINDOW_WIDTH, 0), 'Jump to line') # edit text caption jumpingY = MARGIN_TOP self.w.caption = TextBox((MARGIN_LFT, jumpingY + 3, NET_WIDTH * .6, vanillaControlsSize['TextBoxRegularHeight']), 'Jump to line:') self.w.lineEdit = EditText( (MARGIN_LFT + NET_WIDTH * .6, jumpingY, -MARGIN_RGT, vanillaControlsSize['EditTextRegularHeight']), continuous=False) jumpingY += vanillaControlsSize['EditTextRegularHeight'] + MARGIN_INT self.w.cancelButton = Button( (-(BUTTON_WIDTH * 2 + MARGIN_INT + MARGIN_RGT), jumpingY, BUTTON_WIDTH, vanillaControlsSize['ButtonRegularHeight']), 'Cancel', callback=self.cancelButtonCallback) self.w.okButton = Button( (-(BUTTON_WIDTH + MARGIN_RGT), jumpingY, BUTTON_WIDTH, vanillaControlsSize['ButtonRegularHeight']), 'Ok', callback=self.okButtonCallback) jumpingY += vanillaControlsSize['ButtonRegularHeight'] + MARGIN_BTM self.setUpBaseWindowBehavior() self.w.resize(WINDOW_WIDTH, jumpingY)
def __init__(self, options, callback): super(ChooseExceptionWindow, self).__init__() self.options = options self.callback = callback self.whichException = options[0] self.w = FloatingWindow((300, 120), 'Choose exception') self.w.optionsRadio = RadioGroup( (MARGIN, MARGIN, -MARGIN, len(options) * 20), options, callback=self.optionsCallback) self.w.optionsRadio.set(0) self.w.cancel = Button( (-(90 * 2 + MARGIN * 2), -(vanillaControlsSize['ButtonRegularHeight'] + MARGIN), 90, vanillaControlsSize['ButtonRegularHeight']), 'Cancel', callback=self.cancelCallback) self.w.submit = Button( (-(90 + MARGIN), -(vanillaControlsSize['ButtonRegularHeight'] + MARGIN), 90, vanillaControlsSize['ButtonRegularHeight']), 'Submit', callback=self.submitCallback) self.setUpBaseWindowBehavior()
def __init__(self): self.glyph = None # Typical RoboFont function self.updating = False pad = 10 leading = 32 y = pad w = 300 h = 400 buttonWidth = 100 buttonHeight = 48 self.w = FloatingWindow((100, 100, w, h), 'DemoWindowTool') self.w.doDraw = CheckBox((pad, y, 100, 24), 'Draw', callback=self.doDrawCallback) y += leading self.w.mySlider = Slider((pad, y, -pad, 24), minValue=0, maxValue=2000, value=0, tickMarkCount=10, callback=self.mySliderCallback) y = self.w.saveFont = Button((-buttonWidth - pad, -buttonHeight - pad, buttonWidth, buttonHeight), 'Save', callback=self.saveFontCallback) addObserver(self, "currentGlyphChanged", "currentGlyphChanged") # Subscribe to application event addObserver(self, 'draw', 'draw') addObserver(self, 'drawBackground', 'drawBackground') self.w.bind('close', self.windowCloseCallback) self.w.open()
def __init__(self): self.w = FloatingWindow((100, 100), "Tester") self.w.bind("close", self.closeCB) self.guideView = None addObserver(self, "glyphWindowOpenCB", "glyphWindowDidOpen")
def __init__(self): # base window self.w = FloatingWindow((0, 0, PLUGIN_WIDTH, PLUGIN_HEIGHT)) jumpingY = MARGIN_VER self.w.libChoice = PopUpButton( (MARGIN_HOR, jumpingY, NET_WIDTH, vanillaControlsSize['PopUpButtonRegularHeight']), ['A', 'B', 'C'], callback=self.libChoiceCallback) jumpingY += vanillaControlsSize['PopUpButtonRegularHeight'] + MARGIN_VER self.w.addButton = SquareButton( (MARGIN_HOR, jumpingY, NET_WIDTH * .6, SQUARE_BUTTON_HEIGHT), 'add stem', callback=self.addButtonCallback) self.w.checkBoxStar = CheckBoxStar( (MARGIN_HOR + MARGIN_VER + NET_WIDTH * .6, jumpingY, NET_WIDTH * .35, NET_WIDTH * .35), callback=self.checkBoxStarCallback) jumpingY += SQUARE_BUTTON_HEIGHT + MARGIN_VER self.w.removeButton = SquareButton( (MARGIN_HOR, jumpingY, NET_WIDTH * .6, SQUARE_BUTTON_HEIGHT), 'remove stem', callback=self.removeButtonCallback) # lit up! self.w.open()
def __init__(self): self.searchResults = [] self.selectedChars = "" self.w = FloatingWindow((300, 400), "Unicode Picker", minSize=(250, 300), autosaveName="UnicodePicker") y = 15 self.w.searchField = EditText((20, y, -20, 25), placeholder="Search Unicode name or value", callback=self.searchTextChanged_) y += 40 columnDescriptions = [ dict(title="char", width=40, cell=makeTextCell(align="center", font=AppKit.NSFont.systemFontOfSize_(14))), dict(title="unicode", width=60, cell=makeTextCell(align="right")), dict(title="name"), ] self.w.unicodeList = List((0, y, 0, -100), [], columnDescriptions=columnDescriptions, rowHeight=18, selectionCallback=self.listSelectionChanged_, doubleClickCallback=self.listDoubleClickCallback_) y = -95 self.w.unicodeText = TextBox((20, y, -10, 55), "") self.w.unicodeText._nsObject.cell().setFont_(AppKit.NSFont.systemFontOfSize_(36)) self.w.unicodeText._nsObject.cell().setLineBreakMode_(AppKit.NSLineBreakByTruncatingMiddle) y += 55 self.w.copyButton = Button((20, y, 120, 25), "Copy", callback=self.copy_) self.w.copyButton.enable(False) self.w.open() self.w._window.setWindowController_(self) self.w._window.setBecomesKeyOnlyIfNeeded_(False) self.w._window.makeKeyWindow()
def showWindow_(self, sender): if Glyphs.font is None: self.helperWindow(self.warningNoFontOpen) elif len(Glyphs.font.masters) < 2: self.helperWindow(self.warningOnlyOneMaster) else: mastersList = [] for m in Glyphs.font.masters: mastersList.append(m.name) currentMasterIndex = Glyphs.font.masterIndex self.windowWidth = 250 self.windowHeight = 25 * len(mastersList) + 23 + 30 self.w = FloatingWindow((self.windowWidth, self.windowHeight), self.name) self.w.radiomasters = RadioGroup( (10, 10, -10, 25 * len(mastersList)), mastersList, callback=self.changeMaster) self.w.slider = Slider((10, -35, -10, 23), tickMarkCount=len(mastersList), stopOnTickMarks=True, value=currentMasterIndex, minValue=0, maxValue=len(mastersList) - 1, sizeStyle="small", continuous=False, callback=self.changeMasterSlider) self.w.open()
def __init__(self, glyph): # if glyph is None, show a message if glyph is None: Message('no glyph selected', title='moveTool', informativeText='Please select one glyph first!') return # store the glyph and initial move values as object attributes self.glyph = glyph self.moveXTRA = 0 # create a floating window self.w = FloatingWindow((200, 74), "move %s" % self.glyph.name) # add a slider for moving in the x axis self.w.sliderXTRA = Slider((10, 10, -10, 22), value=0, maxValue=200, minValue=0, callback=self.adjustXTRA) # self.w.sliderXOPQ = Slider( # (10, 10, -10, 22), # value=0, maxValue=200, minValue=-200, # callback=self.adjust) # open the window self.w.open()
def __init__(self): '''Initialize the dialog.''' x = y = padding = 10 buttonHeight = 20 windowWidth = 400 rows = 4.5 self.w = FloatingWindow( (windowWidth, buttonHeight * rows + padding * (rows)), "Glyph Fax Machine") self.fonts = {} # self.w.textBox = TextBox((x, y, -padding, buttonHeight), "Glyphs to Copy") # y += buttonHeight self.w.editText = EditText( (x, y, -padding, buttonHeight * 2 + padding), placeholder="Space-separated list of glyphs to copy") y += buttonHeight * 2 + padding * 2 # self.w.overwriteGlyphsCheckBox = CheckBox((x, y, -padding, buttonHeight), "Overwrite Glyphs", value=False, callback=self.overwriteGlyphsOptions) # y += buttonHeight + padding self.w.overwriteNormalWidthGlyphsCheckBox = CheckBox( (x, y, -padding, buttonHeight), "Overwrite 600w Glyphs", value=False, sizeStyle="small") # self.w.overwriteNormalWidthGlyphsCheckBox.show(False) self.w.overwriteAdjustedWidthGlyphsCheckBox = CheckBox( (windowWidth * 0.4, y, -padding, buttonHeight), "Overwrite non-600w Glyphs", value=False, sizeStyle="small") # self.w.overwriteAdjustedWidthGlyphsCheckBox.show(False) self.w.colorWell = ColorWell( (windowWidth * 0.85, y, -padding, buttonHeight), color=NSColor.orangeColor()) y += buttonHeight + padding self.w.sans2mono = Button( (x, y, windowWidth / 3 - padding / 2, buttonHeight), "Sans → Mono", callback=self.sans2monoCallback) self.w.mono2sans = Button( (windowWidth / 3 + padding, y, -padding, buttonHeight), "Mono → Sans", callback=self.mono2SansCallback) self.w.open()
def __init__(self): self.w = FloatingWindow((246, 300), "CodeColors") x = y = p = 10 self.w.colorThemesList = List((x, y, -p, -p), sorted(self.colorThemes.keys()), selectionCallback=self.selectionCallback, allowsMultipleSelection=False, allowsEmptySelection=False) self.w.open()
def __init__(self, attributes, callback, document=None): self._callback = callback self._attributes = None self.w = FloatingWindow((250, 50)) self.buildUI(attributes) self.w.open() if document: self.w.assignToDocument(document) self.w.setTitle("Variables")
def __init__(self): super(AccentedMaker, self).__init__() self.initLogger() self.fontOptions = ['All Fonts', 'Current Font'] + AllFonts() self.whichFont = self.fontOptions[0] self.pluginHeight = PLUGIN_HEIGHT self.loadAccentedData() self.parseGlyphListsFromAccentedData() firstKey = self.glyphLists[self.whichAction].keys()[0] self.whichGlyphList = self.glyphLists[self.whichAction][firstKey] self.w = FloatingWindow((0, 0, PLUGIN_WIDTH, self.pluginHeight), PLUGIN_TITLE) self.w.sharedCtrls = SharedCtrls( (MARGIN_HOR, MARGIN_VER, NET_WIDTH, 104), fontOptions=self.fontOptions, whichFont=self.whichFont, actions=self.actions, whichAction=self.whichAction, glyphLists=self.glyphLists, whichGlyphList=self.whichGlyphList, markColor=self.markColor, markEditedGlyphs=self.markEditedGlyphs, callback=self.sharedCtrlsCallback) self.w.separationLine = HorizontalLine( (MARGIN_HOR, self.w.sharedCtrls.getPosSize()[3] + MARGIN_ROW, NET_WIDTH, vanillaControlsSize['HorizontalLineThickness'])) dependantCtrlsHgt = MARGIN_VER + self.w.sharedCtrls.getPosSize( )[3] + MARGIN_ROW self.w.anchorsCtrls = AnchorsCtrls( (MARGIN_HOR, dependantCtrlsHgt, NET_WIDTH, 76), callbackAttrs=self.anchorsVarsCallback, placeCallback=self.anchorsPlaceCallback, deleteCallback=self.anchorsDeleteCallback) self.w.buildingCtrls = BuildingCtrls( (MARGIN_HOR, dependantCtrlsHgt, NET_WIDTH, 50), self.uppercaseAccents, callbackAttrs=self.buildingVarsCallback, callbackCheck=self.checkAccentedCallback, callbackBuild=self.buildAccentedCallback) self.w.buildingCtrls.show(False) addObserver(self, 'updateFontOptions', "newFontDidOpen") addObserver(self, 'updateFontOptions', "fontDidOpen") addObserver(self, 'updateFontOptions', "fontWillClose") self.w.bind("close", self.windowCloseCallback) self.setUpBaseWindowBehavior() self.adjustPluginHeight() self.w.open()
def __init__(self): self.fontTarget = FONT_TARGET_OPTIONS[0] self.glyphTarget = GLYPH_TARGET_OPTIONS[0] self.gridSize = 4 self.w = FloatingWindow((0, 0, PLUGIN_WIDTH, 400), PLUGIN_TITLE) jumpingY = MARGIN_VER # font target self.w.fontTargetPopUp = PopUpButton( (MARGIN_HOR, jumpingY, NET_WIDTH, vanillaControlsSize['PopUpButtonRegularHeight']), FONT_TARGET_OPTIONS, callback=self.fontTargetPopUpCallback) jumpingY += vanillaControlsSize['PopUpButtonRegularHeight'] + MARGIN_VER # glyph target self.w.glyphTargetPopUp = PopUpButton( (MARGIN_HOR, jumpingY, NET_WIDTH, vanillaControlsSize['PopUpButtonRegularHeight']), GLYPH_TARGET_OPTIONS, callback=self.glyphTargetPopUpCallback) jumpingY += vanillaControlsSize['PopUpButtonRegularHeight'] + MARGIN_VER # grid size captions self.w.gridSizeCaption = TextBox( (MARGIN_HOR, jumpingY + 2, NET_WIDTH * .32, vanillaControlsSize['TextBoxRegularHeight']), 'Grid Size:') # grid size edit self.w.gridSizeEdit = EditText( (MARGIN_HOR + NET_WIDTH * .32, jumpingY, NET_WIDTH * .3, vanillaControlsSize['EditTextRegularHeight']), text='{:d}'.format(self.gridSize), callback=self.gridSizeEditCallback) jumpingY += vanillaControlsSize['EditTextRegularHeight'] + MARGIN_VER self.w.moveBcpHandlesCheck = CheckBox( (MARGIN_HOR, jumpingY, NET_WIDTH, vanillaControlsSize['CheckBoxRegularHeight']), 'move bcp handles', value=self.bcpHandlesFit, callback=self.moveBcpHandlesCheckCallback) jumpingY += vanillaControlsSize['CheckBoxRegularHeight'] + MARGIN_VER # fit button self.w.fitButton = Button((MARGIN_HOR, jumpingY, NET_WIDTH, vanillaControlsSize['ButtonRegularHeight']), 'Fit!', callback=self.fitButtonCallback) jumpingY += vanillaControlsSize['ButtonRegularHeight'] + MARGIN_VER self.w.setPosSize((0, 0, PLUGIN_WIDTH, jumpingY)) self.w.open()
def __init__(self): self.transferList = NAME_2_GLYPHLIST[GLYPHLISTS_OPTIONS[0]] self.target = TARGET_OPTIONS[0] self.w = FloatingWindow((0, 0, PLUGIN_WIDTH, 400), PLUGIN_TITLE) jumpingY = MARGIN_VER # target fonts self.w.targetFontsPopUp = PopUpButton( (MARGIN_HOR, jumpingY, NET_WIDTH, vanillaControlsSize['PopUpButtonRegularHeight']), TARGET_OPTIONS, callback=self.targetFontsPopUpCallback) jumpingY += vanillaControlsSize['PopUpButtonRegularHeight'] + MARGIN_VER # transfer lists pop up self.w.glyphListPopUp = PopUpButton( (MARGIN_HOR, jumpingY, NET_WIDTH, vanillaControlsSize['PopUpButtonRegularHeight']), GLYPHLISTS_OPTIONS, callback=self.glyphListPopUpCallback) jumpingY += vanillaControlsSize['PopUpButtonRegularHeight'] + MARGIN_VER # offset caption self.w.offsetCaption = TextBox( (MARGIN_HOR, jumpingY + 2, NET_WIDTH * .22, vanillaControlsSize['TextBoxRegularHeight']), 'Offset:') # offset edit text self.w.offsetEdit = EditText( (MARGIN_HOR + NET_WIDTH * .25, jumpingY, NET_WIDTH * .35, vanillaControlsSize['EditTextRegularHeight']), continuous=False, callback=self.offsetEditCallback) self.w.offsetEdit.set('%d' % self.verticalOffset) jumpingY += vanillaControlsSize['EditTextRegularHeight'] + MARGIN_VER # clean button self.w.cleanButton = Button( (MARGIN_HOR, jumpingY, NET_WIDTH * .45, vanillaControlsSize['ButtonRegularHeight']), 'Clean', callback=self.cleanButtonCallback) # run button self.w.runButton = Button( (MARGIN_HOR + NET_WIDTH * .55, jumpingY, NET_WIDTH * .45, vanillaControlsSize['ButtonRegularHeight']), 'Run!', callback=self.runButtonCallback) jumpingY += vanillaControlsSize['ButtonRegularHeight'] + MARGIN_VER self.w.setPosSize((0, 0, PLUGIN_WIDTH, jumpingY)) self.w.open()
def __init__(self): self.w = FloatingWindow((300, 40), "Coldtype Serializer", minSize=(123, 200)) self.w.globalToggle = CheckBox((10, 10, -10, 20), 'serialize?', value=True) self.output = Path("~/robofont-coldtype.json").expanduser().absolute() addObserver(self, "shouldDraw", "draw") self.setUpBaseWindowBehavior() self.w.open()
def spaceCenterOpenCallback(self, notification): if (not self.popupOpen) and (len(self.metricsGroups) > 0): self.w = FloatingWindow((160, 36), 'Group Spacing') self.w.activateGroups = CheckBox( (9, -27, 151, 18), "Activate Group spacing", value=self.enableGroupSpacing, callback=self.enableGroupSpacingCallback, sizeStyle="small") self.w.bind('close', self.windowCloseCallback) self.w.open() self.popupOpen = True
def __init__(self): self.w = FloatingWindow((135, 40), "", minSize=(123, 200)) # a checkbox to turn the tool on/off self.w.showPoints = CheckBox((10, 10, -10, 20), 'highlight points', value=True) # add an observer to the drawPreview event addObserver(self, "highlightPoints", "draw") # open window self.setUpBaseWindowBehavior() self.w.open()
def __init__(self): self.valuesPrefsKey = prefsKey + ".delta." + basename( Glyphs.font.filepath) # UI metrics spacing = 8 height = 22 # calculate window height minWinSize = (220, 120 + (len(Glyphs.font.masters) * (height + spacing))) # create UI window self.w = FloatingWindow(minWinSize, "Adjust sidebearings", minSize=minWinSize, maxSize=(500, 500), autosaveName=prefsKey + ".win") # layout UI controls y = 16 self.w.label = TextBox((16, y, -16, height), "Sidebearing delta adjustment:") y += height + spacing inputWidth = 64 for master in Glyphs.font.masters: setattr(self.w, "deltaLabel%s" % master.id, TextBox((16, y, -16 - inputWidth, height), master.name)) setattr(self.w, "deltaInput%s" % master.id, EditText((-16 - inputWidth, y, -16, height), "16")) # print("self.w.deltaInputs[master.id]", getattr(self.w, "deltaInput%s" % master.id)) y += height + spacing self.w.submitButton = Button((16, -16 - height, -16, height), "Adjust all sidebearings", callback=self.onSubmit) # finalize UI self.w.setDefaultButton(self.w.submitButton) self.loadPreferences() self.w.bind("close", self.savePreferences) # make sure window is large enough to show all masters x, y, w, h = self.w.getPosSize() if w < minWinSize[0] and h < minWinSize[1]: self.w.setPosSize((x, y, minWinSize[0], minWinSize[1]), animate=False) elif w < minWinSize[0]: self.w.setPosSize((x, y, minWinSize[0], h), animate=False) elif h < minWinSize[1]: self.w.setPosSize((x, y, w, minWinSize[1]), animate=False) self.w.open() self.w.makeKey()
def _buildUI(self): w = FloatingWindow((300, 340), "Rotated Glyph Preview", (300, 340), (2560, 1440)) w.preview = GlyphPreview((2, 2, -2, -40)) w.rotationSlider = Slider( (10, -30, -10, 20), minValue=-180, maxValue=180, value=self.settings["rotation"], tickMarkCount=5, stopOnTickMarks=False, continuous=True, callback=self._setRotation, sizeStyle="small", ) return w
def __init__(self): self.w = FloatingWindow( (120, 140), minSize=(100, 40), textured=True, ) self.w.ti_checkbox = CheckBox((10, 10, -10, 20), 'Test Install', value=True) self.w.otf_checkbox = CheckBox((10, 30, -10, 20), 'OTF Backup', value=True) self.w.button = SquareButton((10, 60, -10, -10), 'GO', callback=self.button_callback) self.w.open()
def __init__(self): self.modifiedGlyph = None self.w = FloatingWindow((400, 170), 'Corner Tool') self.w.getNSWindow().setBackgroundColor_(NSColor.whiteColor()) self.modes = ['Break', 'Build','Pit'] self.objectTypes = {'Build':'Segment', 'Break':'Corner point', 'Pit':'Corner point'} self.parameters = { 'radius': VanillaSingleValueParameter('radius', 20, (-200, 200), numType='int'), 'roundness': VanillaSingleValueParameter('roundness', 1.25, (0, 4), numType='float'), 'depth': VanillaSingleValueParameter('depth', 30, (-100, 100), numType='int'), 'breadth': VanillaSingleValueParameter('breadth', 30, (0, 150), numType='int'), 'bottom': VanillaSingleValueParameter('bottom', 5, (0, 40), numType='int') } self.currentMode = 'Break' self.previewGlyph = None self.w.modes = RadioGroup((15, 15, 70, -15), self.modes, callback=self.changeMode) for i, mode in enumerate(self.modes): setattr(self.w, mode, Group((120, 15, -15, -15))) modeGroup = getattr(self.w, mode) modeGroup.apply = GradientButton((-35, 0, -0, -0), title=u'>', callback=self.apply) modeGroup.infoBox = Box((0, 0, -50, 35)) modeGroup.info = TextBox((10, 8, -50, 20), 'No selection') if i > 0: modeGroup.show(False) self.w.Break.radius = ParameterSliderTextInput(self.parameters['radius'], (0, 60, -25, 25), title='Radius', callback=self.makePreviewGlyph) self.w.Break.roundness = ParameterSliderTextInput(self.parameters['roundness'], (0, 95, -25, 25), title='Roundness', callback=self.makePreviewGlyph) self.w.Pit.depth = ParameterSliderTextInput(self.parameters['depth'], (0, 50, -25, 25), title='Depth', callback=self.makePreviewGlyph) self.w.Pit.breadth = ParameterSliderTextInput(self.parameters['breadth'], (0, 80, -25, 25), title='Breadth', callback=self.makePreviewGlyph) self.w.Pit.bottom = ParameterSliderTextInput(self.parameters['bottom'], (0, 110, -25, 25), title='bottom', callback=self.makePreviewGlyph) addObserver(self, 'preview', 'draw') addObserver(self, 'preview', 'drawInactive') addObserver(self, 'previewSolid', 'drawPreview') addObserver(self, 'makePreviewGlyph', 'mouseDown') addObserver(self, 'makePreviewGlyph', 'mouseDragged') addObserver(self, 'makePreviewGlyph', 'keyDown') addObserver(self, 'makePreviewGlyph', 'keyUp') addObserver(self, 'setControls', 'mouseUp') addObserver(self, 'setControls', 'selectAll') addObserver(self, 'setControls', 'deselectAll') addObserver(self, 'setControls', 'currentGlyphChanged') self.w.bind('close', self.windowClose) self.setControls() self.w.open()
def loadPlugin(self): self.menuName = "Italic Extremes" self.actionButtonLabel = 'Add Nodes' self.keyboardShortcut = None windowWidth = 300 windowHeight = 120 m, h, yPos = 10, 18, 10 self.w = FloatingWindow((windowWidth, windowHeight)) self.w.group = Group((0, 0, windowWidth, windowHeight)) self.w.group.angle = EditText((m, yPos, -50, h), "", placeholder='Angles', sizeStyle='small', callback=self.editAngles_callback, continuous=True) self.w.group.refresh = Button((-40, yPos, -m, h), u"↺", callback=self.revertAngles_callback) yPos += m + h self.w.group.tabs = Tabs((m, yPos, -m, -m), ["Add slanted nodes", "Add H/V extremes"], callback=self.tab_callback) self.tab1 = self.w.group.tabs[0] self.tab1.removeV = CheckBox((m, 0, -m, h), "Delete vertical extremes", sizeStyle='small', value=False, callback=self.removeV_callback) yPos = h self.tab1.removeH = CheckBox((m, yPos, -m, h), "Delete horizontal extremes", sizeStyle='small', value=False, callback=self.removeH_callback) self.tab2 = self.w.group.tabs[1] yPos = 0 self.tab2.removeI = CheckBox((m, yPos, -m, h), "Delete slanted nodes", sizeStyle='small', value=False, callback=self.removeI_callback) self.dialog = self.w.group.getNSView()
def __init__(self, glyph): # if glyph is None, show a message # store the glyph and initial move values as object attributes self.w = FloatingWindow((200, 64), "move "+str(labelslider)) for labelslider in BuildLabelsList(f): # create a floating window # add a slider for moving in the x axis self.g = glyph self.moveX = 0 self.label= labelslider self.w.labelslider = Slider( (10, 10, -10, 22), value=0, maxValue=100, minValue=-100, callback=self.adjust) # open the window self.w.button = Button((15, -35, -15, 20), "Done") self.w.open()
def __init__(self): NSUserDefaults.standardUserDefaults().registerDefaults_({"ToucheWindowHeight":340}) self.windowHeight = NSUserDefaults.standardUserDefaults().integerForKey_("ToucheWindowHeight") self.minWindowHeight = 340 if self.windowHeight < self.minWindowHeight: self.windowHeight = self.minWindowHeight self.closedWindowHeight = 100 self.w = FloatingWindow((180, self.windowHeight), u'Touché!', minSize=(180,340), maxSize=(250,898)) self.w.bind("resize", self.windowResized) self.isResizing = False p = 10 w = 160 # options self.w.options = Group((0, 0, 180, 220)) buttons = { "checkSelBtn": {"text": "Check selected glyphs", "callback": self.checkSel, "y": p}, } for button, data in buttons.iteritems(): setattr(self.w.options, button, Button((p, data["y"], w - 22, 22), data["text"], callback=data["callback"], sizeStyle="small")) self.w.options.zeroCheck = CheckBox((p, 35, w, 20), "Ignore zero-width glyphs", value=True, sizeStyle="small") self.w.options.progress = ProgressSpinner((w - 8, 13, 16, 16), sizeStyle="small") # results self.w.results = Group((0, 220, 180, -0)) self.w.results.show(False) textBoxes = {"stats": -34, "result": -18} for box, y in textBoxes.iteritems(): setattr(self.w.results, box, TextBox((p, y, w, 14), "", sizeStyle="small")) # list and preview self.w.outputList = List((0,58,-0,-40), [{"left glyph": "", "right glyph": ""}], columnDescriptions=[{"title": "left glyph", "width": 90}, {"title": "right glyph"}], showColumnTitles=False, allowsMultipleSelection=False, enableDelete=False, selectionCallback=self.showPair) self.w.outputList._setColumnAutoresizing() self._resizeWindow(False) self.w.open()
def __init__(self): # init window self.w = FloatingWindow((PLUGIN_WIDTH, 300), 'labeler.py') self.jumpingY = MARGIN_VER self.w.labelCtrl_0 = LabelCtrl((MARGIN_HOR, self.jumpingY, NET_WIDTH, vanillaControlsSize['EditTextRegularHeight']), index=self.labelCltrIndex, callback=self.labelCtrlsCallback) self.jumpingY += vanillaControlsSize['EditTextRegularHeight'] + MARGIN_VER self.w.separation = HorizontalLine((MARGIN_HOR, self.jumpingY, NET_WIDTH, vanillaControlsSize['HorizontalLineThickness'])) self.w.clearButton = SquareButton((MARGIN_HOR, self.jumpingY+vanillaControlsSize['HorizontalLineThickness'] + MARGIN_VER, NET_WIDTH, vanillaControlsSize['ButtonRegularHeight']), 'Clear Glyph Labels', sizeStyle='small', callback=self.clearButtonCallback) # resize window self._computeWindowHeight() self.w.resize(PLUGIN_WIDTH, self.windowHeight) # open window self.w.open()
def __init__(self, parent): self.parent = parent self.w = FloatingWindow((150, 130), "Speed Punk %s" % VERSION, closable = False, autosaveName = 'de_yanone_speedPunk_%s.prefWindow' % (environment), ) self.w.illustrationPositionRadioGroup = RadioGroup((10, 10, -10, 40), ["Outside of glyph", "Outer side of curve"], callback=self.radioGroupCallback, sizeStyle = "small") self.w.curveGainTextBox = TextBox((10, 60, -10, 17), "Gain", sizeStyle = "mini") self.w.curveGainSlider = Slider((10, 70, -10, 25), tickMarkCount=5, callback=self.curveGainSliderCallback, sizeStyle = "small", minValue = curveGain[0], maxValue = curveGain[1], value = self.parent.getPreference('curveGain')) self.w.illustrationPositionRadioGroup.set(self.parent.getPreference('illustrationPositionIndex')) self.w.faderCheckBox = CheckBox((10, 100, -10, 17), "Fader", sizeStyle = "small", callback = self.faderCheckBoxCallback) self.w.faderSlider = Slider((10, 125, -10, 25), sizeStyle = "small", minValue = 0, maxValue = 1.0, value = 1.0, callback = self.faderSliderCallback) self.w.gradientImage = ImageView((10, 150, -10, 15)) self.w.histogramImage = ImageView((10, 150, -10, 15))
def __init__(self): super(VFB2UFO, self).__init__() self.w = FloatingWindow((PLUGIN_WIDTH, 2), PLUGIN_TITLE) self.jumpingY = MARGIN_VER # options button self.w.optionsPopUp = PopUpButton( (MARGIN_HOR, self.jumpingY, NET_WIDTH, vanillaControlsSize['PopUpButtonRegularHeight']), self.inputOptions, callback=self.optionsPopUpCallback) self.jumpingY += vanillaControlsSize[ 'PopUpButtonRegularHeight'] + MARGIN_HOR # suffix option self.w.suffixRadio = RadioGroup( (MARGIN_HOR, self.jumpingY, NET_WIDTH, vanillaControlsSize['ButtonRegularHeight'] * 2), ["From VFB to UFO", "From UFO to VFB"], callback=self.suffixRadioCallback) self.w.suffixRadio.set(0) self.w.suffixRadio.enable(False) self.jumpingY += vanillaControlsSize[ 'ButtonRegularHeight'] * 2 + MARGIN_HOR # convert button self.w.convertButton = Button( (MARGIN_HOR, self.jumpingY, NET_WIDTH, vanillaControlsSize['ButtonRegularHeight']), 'Choose file and convert', callback=self.convertButtonCallback) self.jumpingY += vanillaControlsSize['ButtonRegularHeight'] + MARGIN_HOR self.w.resize(PLUGIN_WIDTH, self.jumpingY) self.setUpBaseWindowBehavior() self.w.open()
def build(self): glyphEditor = self.getGlyphEditor() self.container = glyphEditor.extensionContainer( identifier="com.roboFont.ItalicBowtie.background", location="background", clear=True) self.crossHeightLayer = self.container.appendLineSublayer( strokeWidth=1, strokeColor=(.2, .1, .5, .5), strokeDash=(2, )) fillColor = (.2, .1, .5, .05) strokeColor = (.2, .1, .5, .5) strokeWidth = 0.5 self.leftBowtieLayer = self.container.appendPathSublayer( fillColor=fillColor, strokeColor=strokeColor, strokeWidth=strokeWidth) self.rightBowtieLayer = self.container.appendPathSublayer( fillColor=fillColor, strokeColor=strokeColor, strokeWidth=strokeWidth) self.w = FloatingWindow((325, 250), "Italic Bowtie") self.populateWindow()
def build(self): self.fonts = AllFonts() self.w = FloatingWindow((400, 200), "Overlay UFOs", minSize=(400, 200)) self.populateWindow() self.w.open()
def __init__(self, font): self.w = FloatingWindow((185, 370), "Font Nanny") y = 5 self.w.info = TextBox((10, y, 180, 14), text="Glyph Checks (all Glyphs):", sizeStyle="small") y += 20 self.w.check1 = SquareButton((10, y, 145, 20), "Unicode values", callback=self.perform, sizeStyle="small") self.w.color1 = ColorWell( (155, y, 20, 20), color=NSColor.colorWithCalibratedRed_green_blue_alpha_( 0, 0, 1, 0.3)) self.w.color1.enable(0) y += 20 self.w.check2 = SquareButton((10, y, 145, 20), "Contour Count", callback=self.perform, sizeStyle="small") self.w.color2 = ColorWell( (155, y, 20, 20), color=NSColor.colorWithCalibratedRed_green_blue_alpha_( 5, 0, 0, 0.4)) self.w.color2.enable(0) y += 25 self.w.info2 = TextBox((10, y, 180, 14), text="Outline Checks (all Glyphs):", sizeStyle="small") y += 20 self.w.check3 = SquareButton((10, y, 145, 20), "Stray Points", callback=self.perform, sizeStyle="small") self.w.color3 = ColorWell( (155, y, 20, 20), color=NSColor.colorWithCalibratedRed_green_blue_alpha_( .7, .0, .7, .9)) self.w.color3.enable(0) y += 20 self.w.check4 = SquareButton((10, y, 145, 20), "Small Contours", callback=self.perform, sizeStyle="small") self.w.color4 = ColorWell( (155, y, 20, 20), color=NSColor.colorWithCalibratedRed_green_blue_alpha_( 0, .8, 0, 0.9)) self.w.color4.enable(0) y += 20 self.w.check5 = SquareButton((10, y, 145, 20), "Open Contours", callback=self.perform, sizeStyle="small") self.w.color5 = ColorWell( (155, y, 20, 20), color=NSColor.colorWithCalibratedRed_green_blue_alpha_( .4, .4, .4, 0.8)) self.w.color5.enable(0) y += 20 self.w.check6 = SquareButton((10, y, 145, 20), "Duplicate Contours", callback=self.perform, sizeStyle="small") self.w.color6 = ColorWell( (155, y, 20, 20), color=NSColor.colorWithCalibratedRed_green_blue_alpha_( 1, 0, 0, 0.6)) self.w.color6.enable(0) y += 20 self.w.check7 = SquareButton((10, y, 145, 20), "Extreme points", callback=self.perform, sizeStyle="small") self.w.color7 = ColorWell( (155, y, 20, 20), color=NSColor.colorWithCalibratedRed_green_blue_alpha_( 0, .9, 0, 0.6)) self.w.color7.enable(0) y += 20 self.w.check8 = SquareButton((10, y, 145, 20), "Unnecessary Points", callback=self.perform, sizeStyle="small") self.w.color8 = ColorWell( (155, y, 20, 20), color=NSColor.colorWithCalibratedRed_green_blue_alpha_( 1, .0, 1, 0.8)) self.w.color8.enable(0) y += 20 self.w.check9 = SquareButton((10, y, 145, 20), "Unnecessary Handles", callback=self.perform, sizeStyle="small") self.w.color9 = ColorWell( (155, y, 20, 20), color=NSColor.colorWithCalibratedRed_green_blue_alpha_( .4, .0, .0, .3)) self.w.color9.enable(0) y += 20 self.w.check10 = SquareButton((10, y, 145, 20), "Overlapping Points", callback=self.perform, sizeStyle="small") self.w.color10 = ColorWell( (155, y, 20, 20), color=NSColor.colorWithCalibratedRed_green_blue_alpha_( .0, .0, .6, .3)) self.w.color10.enable(0) y += 20 self.w.check11 = SquareButton((10, y, 145, 20), "Points near vert. Metrics", callback=self.perform, sizeStyle="small") self.w.color11 = ColorWell( (155, y, 20, 20), color=NSColor.colorWithCalibratedRed_green_blue_alpha_( 1, 1, .0, .2)) self.w.color11.enable(0) y += 20 self.w.check12 = SquareButton((10, y, 145, 20), "Complex Curves", callback=self.perform, sizeStyle="small") self.w.color12 = ColorWell( (155, y, 20, 20), color=NSColor.colorWithCalibratedRed_green_blue_alpha_(1, 1, 0, 1)) self.w.color12.enable(0) y += 20 self.w.check13 = SquareButton((10, y, 145, 20), "Crossed handles", callback=self.perform, sizeStyle="small") self.w.color13 = ColorWell( (155, y, 20, 20), color=NSColor.colorWithCalibratedRed_green_blue_alpha_( 1, 0, .4, .2)) self.w.color13.enable(0) y += 20 self.w.check14 = SquareButton((10, y, 145, 20), "Straight Lines", callback=self.perform, sizeStyle="small") self.w.color14 = ColorWell( (155, y, 20, 20), color=NSColor.colorWithCalibratedRed_green_blue_alpha_( .0, .6, .0, .3)) self.w.color14.enable(0) y += 30 self.w.horizontalLine = HorizontalLine((10, y - 5, 165, 1)) self.w.clearGlyphMarksButton = SquareButton( (10, y, 90, 20), "Clear all marks", callback=self.clearGlyphMarks, sizeStyle="small") self.w.colorClearGlyphMarks = ColorWell( (100, y, 20, 20), color=NSColor.colorWithCalibratedRed_green_blue_alpha_(1, 1, 1, 1)) self.w.colorClearGlyphMarks.enable(0) self.w.closeWin = SquareButton((120, y, -10, 20), "x) close", callback=self.CloseWindow, sizeStyle="small") self.w.open()