I’m having a heck of a time trying to keep my app appearing responsive
while shelling out to long running commands / downloading large files.
I’ve read everything I can find on the subject, which got me what I have
now, but nothing I try seems to work. How do I keep the interface
refreshed so that it’s not just a plain white box after other windows
are opened over it, etc? Below is a rough idea of what I have. What am
I missing?
def on_init
t = Wx::Timer.new(self, 55)
evt_timer(55) { Thread.pass }
t.start(25)
@frame = MyFrame.new
@frame.show
end
class MyFrame
…
def on_download(event)
…
Thread.new { download(file) }
…
end
on an event, download the file
def download(file_obj)
Wx::WindowDisabler.disable(self) do
info = Wx::BusyInfo.busy(‘Please wait…’, self) do
Wx::log_message(“Getting file #{file_obj.name}”)
file_obj.fetch # uses open-uri to get a large binary
end
end
…
end
end