Skip to content

Commit

Permalink
v0.8.1
Browse files Browse the repository at this point in the history
attachement (and close) bug fix
  • Loading branch information
stonebig committed Jun 25, 2014
1 parent 3f7bb45 commit bb68f3c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
6 changes: 6 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ Changelog
=========


2014-06-25a : v0.8.1 'Attach them all !'
----------------------------------------

* support attachement of several databases with the same name


2014-06-21a : v0.8.0 'Mark the date !'
--------------------------------------

Expand Down
15 changes: 8 additions & 7 deletions sqlite_bro.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ class App:
"""the GUI graphic application"""
def __init__(self):
"""create a tkk graphic interface with a main window tk_win"""
self.__version__ = '0.8.0'
self._title= "2014-06-21a : 'Mark the date !'"
self.__version__ = '0.8.1'
self._title= "2014-06-25a : 'Attach them all !'"
self.conn = None # Baresql database object
self.database_file = ""
self.tk_win = Tk()
Expand Down Expand Up @@ -231,7 +231,10 @@ def attach_db(self):
filetypes=[("default", "*.db"), ("other", "*.db*"),
("all", "*.*")])
attach = os.path.split(filename)[1].split(".")[0]

avoid = {i[1]:0 for i in get_leaves(self.conn, 'attached_databases')}
att , indice = attach , 0
while attach in avoid:
attach, indice = att + "_" + str(indice), indice + 1
if filename != '':
self.set_initialdir(filename)
attach_order = "ATTACH DATABASE '%s' as '%s' " % (filename, attach)
Expand All @@ -240,11 +243,9 @@ def attach_db(self):

def close_db(self):
"""close the database"""
try:
self.db_tree.delete("Database")
except:
pass
self.conn.close
self.new_db(":memory:")
self.actualize_db()

def actualize_db(self):
"""refresh the database view"""
Expand Down

0 comments on commit bb68f3c

Please sign in to comment.