Exemplo n.º 1
0
 def __init__(self):
     glyphWindow = getActiveGlyphWindow()
     if glyphWindow is None:
         return
     self.w = ActionWindow((1, 1),
                           centerInView=CurrentGlyphWindow().getGlyphView())
     self.w.responderWillBecomeFirstCallback = self.responderWillBecomeFirstCallback
     # There is probably a better way to set
     # the escape key to close the window but
     # I am lazy so I'm using a hidden button.
     self.w._closeButton = vanilla.ImageButton(
         (0, 0, 0, 0), bordered=False, callback=self._closeButtonCallback)
     self.w._closeButton.bind("\u001B", [])
     # Build the interface
     self.metrics = dict(
         margin=15,
         iconPadding=5,
         iconButtonWidth=30,
         iconButtonHeight=30,
         groupPadding=15,
     )
     rules = self.buildInterface(self.w)
     if rules is not None:
         self.w.addAutoPosSizeRules(rules, self.metrics)
     # Bind close.
     self.w.bind("close", self.windowCloseCallback)
     # Go
     self.w.open()
Exemplo n.º 2
0
    def start(self):
        super(SpacingHUDControl, self).start()
        events.addObserver(self, "currentGlyphChangedCallback",
                           "currentGlyphChanged")
        self.glyph = None

        foregroundColor = RoboHUDController().getForegroundColor()
        backgroundColor = RoboHUDController().getBackgroundColor()

        self.view.leftEditText = vanilla.EditText(
            (0, 0, 40, 19),
            "",
            callback=self.leftEditTextCallback,
            continuous=False,
            sizeStyle="small")
        self.view.widthEditText = vanilla.EditText(
            (40, 0, 40, 19),
            "",
            callback=self.widthEditTextCallback,
            continuous=False,
            sizeStyle="small")
        self.view.rightEditText = vanilla.EditText(
            (80, 0, 40, 19),
            "",
            callback=self.rightEditTextCallback,
            continuous=False,
            sizeStyle="small")
        self.view.icon = vanilla.ImageButton(
            (0, 19, 120, 11),
            imageObject=drawIcon(foregroundColor, backgroundColor),
            bordered=False)

        controls = [(self.view.widthEditText, NSCenterTextAlignment),
                    (self.view.leftEditText, NSLeftTextAlignment),
                    (self.view.rightEditText, NSRightTextAlignment)]
        for control, alignment in controls:
            textField = control.getNSTextField()
            textField.setBordered_(False)
            textField.setTextColor_(foregroundColor)
            textField.setBackgroundColor_(backgroundColor)
            textField.setFocusRingType_(NSFocusRingTypeNone)
            textField.setAlignment_(alignment)
        controls = [self.view.leftEditText, self.view.rightEditText]
        for index, control in enumerate(controls):
            next = index + 1
            if next == len(controls):
                next = 0
            next = controls[next].getNSTextField()
            control.getNSTextField().setNextKeyView_(next)
Exemplo n.º 3
0
    def __init__(self, resources_path):

        self.pref_key = 'com.ryanbugden.sidebear.increment'

        initialDefaults = {
            self.pref_key: 2,
        }
        registerExtensionDefaults(initialDefaults)

        try:
            self.g = CurrentGlyph()
        except:
            self.g = None

        window_width = 255
        window_margin = 20
        gutter = 25
        vert_gutter = 12
        rule_gutter = vert_gutter - 2
        text_box_height = 20
        row_1_y = -14
        row_2_y = row_1_y + vert_gutter + text_box_height - 5
        row_3_y = row_2_y + vert_gutter + text_box_height
        row_4_y = row_3_y + text_box_height + rule_gutter
        row_5_y = row_4_y + rule_gutter
        third_width = (window_width - (window_margin * 2) - (gutter * 2)) / 3
        self.window_height = window_margin * 2 + row_5_y + text_box_height + 8

        # The group of elements
        self.w = vanilla.Group((0, 0, -0, -0))

        # Current glyph
        self.w.curr_glyph_note = vanilla.TextBox(
            (window_margin + third_width / 2, window_margin + row_1_y,
             third_width * 2 + gutter * 2, text_box_height),
            "None",
            sizeStyle="regular",
            alignment="center")

        # Left width span rule
        self.w.left_w_span = vanilla.HorizontalLine(
            (window_margin + 2,
             window_margin + row_1_y + (text_box_height / 2), third_width, 1))

        # Left width vert rule
        self.w.left_w_vert = vanilla.VerticalLine(
            (window_margin + 1, window_margin + row_1_y, 1, text_box_height))

        # Right width span rule
        self.w.right_w_span = vanilla.HorizontalLine(
            (window_margin + third_width * 2 + gutter * 2,
             window_margin + row_1_y + (text_box_height / 2), third_width - 1,
             1))

        # Right width vert rule
        self.w.right_w_vert = vanilla.VerticalLine(
            (window_margin + third_width * 3 + gutter * 2 - 1,
             window_margin + row_1_y, 1, text_box_height))

        # Left side-bearing
        self.w.LSB = vanilla.EditText((window_margin, window_margin + row_2_y,
                                       third_width, text_box_height),
                                      text="",
                                      sizeStyle="small",
                                      callback=self.editLSBCallback,
                                      continuous=False)
        self.w.LSB.getNSTextField().setFocusRingType_(1)
        self.w.LSB.getNSTextField().setAlignment_(2)

        # Left swap bridge rule
        self.w.left_sw_rule = vanilla.HorizontalLine(
            (window_margin + third_width,
             window_margin + row_2_y + text_box_height / 2, gutter, 1))

        # Swap SB button
        self.w.swap_SB = vanilla.ImageButton(
            (window_margin + third_width + gutter, window_margin + row_2_y,
             third_width, text_box_height),
            imagePath=resources_path + '/_icon_Swap.pdf',
            callback=self.swapSBButtonCallback,
            sizeStyle='regular')

        # Right swap bridge rule
        self.w.right_sw_rule = vanilla.HorizontalLine(
            (window_margin + third_width * 2 + gutter,
             window_margin + row_2_y + text_box_height / 2, gutter, 1))

        # Right side-bearing
        self.w.RSB = vanilla.EditText(
            (window_margin + third_width * 2 + gutter * 2,
             window_margin + row_2_y, third_width, text_box_height),
            text="",
            sizeStyle="small",
            callback=self.editRSBCallback,
            continuous=False)
        self.w.RSB.getNSTextField().setFocusRingType_(1)
        self.w.RSB.getNSTextField().setAlignment_(2)

        # Center Glyph button
        self.w.center_glyph = vanilla.ImageButton(
            (window_margin + third_width + gutter, window_margin + row_3_y,
             third_width, text_box_height),
            imagePath=resources_path + '/_icon_Center.pdf',
            callback=self.centerGlyphButtonCallback,
            sizeStyle='regular')

        # Left vert bridge rule
        self.w.left_vert_rule = vanilla.VerticalLine(
            (window_margin + third_width / 2,
             window_margin + row_2_y + text_box_height, 1, vert_gutter))

        # Right vert bridge rule
        self.w.right_vert_rule = vanilla.VerticalLine(
            (window_margin + third_width * 2.5 + gutter * 2,
             window_margin + row_2_y + text_box_height, 1, vert_gutter))

        # Equals RSB button
        self.w.equals_RSB = vanilla.ImageButton(
            (window_margin, window_margin + row_3_y, third_width,
             text_box_height),
            imagePath=resources_path + '/_icon_EqualRSB.pdf',
            callback=self.equalsRSBButtonCallback,
            sizeStyle='regular')

        # Equals LSB button
        self.w.equals_LSB = vanilla.ImageButton(
            (window_margin + third_width * 2 + gutter * 2,
             window_margin + row_3_y, third_width, text_box_height),
            imagePath=resources_path + '/_icon_EqualLSB.pdf',
            callback=self.equalsLSBButtonCallback,
            sizeStyle='regular')

        # Rule
        self.w.rule = vanilla.HorizontalLine(
            (window_margin, window_margin + row_4_y,
             third_width * 3 + gutter * 2, 1))

        # Increment input
        self.increment = getExtensionDefault(self.pref_key, 2)
        self.w.inc_text_box = vanilla.EditText(
            (window_margin + gutter + third_width, window_margin + row_5_y,
             third_width, text_box_height),
            text="%s" % self.increment,
            sizeStyle="small",
            callback=self.incrementCallback)
        self.w.inc_text_box.getNSTextField().setFocusRingType_(1)
        self.w.inc_text_box.getNSTextField().setAlignment_(2)

        # Left expand/contract bridge rule
        self.w.left_ec_rule = vanilla.HorizontalLine(
            (window_margin + third_width,
             window_margin + row_5_y + text_box_height / 2, gutter, 1))

        # Right expand/contract bridge rule
        self.w.right_ec_rule = vanilla.HorizontalLine(
            (window_margin + third_width * 2 + gutter,
             window_margin + row_5_y + text_box_height / 2, gutter, 1))

        # Close SBs
        self.w.close_SB = vanilla.ImageButton(
            (window_margin, window_margin + row_5_y, third_width,
             text_box_height),
            imagePath=resources_path + '/_icon_Close.pdf',
            callback=self.closeSBButtonCallback,
            sizeStyle='regular')

        # Open SBs
        self.w.open_SB = vanilla.ImageButton(
            (window_margin + third_width * 2 + gutter * 2,
             window_margin + row_5_y, third_width, text_box_height),
            imagePath=resources_path + '/_icon_Open.pdf',
            callback=self.openSBButtonCallback,
            sizeStyle='regular')

        # Increment
        self.w.incr_caption = vanilla.TextBox(
            (window_margin + third_width, window_margin + row_5_y + 23,
             third_width + gutter * 2, text_box_height),
            "Increment",
            sizeStyle="mini",
            alignment="center")

        addObserver(self, "glyphChanged", "currentGlyphChanged")
        addObserver(self, "glyphChanged", "viewDidChangeGlyph")
        addObserver(self, "glyphChanged", "glyphWindowDidOpen")
        addObserver(self, "glyphDraw", "draw")

        self.updateUI_BothSB()
Exemplo n.º 4
0
    def __init__(self):
        self.glyph = CurrentGlyph()

        self.w = vanilla.Window((300, 0), minSize=(100, 100))

        metrics = dict(
            border=15,
            padding1=10,
            padding2=5,
            titleWidth=45,
            inputSpace=70,  # border + title + padding
            killButtonWidth=20,
            fieldHeight=22,
        )
        rules = [
            # Left
            "H:|-border-[leftTitle(==titleWidth)]-padding1-[leftField]-border-|",
            "H:|-inputSpace-[leftButton]-padding2-[leftKillButton(==killButtonWidth)]-border-|",
            "V:|-border-[leftTitle(==fieldHeight)]",
            "V:|-border-[leftField(==fieldHeight)]",
            "V:[leftField]-padding2-[leftButton]",
            "V:[leftField]-padding2-[leftKillButton(==leftButton)]",

            # Right
            "H:|-border-[rightTitle(==titleWidth)]-padding1-[rightField]-border-|",
            "H:|-inputSpace-[rightButton]-padding2-[rightKillButton(==killButtonWidth)]-border-|",
            "V:[leftButton]-padding1-[rightTitle(==fieldHeight)]",
            "V:[leftButton]-padding1-[rightField(==fieldHeight)]",
            "V:[rightField]-padding2-[rightButton]",
            "V:[rightField]-padding2-[rightKillButton(==rightButton)]",

            # Width
            "H:|-border-[widthTitle(==titleWidth)]-padding1-[widthField]-border-|",
            "H:|-inputSpace-[widthButton]-padding2-[widthKillButton(==killButtonWidth)]-border-|",
            "V:[rightButton]-padding1-[widthTitle(==fieldHeight)]",
            "V:[rightButton]-padding1-[widthField(==fieldHeight)]",
            "V:[widthField]-padding2-[widthButton]",
            "V:[widthField]-padding2-[widthKillButton(==rightButton)]",

            # Bottom
            "H:|-inputSpace-[line]-border-|",
            "H:|-inputSpace-[doneButton]-border-|",
            "V:[widthButton]-padding1-[line]-padding1-[doneButton]-border-|",
        ]

        self.w.leftTitle = vanilla.TextBox("auto", "Left:", alignment="right")
        self.w.leftField = vanilla.EditText("auto",
                                            "",
                                            continuous=False,
                                            callback=self.fieldCallback)
        self.w.leftButton = vanilla.Button("auto",
                                           "",
                                           callback=self.buttonCallback)
        self.w.leftKillButton = vanilla.ImageButton(
            "auto",
            imageNamed=NSImageNameStopProgressFreestandingTemplate,
            bordered=False,
            callback=self.buttonCallback)

        self.w.rightTitle = vanilla.TextBox("auto",
                                            "Right:",
                                            alignment="right")
        self.w.rightField = vanilla.EditText("auto",
                                             "",
                                             continuous=False,
                                             callback=self.fieldCallback)
        self.w.rightButton = vanilla.Button("auto",
                                            "",
                                            callback=self.buttonCallback)
        self.w.rightKillButton = vanilla.ImageButton(
            "auto",
            imageNamed=NSImageNameStopProgressFreestandingTemplate,
            bordered=False,
            callback=self.buttonCallback)

        self.w.widthTitle = vanilla.TextBox("auto",
                                            "Width:",
                                            alignment="right")
        self.w.widthField = vanilla.EditText("auto",
                                             "",
                                             continuous=False,
                                             callback=self.fieldCallback)
        self.w.widthButton = vanilla.Button("auto",
                                            "",
                                            callback=self.buttonCallback)
        self.w.widthKillButton = vanilla.ImageButton(
            "auto",
            imageNamed=NSImageNameStopProgressFreestandingTemplate,
            bordered=False,
            callback=self.buttonCallback)

        self.controlGroups = [
            dict(attr="leftMargin",
                 field=self.w.leftField,
                 button=self.w.leftButton),
            dict(attr="rightMargin",
                 field=self.w.rightField,
                 button=self.w.rightButton),
            dict(attr="width",
                 field=self.w.widthField,
                 button=self.w.widthButton),
        ]
        for group in self.controlGroups:
            field = group["field"]
            button = group["button"]
            button.getNSButton().setAlignment_(NSLeftTextAlignment)

        # if self.glyph.bounds is None:
        #     self.setFirstResponder(self.w.widthField)
        # else:
        #     self.setFirstResponder(self.w.leftField)
        # leftField = self.w.leftField.getNSTextField()
        # rightField = self.w.rightField.getNSTextField()
        # leftField.setNextKeyView_(rightField)
        # rightField.setNextKeyView_(leftField)

        self.w.line = vanilla.HorizontalLine("auto")
        self.w.doneButton = vanilla.Button("auto",
                                           "Close",
                                           callback=self.doneCallback)
        self.w.doneButton.bind(escapeCharacter, [])

        self.w.addAutoPosSizeRules(rules, metrics)

        self.w.open()
Exemplo n.º 5
0
    def __init__(self, value, callback):
        self.callback = callback
        super(OriginButton, self).__init__("auto")

        self.value = value

        self.image = vanilla.ImageView(
            "auto",
            scale="none"
        )
        self.topLeft = vanilla.ImageButton(
            "auto",
            bordered=False,
            callback=self.buttonCallback
        )
        self.topCenter = vanilla.ImageButton(
            "auto",
            bordered=False,
            callback=self.buttonCallback
        )
        self.topRight = vanilla.ImageButton(
            "auto",
            bordered=False,
            callback=self.buttonCallback
        )
        self.centerLeft = vanilla.ImageButton(
            "auto",
            bordered=False,
            callback=self.buttonCallback
        )
        self.centerCenter = vanilla.ImageButton(
            "auto",
            bordered=False,
            callback=self.buttonCallback
        )
        self.centerRight = vanilla.ImageButton(
            "auto",
            bordered=False,
            callback=self.buttonCallback
        )
        self.bottomLeft = vanilla.ImageButton(
            "auto",
            bordered=False,
            callback=self.buttonCallback
        )
        self.bottomCenter = vanilla.ImageButton(
            "auto",
            bordered=False,
            callback=self.buttonCallback
        )
        self.bottomRight = vanilla.ImageButton(
            "auto",
            bordered=False,
            callback=self.buttonCallback
        )
        self.updateIcon()

        metrics = {}
        rules = [
            "H:|[topLeft][topCenter(==topLeft)][topRight(==topLeft)]|",
            "H:|[centerLeft(==topLeft)][centerCenter(==topLeft)][centerRight(==topLeft)]|",
            "H:|[bottomLeft(==topLeft)][bottomCenter(==topLeft)][bottomRight(==topLeft)]|",

            "V:|"
                "[topLeft]"
                "[centerLeft(==topLeft)]"
                "[bottomLeft(==topLeft)]"
                "|",
            "V:|"
                "[topCenter(==topLeft)]"
                "[centerCenter(==topLeft)]"
                "[bottomCenter(==topLeft)]"
                "|",
            "V:|"
                "[topRight(==topLeft)]"
                "[centerRight(==topLeft)]"
                "[bottomRight(==topLeft)]"
                "|",
        ]
        self.addAutoPosSizeRules(rules, metrics)
Exemplo n.º 6
0
    def __init__(self,
            title,
            entry1PreText="",
            entry1PostText="",
            entry1Value=None,
            showEntry2=True,
            entry2PreText="",
            entry2PostText="",
            entry2Value=None,
            showLinkButton=False,
            linked=False,
            callback=None,
            valueChangedCallback=None
        ):
        super(TransformationGroup, self).__init__("auto")
        self.callback = callback
        self.valueChangedCallback = valueChangedCallback
        self.button = vanilla.Button(
            "auto",
            title,
            callback=self.buttonCallback
        )

        self.entry1PreText = vanilla.TextBox(
            "auto",
            entry1PreText,
            alignment="right"
        )
        self.entry1 = vanilla.EditText(
            "auto",
            entry1Value,
            callback=self.entry1Callback
        )
        self.entry1PostText = vanilla.TextBox(
            "auto",
            entry1PostText,
            alignment="left"
        )

        self.entry2PreText = vanilla.TextBox(
            "auto",
            entry2PreText,
            alignment="right"
        )
        self.entry2 = vanilla.EditText(
            "auto",
            entry2Value,
            callback=self.entry2Callback
        )
        self.entry2PostText = vanilla.TextBox(
            "auto",
            entry2PostText,
            alignment="left"
        )
        if not showEntry2:
            self.entry2PreText.show(False)
            self.entry2.show(False)
            self.entry2PostText.show(False)

        self.linked = linked
        self.linkedImage = getImage("icon-transform-linked")
        self.unlinkedImage = getImage("icon-transform-unlinked")
        if linked:
            image = self.linkedImage
        else:
            image = self.unlinkedImage
        if entry1Value != entry2Value:
            image = self.unlinkedImage
        self.linkedButton = vanilla.ImageButton(
            "auto",
            callback=self.linkedButtonCallback,
            imageObject=self.linkedImage,
            bordered=False
        )
        self.linkedButton.show(showLinkButton)
        self.linked = not self.linked
        self.linkedButtonCallback(self.linkedButton)

        field1 = self.entry1.getNSTextField()
        field2 = self.entry2.getNSTextField()
        field1.setNextKeyView_(field2)
        field2.setNextKeyView_(field1)

        self.metrics = dict(
            padding=3,
            buttonWidth=80,
            entryWidth=42,
            textWidth=15,
            linkedButtonWidth=30,
            linePadding=10
        )
        rules = [
            "H:|"
                "[button(==buttonWidth)]"
                "-padding-"
                "[entry1PreText(==textWidth)]"
                "-padding-"
                "[entry1(==entryWidth)]"
                "-padding-"
                "[entry1PostText(==textWidth)]"
                "-padding-"
                "[entry2PreText(==textWidth)]"
                "-padding-"
                "[entry2(==entryWidth)]"
                "-padding-"
                "[entry2PostText(==textWidth)]"
                "-padding-"
                "[linkedButton(==linkedButtonWidth)]",

            "V:|[button]",
            "V:|[entry1PreText]",
            "V:|[entry1]",
            "V:|[entry1PostText]",
            "V:|[entry2PreText]",
            "V:|[entry2]",
            "V:|[entry2PostText]",
            "V:|[linkedButton]",
        ]
        self.addAutoPosSizeRules(rules, self.metrics)
Exemplo n.º 7
0
 def start(self):
     self.view.yt = vanilla.ImageButton((0, 0, 19, 19),
                                        bordered=False,
                                        callback=self.alignTop)
     self.view.yc = vanilla.ImageButton((25, 0, 19, 19),
                                        bordered=False,
                                        callback=self.alignYCenter)
     self.view.yb = vanilla.ImageButton((50, 0, 19, 19),
                                        bordered=False,
                                        callback=self.alignBottom)
     self.view.xl = vanilla.ImageButton((0, 25, 19, 19),
                                        bordered=False,
                                        callback=self.alignLeft)
     self.view.xc = vanilla.ImageButton((25, 25, 19, 19),
                                        bordered=False,
                                        callback=self.alignXCenter)
     self.view.xr = vanilla.ImageButton((50, 25, 19, 19),
                                        bordered=False,
                                        callback=self.alignRight)
     self.view.cc = vanilla.ImageButton((0, 50, 19, 19),
                                        bordered=False,
                                        callback=self.alignCenterCenter)
     self.view.dx = vanilla.ImageButton((25, 50, 19, 19),
                                        bordered=False,
                                        callback=self.distributeXSpacing)
     self.view.dy = vanilla.ImageButton((50, 50, 19, 19),
                                        bordered=False,
                                        callback=self.distributeYSpacing)
     self.view.dt = vanilla.ImageButton((0, 75, 19, 19),
                                        bordered=False,
                                        callback=self.distributeTop)
     self.view.dyc = vanilla.ImageButton((25, 75, 19, 19),
                                         bordered=False,
                                         callback=self.distributeYCenter)
     self.view.db = vanilla.ImageButton((50, 75, 19, 19),
                                        bordered=False,
                                        callback=self.distributeBottom)
     self.view.dl = vanilla.ImageButton((0, 100, 19, 19),
                                        bordered=False,
                                        callback=self.distributeLeft)
     self.view.dxc = vanilla.ImageButton((25, 100, 19, 19),
                                         bordered=False,
                                         callback=self.distributeXCenter)
     self.view.dr = vanilla.ImageButton((50, 100, 19, 19),
                                        bordered=False,
                                        callback=self.distributeRight)
     self.setImagesInButtons()
     self.setToolTipsInButtons()
Exemplo n.º 8
0
    def __init__(self, glyph):
        self.w = StatusInteractivePopUpWindow(
            (250, 0), centerInView=CurrentGlyphWindow().getGlyphView())

        metrics = dict(
            border=15,
            padding1=10,
            padding2=5,
            titleWidth=45,
            inputSpace=70,  # border + title + padding
            killButtonWidth=20,
            navigateButtonWidth=30,
            fieldHeight=22,
        )
        rules = [
            # Left
            "H:|-border-[leftTitle(==titleWidth)]-padding1-[leftField]-border-|",
            "H:|-inputSpace-[leftButton]-padding2-[leftKillButton(==killButtonWidth)]-border-|",
            "V:|-border-[leftTitle(==fieldHeight)]",
            "V:|-border-[leftField(==fieldHeight)]",
            "V:[leftField]-padding2-[leftButton]",
            "V:[leftField]-padding2-[leftKillButton(==leftButton)]",

            # Right
            "H:|-border-[rightTitle(==titleWidth)]-padding1-[rightField]-border-|",
            "H:|-inputSpace-[rightButton]-padding2-[rightKillButton(==killButtonWidth)]-border-|",
            "V:[leftButton]-padding1-[rightTitle(==fieldHeight)]",
            "V:[leftButton]-padding1-[rightField(==fieldHeight)]",
            "V:[rightField]-padding2-[rightButton]",
            "V:[rightField]-padding2-[rightKillButton(==rightButton)]",

            # Width
            "H:|-border-[widthTitle(==titleWidth)]-padding1-[widthField]-border-|",
            "H:|-inputSpace-[widthButton]-padding2-[widthKillButton(==killButtonWidth)]-border-|",
            "V:[rightButton]-padding1-[widthTitle(==fieldHeight)]",
            "V:[rightButton]-padding1-[widthField(==fieldHeight)]",
            "V:[widthField]-padding2-[widthButton]",
            "V:[widthField]-padding2-[widthKillButton(==rightButton)]",

            # Bottom
            "H:|-inputSpace-[line]-border-|",
            "H:|-inputSpace-[previousGlyphButton(==navigateButtonWidth)]-padding2-[nextGlyphButton(==navigateButtonWidth)]-padding1-[doneButton(>=0)]-border-|",
            "V:[widthButton]-padding1-[line]",
            "V:[line]-padding1-[previousGlyphButton]-border-|",
            "V:[line]-padding1-[nextGlyphButton]-border-|",
            "V:[line]-padding1-[doneButton]-border-|",
        ]

        self.w.leftTitle = vanilla.TextBox("auto", "Left:", alignment="right")
        self.w.leftField = vanilla.EditText("auto",
                                            "",
                                            continuous=False,
                                            callback=self.fieldCallback)
        self.w.leftButton = vanilla.Button("auto",
                                           "",
                                           callback=self.buttonCallback)
        self.w.leftKillButton = vanilla.ImageButton(
            "auto",
            imageNamed=NSImageNameStopProgressFreestandingTemplate,
            bordered=False,
            callback=self.buttonCallback)

        self.w.rightTitle = vanilla.TextBox("auto",
                                            "Right:",
                                            alignment="right")
        self.w.rightField = vanilla.EditText("auto",
                                             "",
                                             continuous=False,
                                             callback=self.fieldCallback)
        self.w.rightButton = vanilla.Button("auto",
                                            "",
                                            callback=self.buttonCallback)
        self.w.rightKillButton = vanilla.ImageButton(
            "auto",
            imageNamed=NSImageNameStopProgressFreestandingTemplate,
            bordered=False,
            callback=self.buttonCallback)

        self.w.widthTitle = vanilla.TextBox("auto",
                                            "Width:",
                                            alignment="right")
        self.w.widthField = vanilla.EditText("auto",
                                             "",
                                             continuous=False,
                                             callback=self.fieldCallback)
        self.w.widthButton = vanilla.Button("auto",
                                            "",
                                            callback=self.buttonCallback)
        self.w.widthKillButton = vanilla.ImageButton(
            "auto",
            imageNamed=NSImageNameStopProgressFreestandingTemplate,
            bordered=False,
            callback=self.buttonCallback)

        self.controlGroups = [
            dict(attr="leftMargin",
                 field=self.w.leftField,
                 button=self.w.leftButton,
                 kill=self.w.leftKillButton),
            dict(attr="rightMargin",
                 field=self.w.rightField,
                 button=self.w.rightButton,
                 kill=self.w.rightKillButton),
            dict(attr="width",
                 field=self.w.widthField,
                 button=self.w.widthButton,
                 kill=self.w.widthKillButton),
        ]
        for group in self.controlGroups:
            field = group["field"]
            button = group["button"]
            button.getNSButton().setAlignment_(NSLeftTextAlignment)

        self.w.line = vanilla.HorizontalLine("auto")
        self.w.doneButton = vanilla.Button("auto",
                                           "Close",
                                           callback=self.doneCallback)
        self.w.doneButton.bind(escapeCharacter, [])
        self.w.previousGlyphButton = vanilla.Button(
            "auto", "←", callback=self.previousGlyphCallback)
        self.w.previousGlyphButton.bind("[", ["command"])
        self.w.nextGlyphButton = vanilla.Button(
            "auto", "→", callback=self.nextGlyphCallback)
        self.w.nextGlyphButton.bind("]", ["command"])

        self.w.addAutoPosSizeRules(rules, metrics)

        self.loadGlyph()

        self.w.open()