Skip to content

Commit

Permalink
Merge pull request #932 from lanzagar/sql
Browse files Browse the repository at this point in the history
owsql: Call methods to open a table in the correct order
  • Loading branch information
lanzagar committed Dec 16, 2015
2 parents dc0c44b + 1bcfc92 commit 486ae5d
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions Orange/widgets/data/owsql.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,7 @@ def __init__(self):
"Download data to local memory",
callback=self.open_table)

self.connect()
if self.table:
QTimer.singleShot(0, self.open_table)
QTimer.singleShot(0, self.connect)

def error(self, id=0, text=""):
super().error(id, text)
Expand Down Expand Up @@ -165,11 +163,12 @@ def connect(self):
password=self.password
)
self.error(0)
self.refresh_tables()
self.database_desc = OrderedDict((
("Host", self.host), ("Port", self.port),
("Database", self.database), ("User name", self.username)
))
self.refresh_tables()
self.select_table()
except psycopg2.Error as err:
self.error(0, str(err).split('\n')[0])
self.database_desc = self.data_desc_table = None
Expand Down Expand Up @@ -205,7 +204,6 @@ def refresh_tables(self):
if table_name == self.table:
self.tablecombo.setCurrentIndex(i + 1)
self.tablecombo.addItem("Custom SQL")
self.select_table()

def select_table(self):
curIdx = self.tablecombo.currentIndex()
Expand Down

0 comments on commit 486ae5d

Please sign in to comment.