Esempio n. 1
0
    def __init__(self, parent):
        self.parent = parent
        self.w = vanilla.FloatingWindow(
            (150, 130),
            "Speed Punk %s" % VERSION,
            closable=False,
            autosaveName='de.yanone.speedPunk.%s.prefWindow' % (environment),
        )

        from AppKit import NSHUDWindowMask, NSUtilityWindowMask, NSTitledWindowMask, NSBorderlessWindowMask
        self.w.getNSWindow().setStyleMask_(0 << 1 | 0 << 2
                                           | NSUtilityWindowMask
                                           | NSTitledWindowMask
                                           | NSBorderlessWindowMask)

        self.w.illustrationPositionRadioGroup = vanilla.RadioGroup(
            (10, 10, -10, 40), ["Outside of glyph", "Outer side of curve"],
            callback=self.radioGroupCallback,
            sizeStyle="small")

        self.w.curveGainTextBox = vanilla.TextBox((10, 60, -10, 17),
                                                  "Gain",
                                                  sizeStyle="mini")

        self.w.curveGainSlider = vanilla.Slider(
            (10, 70, -10, 25),
            tickMarkCount=5,
            callback=self.curveGainSliderCallback,
            sizeStyle="small",
            minValue=curveGain[0],
            maxValue=curveGain[1],
            value=self.parent.getPreference('curveGain'))

        if self.parent.getPreference(
                'illustrationPosition') == "outsideOfGlyph":
            self.w.illustrationPositionRadioGroup.set(0)
        if self.parent.getPreference(
                'illustrationPosition') == "outsideOfCurve":
            self.w.illustrationPositionRadioGroup.set(1)

        self.w.faderCheckBox = vanilla.CheckBox(
            (10, 100, -10, 17),
            "Fader",
            sizeStyle="small",
            callback=self.faderCheckBoxCallback)

        self.w.faderSlider = vanilla.Slider(
            (10, 125, -10, 25),
            sizeStyle="small",
            minValue=0,
            maxValue=1.0,
            value=1.0,
            callback=self.faderSliderCallback,
        )

        self.w.gradientImage = vanilla.ImageView((10, 150, -10, 15))
        self.w.histogramImage = vanilla.ImageView((10, 150, -10, 15))
Esempio n. 2
0
    def __init__(self):
        windowWidth = 200
        windowHeight = 240

        self.w = vanilla.FloatingWindow((50, 50, windowWidth, windowHeight),
                                        "CopySidebearings")

        self.fonts = [(makeDefaultIDString(font), font) for font in AllFonts()]
        fontNames = [i[0] for i in self.fonts]

        # dropdowns
        self.w.sourceUFOText = vanilla.TextBox((15, 15, 90, 22),
                                               "Source UFO:",
                                               sizeStyle="small")
        self.w.sourceUFODropDown = vanilla.PopUpButton((15, 30, 170, 20),
                                                       fontNames)
        self.w.sourceUFODropDown.set(0)

        self.w.destinationUFOText = vanilla.TextBox((15, 60, 90, 22),
                                                    "Destination UFO:",
                                                    sizeStyle="small")
        self.w.destinationUFODropDown = vanilla.PopUpButton((15, 75, 170, 20),
                                                            fontNames)
        self.w.destinationUFODropDown.set(1)

        # divider
        self.w.divider1 = vanilla.HorizontalLine((15, 108, -15, 1))

        # glyphs scope area
        self.w.iconAllGlyphs = vanilla.ImageView((15, 123, 12, 13))
        self.w.iconAllGlyphs.setImage(imagePath="../resources/allGlyphs.png")
        self.w.iconSelGlyphs = vanilla.ImageView((15, 149, 12, 13))
        self.w.iconSelGlyphs.setImage(
            imagePath="../resources/selectedGlyphs.png")
        self.w.glyphsRadioGroup = vanilla.RadioGroup(
            (32, 118, -15, 50), ["All Glyphs", "Selected Glyphs"],
            sizeStyle="small")
        self.w.glyphsRadioGroup.set(0)  # default to all glyphs

        # divider
        self.w.divider2 = vanilla.HorizontalLine((15, 176, -15, 1))

        # commit button
        self.w.commitButton = vanilla.Button(
            (15, 188, -15, 20),
            "Copy Sidebearings",
            sizeStyle="small",
            callback=self._commitButtonCallback)

        # note
        self.w.note = vanilla.TextBox((15, 215, -15, 15),
                                      "Open output window for results.",
                                      sizeStyle="mini",
                                      alignment="center")

        self.w.open()  # go go gadget window
Esempio n. 3
0
    def __init__(self):
        windowWidth = 200
        windowHeight = 270

        # amount area
        self.w = vanilla.FloatingWindow((windowWidth, windowHeight),
                                        "AdjustMargins")
        self.w.amountText = vanilla.TextBox((15, 17, 65, 22),
                                            "Amount:",
                                            sizeStyle="small")
        self.w.amountTextBox = vanilla.EditText((70, 12, -15, 22))

        # divider
        self.w.divider1 = vanilla.HorizontalLine((15, 48, -15, 1))

        # glyphs scope area
        self.w.iconAllGlyphs = vanilla.ImageView((15, 65, 12, 13))
        self.w.iconAllGlyphs.setImage(imagePath="../resources/allGlyphs.png")
        self.w.iconSelGlyphs = vanilla.ImageView((15, 91, 12, 13))
        self.w.iconSelGlyphs.setImage(
            imagePath="../resources/selectedGlyphs.png")
        self.w.glyphsRadioGroup = vanilla.RadioGroup(
            (32, 60, -15, 50), ["All Glyphs", "Selected Glyphs"],
            sizeStyle="small")
        self.w.glyphsRadioGroup.set(1)  # default to just selected glyphs

        # divider
        self.w.divider2 = vanilla.HorizontalLine((15, 121, -15, 1))

        # margins area
        self.w.iconBothMargins = vanilla.ImageView((15, 137, 12, 12))
        self.w.iconBothMargins.setImage(
            imagePath="../resources/bothMargins.png")
        self.w.iconLeftMargin = vanilla.ImageView((15, 161, 12, 12))
        self.w.iconLeftMargin.setImage(imagePath="../resources/leftMargin.png")
        self.w.iconRightMargin = vanilla.ImageView((15, 185, 12, 12))
        self.w.iconRightMargin.setImage(
            imagePath="../resources/rightMargin.png")
        self.w.marginSelectionGroup = vanilla.RadioGroup(
            (32, 133, -15, 70),
            ["Both Margins", "Left Margin Only", "Right Margin Only"],
            sizeStyle="small")
        self.w.marginSelectionGroup.set(0)  # default both margins

        # divider
        self.w.divider3 = vanilla.HorizontalLine((15, 216, -15, 1))

        # commit button
        self.w.commitButton = vanilla.Button(
            (15, 232, -15, 20),
            "Commit Adjustments",
            sizeStyle="small",
            callback=self.commitButtonCallback)

        self.w.open()  # go go gadget window
Esempio n. 4
0
 def __init__(self):
     self.w = vanilla.FloatingWindow((200, 120), "Sidebearings EQ")
     self.w.iconAll = vanilla.ImageView((15, 16, 13, 10))
     self.w.iconAll.setImage(imagePath="allglyphs.png")
     self.w.iconSelected = vanilla.ImageView((15, 43, 13, 10))
     self.w.iconSelected.setImage(imagePath="selectedglyphs.png")
     self.w.scopeRadioGroup = vanilla.RadioGroup(
         (35, 10, -15, 50), ["All Glyphs", "Selected Glyphs"],
         sizeStyle="small")
     self.w.scopeRadioGroup.set(1)
     self.w.divider1 = vanilla.HorizontalLine((15, 70, -15, 1))
     self.w.applyButton = vanilla.Button((15, 85, -15, 20),
                                         "Equalize Sidebearings",
                                         sizeStyle="small",
                                         callback=self.applyButtonCallback)
     self.w.open()
Esempio n. 5
0
    def __init__(self, parentWindow=None):
        self.needsUpdate = False
        self.__version__ = __version__
        if not getDefault("DrawBotCheckForUpdatesAtStartup", True):
            return
        self.currentVersion = getCurrentVersion()
        self.needsUpdate = StrictVersion(__version__) < StrictVersion(self.currentVersion)
        if not self.needsUpdate:
            return
        if parentWindow:
            self.w = vanilla.Sheet((450, 130), parentWindow=parentWindow)
        else:
            self.w = vanilla.Window((450, 130))

        self.w.appIcon = vanilla.ImageView((25, 15, 65, 65))
        self.w.appIcon.setImage(imageObject=AppKit.NSApp().applicationIconImage())

        title = "There is a new version of DrawBot!"
        txt = AppKit.NSAttributedString.alloc().initWithString_attributes_(title, {AppKit.NSFontAttributeName: AppKit.NSFont.boldSystemFontOfSize_(0)})
        self.w.introBold = vanilla.TextBox((100, 15, -15, 20), txt)

        self.w.intro = vanilla.TextBox((100, 45, -15, 200), "DrawBot %s is out now (you have %s).\nWould you like to download it now?" % (self.currentVersion, __version__), sizeStyle="small")

        self.w.cancelButton = vanilla.Button((-270, -30, 60, 20), "Cancel", callback=self.cancelCallback, sizeStyle="small")
        self.w.cancelButton.bind(".", ["command"])
        self.w.cancelButton.bind(unichr(27), [])

        self.w.openInBrowser = vanilla.Button((-200, -30, 120, 20), "Show In Browser", callback=self.openInBrowserCallback, sizeStyle="small")
        self.w.okButton = vanilla.Button((-70, -30, 55, 20), "OK", callback=self.okCallback, sizeStyle="small")
        self.w.setDefaultButton(self.w.okButton)

        self.w.open()
Esempio n. 6
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)