Esempio n. 1
0
    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()
Esempio n. 2
0
    def __init__(self, posSize, uppercaseAccents, callbackAttrs, callbackCheck,
                 callbackBuild):
        super(BuildingCtrls, self).__init__(posSize)
        x, y, width, height = posSize
        self.uppercaseAccents = uppercaseAccents
        self.callbackAttrs = callbackAttrs
        self.callbackCheck = callbackCheck
        self.callbackBuild = callbackBuild

        jumpinY = 0
        self.uppercaseCheck = CheckBox(
            (0, jumpinY, width, vanillaControlsSize['CheckBoxRegularHeight']),
            'Use Uppercase accents',
            value=self.uppercaseAccents,
            callback=self.uppercaseCheckCallback)
        self.uppercaseCheck.enable(False)

        jumpinY += self.uppercaseCheck.getPosSize()[3] + MARGIN_ROW + 2
        self.checkButton = Button((0, jumpinY, width * .45,
                                   vanillaControlsSize['ButtonRegularHeight']),
                                  'Check',
                                  callback=self.checkButtonCallback)
        self.buildButton = Button((width * .55, jumpinY, width * .45,
                                   vanillaControlsSize['ButtonRegularHeight']),
                                  'Build',
                                  callback=self.buildButtonCallback)
Esempio n. 3
0
    def __init__(self,
                 dimensions,
                 applicant_roster,
                 font_family_id,
                 after_approve=None):
        super(ApplicantList, self).__init__(dimensions)

        _, _, width, height = self.getPosSize()

        self.applicant_roster = applicant_roster
        self.family_id = font_family_id
        self.after_approve = after_approve

        self.border = DashedRectangle((0, 0, width, height))
        self.enable_registry_button = CenteredButton(width,
                                                     height,
                                                     190,
                                                     24,
                                                     "Create Application Form",
                                                     callback=self.enable)

        self.label = TextBox((0, 0, -0, 22), "Applicants", sizeStyle="small")
        self.list = List((0, 23, 0, -34), [], columnDescriptions=self.columns)
        self.approve_applicant_button = Button((0, -24, 90, 24),
                                               "Approve",
                                               callback=self.approve_applicant)
        self.open_registration_page_button = Button(
            (-150, -20, 150, 17),
            "Open Application Form",
            callback=self.open_registration_page,
            sizeStyle="small")

        self.enabled = self.applicant_roster is not None
Esempio n. 4
0
        def __init__(self):
            tagGroups = {
                "GSUB": {
                    "aalt", "salt", "ss02", "ccmb", "ccmp", "liga", "dlig",
                    "rvrn", "cpsp"
                },
                "GPOS": {"kern", "mark", "mkmk", "cpsp", "ZZZZ"}
            }
            self.w = Window((300, 500),
                            "TagTest",
                            minSize=(200, 200),
                            autosaveName="TempTagTesttt")
            self.tags = FeatureTagGroup(300,
                                        tagGroups,
                                        callback=self.tagsChanged)

            self.w.tagsScrollView = AligningScrollView(
                (0, 0, 0, -50),
                self.tags,
                drawBackground=False,
                borderType=AppKit.NSNoBorder)
            self.w.mutateButton = Button((10, -30, 100, 20),
                                         "Mutate",
                                         callback=self.mutate)
            self.w.repopulateButton = Button((120, -30, 100, 20),
                                             "Repopulate",
                                             callback=self.repopulate)
            self.w.open()
Esempio n. 5
0
    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)
Esempio n. 6
0
    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()
Esempio n. 7
0
 def __init__(self, success_window):
     self.success_window = success_window
     
     self.window.introduction = TextBox((15, 15, -15, 22), 'Sign in with your Ghostlines account.', sizeStyle='small')
     self.window.email_label = TextBox((15, 44, -15, 22), 'Email:', sizeStyle='small')
     self.window.email_field = EditText((15, 61, -15, 22))
     self.window.password_label = TextBox((15, 101, -15, 22), 'Password:'******'small')
     self.window.password_field = SecureEditText((15, 119, -15, 22))
     self.window.need_account_button = Button((15, -35, 110, 17), 'Need Account?', callback=self.make_account, sizeStyle="small")
     self.window.sign_in_button = Button((175, -38, 110, 22), 'Sign In', callback=self.sign_in)
     self.window.setDefaultButton(self.window.sign_in_button)
Esempio n. 8
0
    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 add_recipient(self, sender):
     self.window.sheet = Sheet((250, 89), self.window)
     self.window.sheet.recipient = EditText((15, 15, -15, 22),
                                            "",
                                            placeholder="Email Address")
     self.window.sheet.cancel_button = Button((-190, 52, 80, 22),
                                              'Cancel',
                                              callback=self.close_sheet)
     self.window.sheet.create_button = Button(
         (-95, 52, 80, 22), 'Add', callback=self.create_recipient)
     self.window.sheet.setDefaultButton(self.window.sheet.create_button)
     self.window.sheet.open()
Esempio n. 10
0
    def __init__(self):
        self.glyph = None  # Typical RoboFont function
        self.updating = False

        pad = 10
        leading = 32
        y = pad
        w = 500
        h = 500
        c1 = 150
        c2 = 200
        bh = 24  # Button height
        leading = bh + pad / 2

        self.w = Window((100, 100, w, h), 'Final tool window', minSize=(w, h))
        self.w.fontList = List((pad, pad, c2, -w / 2), [],
                               doubleClickCallback=self.openFontCallback,
                               selectionCallback=self.update)

        y = pad
        self.w.fixTabWidths = Button((-c1 - pad, y, c1, bh),
                                     'Fix tab widths',
                                     callback=self.fixTabWidthsCallback)
        self.w.fixTabWidths.enable(False)

        y += leading
        self.w.fixNegativeWidths = Button(
            (-c1 - pad, y, c1, bh),
            'Fix negative widths',
            callback=self.fixNegativeWidthsCallback)
        self.w.fixNegativeWidths.enable(False)

        y += leading
        self.w.fixMissingComponentsWidths = Button(
            (-c1 - pad, y, c1, bh),
            'Fix missing components',
            callback=self.fixMissingComponentCallback)
        self.w.fixMissingComponentsWidths.enable(False)

        self.w.selectFolder = Button((-c1 - pad, -pad - bh, c1, bh),
                                     'Select fonts',
                                     callback=self.selectFontFolder)

        self.w.canvas = Canvas((pad, -w / 2 - pad, -pad, -w / 4),
                               delegate=self)

        self.w.report = EditText((pad, -w / 4 + pad, -pad, -pad),
                                 readOnly=False)

        self.w.bind('close', self.windowCloseCallback)
        self.w.open()

        self.dirPath = self.selectFontFolder()
Esempio n. 11
0
    def __init__(self, dimensions, storage=NullStorage()):
        self.storage = storage

        super(FileUploadField, self).__init__(dimensions)

        self.choose_file_button = Button((0, 3, 100, 17), "Choose File", sizeStyle="small", callback=self.choose_file)
        self.remove_file_button = Button((-60, 3, 60, 17), "Remove", sizeStyle="small", callback=self.remove_file)
        self.filepath_label = TextBox((18, 3, -70, 20), "")
        self.filepath_button = ImageButton((0, 3, -70, 20), "", callback=self.reveal_file)
        self.filepath_button.getNSButton().setTransparent_(True)
        self.filetype_image = ImageView((0, 4, 16, 16))

        self.filepath = self.storage.retrieve()
Esempio n. 12
0
 def show_subscriber_sheet(self, sender):
     self.window.sheet = Sheet((250, 107), self.window)
     self.window.sheet.name = EditText((15, 15, -15, 22),
                                       "",
                                       placeholder="Name")
     self.window.sheet.email_address = EditText((15, 43, -15, 22),
                                                "",
                                                placeholder="Email Address")
     self.window.sheet.cancel_button = Button((-190, 70, 80, 22),
                                              'Cancel',
                                              callback=self.close_sheet)
     self.window.sheet.create_button = Button(
         (-95, 70, 80, 22), 'Add', callback=self.create_subscriber)
     self.window.sheet.setDefaultButton(self.window.sheet.create_button)
     self.window.sheet.open()
Esempio n. 13
0
    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()
Esempio n. 14
0
    def setSliderInfo(self, sliderInfo):
        savedState = self.get()
        # clear all subviews
        for attr, value in list(self.__dict__.items()):
            if isinstance(value, VanillaBaseObject):
                delattr(self, attr)
        margin = 10
        y = margin
        self._tags = []
        self._defaultValues = {}
        for tag, (label, minValue, defaultValue,
                  maxValue) in sliderInfo.items():
            self._tags.append(tag)
            self._defaultValues[tag] = defaultValue
            attrName = f"slider_{tag}"
            slider = SliderPlus((margin, y, -margin, 40),
                                label,
                                minValue,
                                defaultValue,
                                maxValue,
                                continuous=self._continuous,
                                callback=self._sliderChanged)
            setattr(self, attrName, slider)
            y += 50

        self.resetAllButton = Button((10, y, 120, 25), "Reset all axes",
                                     self._resetAllButtonCallback)
        self.resetAllButton.enable(False)
        y += 35

        posSize = (0, 0, self.getPosSize()[2], y)
        self.setPosSize(posSize)
        self._updateState(savedState)
Esempio n. 15
0
 def __init__(self):
     self.w = Window((400, 400), "Mock Window")
     self.w.sheetButton = Button((10, 10, -10, 20),
                                 "Open sheet",
                                 callback=self.buttonCB)
     self.presets = []
     self._createPresetsList()
Esempio n. 16
0
    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()
Esempio n. 17
0
    def __init__(self):
        self.master_names = [m.name for m in Glyphs.font.masters][1:]

        item_height = 24.0
        w_width = 350.0
        w_height = item_height * 5
        margin = 10
        next_y = margin
        col_1_width = w_width - (margin * 2)
        item_height = 24

        self.w = Window((w_width, w_height), "Convert Master to Brace Layers")

        next_y = margin
        self.w.master_names_label = TextBox((margin, next_y + 2, col_1_width, item_height), "Master to Convert (Cannot be the first Master)", sizeStyle='regular')
        next_y += item_height
        self.w.master_names = PopUpButton((margin, next_y, col_1_width, item_height), self.master_names)
        next_y += item_height + margin
        selected_master_index = Glyphs.font.masters.index(Glyphs.font.selectedFontMaster)
        self.w.master_names.set(selected_master_index - 1)

        self.w.gobutton = Button((margin + (col_1_width / 4), next_y, col_1_width / 2, item_height), 'Add Brace Layers', callback=self.makeitso)

        self.w.setDefaultButton(self.w.gobutton)

        self.w.open()
	def createUI(self):
		x=10;y=10;w=80;h=30;space=5;self.size=(150,300);pos=(1200,300);
		self.w = HUDFloatingWindow((pos[0],pos[1], self.size[0],self.size[1]), "DeleteWindow")
		self.w.deleteRadio = RadioGroup((x, y, w, 190),["penPair", "stroke", "innerFill", "dependX", "dependY"],callback=self.radioGroupCallback)
		y += space + h + 190
		self.w.applyButton = Button((x,y,w,35), "Apply", callback=self.buttonCallback)
		self.deleteOption = None
		self.w.open()
Esempio n. 19
0
    def setSliderInfo(self, sliderInfo):
        self._savedSliderInfo = sliderInfo
        savedState = self.get()
        # clear all subviews
        for attr, value in list(self.__dict__.items()):
            if isinstance(value, VanillaBaseObject):
                delattr(self, attr)
        margin = 10
        y = margin
        self._tags = []
        self._defaultValues = {}
        haveHiddenAxes = False
        for tag, axisSliderInfo in sliderInfo.items():
            if axisSliderInfo.hidden:
                haveHiddenAxes = True
                if not self.showHiddenAxes:
                    continue
            self._tags.append(tag)
            self._defaultValues[tag] = axisSliderInfo.defaultValue
            attrName = f"slider_{tag}"
            slider = SliderPlus(
                (margin, y, -margin, 40),
                axisSliderInfo.label,
                axisSliderInfo.minValue,
                axisSliderInfo.defaultValue,
                axisSliderInfo.maxValue,
                continuous=self._continuous,
                callback=self._sliderChanged,
            )
            setattr(self, attrName, slider)
            y += 50

        self.resetAllButton = Button((10, y, 120, 25), "Reset all axes",
                                     self._resetAllButtonCallback)
        self.resetAllButton.enable(False)
        if haveHiddenAxes:
            self.showHiddenAxesButton = Button(
                (140, y, 140, 25),
                showHiddenAxesButtonLabels[self.showHiddenAxes],
                self._showHiddenAxesButtonCallback,
            )
        y += 35

        posSize = (0, 0, self.getPosSize()[2], y)
        self.setPosSize(posSize)
        self._updateState(savedState)
Esempio n. 20
0
 def __init__(self):
     self.w = Window((550, 140), "Replace named Layer")
     self.w.editText = EditText((10, 15, -10, 22), placeholder="Layer Name", text='{170}')
     self.w.correct_path_direction = CheckBox((10, 50, -10, 18), "Correct Path Direction", value=True, sizeStyle='small')
     self.w.sync_metrics = CheckBox((210, 50, -10, 18), "Sync Metrics", value=True, sizeStyle='small')
     self.w.add_if_missing = CheckBox((10, 70, -10, 18), "Add layer if missing", value=True, sizeStyle='small')
     self.w.copybutton = Button((10, 100, -10, 17), "Replace layer", callback=self.buttonCallback)
     self.w.open()
Esempio n. 21
0
 def show_notification_sheet(self, text, size=(300, 80)):
     self.w.notification = Sheet(size, self.parent.w)
     self.w.notification.text = TextBox((15, 15, -50, -15), text)
     self.w.notification.closeButton = Button(
         (-115, -37, 100, 22),
         'Close',
         callback=self.close_notification_sheet)
     self.w.notification.setDefaultButton(
         self.parent.w.notification.closeButton)
     self.w.notification.open()
Esempio n. 22
0
    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()
Esempio n. 23
0
    def __init__(self):
        self.font = Glyphs.font  # Returns the current that is open in GlyphsApp
        self.currentGlyphName = 'H'
        self.glyph = self.font[self.currentGlyphName].layers[0]
        lsb = int(round(self.glyph.LSB))
        rsb = int(round(self.glyph.RSB))

        pad = 10
        leading = 32
        y = pad
        w = 300
        h = 400
        buttonWidth = 100
        buttonHeight = 48

        self.w = Window((100, 100, w, h), 'DemoWindowTool')
        self.w.doDraw = CheckBox((pad, y, 100, 24),
                                 'Draw',
                                 callback=self.doDrawCallback)

        y += leading
        self.w.leftMarginLabel = TextBox((pad, y, -pad, 24), 'Left margin')
        y += leading / 2
        self.w.leftMarginSlider = Slider(
            (pad, y, -pad - 60, 24),
            minValue=MIN_LSB,
            maxValue=MAX_LSB,
            value=lsb,
            tickMarkCount=10,
            callback=self.leftMarginSliderCallback)
        self.w.leftMarginBox = EditText((-pad - 60 + pad, y, -pad, 24),
                                        callback=self.leftMarginBoxCallback)
        self.w.leftMarginBox.set(str(lsb))

        y += leading
        self.w.rightMarginLabel = TextBox((pad, y, -pad, 24), 'Right margin')
        y += leading / 2
        self.w.rightMarginSlider = Slider(
            (pad, y, -pad - 60, 24),
            minValue=MIN_RSB,
            maxValue=MAX_RSB,
            value=rsb,
            tickMarkCount=10,
            callback=self.rightMarginSliderCallback)
        self.w.rightMarginBox = EditText((-pad - 60 + pad, y, -pad, 24),
                                         callback=self.rightMarginBoxCallback)
        self.w.rightMarginBox.set(str(rsb))

        y = self.w.saveFont = Button((-buttonWidth - pad, -buttonHeight - pad,
                                      buttonWidth, buttonHeight),
                                     'Save',
                                     callback=self.saveFontCallback)

        self.w.open()
Esempio n. 24
0
    def buildTop(self):
        """Builds buttons at top.

        TODO: put in a group.
        """
        x = 4
        y = 4
        w = 100
        h = 24
        self.window.openFile = Button((x, y, w, h),
                                      'Open',
                                      sizeStyle='small',
                                      callback=self.openCallback)
        x += 110
        self.window.saveButton = Button((x, y, w, h),
                                        'Save',
                                        sizeStyle='small',
                                        callback=self.saveCallback)
        x += 110
        self.window.path = TextBox((x, y + 2, -40, h), '', sizeStyle='small')
Esempio n. 25
0
	def __init__( self ):
		hori_margin = 10
		verti_margin = hori_margin
		button_width = 30
		glyphname_width = 180
		line_height = 20
		gap = 9
		dialog_height = line_height + gap + line_height + gap + line_height
		dialog_width = button_width + gap + glyphname_width + gap + button_width
		self.w = Window( ( hori_margin + dialog_width + hori_margin, verti_margin + dialog_height + verti_margin ), "insert glyph" )
		self.w.center()
		x = hori_margin
		y = verti_margin
		# glyph name
		self.w.glyphname = EditText( ( x, y, glyphname_width, line_height ), '')
		self.w.glyphname.getNSTextField().setToolTip_( u'Enter the name of the glyph to be inserted. It is sufficient to enter the beginning of the glyph name, e.g. “deg” for “degree”.' )
		# buttons
		x += glyphname_width + gap
		self.w.alignleft = Button( ( x, y, button_width, line_height ), LEFT, callback = self.buttonCallback )
		self.w.alignleft.getNSButton().setToolTip_( 'Insert the other glyph left-aligned, i.e. at its original same position. Keyboard shortcut: Enter' )
		x += button_width + gap
		self.w.alignright = Button( ( x, y, button_width, line_height ), RIGHT, callback = self.buttonCallback )
		self.w.alignright.getNSButton().setToolTip_( 'Insert the other glyph right-aligned with respect to the advance widths. Keyboard shortcut: Esc' )
		self.w.setDefaultButton( self.w.alignleft )
		self.w.alignright.bind( "\x1b", [] )
		# insert as component
		as_component_is_checked = True
		if Glyphs.defaults["com.FMX.InsertGlyphToBackground.AsCompoment"]  is not None:
			as_component_is_checked = Glyphs.defaults["com.FMX.InsertGlyphToBackground.AsCompoment"]
		y += line_height + gap
		x = hori_margin
		self.w.as_component = CheckBox( ( x, y, dialog_width, line_height ), 'Insert as component', callback=None, value=as_component_is_checked )
		self.w.as_component.getNSButton().setToolTip_( 'If checked, the other glyph is inserted to the background as a component. Otherwise, it is inserted as paths (even if the other glyph is made of components).' )
		# clear current contents
		y += line_height + gap
		clear_contents_is_checked = True
		if Glyphs.defaults["com.FMX.InsertGlyphToBackground.ClearContents"]  is not None:
			clear_contents_is_checked = Glyphs.defaults["com.FMX.InsertGlyphToBackground.ClearContents"]
		self.w.clear_contents = CheckBox( ( x, y, dialog_width, line_height ), 'Clear current contents', callback=None, value=clear_contents_is_checked )
		self.w.clear_contents.getNSButton().setToolTip_( 'Check this to clear the background before inserting the other glyph. Uncheck to keep the current contents of the background.' )
		self.w.open()
Esempio n. 26
0
    def __init__(self, updates):
        self.updates = updates

        if self.updates:
            self.create_image()

            self.w.title = TextBox((105, 20, -20, 20), self.title)

            self.w.explanation = TextBox((105, 45, -20, 50), self.explanation)

            self.w.updateButton = Button((-150, -40, 130, 20),
                                         "Install Updates",
                                         callback=self.do_update)
            self.w.cancelButton = Button((-255, -40, 90, 20),
                                         "Not Now",
                                         callback=self.cancel)
            self.w.showDetailsButton = Button((105, -40, 110, 20),
                                              "Show Details",
                                              callback=self.show_details)
            self.w.setDefaultButton(self.w.updateButton)

            self.w.open()
Esempio n. 27
0
    def __init__(self, posSize, callbackAttrs, placeCallback, deleteCallback):
        super(AnchorsCtrls, self).__init__(posSize)
        self.callbackAttrs = callbackAttrs
        self.placeCallback = placeCallback
        self.deleteCallback = deleteCallback

        x, y, width, height = posSize

        jumpinY = 0
        self.heightCaption = TextBox(
            (32, jumpinY, width / 2.,
             vanillaControlsSize['TextBoxRegularHeight']), 'Height:')
        self.heightEdit = EditText(
            (width / 2., jumpinY, width / 2.,
             vanillaControlsSize['EditTextRegularHeight']),
            continuous=False,
            callback=self.heightEditCallback)

        jumpinY += self.heightEdit.getPosSize()[3] + MARGIN_ROW
        self.nameCaption = TextBox(
            (32, jumpinY, width / 2.,
             vanillaControlsSize['TextBoxRegularHeight']), 'Anchor:')
        self.nameCombo = ComboBox(
            (width / 2., jumpinY, width / 2.,
             vanillaControlsSize['ComboBoxRegularHeight']),
            ['top', '_top', 'bottom', '_bottom'],
            callback=self.nameComboCallback)

        jumpinY += self.nameCombo.getPosSize()[3] + MARGIN_ROW * 2
        self.placeButton = Button((0, jumpinY, width * .45,
                                   vanillaControlsSize['ButtonRegularHeight']),
                                  'Place',
                                  callback=self.placeButtonCallback)

        self.deleteButton = Button(
            (width * .55, jumpinY, width * .45,
             vanillaControlsSize['ButtonRegularHeight']),
            'Delete',
            callback=self.deleteButtonCallback)
    def __init__(self):
        self.verboten = {
            'right': ['napostrophe', 'Omegadasiavaria'],
            'left': ['ldot', 'Ldot', 'ldot.sc', 'sigmafinal'],
            'both': ['*.tf', '*.tosf', '.notdef', 'NULL', 'CR']
        }
        self.category = None
        self.messages = []
        self.interpolated_fonts = dict()
        self.use_real = True
        self.use_selection = False
        self.ignore_red = False
        self.current_glyph = None
        self.leftside_kerning_groups = None
        self.rightside_kerning_groups = None
        self.all_kern_categories = self.get_all_kern_categories()
        self.categories_leftside = self.get_categorised_glyphs('left')
        self.categories_rightside = self.get_categorised_glyphs('right')

        item_height = 24.0
        w_width = 300.0
        w_height = item_height * (7 + len(self.all_kern_categories))
        margin = 10
        next_y = margin
        col_1_width = w_width - (margin * 2)
        item_height = 24

        radio_height = item_height * len(self.all_kern_categories)

        self.w = Window((w_width, w_height), "Make Kerning Strings")

        self.w.text_1 = TextBox((margin, next_y, w_width, item_height), "Kern with:", sizeStyle='regular')
        next_y += item_height
        self.w.radioCategories = RadioGroup((margin, next_y, col_1_width, radio_height), self.all_kern_categories, sizeStyle='regular')
        self.w.radioCategories.set(0)
        next_y += radio_height + margin

        self.w.use_real = CheckBox((margin, next_y, col_1_width, item_height), "Use real words", value=True, sizeStyle='regular')
        next_y += item_height

        self.w.use_selected = CheckBox((margin, next_y, col_1_width, item_height), "Use the selected glyphs verbatum", value=False, sizeStyle='regular')
        next_y += item_height

        self.w.ignore_red = CheckBox((margin, next_y, col_1_width, item_height), "Ignore red marked glyphs", value=False, sizeStyle='regular')
        next_y += item_height + margin

        self.w.gobutton = Button((margin + (col_1_width / 4), next_y, col_1_width / 2, item_height), 'Make Strings', callback=self.makeitso)

        self.w.setDefaultButton(self.w.gobutton)
        self.w.center()
        self.w.open()
Esempio n. 29
0
    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()
Esempio n. 30
0
 def __init__(self):
     x = 10
     y = 10
     height = 20
     button_width = 30
     glyphname_width = 180
     gap = 6
     self.w = Window(
         (x + button_width + gap + glyphname_width + gap + button_width + x,
          y + height + y), "insert glyph")
     self.w.center()
     self.w.glyphname = EditText((x, y, glyphname_width, height), '')
     x += glyphname_width + gap
     self.w.alignleft = Button((x, y, button_width, height),
                               LEFT,
                               callback=self.buttonCallback)
     x += button_width + gap
     self.w.alignright = Button((x, y, button_width, height),
                                RIGHT,
                                callback=self.buttonCallback)
     self.w.setDefaultButton(self.w.alignleft)
     self.w.alignright.bind("\x1b", [])
     self.w.open()