Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Using LrHttp in Export dialog

New Here ,
Mar 17, 2025 Mar 17, 2025

I adding a view in the export dialog with items created from http import:

 

function WebGUI.galleryView(f, sessions, props)

	local galleryView = {}
	local rowView = {}

	local numOfSessions = 0
	for idx, val in pairs(sessions) do
		if (isEmpty(props.filter)) or (not isEmpty(props.filter) and checkTable(props.filter, val["state"])) then
			table.insert (rowView, 
				f:group_box {
					width = 450,
					f:row { 
						f:checkbox { value = LrView.bind{ bind_to_object = selections, key = "box"..idx }, },
						f:static_text { title = val["state"], },
					},
					f:row {
						f:static_text { title = val["name"], },
					},
				}
			)
			numOfSessions = numOfSessions + 1
		end

		if (0 == numOfSessions % numOfSessionInRow) or (#sessions == idx) then
			table.insert (galleryView, f:row(rowView)) 
			rowView = {}
		end
	end

	return f:column(galleryView)
end

 

then it is used like this:

function ExportDialogSections.sectionsForBottomOfDialog( f, propertyTable )

	local result
	local bind = LrView.bind
	local webView = nil

	LrFunctionContext.postAsyncTaskWithContext( "showExportDialog", function( context )

			local err = Html.extractGaleries()
			if err then	LrDialogs.message( "HTTP error: ", err )
			else
				webSessions = Html.getSessions()
				WebGUI.initSelectionBinding( webSessions, context )
				webView = WebGUI.galleryView(f, webSessions, propertyTable)
			end
	end )

	local result = {
			{
[...]

				f:column {
					spacing = f:control_spacing(),

					f:scrolled_view {
						width = 550,
						height = 300,
						webView,
					},
				},


So my problem is that i need to run LrHttp inside async task, but I don't know how to make sectionsForBottomOfDialog() wait for the result of async task.

TOPICS
SDK
39
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
no replies

Have something to add?

Join the conversation