示例#1
0
    def keyUp_(self, event):
        if event.characters() == NSUpArrowFunctionKey or event.characters(
        ) == NSDownArrowFunctionKey:
            shiftDown = NSEvent.modifierFlags() & NSShiftKeyMask
            commandDown = NSEvent.modifierFlags() & NSCommandKeyMask
            value = 1
            if event.characters() == NSDownArrowFunctionKey: value *= -1
            if shiftDown: value *= 10
            if commandDown and shiftDown: value *= 10
            # if "End" in selector or "Right" in selector or "Left" in selector or "Beggining" in selector or "deleteBackward" in selector: return False

            strValue = self.stringValue()
            strValue = strValue.replace(",", ".")
            # print(strValue)
            for chr in strValue:
                if chr not in digits_dot_minus:
                    return True
            floatValue = float(strValue)
            floatValue += value
            floatValue = round(floatValue, 3)
            if floatValue % 1 != 0:
                strValue = floatValue
            else:
                strValue = int(floatValue)

            self.setStringValue_(str(strValue))
            # print(self.delegate())
            self.delegate().action_(self)
示例#2
0
 def _checkForUpdatesCallback(value):
     if value:
         if NSEvent.modifierFlags() & NSAlternateKeyMask:
             # only check the selected items
             items = self.getSelection()
             self.checkForUpdates(items)
         else:
             self.checkForUpdates()
         self.extensionListSelectionCallback(self.w.extensionList)
示例#3
0
 def _checkForUpdatesCallback(value):
     if value:
         if NSEvent.modifierFlags() & NSAlternateKeyMask:
             # only check the selected items
             selected = self.getSelection()
             self.checkForUpdates(selected)
         else:
             # only check for updates in items that are actually installed
             installed = [item.extensionObject() for item in self._wrappedItems if item.extensionObject().isExtensionInstalled()]
             self.checkForUpdates(installed)
         self.extensionListSelectionCallback(self.w.extensionList)
    def selectionCallback(self, multiLineView):

        if (multiLineView._glyphLineView.getSelected() is None):
            self.selected = not self.selected

        if (self.selected == True) or (multiLineView._glyphLineView.getSelected() is not None):
            myTypeBench.selectedLine = self.index
            myTypeBench.onSelectionUpdate()
        elif self.selected == False:
            myTypeBench.selectedLine = None
            myTypeBench.onSelectionUpdate()

        if (multiLineView._glyphLineView.getSelected() is not None) and (NSEvent.modifierFlags() & NSAlternateKeyMask):
            OpenGlyphWindow(self.font[multiLineView._glyphLineView.getSelected().name], False)
示例#5
0
    def selectionCallback(self, multiLineView):

        if (multiLineView._glyphLineView.getSelected() is None):
            self.selected = not self.selected

        if (self.selected == True) or (multiLineView._glyphLineView.getSelected() is not None):
            myTypeBench.selectedLine = self.index
            myTypeBench.onSelectionUpdate()
        elif self.selected == False:
            myTypeBench.selectedLine = None
            myTypeBench.onSelectionUpdate()

        if (multiLineView._glyphLineView.getSelected() is not None) and (NSEvent.modifierFlags() & NSAlternateKeyMask):
            OpenGlyphWindow(self.font[multiLineView._glyphLineView.getSelected().name], False)
示例#6
0
		Ctrl-R: Reset Charset. Ctrl-L: Latin1. Ctrl-J: LTR/RTL. Ctrl-C: Center. Ctrl-X: X-Ray. Not working? Please try in a newer macOS or use the <a href="https://www.google.com/chrome/">latest Chrome</a>. Pull mouse across this note to make it disappear.
	</p>
	</body>
</html>
""" % (samsaPlaceholder)

# clears macro window log:
Glyphs.clearLog()

# Query app version:
GLYPHSAPPVERSION = NSBundle.bundleForClass_(NSClassFromString(
    "GSMenu")).infoDictionary().objectForKey_("CFBundleShortVersionString")
appVersionHighEnough = not GLYPHSAPPVERSION.startswith("1.")

optionKeyFlag = 524288
optionKeyPressed = NSEvent.modifierFlags() & optionKeyFlag == optionKeyFlag
shouldCreateSamsa = False
if optionKeyPressed:
    shouldCreateSamsa = True

if appVersionHighEnough:
    firstDoc = Glyphs.orderedDocuments()[0]
    thisFont = Glyphs.font  # frontmost font
    exportPath = currentOTVarExportPath()
    # familyName = otVarFamilyName(thisFont)
    fullName = otVarFullName(thisFont)
    fileName = otVarFileName(thisFont)

    print("Preparing Test HTML for: %s" % fullName)

    if shouldCreateSamsa:
示例#7
0
# MenuTitle: Increase Kerning
# -*- coding: utf-8 -*-
__doc__ = """
Uses modifier keys to adjust the kerning.
"""

from AppKit import NSEvent
from GlyphsApp import Glyphs

Glyphs.clearLog()
# Glyphs.showMacroWindow()

# --- From mekkablue ---
keysPressed = NSEvent.modifierFlags()
shiftKey = 131072
controlKey = 262144
optionKey = 524288
commandKey = 1048576
shiftKeyPressed = keysPressed & shiftKey == shiftKey
controlKeyPressed = keysPressed & controlKey == controlKey
optionKeyPressed = keysPressed & optionKey == optionKey
commandKeyPressed = keysPressed & commandKey == commandKey
# ---


def get_current_glyphs():
    g1 = Glyphs.font.currentTab.layers[Glyphs.font.currentTab.layersCursor -
                                       1].parent
    g2 = Glyphs.font.currentTab.layers[
        Glyphs.font.currentTab.layersCursor].parent
    return g1, g2
示例#8
0
 def moveRight(self, sender):
     shiftKeyPressed = NSEvent.modifierFlags() & 1 << 17 == 1 << 17
     if shiftKeyPressed:
         self.moveGlyph(10)
     else:
         self.moveGlyph(1)