<div dir="ltr"><div dir="ltr">Hi,<div><br></div><div>in relation to what I posted in <a href="https://gis.stackexchange.com/questions/305219/qgis-3-python-plugin-psycopg2-postgres-notify-listen-live-connection">https://gis.stackexchange.com/questions/305219/qgis-3-python-plugin-psycopg2-postgres-notify-listen-live-connection</a> I'm having the following problem:</div><div><br></div><div>I have a plugin with a table in a dock widget to allocate tasks to other users. The list of tasks (to be allocated by supervisors) is displayed in the table by:</div><div><br></div><div>- Psycopg2: query the table in my postgres database. I do a cur.fetchall() so I retrieve all the items in a list.</div><div>- QTableWidget: I run two 'for' loops to insert all the rows. After this, I change the formatting to some columns, etc.</div><div><br></div><div>Up to this point everything is working well, absolutely functional.</div><div><br></div><div>The Problem:</div><div> </div><div>I want to set up an open connection with a "LISTEN" channel so when any cell is modified within the table, I run a postgres trigger and the table UPDATES (hence, the script runs again and the table is re-created).</div><div><br></div><div>I couldn't manage to allocate this signal within my python script to the Task Manager to run in the background - because the python script runs in the main thread the QGIS gets frozen, waiting forever for the NOTIFY signal.</div><div><br></div><div>The only solution I found was to add the table itself to QGIS and use the new built-in function for listening notifications in layers. This works perfect, as I link it to run an action to re-run the table. The only problem is that I will always need to have the table added as a layer.</div><div><br></div><div>So my question is if I could use the same built-in connection in QGIS with my plugin, without having to be set up in a layer necessarily.</div><div><br></div><div>Hope this makes sense.</div><div>Thanks,</div><div>Raúl</div><div><br></div><div>PS: Another example: within the same philosophy, having a chat plugin in a widget will need to have a LISTEN channel always open, and having the "chat table" in the project doesn't seem right at all!</div><div><br></div></div></div>