Fix error from new textualize from dismiss()
in call_after_refresh
.
#412
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is a bug fix, which addresses a new error that seems to have been caused by a
textualize
update.Because of the way the event loop works, as far as I can tell whenever a new
Screen
is made, it takes control of the application. This means if we are transferring data, if we want to show a 'Transferring' screen, then we need to pass a lot of options to a dialog class which itself runs the transfer. This approach seems a little strange, because the 'Transferring' window is just a lightweigh screen, whereas all options for the transfer are set and coordinated in theTransfer
tab, so it makes sense for the transfer logic to be in the transfer-tab class.To allow this,
FinishTransferScreen
provides an OK (proceed with transfer) or Cancel (dont transfer) button. If OK is pressed, previously is would change the message to 'Transferring' and callself.dismiss(True)
within acall_after_refresh
, that would (after GUI update) dismiss and trigger the callback functiontransfer_data
. In recent versions, this reaises an error.As a workaround, a new (slightly messier) workflow means
FinishTransferScreen
directly calls the transfer function, and the transfer function tears downFinishTransferScreen
itself. This is documented in a docstring in this PR.An alterantive approach would be:
FinishTransferScreen
and wait for response withpush_screen_wait
True
, call arun_transfer_data
function. This will create aRunTransferDialog
class that shows 'Transferring', but will also require all options from the transfer tab to be passed to it, including the interface. Then the code to run the transfer will be run from this dialog window.Overall I like this approach less because a lot of the core transfer code is moved into an obscure dialog, rather on the transfer tab, which has the function to coordinate and run the transfer.
See #431 for a much nicer solution to implement ASAP.