refactored component folders in builder

11 views
Skip to first unread message

jonathan.peirce

unread,
May 5, 2016, 11:43:22 AM5/5/16
to psycho...@googlegroups.com
Jeremy,

In this commit
    https://github.com/psychopy/psychopy/commit/f71eb473fce7f8316205222f9858d57271878591
it looks like a folder containing a component should work to store a builder component, but I can't seem to make that work.

Was that only done for custom folders rather than for PsychoPy's cuilt-in components? I'm currently doing some work there and I really want to move component files into folders.

I'm testing with

from psychopy.app.builder import components


for comp in components.getComponents():

print comp

but if I move grating.py and grating.png file into /grating (with an __init__.py) then getComponents no longer detects it.

Am I wrong in thinking that should work from your refactor?


cheers
Jon

-- 
Jonathan Peirce
http://www.peirce.org.uk


This message and any attachment are intended solely for the addressee
and may contain confidential information. If you have received this
message in error, please send it back to me, and immediately delete it. 

Please do not use, copy or disclose the information contained in this
message or in any attachment.  Any views or opinions expressed by the
author of this email do not necessarily reflect the views of the
University of Nottingham.

This message has been checked for viruses but the contents of an
attachment may still contain software viruses which could damage your
computer system, you are advised to perform your own checks. Email
communications with the University of Nottingham may be monitored as
permitted by UK legislation.

Jeremy Gray

unread,
May 9, 2016, 9:11:03 AM5/9/16
to psycho...@googlegroups.com
Hi Jon,

Sorry for the slow reply.

I think (not sure about this) that you are asking about whether moving files within the built-in components directory into their own subdirectories will work. I don't think so / not surprised it does not.

Line ~120 in that commit has this file glob

filexp = os.path.join(folder, '*.py')

and I think that will screen out any new subdirs. I am not sure what is the right thing to do without trying things out to see, since there are various complexities here (using import_module() to do an explicit relative import). Line 132 is

module = import_module(explicit_rel_path, package=pkg)

and explicit_rel_path is currently the name of a .py file, with the extension clipped off (see line 131).

--Jeremy


--
You received this message because you are subscribed to the Google Groups "psychopy-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to psychopy-dev...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages