36 |
|
|
37 |
class ChooseDBTableDialog(wxDialog): |
class ChooseDBTableDialog(wxDialog): |
38 |
|
|
39 |
def __init__(self, session, *args, **kwds): |
def __init__(self, parent, session): |
40 |
kwds["style"] = wxDIALOG_MODAL|wxCAPTION |
wxDialog.__init__(self, parent, -1, _("Choose layer from database"), |
41 |
wxDialog.__init__(self, *args, **kwds) |
style = wxDIALOG_MODAL|wxCAPTION) |
42 |
self.session = session |
self.session = session |
43 |
self.dbconns = self.session.DBConnections() |
self.dbconns = self.session.DBConnections() |
44 |
self.tables = [] |
self.tables = [] |
45 |
self.list_box_4 = wxListBox(self, -1) |
self.list_box_4 = wxListBox(self, -1) |
46 |
for i in range(len(self.dbconns)): |
for i in range(len(self.dbconns)): |
47 |
self.list_box_4.Append(self.dbconns[i].BriefDescription()) |
self.list_box_4.Append(self.dbconns[i].BriefDescription()) |
48 |
|
if self.list_box_4.GetCount() > 0: |
49 |
|
self.list_box_4.SetSelection(0, True) |
50 |
self.DB_CHOOSE_RETRIEVE = wxButton(self, ID_DBCHOOSE_RETRIEVE, |
self.DB_CHOOSE_RETRIEVE = wxButton(self, ID_DBCHOOSE_RETRIEVE, |
51 |
_("Retrieve")) |
_("Retrieve")) |
52 |
self.list_box_5 = wxListBox(self, ID_LB_DCLICK) |
self.list_box_5 = wxListBox(self, ID_LB_DCLICK) |
53 |
self.DB_CHOOSE_OK = wxButton(self, ID_DBCHOOSE_OK, _("OK")) |
self.DB_CHOOSE_OK = wxButton(self, ID_DBCHOOSE_OK, _("OK")) |
54 |
self.DB_CHOOSE_CANCEL = wxButton(self, ID_DBCHOOSE_CANCEL, _("Cancel")) |
self.DB_CHOOSE_CANCEL = wxButton(self, ID_DBCHOOSE_CANCEL, _("Cancel")) |
|
self.__set_properties() |
|
55 |
self.__do_layout() |
self.__do_layout() |
56 |
|
|
57 |
EVT_BUTTON(self, ID_DBCHOOSE_OK, self.OnOK) |
EVT_BUTTON(self, ID_DBCHOOSE_OK, self.OnOK) |
59 |
EVT_BUTTON(self, ID_DBCHOOSE_RETRIEVE, self.OnRetrieve) |
EVT_BUTTON(self, ID_DBCHOOSE_RETRIEVE, self.OnRetrieve) |
60 |
EVT_LISTBOX_DCLICK(self, ID_LB_DCLICK, self.OnLBDClick) |
EVT_LISTBOX_DCLICK(self, ID_LB_DCLICK, self.OnLBDClick) |
61 |
|
|
|
|
|
|
def __set_properties(self): |
|
|
self.SetTitle(_("Choose layer from database")) |
|
|
self.list_box_4.SetSelection(0) |
|
|
self.list_box_5.SetSelection(0) |
|
|
|
|
62 |
def __do_layout(self): |
def __do_layout(self): |
63 |
grid_sizer_1 = wxFlexGridSizer(2, 1, 0, 0) |
grid_sizer_1 = wxFlexGridSizer(2, 1, 0, 0) |
64 |
grid_sizer_3 = wxFlexGridSizer(1, 2, 0, 0) |
grid_sizer_3 = wxFlexGridSizer(1, 2, 0, 0) |
103 |
def OnLBDClick(self, event): |
def OnLBDClick(self, event): |
104 |
if self.list_box_5.GetSelection() >= 0: |
if self.list_box_5.GetSelection() >= 0: |
105 |
self.EndModal(wxID_OK) |
self.EndModal(wxID_OK) |
106 |
self.Show(false) |
self.Show(False) |
107 |
|
|
108 |
def OnOK(self, event): |
def OnOK(self, event): |
109 |
self.EndModal(wxID_OK) |
self.EndModal(wxID_OK) |
110 |
self.Show(false) |
self.Show(False) |
111 |
|
|
112 |
def OnCancel(self, event): |
def OnCancel(self, event): |
113 |
self.EndModal(wxID_CANCEL) |
self.EndModal(wxID_CANCEL) |
114 |
self.Show(false) |
self.Show(False) |
115 |
|
|
116 |
|
|
117 |
class DBDialog(wxDialog): |
class DBDialog(wxDialog): |
197 |
self.EndModal(wxID_OK) |
self.EndModal(wxID_OK) |
198 |
else: |
else: |
199 |
self.EndModal(wxID_CANCEL) |
self.EndModal(wxID_CANCEL) |
200 |
self.Show(false) |
self.Show(False) |
201 |
|
|
202 |
def OnOK(self, event): |
def OnOK(self, event): |
203 |
result = {} |
result = {} |
239 |
def __set_properties(self): |
def __set_properties(self): |
240 |
self.SetTitle(_("Database Management")) |
self.SetTitle(_("Database Management")) |
241 |
self.DB_ListBox.SetSize((200, 157)) |
self.DB_ListBox.SetSize((200, 157)) |
|
self.DB_ListBox.SetSelection(0) |
|
242 |
|
|
243 |
def __do_layout(self): |
def __do_layout(self): |
244 |
top = wxBoxSizer(wxVERTICAL) |
top = wxBoxSizer(wxVERTICAL) |