FHPythonUtils / Cli2Gui

Use this module to convert a cli program to a gui
MIT License
88 stars 7 forks source link

Bug: UI unresponsive after click `run` with fsg/psg #22

Open mokurin000 opened 1 week ago

mokurin000 commented 1 week ago

Before You Begin

Before proceeding, please make sure to follow these steps:

Issue Details

  1. start cli2gui UI
  2. enter arguments
  3. click Run
  4. UI will get stuck and warn unresponsive state

Description

This problem only occurs on pysimpleguiwrapper

Expected Behavior

UI should not be blocked

Actual Behavior

Unresponsive warn happens.

System Information

Please provide the following additional information about your system or environment:

FredHappyface commented 1 week ago

Hey thanks for the issue, I wasn't able to replicate this locally. I've created a test file based on the code you'd shared with me previously (just removing most of the business type logic). Seems not to freeze up the ui.

image

mokurin000 commented 1 week ago

Hey thanks for the issue, I wasn't able to replicate this locally. I've created a test file based on the code you'd shared with me previously (just removing most of the business type logic). Seems not to freeze up the ui.

image

could you please send your test script I'm testing on https://github.com/mokurin000/fuckingfast-batch-download/commit/test-freeze

also, did you add some fake payload (for exmaple time.sleep() ?

FredHappyface commented 1 week ago

Yeah sure its https://github.com/FHPythonUtils/Cli2Gui/blob/master/tests/argparse/test_22.py

Can't seem to view the image

Ah could it be the threading do you think? Shouldn't block dearpygui though? Unless I need to think about spawning a UI thread perhaps

mokurin000 commented 1 week ago

Yeah sure its https://github.com/FHPythonUtils/Cli2Gui/blob/master/tests/argparse/test_22.py

Can't seem to view the image

Ah could it be the threading do you think? Shouldn't block dearpygui though? Unless I need to think about spawning a UI thread perhaps

Ah, I think I may have misundescribe. I encountered blocking when I did not open another thread to start the main function. If Thread.start() is replaced with Thread.run(), it will run the task in the current thread, and then because the task is running in the UI thread, it will block the UI. What I did to solve the problem was to open the task in another thread (the wrapper)