frederik

Forum Replies Created

Viewing 15 posts - 226 through 240 (of 531 total)
  • Author
    Posts
  • in reply to: Vanilla set.text to TextBox #5481

    frederik
    Keymaster

    can you use the defconAppKit progressWindow?

    see http://code.typesupply.com/browser/packages/defconAppKit/trunk/Lib/defconAppKit/windows/progressWindow.py

    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

    in reply to: Full Screen + Second Screen #5479

    frederik
    Keymaster

    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!

    in reply to: Resources #5477

    frederik
    Keymaster

    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 object

    from 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/

    in reply to: breakContour() and updateSelection() #5474

    frederik
    Keymaster

    (oh a thread that slipped thought my fingers)

    this is indeed a bug, will be fixed in the next version

    thanks

    in reply to: Extension Interoperability #5471

    frederik
    Keymaster

    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 extension

    import 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

    in reply to: Generate? #5468

    frederik
    Keymaster

    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 progressWindow

    the required methods are update(text=None) and setTickCount(value)

    in reply to: Font Collection Custom Tool #5464

    frederik
    Keymaster

    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

    in reply to: Font Collection Custom Tool #5461

    frederik
    Keymaster

    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/

    in reply to: Font Collection Custom Tool #5459

    frederik
    Keymaster

    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!

    in reply to: Update encoding #5457

    frederik
    Keymaster

    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)

    in reply to: AccordionView, storing groups in separate modules #5454

    frederik
    Keymaster

    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.
    in reply to: AccordionView, storing groups in separate modules #5452

    frederik
    Keymaster

    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!


    frederik
    Keymaster

    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

    in reply to: Python module pysvn: Works under 10.6, crash under 10.8 #5441

    frederik
    Keymaster

    RoboFont 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.

    in reply to: Adding a smart set via script doesn't work #5437

    frederik
    Keymaster

    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

Viewing 15 posts - 226 through 240 (of 531 total)