-
Notifications
You must be signed in to change notification settings - Fork 0
/
DltWrng.py
76 lines (62 loc) · 2.91 KB
/
DltWrng.py
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
65
66
67
68
69
70
71
72
73
74
75
76
import wx
class DeleteWarning(wx.Dialog):
def __init__(self, parent, elem):
super(DeleteWarning, self).__init__(
parent,
title="Confirm Deletion",
size=(480, 225),
style=wx.DEFAULT_FRAME_STYLE &
~(wx.RESIZE_BORDER |
wx.MAXIMIZE_BOX |
wx.MINIMIZE_BOX))
self.elem = elem
self.parent = parent
self.InitUI()
self.show_me = False
def InitUI(self):
# put the buttons in a sizer
self.sizer = wx.BoxSizer(wx.VERTICAL)
if self.elem == 'line':
msg = 'Deleting a line will result in the\ndeletion of' \
'all related loops.\n' \
'Select the corresponding\nline letter to proceed.'
elif self.elem == 'node':
msg = 'Deleting a node will result in the\ndeletion of ' \
'all intersecting lines and\ntheir related loops.' \
'\n\nSelect the corresponding node letter to delete.'
elif self.elem == 'loop':
msg = 'Deleting a loop will result in the\ndeletion of ' \
'all data related to the loop.\n' \
'Select the corresponding loop\nnumber to proceed.'
elif self.elem == 'pump':
msg = 'Deleting a pump will result in the\ndeletion of ' \
'all data related to the pump.\n' \
'Select the corresponding\npump to proceed.'
hdrsizer = wx.BoxSizer(wx.HORIZONTAL)
hdr1 = wx.StaticText(self,
label=msg,
style=wx.ALIGN_CENTER_HORIZONTAL)
hdrsizer.Add(hdr1, 1, wx.LEFT, 20)
btnsizer = wx.BoxSizer(wx.HORIZONTAL)
self.wrng_shw = wx.CheckBox(self,
label='Do not show this warning again.')
ok = wx.Button(self, -1, "Ok")
xit = wx.Button(self, -1, "Cancel")
btnsizer.Add(self.wrng_shw, 0, wx.ALIGN_CENTER|wx.LEFT|wx.RIGHT, 15)
btnsizer.Add(ok, 0, wx.ALL|wx.ALIGN_CENTER, 5)
btnsizer.Add(xit, 0, wx.ALL|wx.ALIGN_CENTER, 5)
# bind the button events to handlers
self.Bind(wx.EVT_BUTTON, self.OnOk, ok)
self.Bind(wx.EVT_BUTTON, self.OnCancel, xit)
self.sizer.Add(hdrsizer, 1, wx.ALIGN_CENTER|wx.TOP, 10)
self.sizer.Add((20, 10))
self.sizer.Add(btnsizer, 1)
self.SetSizer(self.sizer)
self.Centre()
self.Show(True)
def OnOk(self, evt):
self.EndModal(True)
self.show_me = self.wrng_shw.GetValue()
def OnCancel(self, evt):
self.EndModal(False)
self.show_me = self.wrng_shw.GetValue()