Skip to content

Commit

Permalink
a new database overwrite previous datas
Browse files Browse the repository at this point in the history
  • Loading branch information
stonebig committed Jun 8, 2014
1 parent cb56be6 commit 05fe3ca
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions examples/sqlite_py_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def create_menu(self):
self.menu.add_command(label='New Database', command=self.new_db)
self.menu.add_command(label='New In-Memory Database',
command=lambda: self.new_db(":memory:"))
self.menu.add_command(label='Connect to Database ...',
self.menu.add_command(label='Open Database ...',
command=self.open_db)
self.menu.add_command(label='Close Database', command=self.close_db)
self.menu.add_separator()
Expand All @@ -87,7 +87,7 @@ def create_menu(self):
self.menu_help.add_command(label='about',
command=lambda: messagebox.showinfo(message="""
\nSqlite_py_manager : a graphic SQLite Client in 1 Python file
\nversion 2014-06-08b : 'The magic 8th PEP'
\nversion 2014-06-08c : 'The magic 8th PEP'
\n(https://github.com/stonebig/baresql/blob/master/examples)"""))

def create_toolbar(self):
Expand Down Expand Up @@ -133,6 +133,11 @@ def new_db(self, filename=''):
("all", "*.*")])
if filename != '':
self.database_file = filename
if os.path.isfile(filename):
if messagebox.askyesno(
message='Confirm Destruction of previous Datas ?',
icon='question', title='Destroying'):
os.remove(filename)
self.conn = Baresql(self.database_file)
self.actualize_db()

Expand Down

0 comments on commit 05fe3ca

Please sign in to comment.