Forum Replies Created
-
AuthorPosts
-
can you use the defconAppKit progressWindow?
Cocoa is build up rather smart so it checks when a view is been updated frequently before redrawing it on screen.
Although you can force a redraw:
self.w.text.getNSTextField().display()
after setting a string into the TextBox
Seconds screens is always a mess with full screens.
You could open a new Space Center in single window mode:
from mojo.UI import OpenSpaceCenter font = CurrentFont() if font: OpenSpaceCenter(font)
good luck!
If you look into any app bundle folder names are capitalized
The Resources folder is used for assets like image, everything except .py files.
This is handy in combination with an
ExtensionBundle
objectfrom mojo.extensions import ExtensionBundle myBundle = ExtensionBundle("MyBundleName") # assuming in the Resource folder there is a file called "myToolbarIcon.png" # when retrieving files from a bundle an extension is not required # this will return a NSImage object toolbarIcon = myBundle.get("myToolbarIcon")
see:
* http://doc.robofont.com/extensions/building-extensions/
* http://doc.robofont.com/api/mojo/mojo-extensions/(oh a thread that slipped thought my fingers)
this is indeed a bug, will be fixed in the next version
thanks
I suppose everything is possible :)
* use the the ExtensionBundle object to manage your extensions
from mojo.extensions import ExtensionBundle print ExtensionBundle.allExtentions()
see: extension API
* to share variables/packages the best thing todo is to add the a root path with your packages to the python sys.path.
an example
install.py
in an extensionimport sys import os sys.path.append(os.path.dirname(__file__))
this allows to import modules from an extension
* the python way of sharing global variables
* Registering custom events will be possible in the next version!
never thought about it to allow third party app use the same notification center, but this could be indeed very handy…good luck
does your font has a path? the path attribute with unsaved fonts is None.
try printing out the message send back from the generate method:
print font.generate(...)
the
progressBar
argument should be an ProgressWindow / Controller similar to a defconAppKit progressWindowthe required methods are
update(text=None)
andsetTickCount(value)
Hi
The
ToolbarGlyphTools
is an UI object that looks like a button that you can add in a toolbar dict item.usage:
from AppKit import NSImage from lib.UI.toolbarGlyphTools import ToolbarGlyphTools ## create your image, best is that the image is only black and white ## so the image can be inverted when clicked myToolBarImage = NSImage.alloc().initByReferencingFile_(imagePath) ## a ToolbarGlyphTools is similar like the vanilla.SegmentedButton but has an extra toolbar item attributes ## if you want to add more items to the segmented button the item attributes just contains more dicts ## the size of the segmented button is atomically multiplied by the number of items. toolbarView = ToolbarGlyphTools((30, 25), [dict(image=myToolBarImage, toolTip="My ToolTip"], trackingMode="one") newItem = dict(itemIdentifier="myNewButton", label="Button", callback=self.myCallback, view = ToolbarGlyphTools.alloc().init() )
good luck
use <pre> your code </pre> to get the syntax highlighting in a post
There are several kinds of notification systems in RoboFont. There is one on font data, the defcon notifications. Another one is on app level, specific build for tools and extension to use and the last one is on cocoa level, UI only.
see:
http://doc.robofont.com/api/custom-observers/
http://doc.robofont.com/api/custom-tools/he,
that is easy
from mojo.UI import CurrentFontWindow from AppKit import NSImageNameAdvanced class AddToolBarButton(object): def __init__(self): # maybe subscribe to the "fontDidOpen" event # get the current window window = CurrentFontWindow() if window is None: return # get the current toolbar items toolbarItems = window.getToolbarItems() # make a new one, see the vanilla docs for more info newItem = dict(itemIdentifier="myNewButton", label="Button", imageNamed=NSImageNameAdvanced, callback=self.myCallack, ) # add the new item to the existing toolbars toolbarItems.append(newItem) # get the vanilla window object vanillaWindow = window.window() # set the new toolbaritems in the window window.toolbar = vanillaWindow.addToolbar(toolbarIdentifier="myCustomToolbar", toolbarItems=toolbarItems, addStandardItems=False) # done def myCallack(self, sender): print "hit, do something!" AddToolBarButton()
good luck!
not by default :)
but you could make a script that checks/monitors a .enc file, parse the glyph names and add it to the user defaults….
(I know this doesn’t help you much)
euh?
an AccordionView only takes a vanilla like object, best is to subclass a
vanilla.Group
and add UI elements in there.good luck
(a working version attached)
Attachments:
You must be logged in to view attached files.you can only add vanilla like objects in an AccordionView, in your example the class aGroup is not a vanilla like object
use:
from vanilla import * class aGroup(Group): def __init__(self): super(aGroup, self).__init__((0, 0, -0, -0)) self.PopUpButton = PopUpButton((10, 10, -10, -10), ['PopUpButton'], sizeStyle='small')
good luck!
he
I’ve updated the example: http://doc.robofont.com/api/mojo/mojo-ui/
from mojo.UI import AccordionView from vanilla import * class MyInspector: def __init__(self): self.w = FloatingWindow((200, 600)) self.firstItem = TextEditor((10, 10, -10, -10)) self.secondItem = List((0, 0, -0, -0), ["a", "b", "c"]) self.thirdItem = Tabs((10, 10, -10, -10), ["1", "2", "3"]) self.fourthItem = Group((0, 0, -0, -0)) self.fourthItem.checkBox = CheckBox((10, 10, 100, 22), "CheckBox") self.fourthItem.editText = EditText((10, 40, -10, 22)) descriptions = [ dict(label="first item", view=self.firstItem, size=200, collapsed=False, canResize=False), dict(label="second item", view=self.secondItem, minSize=100, size=140, collapsed=True, canResize=True), dict(label="third item", view=self.thirdItem, minSize=100, size=140, collapsed=True, canResize=False), dict(label="fourth item", view=self.fourthItem, size=140, collapsed=False, canResize=False) ] self.w.accordionView = AccordionView((0, 0, -0, -0), descriptions) self.w.open() MyInspector()
good luck
February 28, 2013 at 18:58 in reply to: Python module pysvn: Works under 10.6, crash under 10.8 #5441RoboFont adds the current python site-packages to the embedded python path. This allows users to use their own modules and tools inside RoboFont. This only works if the packages is compiled with the same python version as the embedded python (2.7).
You can check if RoboFont finds the correct path:
from lib.scripting.scriptTools import localSitePackagesPath print localSitePackagesPath
Is there a traceback you can catch? somewhere in the scripting window or in the console.app?
can you send the crash report?I would not recommend you to change the content of the RoboFont.app packages cause it will break code signing, which is been checked on 10.8.
ah, your aren’t doing anything wrong
bug in setting smart sets.setSmartSet seems not to be working nicely with groups….
will be fixed in the next update, thanks
-
AuthorPosts