I’ve been working on a Google Image search experiment and I’m stuck.
When the button gets clicked, it should trigger the file browser to go to a special directory. I can get the directory to show up in the directory field. What I can’t seem to do is get the directory view to update.
How do I do this? Here’s the code so far?
import bpy
import pdb
# goobr_header.py
class GoobrHeader( bpy.types.Header ):
bl_space_type = "FILE_BROWSER"
def draw( self, context ):
layout = self.layout
scn = bpy.context.scene
col = layout.column()
split = col.split( percentage=0.5 )
colL = split.column()
colR = split.column()
colL.prop( scn, "searchTerm" )
colR.operator( "goobr_op" )
class GoobrOp( bpy.types.Operator ):
bl_idname = "goobr_op"
bl_label = "Get Google Images"
def execute( self, context ):
print( "test stub of execute for goobr op" )
fileSpace = context.space_data
fileSpace.params.directory = "/home/username/testdir/"
pdb.set_trace()
return { 'FINISHED',}
def register():
scn = bpy.types.Scene
scn.searchTerm = bpy.props.StringProperty( name = "search term", description = "Search term used to google for images.", default = "" )
def unregister():
pass
if __name__ == "__main__":
register()