TransWikia.com

Strange QGIS plugin behaviour if it runs for the first time

Geographic Information Systems Asked by SWP_IB on December 18, 2020

I have made a plugin that works fine in itself. Shortly said it fills a combobox based on a MS Access table. Then features in the map are shown that meet the value I select in the combobox.

But I encounter a strange phenomenon. If I run the plugin for the first time after starting QGIS, or after reloading it, the combobox is not filled and I can’t do anything but closing the plugin. Then, if I rerun the plugin it works fine.

What’s happening here?

The relevant code:

conn = pyodbc.connect('Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ= [path and .accdb];')
cursor = conn.cursor()
cursor.execute( [query] )
mylist.clear()                 
for row in cursor.fetchall():
  mylist.append(row[0])
  self.dlg.mycombobox.addItem(row[1]+' ('+str(row[2])+')')

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP