Skip to content

Commit 5bbdbb8

Browse files
committed
SQLite: Adding a first connect to dialog
1 parent d77b576 commit 5bbdbb8

File tree

3 files changed

+25
-3
lines changed

3 files changed

+25
-3
lines changed

databases/geanypysqldb.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ def configuration_dialog(self):
2020
pass
2121

2222
def connect_dialog(self):
23-
pass
23+
geany.dialogs.show_msgbox("Not yet implemented", gtk.MESSAGE_ERROR)
2424

2525

databases/sqlanywhere.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
#!/usr/bin/env python
1+
+#!/usr/bin/env python
22
# -*- coding: utf-8 -*-
33
import os
44
import sys
5+
import geany
6+
import gtk
7+
58
import sqlanydb
69
sys.path.append(os.path.dirname(__file__))
710
from .geanypysqldb import GeanyPySQLDB

databases/sqlite.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,15 @@
33

44
import sys
55
import os
6+
import geany
7+
import gtk
8+
69
import sqlite3
710
sys.path.append(os.path.dirname(__file__))
811
from .geanypysqldb import GeanyPySQLDB
912
sys.path.remove(os.path.dirname(__file__))
1013

14+
1115
class GPS_sqlite(GeanyPySQLDB):
1216

1317
def __init__(self, path=None):
@@ -24,4 +28,19 @@ def disconnect(self):
2428
self.connection.close()
2529

2630
def connect_dialog(self):
27-
pass
31+
32+
db_path = geany.dialogs.show_input(
33+
title="Path of sqlite DB",
34+
parent=geany.main_widgets.window,
35+
label_text="Please specify path of SQLite database")
36+
if os.path.isfile(db_path):
37+
self.path = db_path
38+
try:
39+
self.connect()
40+
print "Connected"
41+
except:
42+
geany.dialogs.show_msgbox("Could not create connection", gtk.MESSAGE_ERROR)
43+
else:
44+
geany.dialogs.show_msgbox("Seems not to be a valid path", gtk.MESSAGE_ERROR)
45+
46+

0 commit comments

Comments
 (0)