#!/usr/bin/env python
# -*- coding: ISO-8859-1 -*-
# generated by wxGlade 0.4.1 on Sun Nov  5 14:02:37 2006

import wx, BIB

class DB_Engine(wx.Panel):
    def __init__(self, *args, **kwds):
        # begin wxGlade: DB_Engine.__init__
        kwds["style"] = wx.TAB_TRAVERSAL
        wx.Panel.__init__(self, *args, **kwds)
        self.label_1 = wx.StaticText(self, -1, _("Please choose the database engine you want to use"), style=wx.ALIGN_CENTRE)
        self.rb_dbengine = wx.RadioBox(self, -1, _("DB engine"), choices=[_("SQLite"), _("MySQL")], majorDimension=2, style=wx.RA_SPECIFY_COLS)
        self.label_2 = wx.StaticText(self, -1, _("- If you want to use Bibus on a single computer (mono-user), \n            SQLite is presumably the best choice."))
        self.label_3 = wx.StaticText(self, -1, _("- If you want to use Bibus on multiple computers (multi-user),\n            MySQL is presumably the best choice."))
        self.label_4 = wx.StaticText(self, -1, _("- You can change this choice at anytime in the preferences."))

        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_RADIOBOX, self.onDbEngine, self.rb_dbengine)
        # end wxGlade

    def __set_properties(self):
        # begin wxGlade: DB_Engine.__set_properties
        self.label_1.SetFont(wx.Font(14, wx.SWISS, wx.NORMAL, wx.BOLD, 0, ""))
        self.rb_dbengine.SetSelection(0)
        # end wxGlade
        if BIB.DB_TYPE == "MySQL": self.rb_dbengine.SetSelection(1)

    def __do_layout(self):
        # begin wxGlade: DB_Engine.__do_layout
        sizer_1 = wx.BoxSizer(wx.VERTICAL)
        sizer_2 = wx.BoxSizer(wx.HORIZONTAL)
        sizer_1.Add(self.label_1, 0, wx.ALL|wx.ADJUST_MINSIZE, 10)
        sizer_2.Add(self.rb_dbengine, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 5)
        sizer_1.Add(sizer_2, 1, wx.ALIGN_CENTER_HORIZONTAL, 0)
        sizer_1.Add(self.label_2, 0, wx.ADJUST_MINSIZE, 0)
        sizer_1.Add(self.label_3, 0, wx.ADJUST_MINSIZE, 0)
        sizer_1.Add(self.label_4, 0, wx.ADJUST_MINSIZE, 0)
        self.SetAutoLayout(True)
        self.SetSizer(sizer_1)
        sizer_1.Fit(self)
        sizer_1.SetSizeHints(self)
        # end wxGlade

    def onDbEngine(self, event): # wxGlade: DB_Engine.<event_handler>
        BIB.DB_TYPE = self.rb_dbengine.GetStringSelection()
        self.GetParent().GetParent().chainDB()	# reset the order of the pages in FirstStart

# end of class DB_Engine


