#!/usr/bin/env python
# -*- coding: utf-8 -*-
# generated by wxGlade 0.6.1 on Thu Feb  7 23:20:54 2008

import wx

# begin wxGlade: extracode
# end wxGlade


class CleanDatabase(wx.Dialog):
	def __init__(self, db, *args, **kwds):
		self.db = db
		# begin wxGlade: CleanDatabase.__init__
		kwds["style"] = wx.DEFAULT_DIALOG_STYLE
		wx.Dialog.__init__(self, *args, **kwds)
		self.label_1 = wx.StaticText(self, -1, _("Hitting \"Detele\" will remove all the references from the \"Non-classified\" key.\nSome of the references may not be deleted if they are in use by another user."))
		self.button_DeleteTrash = wx.Button(self, wx.ID_DELETE, "")
		self.label_2 = wx.StaticText(self, -1, _("Database cleanup may corrupt your database!\nYou should make a backup of your database before using this command."))
		self.button_CleanDB = wx.Button(self, -1, _("Check database"))
		self.static_line_1 = wx.StaticLine(self, -1)
		self.button_quit = wx.Button(self, wx.ID_CLOSE, "")

		self.__set_properties()
		self.__do_layout()

		self.Bind(wx.EVT_BUTTON, self.onEmptyTrash, self.button_DeleteTrash)
		self.Bind(wx.EVT_BUTTON, self.onCheckDB, self.button_CleanDB)
		self.Bind(wx.EVT_BUTTON, self.onClose, self.button_quit)
		# end wxGlade

	def __set_properties(self):
		# begin wxGlade: CleanDatabase.__set_properties
		self.SetTitle(_("Database cleanup"))
		self.button_quit.SetDefault()
		# end wxGlade

	def __do_layout(self):
		# begin wxGlade: CleanDatabase.__do_layout
		sizer_1 = wx.BoxSizer(wx.VERTICAL)
		grid_sizer_1 = wx.FlexGridSizer(3, 2, 5, 5)
		grid_sizer_1.Add(self.label_1, 0, wx.ALL, 5)
		grid_sizer_1.Add(self.button_DeleteTrash, 0, 0, 0)
		grid_sizer_1.Add(self.label_2, 0, wx.ALL, 5)
		grid_sizer_1.Add(self.button_CleanDB, 0, 0, 0)
		sizer_1.Add(grid_sizer_1, 1, wx.EXPAND, 0)
		sizer_1.Add(self.static_line_1, 0, wx.EXPAND, 0)
		sizer_1.Add(self.button_quit, 0, wx.ALL|wx.ALIGN_RIGHT, 5)
		self.SetSizer(sizer_1)
		sizer_1.Fit(self)
		self.Layout()
		# end wxGlade

	def onEmptyTrash(self, event): # wxGlade: CleanDatabase.<event_handler>
		self.db.emptyTrash()

	def onCheckDB(self, event): # wxGlade: CleanDatabase.<event_handler>
		self.db.checkDatabase()

	def onClose(self, event): # wxGlade: CleanDatabase.<event_handler>
		self.Close()

# end of class CleanDatabase

