diff --git a/LabelKey.glyphsPalette/Contents/Info.plist b/LabelKey.glyphsPalette/Contents/Info.plist index fd13dba..c0d8068 100644 --- a/LabelKey.glyphsPalette/Contents/Info.plist +++ b/LabelKey.glyphsPalette/Contents/Info.plist @@ -1,11 +1,9 @@ - + CFBundleDevelopmentRegion - English - CFBundleDisplayName - Label Key + en CFBundleExecutable plugin CFBundleIdentifier @@ -14,12 +12,10 @@ 6.0 CFBundleName Label Key - CFBundlePackageType - BNDL - CFBundleVersion - 2.0 CFBundleShortVersionString 2.0 + CFBundleVersion + 3 UpdateFeedURL https://github.com/RobertPratley/labelKey/LabelKey.glyphsPalette/Contents/Info.plist productPageURL @@ -30,9 +26,5 @@ Copyright, RobertPratley, 2017 NSPrincipalClass labelKey - PyMainFileNames - - ../MacOS/main.py - diff --git a/LabelKey.glyphsPalette/Contents/MacOS/main.py b/LabelKey.glyphsPalette/Contents/MacOS/main.py deleted file mode 100644 index 98f307d..0000000 --- a/LabelKey.glyphsPalette/Contents/MacOS/main.py +++ /dev/null @@ -1,11 +0,0 @@ -def _run(*scripts): - global __file__ - import os, sys #, site - sys.frozen = 'macosx_plugin' - base = os.environ['RESOURCEPATH'] - for script in scripts: - path = os.path.join(base, script) - __file__ = path - execfile(path, globals(), globals()) - -_run('plugin.py') diff --git a/LabelKey.glyphsPalette/Contents/MacOS/plugin b/LabelKey.glyphsPalette/Contents/MacOS/plugin old mode 100644 new mode 100755 index b21f0e4..3d1b859 Binary files a/LabelKey.glyphsPalette/Contents/MacOS/plugin and b/LabelKey.glyphsPalette/Contents/MacOS/plugin differ diff --git a/LabelKey.glyphsPalette/Contents/PkgInfo b/LabelKey.glyphsPalette/Contents/PkgInfo deleted file mode 100644 index 19a9cf6..0000000 --- a/LabelKey.glyphsPalette/Contents/PkgInfo +++ /dev/null @@ -1 +0,0 @@ -BNDL???? \ No newline at end of file diff --git a/LabelKey.glyphsPalette/Contents/Resources/plugin.py b/LabelKey.glyphsPalette/Contents/Resources/plugin.py index 0641f38..3a56e14 100644 --- a/LabelKey.glyphsPalette/Contents/Resources/plugin.py +++ b/LabelKey.glyphsPalette/Contents/Resources/plugin.py @@ -1,4 +1,5 @@ # encoding: utf-8 +from __future__ import division, print_function, unicode_literals ########################################################################################################### # @@ -11,6 +12,7 @@ # ########################################################################################################### from vanilla import * +import objc import re import os import codecs @@ -19,8 +21,8 @@ class labelKey(PalettePlugin): - - def settings( self ): + @objc.python_method + def settings(self): self.name = 'Label Key' self.width = 160 self.elementHeight = 16 @@ -51,7 +53,9 @@ def settings( self ): color = NSUnarchiver.unarchiveObjectWithData_(colorData) colours.append(color) self.colours = dict(zip(colorKeys, colours)) + self.order = [] + @objc.python_method def update(self, sender): if hasattr(self.paletteView.frame, 'labels'): delattr(self.paletteView.frame, 'labels') @@ -62,7 +66,8 @@ def update(self, sender): newHeight = self.elementHeight * len(self.order) self.paletteView.frame.resize(self.width, newHeight + 10) - def draw( self, view ): + @objc.python_method + def draw(self, view): keyDiameter = 10 height = view.bounds().size.height for num, i in enumerate(self.order, 1): @@ -73,7 +78,8 @@ def draw( self, view ): self.colours[i].set() NSBezierPath.bezierPathWithOvalInRect_(((0, height - (num * self.elementHeight)), (keyDiameter, keyDiameter))).fill() - def getKeyFile( self ): + @objc.python_method + def getKeyFile(self): keyFile = None try: thisDirPath = os.path.dirname(self.windowController().document().font.filepath) @@ -85,8 +91,8 @@ def getKeyFile( self ): if keyFile is None: keyFile = os.path.expanduser('~/Library/Application Support/Glyphs/Info/labelkey.txt') return keyFile - - def mapKeys( self, keyFile ): + @objc.python_method + def mapKeys(self, keyFile): order = [] colourLabels = {} if os.path.exists(keyFile): @@ -107,6 +113,7 @@ def setWindowController_(self, windowController): import traceback self.logError(traceback.format_exc()) + @objc.python_method def __file__(self): """Please leave this method unchanged""" return __file__