ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/ns_dev/Python/NinoCode/Active_prgs/MCP/Trunk/StorageUploadCostsDialog.py
Revision: 321
Committed: Tue Mar 26 14:51:35 2013 UTC (13 years ago) by nino.borges
Content type: text/x-python
Original Path: Python/NinoCode/Active_prgs/MCP/StorageUploadCostsDialog.py
File size: 4410 byte(s)
Log Message:
Added the disclosure letter feature with dialogs and warning message on main view edit.

File Contents

# User Rev Content
1 nino.borges 321 """
2    
3     StorageUploadCostsDialog
4    
5     Created by
6     Emanuel Borges
7     02.13.2013
8    
9     Dialog for changing the storage or upload costs for a case
10    
11     """
12    
13     import wx, os
14    
15     class StorageUploadCostsDialog(wx.Dialog):
16     def __init__(self, parent,storageCost,uploadCost):
17     #self.CLM = CLM
18     self.parent = parent
19     wx.Dialog.__init__(self, parent, -1, "Storage and Upload Cost", style = wx.DEFAULT_DIALOG_STYLE, size = (250,190))
20     storageCostStaticText = wx.StaticText(self, -1, "Storage Cost GB $:",wx.DefaultPosition)
21     self.storageCostControl = wx.TextCtrl(self,-1,str(storageCost), size=(60,-1))
22     uploadCostStaticText = wx.StaticText(self, -1, "Upload Cost GB $:",wx.DefaultPosition)
23     self.uploadCostControl = wx.TextCtrl(self,-1,str(uploadCost), size=(60,-1))
24    
25     storage_h = self.storageCostControl.GetSize().height
26     storage_w = self.storageCostControl.GetSize().width + self.storageCostControl.GetPosition().x + 2
27     self.storageSpin = wx.SpinButton(self, -1,(storage_w, 50),(storage_h*2/3, storage_h),wx.SP_VERTICAL)
28     self.storageSpin.SetRange(1, 100)
29     self.storageSpin.SetValue(0)
30    
31     upload_h = self.uploadCostControl.GetSize().height
32     upload_w = self.uploadCostControl.GetSize().width + self.uploadCostControl.GetPosition().x + 2
33     self.uploadSpin = wx.SpinButton(self, -1,(upload_w, 50),(upload_h*2/3, upload_h),wx.SP_VERTICAL)
34     self.uploadSpin.SetRange(1, 100)
35     self.uploadSpin.SetValue(0)
36    
37    
38     mainSizer = wx.BoxSizer(wx.VERTICAL)
39     storageCostSizer = wx.BoxSizer(wx.HORIZONTAL)
40     storageCostSizer.Add(storageCostStaticText,0,wx.ALL|wx.ALIGN_CENTER_VERTICAL,5)
41     storageCostSizer.Add(self.storageCostControl,0,wx.ALL,5)
42     storageCostSizer.Add(self.storageSpin,0,wx.ALL|wx.ALIGN_CENTER_VERTICAL,0)
43    
44     uploadCostSizer = wx.BoxSizer(wx.HORIZONTAL)
45     uploadCostSizer.Add(uploadCostStaticText,0,wx.ALL|wx.ALIGN_CENTER_VERTICAL,5)
46     uploadCostSizer.Add(self.uploadCostControl,0,wx.ALL,5)
47     uploadCostSizer.Add(self.uploadSpin,0,wx.ALL|wx.ALIGN_CENTER_VERTICAL,0)
48    
49     mainSizer.Add(storageCostSizer,0,wx.ALL, 10)
50     mainSizer.Add(uploadCostSizer,0,wx.ALL, 10)
51    
52     oKButton = wx.Button(self, wx.ID_OK)
53     oKButton.SetDefault()
54     cancelButton = wx.Button(self, wx.ID_CANCEL)
55     buttonSizer = wx.BoxSizer(wx.HORIZONTAL)
56     buttonSizer.Add(oKButton,0,wx.ALL,5)
57     buttonSizer.Add(cancelButton,0,wx.ALL,5)
58     mainSizer.Add(buttonSizer, 0, wx.ALIGN_CENTER|wx.ALL, 15)
59     self.SetSizer(mainSizer)
60    
61    
62     self.Bind(wx.EVT_SPIN_UP, self.OnStorageSpinUp, self.storageSpin)
63     self.Bind(wx.EVT_SPIN_DOWN, self.OnStorageSpinDown, self.storageSpin)
64     self.Bind(wx.EVT_SPIN_UP, self.OnUploadSpinUp, self.uploadSpin)
65     self.Bind(wx.EVT_SPIN_DOWN, self.OnUploadSpinDown, self.uploadSpin)
66    
67     def OnStorageSpinUp(self, event):
68     #print event.GetPosition()
69     oldValue = self.storageCostControl.GetValue()
70     if oldValue:
71     pass
72     else:
73     oldValue = 0
74     newValue = float(oldValue) + .5
75     self.storageCostControl.SetValue(str(newValue))
76     def OnStorageSpinDown(self,event):
77     oldValue = self.storageCostControl.GetValue()
78     if oldValue:
79     pass
80     else:
81     oldValue = 0
82     newValue = float(oldValue) - .5
83     self.storageCostControl.SetValue(str(newValue))
84    
85     def OnUploadSpinUp(self, event):
86     #print event.GetPosition()
87     oldValue = self.uploadCostControl.GetValue()
88     if oldValue:
89     pass
90     else:
91     oldValue = 0
92     newValue = float(oldValue) + .5
93     self.uploadCostControl.SetValue(str(newValue))
94     def OnUploadSpinDown(self,event):
95     oldValue = self.uploadCostControl.GetValue()
96     if oldValue:
97     pass
98     else:
99     oldValue = 0
100     newValue = float(oldValue) - .5
101     self.uploadCostControl.SetValue(str(newValue))
102    
103     def GetValues(self):
104     storageCost = self.storageCostControl.GetValue()
105    
106     uploadCost = self.uploadCostControl.GetValue()
107    
108     return storageCost,uploadCost