File: CleanDB.py

package info (click to toggle)
bibus 1.5.2%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 12,488 kB
  • sloc: python: 30,790; sql: 211; makefile: 158; xml: 10; sh: 3
file content (64 lines) | stat: -rw-r--r-- 2,287 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/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