ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/ns_dev/Python/NinoCode/Active_prgs/MCP/Trunk/MCP_ViewEdit_UI.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/MCP_ViewEdit_UI.py
File size: 31569 byte(s)
Log Message:
Added the disclosure letter feature with dialogs and warning message on main view edit.

File Contents

# User Rev Content
1 ninoborges 8 """
2    
3     MCP_ViewEdit_UI
4    
5     Created by
6     Emanuel Borges
7     03.17.2011
8    
9     This is the UI for viewing or editing case info
10    
11     """
12    
13    
14 nino.borges 321 import wx, MCP_Lib, MCP_Console,os,CurrentProductionsDialog,CaseUploadsDialog,AddDocumentProductionDialog,CasePathsDialog,NinoGenTools,EditVendorFolderDialog,StorageUploadCostsDialog,DisclosureLetterDialog
15 ninoborges 8
16     class MyFrame(wx.Frame):
17     def __init__(self, parent, ID, title, pos=wx.DefaultPosition):
18     self.console = MCP_Console.MainConsole()
19    
20     wx.Frame.__init__(self, parent, ID, title, pos, size =(550,580))
21     self.panel = wx.Panel(self,-1)
22    
23     #self.panel.SetBackgroundColour("yellow green")
24     casesListStaticText = wx.StaticText(self.panel, -1, "Select Case: ",wx.DefaultPosition)
25 nino.borges 189 #casesList,casesDir = MCP_Lib.GetCaseList()
26     self.myCases, self.officeCases, self.allCases, casesDir = MCP_Lib.GetCaseList()
27     self.casesListChoice = wx.Choice(self.panel, -1, wx.DefaultPosition, choices=self.myCases)
28 ninoborges 8 self.casesListChoice.SetSelection(0)
29 nino.borges 303
30     self.uploadCostStaticText = wx.StaticText(self.panel, -1, "", (300, 70), (60, -1), wx.ALIGN_RIGHT)#"Upload:$20", (300, 70), (60, -1), wx.ALIGN_RIGHT)
31     self.storageCostStaticText = wx.StaticText(self.panel, -1, "", (300, 70), (65, -1), wx.ALIGN_RIGHT)#"Storage:$30", (300, 70), (65, -1), wx.ALIGN_RIGHT)
32     self.uploadCostStaticText.SetBackgroundColour('Dark Green')
33     self.uploadCostStaticText.SetForegroundColour('White')
34     self.storageCostStaticText.SetBackgroundColour('Dark Green')
35     self.storageCostStaticText.SetForegroundColour('White')
36    
37 nino.borges 321 self.disclosureLetterReminderText = wx.StaticText(self.panel, -1, "", (50, 55), (65, -1), wx.ALIGN_LEFT)
38     self.disclosureLetterReminderText.SetForegroundColour('Red')
39    
40 ninoborges 8 self.chargeableCheckBox = wx.CheckBox(self.panel,-1,"Chargeable?")
41     responsibleAttnyStaticText = wx.StaticText(self.panel, -1, "Responsible Attorney: ",wx.DefaultPosition)
42     self.responsibleAttnyTextCtrl = wx.TextCtrl(self.panel, -1, "", wx.DefaultPosition, (110,-1))
43     responsibleParalegalStaticText = wx.StaticText(self.panel, -1, "Responsible Paralegal: ",wx.DefaultPosition)
44     self.responsibleParalegalTextCtrl = wx.TextCtrl(self.panel, -1, "", wx.DefaultPosition, (110,-1))
45     platformChoicesList = ["",'Concordance DIS','Concordance LN','Relativity']
46     reviewPlatformStaticText = wx.StaticText(self.panel, -1, "Platform: ",wx.DefaultPosition)
47     self.reviewPlatformChoice = wx.Choice(self.panel, -1, wx.DefaultPosition, choices=platformChoicesList)
48     responsibleProcessingVendorStaticText = wx.StaticText(self.panel, -1, "Processing Vendor: ",wx.DefaultPosition)
49     self.responsibleProcessingVendorTextCtrl = wx.TextCtrl(self.panel, -1, "", wx.DefaultPosition, (150,-1))
50     responsibleScanningVendorStaticText = wx.StaticText(self.panel, -1, "Scanning Vendor: ",wx.DefaultPosition)
51     self.responsibleScanningVendorTextCtrl = wx.TextCtrl(self.panel, -1, "", wx.DefaultPosition, (150,-1))
52     responsibleHostingVendorStaticText = wx.StaticText(self.panel, -1, "Hosting Vendor: ",wx.DefaultPosition)
53     self.responsibleHostingVendorTextCtrl = wx.TextCtrl(self.panel, -1, "", wx.DefaultPosition, (150,-1))
54     responsibleTPMStaticText = wx.StaticText(self.panel, -1, "TPM: ",wx.DefaultPosition)
55     self.responsibleTPMTextCtrl = wx.TextCtrl(self.panel, -1, "", wx.DefaultPosition, (110,-1))
56     responsibleOfficeStaticText = wx.StaticText(self.panel, -1, "Office: ",wx.DefaultPosition)
57     self.responsibleOfficeTextCtrl = wx.TextCtrl(self.panel, -1, "", wx.DefaultPosition, (110,-1))
58     caseStatusStaticText = wx.StaticText(self.panel, -1, "Case Status: ",wx.DefaultPosition)
59     statusChoicesList = ['Active','Dormant','Closed','Archived']## Selecting archived automatically unchecks chareable.
60     self.caseStatusChoice = wx.Choice(self.panel, -1, wx.DefaultPosition, choices=statusChoicesList)
61    
62    
63 nino.borges 189 self.SetFields(self.myCases[0])
64 ninoborges 8
65     self.CreateBoxesSection()
66    
67 nino.borges 303 costSizer = wx.BoxSizer(wx.HORIZONTAL)
68     costSizer.Add(self.uploadCostStaticText,0,wx.ALL,5)
69     costSizer.Add(self.storageCostStaticText,0,wx.ALL,5)
70    
71 ninoborges 8 casesSizer = wx.BoxSizer(wx.HORIZONTAL)
72     casesSizer.Add(casesListStaticText,0,wx.ALL,5)
73     casesSizer.Add(self.casesListChoice,0,wx.ALL,5)
74 nino.borges 303 #casesSizer.Add(costSizer,0,wx.ALL,5)
75 ninoborges 8
76     secondHalfSizer = wx.GridBagSizer(5,5)
77     secondHalfSizer.Add(reviewPlatformStaticText, pos=(0,0))
78     secondHalfSizer.Add(self.reviewPlatformChoice, pos=(0,1))
79     secondHalfSizer.Add(self.chargeableCheckBox,pos=(0,3))
80     #secondHalfSizer.Add(self.chargeableCheckBox,pos=(0,2), span=(1,2), flag = wx.EXPAND|wx.ALIGN_CENTER_HORIZONTAL)
81     secondHalfSizer.Add(responsibleAttnyStaticText, pos=(1,0))
82     secondHalfSizer.Add(self.responsibleAttnyTextCtrl, pos=(1,1))
83     secondHalfSizer.Add(responsibleTPMStaticText, pos = (1,2))
84     secondHalfSizer.Add(self.responsibleTPMTextCtrl, pos = (1,3))
85     secondHalfSizer.Add(responsibleParalegalStaticText, pos=(2,0))
86     secondHalfSizer.Add(self.responsibleParalegalTextCtrl, pos=(2,1))
87     secondHalfSizer.Add(responsibleOfficeStaticText, pos=(2,2))
88     secondHalfSizer.Add(self.responsibleOfficeTextCtrl, pos=(2,3))
89     secondHalfSizer.Add(caseStatusStaticText, pos=(3,0))
90     secondHalfSizer.Add(self.caseStatusChoice, pos=(3,1))
91    
92     respVendorsStaticBox = wx.StaticBox(self.panel, -1, 'Responsible Vendors:')
93     respVendorsStaticBoxSizer = wx.StaticBoxSizer(respVendorsStaticBox, wx.VERTICAL)
94     respVendorsFlexGridSizer = wx.FlexGridSizer(3,2,10,10)
95     respVendorsFlexGridSizer.Add(responsibleProcessingVendorStaticText,5)
96     respVendorsFlexGridSizer.Add(self.responsibleProcessingVendorTextCtrl,5)
97     respVendorsFlexGridSizer.Add(responsibleScanningVendorStaticText,5)
98     respVendorsFlexGridSizer.Add(self.responsibleScanningVendorTextCtrl,5)
99     respVendorsFlexGridSizer.Add(responsibleHostingVendorStaticText,5)
100     respVendorsFlexGridSizer.Add(self.responsibleHostingVendorTextCtrl,5)
101     respVendorsStaticBoxSizer.Add(respVendorsFlexGridSizer,0,wx.ALL,20)
102    
103     mainSizer = wx.BoxSizer(wx.VERTICAL)
104 nino.borges 303 mainSizer.Add(costSizer,0,wx.RIGHT|wx.ALIGN_RIGHT,10)
105     mainSizer.Add(casesSizer,0,wx.BOTTOM|wx.LEFT|wx.RIGHT, 20)
106 ninoborges 8 mainSizer.Add(secondHalfSizer,0,wx.ALL,20)
107     mainSizer.Add(respVendorsStaticBoxSizer,0,wx.ALL,20)
108     #mainSizer.Add(self.chargeableCheckBox,0,wx.ALL,5)
109     #mainSizer.Add(self.reviewPlatformChoice,0,wx.ALL,5)
110     #mainSizer.Add(self.responsibleAttnyTextCtrl,0,wx.ALL,5)
111     #mainSizer.Add(self.responsibleParalegalTextCtrl,0,wx.ALL,5)
112     #mainSizer.Add(self.responsibleProcessingVendorTextCtrl,0,wx.ALL,5)
113     #mainSizer.Add(self.responsibleScanningVendorTextCtrl,0,wx.ALL,5)
114     #mainSizer.Add(self.responsibleHostingVendorTextCtrl,0,wx.ALL,5)
115     #mainSizer.Add(workDirSizer,0,wx.ALL, 10)
116     #mainSizer.Add(copyUpTypeStaticBoxSizer, 0, wx.ALL, 10)
117     mainSizer.Add(self.buttonSizer,0, wx.ALL|wx.ALIGN_BOTTOM|wx.ALIGN_CENTER, 10)
118    
119     self.oKButton.Disable()
120    
121     #self.chargeableCheckBox.Disable() ## Remove me.
122    
123     self.panel.SetSizer(mainSizer)
124    
125     self.CreateStatusBar()
126     self.SetStatusText("Ready.")
127     self.CreateMenuBar()
128    
129     self.Bind(wx.EVT_CHOICE, self.OnSetFields, self.casesListChoice)
130     self.Bind(wx.EVT_CHOICE, self.OnFormChanged, self.reviewPlatformChoice)
131     self.Bind(wx.EVT_CHOICE, self.OnFormChanged, self.caseStatusChoice)
132     self.Bind(wx.EVT_CHECKBOX, self.OnFormChanged, self.chargeableCheckBox)
133     self.Bind(wx.EVT_TEXT, self.OnFormChanged, self.responsibleAttnyTextCtrl)
134     self.Bind(wx.EVT_TEXT, self.OnFormChanged, self.responsibleTPMTextCtrl)
135     self.Bind(wx.EVT_TEXT, self.OnFormChanged, self.responsibleParalegalTextCtrl)
136     self.Bind(wx.EVT_TEXT, self.OnFormChanged, self.responsibleOfficeTextCtrl)
137     self.Bind(wx.EVT_TEXT, self.OnFormChanged, self.responsibleProcessingVendorTextCtrl)
138     self.Bind(wx.EVT_TEXT, self.OnFormChanged, self.responsibleScanningVendorTextCtrl)
139     self.Bind(wx.EVT_TEXT, self.OnFormChanged, self.responsibleHostingVendorTextCtrl)
140    
141     self.Bind(wx.EVT_BUTTON, self.OnProcess, self.oKButton)
142     self.Bind(wx.EVT_BUTTON, self.CloseWindow, self.cancelButton)
143    
144     def NothingYet(self,event):
145     """ A simple place holder function that is used to be a PASS statment when I'm creating controls"""
146     diag = wx.MessageDialog(self,"Nothing here yet!", "Disabled...",wx.OK | wx.ICON_INFORMATION)
147     diag.ShowModal()
148     diag.Destroy()
149    
150     def MenuData(self):
151 nino.borges 303 return(("Case",
152     ("Edit Case &Name","Allows you to edit the case name.",self.NothingYet,"DISABLED"),
153     ("Change Negotiated &Price","Allows you to edit the negotiated prices for hosting and uploading.",self.OnChangePricing,""),
154 nino.borges 321 ("Disclosure &Letter ...","Allows you to load and link your disclosure letter to this case.",self.OnChangeDisclosureLetter,""),
155 nino.borges 303 ("","","",""),
156     ("&Transfer Case","Allows you to transfer a case to another TPM.",self.NothingYet,"DISABLED"),
157     ("","","",""),
158     ("&Add New Case","Adds a new case to the system.",self.NothingYet,"DISABLED")),
159     ("View",
160 nino.borges 174 ("My Cases", "Chooses from your assigned cases.",self.OnChangeCaseView,"RADIO"),
161     ("My Office Cases", "Chooses from cases assigned to everyone in your office.",self.OnChangeCaseView,"RADIO"),
162     ("All Cases", "Chooses from all cases.",self.OnChangeCaseView,"RADIO"),
163     ("","","",""),
164     ("Case &Uploads", "Displays the Case Uploads for this case.",self.OnViewCaseUploads,""),
165     ("&Production History", "Displays the Production History for this case.",self.OnViewDocProduction,""),
166     ("","","",""),
167 nino.borges 258 ("My Case &Notes","Opens the case notes file for the current selected case.",self.OnViewCaseNotes,""),
168     ("My Production &Spec","Opens the production specifications file for the current selected case.",self.OnViewProdSpec,""),
169 nino.borges 261 ("&Alternate Media Folder","Opens the alternate media path for the current selected case.",self.OnOpenAlternateMediaFolder,""),
170 nino.borges 174 ("Open Case &Folder","Opens the case folder for the current selected case.",self.OnOpenCaseFolder,"")),
171 ninoborges 8 ("Production",
172 nino.borges 174 ("&Add Production Entry","Adds a new production to the matter database.",self.OnAddDocProduction,"")),
173 nino.borges 258 ("Settings",
174 nino.borges 268 ("Linked &Vendor Folders","Allows you to link vendor folders to this case for copy ups.",self.OnEditVendorFolders,""),
175 nino.borges 262 ("&Case Paths","Allows you to set or change the alternate media path.",self.OnCasePathsSettings,"")),
176 nino.borges 321 ("Reporting",
177     ("Create &Produciton Report","Creates or updates the Production Report Page.",self.OnCreateProductionReport,""),
178     ("&Managerial","Managerial reports.",self.NothingYet,"DISABLED")),
179 ninoborges 8 ("&Help",
180 nino.borges 174 ("&About", "Displays the About Window.", self.OnAbout,"")))
181 ninoborges 8
182     def CreateMenuBar(self):
183     menuBar = wx.MenuBar()
184 nino.borges 158 count = 1
185 ninoborges 8 for eachMenuData in self.MenuData():
186     menuLabel = eachMenuData[0]
187     menuItems = eachMenuData[1:]
188     menuBar.Append(self.CreateMenu(menuItems), menuLabel)
189 nino.borges 158 count = count + 1
190 ninoborges 8 self.SetMenuBar(menuBar)
191    
192    
193     def CreateMenu(self, menuData):
194     menu = wx.Menu()
195 nino.borges 174 for eachLabel, eachStatus, eachHandler, eachType in menuData:
196 ninoborges 8 if not eachLabel:
197     menu.AppendSeparator()
198     continue
199 nino.borges 174 if eachType == "RADIO":
200     menuItem = menu.AppendRadioItem(-1,eachLabel,eachStatus)
201     else:
202     menuItem = menu.Append(-1, eachLabel, eachStatus)
203 nino.borges 303 if eachType == 'DISABLED':
204     menuItem.Enable(False)
205 ninoborges 8 self.Bind(wx.EVT_MENU, eachHandler, menuItem)
206     return menu
207    
208    
209     def OnFormChanged(self,event):
210     self.oKButton.Enable()
211    
212     def OnSetFields(self,event):
213     #print self.casesListChoice.GetStringSelection()
214     self.SetFields(self.casesListChoice.GetStringSelection())
215     self.oKButton.Disable()
216    
217     def SetFields(self, case):
218 nino.borges 321 currentChargeableBool,currentRespAttorney,currentRespParalegal,currentRespVendorTpl,currentRevPlatform,respTPM,respOffice,caseStatus,uploadCost,storageCost,disclosureLetterBool = self.console.GetCaseData(case)
219 ninoborges 8 if currentChargeableBool:
220     self.chargeableCheckBox.SetValue(True)
221     else:
222     self.chargeableCheckBox.SetValue(False)
223     if currentRevPlatform == 'Concordance':
224     ## Make an assumption
225     currentRevPlatform = "Concordance DIS"
226     if currentRevPlatform:
227     #print currentRevPlatform
228     self.reviewPlatformChoice.SetStringSelection(currentRevPlatform)
229     else:
230     self.reviewPlatformChoice.SetStringSelection('')
231     if currentRespAttorney:
232     self.responsibleAttnyTextCtrl.SetValue(currentRespAttorney)
233     else:
234     self.responsibleAttnyTextCtrl.SetValue('')
235     if currentRespParalegal:
236     self.responsibleParalegalTextCtrl.SetValue(currentRespParalegal)
237     else:
238     self.responsibleParalegalTextCtrl.SetValue('')
239     if currentRespVendorTpl[0]:
240     self.responsibleProcessingVendorTextCtrl.SetValue(currentRespVendorTpl[0])
241     else:
242     self.responsibleProcessingVendorTextCtrl.SetValue("")
243     if currentRespVendorTpl[1]:
244     self.responsibleScanningVendorTextCtrl.SetValue(currentRespVendorTpl[1])
245     else:
246     self.responsibleScanningVendorTextCtrl.SetValue('')
247     if currentRespVendorTpl[2]:
248     self.responsibleHostingVendorTextCtrl.SetValue(currentRespVendorTpl[2])
249     else:
250     self.responsibleHostingVendorTextCtrl.SetValue('')
251     if respTPM:
252     self.responsibleTPMTextCtrl.SetValue(respTPM)
253     else:
254     self.responsibleTPMTextCtrl.SetValue('')
255     if respOffice:
256     self.responsibleOfficeTextCtrl.SetValue(respOffice)
257     else:
258     self.responsibleOfficeTextCtrl.SetValue('')
259     if caseStatus:
260     self.caseStatusChoice.SetStringSelection(caseStatus)
261     else:
262     self.caseStatusChoice.SetStringSelection('')
263 nino.borges 303 if storageCost:
264     self.storageCostStaticText.SetLabel(" Storage:$%s "%str(storageCost))
265     else:
266 nino.borges 321 self.storageCostStaticText.SetLabel(' Storage:$0 ')
267 nino.borges 303 if uploadCost:
268     self.uploadCostStaticText.SetLabel(" Upload:$%s "%str(uploadCost))
269     else:
270 nino.borges 321 self.uploadCostStaticText.SetLabel(' Upload:$0 ')
271     if currentChargeableBool:
272     if currentRevPlatform:
273     if disclosureLetterBool:
274     self.disclosureLetterReminderText.SetLabel('')
275     else:
276     self.disclosureLetterReminderText.SetLabel('WARNING: There is no disclosure letter for this case on file!')
277     else:
278     self.disclosureLetterReminderText.SetLabel('')
279     else:
280     self.disclosureLetterReminderText.SetLabel('')
281 ninoborges 8
282     def OnProcess(self, event):
283     caseName = self.casesListChoice.GetStringSelection()
284     if self.chargeableCheckBox.GetValue():
285     chargeableBool = True
286     else:
287     chargeableBool = False
288     currentRevPlatform = self.reviewPlatformChoice.GetStringSelection()
289     caseStatus = self.caseStatusChoice.GetStringSelection()
290     currentRespAttorney = self.responsibleAttnyTextCtrl.GetValue()
291     currentRespParalegal = self.responsibleParalegalTextCtrl.GetValue()
292     currentRespVendorTpl = (self.responsibleProcessingVendorTextCtrl.GetValue(),self.responsibleScanningVendorTextCtrl.GetValue(),
293     self.responsibleHostingVendorTextCtrl.GetValue())
294     respTPM = self.responsibleTPMTextCtrl.GetValue()
295     respOffice = self.responsibleOfficeTextCtrl.GetValue()
296     print "Updating Access DB..."
297     self.console.EditCaseData(caseName,chargeableBool,currentRespAttorney,currentRespParalegal,currentRespVendorTpl,currentRevPlatform,
298     respTPM,respOffice, caseStatus)
299     print "Complete!"
300     finishedDlg = wx.MessageDialog(self, "MCP: Your settings have been saved to the Matter Management database.", "MCP: Process Complete",wx.OK, wx.DefaultPosition)
301     finishedDlg.ShowModal()
302     finishedDlg.Destroy()
303     self.oKButton.Disable()
304    
305     def CreateBoxesSection(self):
306     self.oKButton = wx.Button(self.panel, wx.ID_OK,'Save')
307     self.oKButton.SetDefault()
308     self.oKButton.SetSize(self.oKButton.GetBestSize())
309     self.cancelButton = wx.Button(self.panel, wx.ID_CANCEL,'Close')
310     self.cancelButton.SetSize(self.cancelButton.GetBestSize())
311     self.buttonSizer = wx.BoxSizer(wx.HORIZONTAL)
312     self.buttonSizer.Add(self.oKButton,0,wx.ALL,10)
313     self.buttonSizer.Add(self.cancelButton,0,wx.ALL,10)
314    
315     def CloseWindow(self, event):
316     self.Close(True)
317 nino.borges 158
318 nino.borges 174 def OnChangeCaseView(self,event):
319     self.casesListChoice.Clear()
320     eventID = event.GetId()
321 nino.borges 303 #print eventID
322     if eventID == 105:
323 nino.borges 174 #change it to my cases
324 nino.borges 189 self.casesListChoice.SetItems(self.myCases)
325     self.casesListChoice.SetSelection(0)
326     self.SetFields(self.myCases[0])
327 nino.borges 303 if eventID == 106:
328 nino.borges 174 #change it to office cases
329 nino.borges 189 self.casesListChoice.SetItems(self.officeCases)
330     self.casesListChoice.SetSelection(0)
331     self.SetFields(self.officeCases[0])
332 nino.borges 303 if eventID == 107:
333 nino.borges 174 #change it to all cases
334 nino.borges 189 self.casesListChoice.SetItems(self.allCases)
335     self.casesListChoice.SetSelection(0)
336     self.SetFields(self.allCases[0])
337 nino.borges 174
338    
339 nino.borges 158 def OnViewCaseNotes(self,event):
340     caseName = self.casesListChoice.GetStringSelection()
341     office = self.responsibleOfficeTextCtrl.GetValue()
342     err = self.console.ViewCaseNotes(caseName,office)
343     if err:
344     errDlg = wx.MessageDialog(self, "MCP: The path to this case file could not be found.", "MCP: Does Not Compute",wx.OK, wx.DefaultPosition)
345     errDlg.ShowModal()
346     errDlg.Destroy()
347    
348     def OnViewProdSpec(self,event):
349     caseName = self.casesListChoice.GetStringSelection()
350     office = self.responsibleOfficeTextCtrl.GetValue()
351     err = self.console.ViewProdSpec(caseName,office)
352     if err:
353     errDlg = wx.MessageDialog(self, "MCP: The path to this case file could not be found.", "MCP: Does Not Compute",wx.OK, wx.DefaultPosition)
354     errDlg.ShowModal()
355     errDlg.Destroy()
356 ninoborges 8
357 nino.borges 261 def OnOpenAlternateMediaFolder(self,event):
358     caseName = self.casesListChoice.GetStringSelection()
359     office = self.responsibleOfficeTextCtrl.GetValue()
360     err = self.console.OpenAlternateMediaFolder(caseName,office)
361     if err:
362     errDlg = wx.MessageDialog(self, "MCP: There is no current alternate media folder for this case.\nYou can set this in Settings.", "MCP: Does Not Compute",wx.OK, wx.DefaultPosition)
363     errDlg.ShowModal()
364     errDlg.Destroy()
365    
366 ninoborges 8 def OnOpenCaseFolder(self,event):
367     caseName = self.casesListChoice.GetStringSelection()
368     office = self.responsibleOfficeTextCtrl.GetValue()
369     err = self.console.OpenCaseFolder(caseName,office)
370     if err:
371     errDlg = wx.MessageDialog(self, "MCP: The path to this case file could not be found.", "MCP: Does Not Compute",wx.OK, wx.DefaultPosition)
372     errDlg.ShowModal()
373     errDlg.Destroy()
374    
375     def OnViewCaseUploads(self, event):
376     uploadList = self.console.GetUploadData(self.casesListChoice.GetStringSelection())
377     numberOfRows = len(uploadList)
378     uploadTotal = self.console.GetUploadTotal(uploadList)
379     caseName = self.casesListChoice.GetStringSelection()
380     CLM = caseName.split("_(")[1]
381     CLM = CLM[:-1]
382     CLM = CLM.replace('-','.')
383     #print CLM
384     if numberOfRows == 0:
385     dlg = wx.MessageDialog(self, "MCP: There are no case uploads for this case.", "MCP: Does Not Compute",wx.OK, wx.DefaultPosition)
386     else:
387     dlg = CaseUploadsDialog.CaseUploadsDialog(self,numberOfRows, uploadList, uploadTotal,CLM)
388     #dlg.Show(True)
389     dlg.ShowModal()
390     dlg.Destroy()
391    
392     def OnViewDocProduction(self,event):
393 nino.borges 321 prodMatrix = self.console.GetProductionData(self.casesListChoice.GetStringSelection())
394     prodList = []
395     for key in prodMatrix.keys():
396     prodList.extend(prodMatrix[key])
397 ninoborges 8 numberOfRows = len(prodList)
398     prodTotals = self.console.GetProductionTotal(prodList)
399     caseName = self.casesListChoice.GetStringSelection()
400     CLM = caseName.split("_(")[1]
401     CLM = CLM[:-1]
402     CLM = CLM.replace('-','.')
403     #print CLM
404     if numberOfRows == 0:
405     dlg = wx.MessageDialog(self, "MCP: There are no current productions for this case.", "MCP: Does Not Compute",wx.OK, wx.DefaultPosition)
406     else:
407     dlg = CurrentProductionsDialog.CaseUploadsDialog(self,numberOfRows, prodList,CLM, prodTotals)
408     #dlg.Show(True)
409     dlg.ShowModal()
410     dlg.Destroy()
411    
412     def OnAddDocProduction(self, event):
413     caseName = self.casesListChoice.GetStringSelection()
414 nino.borges 321 caseDatabaseList = self.console.GetDatabaseList(caseName)
415     possibleProducedToEntities = self.console.GetPossibleProducedToEntities(caseName)
416     possibleProdReqByNames = self.console.GetPossibleProdReqByNames(caseName)
417 ninoborges 8 CLM = caseName.split("_(")[1]
418     CLM = CLM[:-1]
419     CLM = CLM.replace('-','.')
420     #print CLM
421 nino.borges 321 dlg = AddDocumentProductionDialog.AddDocumentProductionDialog(self,CLM, caseDatabaseList, possibleProducedToEntities,possibleProdReqByNames)
422 ninoborges 8 if dlg.ShowModal() == wx.ID_OK:
423 nino.borges 321 prodProcessedDate, begBates, endBates, prodDocCount, prodPageCount, prodNotes, prodTo, prodMedia,prodSource,prodReqBy,prodSentDate,prodMediaPassword = dlg.GetValues()
424 ninoborges 8 #print prodDate
425     dateConverter = NinoGenTools.DateUtilities()
426 nino.borges 321 prodID = 'prod_' + str(dateConverter.ConvertDateFormat(prodProcessedDate, convertToFormat='computer'))
427     errRpt = self.console.AddProductionEntry(CLM,prodID,prodProcessedDate,begBates,endBates,prodDocCount, prodPageCount, prodNotes, prodTo, prodMedia,prodSource,prodReqBy,prodSentDate,prodMediaPassword)
428 ninoborges 8 if errRpt:
429     doneDlg = wx.MessageDialog(self, "MCP: All fields need to be filled out.\nPlease try again.", "MCP: Does Not Compute",wx.OK, wx.DefaultPosition)
430     else:
431     doneDlg = wx.MessageDialog(self, "MCP: Production detail added successfully.", "MCP: Success",wx.OK, wx.DefaultPosition)
432     doneDlg.ShowModal()
433     doneDlg.Destroy()
434    
435 nino.borges 321 def OnChangeDisclosureLetter(self,event):
436     office = self.responsibleOfficeTextCtrl.GetValue()
437     altMediaPath, casePath = self.console.GetCasePathsData(self.casesListChoice.GetStringSelection(),office)
438     disclosureLetterSet,disclosureLetterPath = self.console.GetDisclosureLetterData(self.casesListChoice.GetStringSelection())
439     if disclosureLetterPath:
440     disclosureLetterPath = str(disclosureLetterPath)
441     else:
442     disclosureLetterPath = ""
443     dlg = DisclosureLetterDialog.DisclosureLetterDialog(self, disclosureLetterSet, disclosureLetterPath, casePath)
444     if dlg.ShowModal() == wx.ID_OK:
445     newdisclosureLetterPath,errRpt = dlg.GetValues()
446     dlg.Destroy()
447     if errRpt:
448     doneDlg = wx.MessageDialog(self, "MCP: The Disclosure letter could NOT be loaded.\nPlease try again.", "MCP: Does Not Compute",wx.OK, wx.DefaultPosition)
449     else:
450     if newdisclosureLetterPath == disclosureLetterPath:
451     doneDlg = False
452     else:
453     self.console.SetDisclosureLetterData(self.casesListChoice.GetStringSelection(),newdisclosureLetterPath)
454     doneDlg = wx.MessageDialog(self, "MCP: Disclosure letter loaded successfully.", "MCP: Success",wx.OK, wx.DefaultPosition)
455     self.disclosureLetterReminderText.SetLabel('')
456     if doneDlg:
457     doneDlg.ShowModal()
458     doneDlg.Destroy()
459    
460 nino.borges 262 def OnCasePathsSettings(self, event):
461     office = self.responsibleOfficeTextCtrl.GetValue()
462     altMediaPath, casePath = self.console.GetCasePathsData(self.casesListChoice.GetStringSelection(),office)
463     if altMediaPath:
464     pass
465     else:
466     altMediaPath = ""
467     dlg = CasePathsDialog.CasePathsDialog(self, altMediaPath, casePath)
468     if dlg.ShowModal() == wx.ID_OK:
469 nino.borges 265 newAltMediaPath,errRpt = dlg.GetValues()
470 nino.borges 262 dlg.Destroy()
471 nino.borges 265 if errRpt:
472     doneDlg = wx.MessageDialog(self, "MCP: The media path either does not exist, is local or references a drive letter, which is not allowed.\nPlease try again.", "MCP: Does Not Compute",wx.OK, wx.DefaultPosition)
473     else:
474     if newAltMediaPath == altMediaPath:
475     pass
476     else:
477     self.console.SetAlternateMediaFolder(self.casesListChoice.GetStringSelection(),newAltMediaPath)
478     doneDlg = wx.MessageDialog(self, "MCP: Alternate Media Path updated successfully.", "MCP: Success",wx.OK, wx.DefaultPosition)
479     if doneDlg:
480     doneDlg.ShowModal()
481     doneDlg.Destroy()
482 nino.borges 303
483     def OnChangePricing(self,event):
484 nino.borges 321 #StorageUploadCostsDialog
485 nino.borges 303 office = self.responsibleOfficeTextCtrl.GetValue()
486     currentStorageCosts = self.storageCostStaticText.Label
487     if currentStorageCosts:
488     currentStorageCosts = float(currentStorageCosts.replace(" Storage:$",""))
489     currentUploadCosts = self.uploadCostStaticText.Label
490     if currentUploadCosts:
491     currentUploadCosts = float(currentUploadCosts.replace(" Upload:$",""))
492     dlg = StorageUploadCostsDialog.StorageUploadCostsDialog(self, currentStorageCosts,currentUploadCosts)
493     if dlg.ShowModal() == wx.ID_OK:
494 nino.borges 321 newStorageCosts,newUploadCosts = dlg.GetValues()
495 nino.borges 303 dlg.Destroy()
496     self.console.SetUploadAndStorageCosts(self.casesListChoice.GetStringSelection(),str(newUploadCosts),str(newStorageCosts))
497     doneDlg = wx.MessageDialog(self, "MCP: Upload and Storage Pricing updated successfully.", "MCP: Success",wx.OK, wx.DefaultPosition)
498     doneDlg.ShowModal()
499     doneDlg.Destroy()
500 ninoborges 8
501 nino.borges 268 def OnEditVendorFolders(self,event):
502     office = self.responsibleOfficeTextCtrl.GetValue()
503 nino.borges 271 currentVendorFolder = self.console.GetVendorFolders(self.casesListChoice.GetStringSelection())
504     if currentVendorFolder:
505     pass
506     else:
507     currentVendorFolder = "None"
508     vendorFolderList = self.console.GetVendorFoldersList()
509     dlg = EditVendorFolderDialog.EditVendorFolderDialog(self, currentVendorFolder,vendorFolderList)
510     if dlg.ShowModal() == wx.ID_OK:
511     newCurrentVendorFolder = dlg.GetValues()
512     if newCurrentVendorFolder == currentVendorFolder:
513     pass
514     else:
515     self.console.SetVendorFolders(self.casesListChoice.GetStringSelection(), newCurrentVendorFolder)
516     doneDlg = wx.MessageDialog(self, "MCP: Vendor Folder updated successfully.", "MCP: Success",wx.OK, wx.DefaultPosition)
517     doneDlg.ShowModal()
518     doneDlg.Destroy()
519 nino.borges 321
520     def OnCreateProductionReport(self,event):
521     """This method creates or updates the Produciton Reporting page."""
522     ## Check to see if a alternate media folder exists
523     caseName = self.casesListChoice.GetStringSelection()
524     office = self.responsibleOfficeTextCtrl.GetValue()
525     err = self.console.OpenAlternateMediaFolder(caseName,office,testOnly=True)
526     if err:
527     errDlg = wx.MessageDialog(self, "MCP: There is no current alternate media folder for this case. A media folder is necesary for this option.\nYou can set this in Settings.", "MCP: Does Not Compute",wx.OK, wx.DefaultPosition)
528     errDlg.ShowModal()
529     errDlg.Destroy()
530     else:
531     err2 = self.console.CreateProductionReport(caseName,office)
532     if err2:
533     err2Dlg = wx.MessageDialog(self, "MCP: There are no productions for this case..", "MCP: Does Not Compute",wx.OK, wx.DefaultPosition)
534     err2Dlg.ShowModal()
535     err2Dlg.Destroy()
536     else:
537     sucessDlg = wx.MessageDialog(self, "MCP: The production report has been saved to the __MCP_data folder, in the alternate media folder.", "MCP: Process Complete",wx.OK, wx.DefaultPosition)
538     sucessDlg.ShowModal()
539     sucessDlg.Destroy()
540 nino.borges 268
541 ninoborges 8 def OnAbout(self, event):
542     """
543     OnAbout(self,event) Displays an about dialog with developer and bug reporting info
544     """
545     dlg = wx.MessageDialog(self, "MCP is a case organization program.\n"
546     "\n\n"
547     "For questions or comments about this program\n"
548     "or to report a bug, please email the program\n"
549     "creator at Nino.Borges@gmail.com\n\n"
550     "MCP is\n"
551     "Copyright (c) 2011 Emanuel Borges.\n"
552     "All rights reserved.\n"
553     "(Nino.Borges@gmail.com)\n",
554     "About MCP", wx.OK | wx.ICON_INFORMATION)
555     dlg.ShowModal()
556     dlg.Destroy()
557    
558    
559     class MyApp(wx.App):
560     def OnInit(self):
561     prgVersion = MCP_Lib.GetMCPVersion()
562     self.frame = MyFrame(None, -1, "View/Edit Case Information %s"%prgVersion)
563     self.frame.Show(True)
564     self.SetTopWindow(self.frame)
565     return True
566    
567    
568     if __name__ == '__main__':
569     app = MyApp(0)
570     app.MainLoop()