Skip to content

Commit

Permalink
Fixed bug related to qasync failing with non-awaited tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
theonlydvr committed Apr 30, 2024
1 parent fa2c385 commit f15460a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pybehave/Sources/VideoSource.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,9 @@ def initialize(self):
self.screen_width = int(self.screen_width)
mw.setGeometry(0, 0, self.screen_width, self.screen_height)
mw.show()
asyncio.set_event_loop(qasync.QEventLoop(self.app))
self.loop = asyncio.get_event_loop()
self.loop = qasync.QEventLoop(self.app)
asyncio.set_event_loop(self.loop)
asyncio.events._set_running_loop(self.loop)
self.loop.run_forever()

def register_component(self, component, metadata):
Expand Down Expand Up @@ -229,7 +230,7 @@ async def close_component_async(self, component_id):

@staticmethod
def metadata_defaults(comp_type: Component.Type = None) -> Dict:
return {"fr": 30, "row": 0, "col": 0, "row_span": 0, "col_span": 0}
return {"fr": 30, "row": 0, "col": 0, "row_span": 0, "col_span": 0, 'vid_type': 'webcam'}


class WebcamProvider(VideoProvider):
Expand Down

1 comment on commit f15460a

@SJChannel
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See also this comment for a possibly better solution to the qasync problem:

CabbageDevelopment/qasync#121 (comment)

Please sign in to comment.