ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/ns_dev/Python/NinoCode/Active_prgs/MCP/MCP_ViewEdit_UI.py
Revision: 421
Committed: Tue Jul 30 18:09:08 2013 UTC (12 years, 8 months ago) by nino.borges
Content type: text/x-python
File size: 33448 byte(s)
Log Message:
Finished and tested the OnEditCaseName by adding list comprehension that edits the 3 case lists in place.

File Contents

# Content
1 """
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 import wx, MCP_Lib, MCP_Console,os,CurrentProductionsDialog,CaseUploadsDialog,AddDocumentProductionDialog,CasePathsDialog,NinoGenTools,EditVendorFolderDialog,StorageUploadCostsDialog,DisclosureLetterDialog,AddEditCaseNameDialog
15
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 #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 self.casesListChoice.SetSelection(0)
29
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 self.disclosureLetterReminderText = wx.StaticText(self.panel, -1, "", (50, 55), (65, -1), wx.ALIGN_LEFT)
38 self.disclosureLetterReminderText.SetForegroundColour('Red')
39
40 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 self.SetFields(self.myCases[0])
64
65 self.CreateBoxesSection()
66
67 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 casesSizer = wx.BoxSizer(wx.HORIZONTAL)
72 casesSizer.Add(casesListStaticText,0,wx.ALL,5)
73 casesSizer.Add(self.casesListChoice,0,wx.ALL,5)
74 #casesSizer.Add(costSizer,0,wx.ALL,5)
75
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 mainSizer.Add(costSizer,0,wx.RIGHT|wx.ALIGN_RIGHT,10)
105 mainSizer.Add(casesSizer,0,wx.BOTTOM|wx.LEFT|wx.RIGHT, 20)
106 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 return(("Case",
152 ("Edit Case &Name","Allows you to edit the case name.",self.OnEditCaseName,""),
153 ("Change Negotiated &Price","Allows you to edit the negotiated prices for hosting and uploading.",self.OnChangePricing,""),
154 ("Disclosure &Letter ...","Allows you to load and link your disclosure letter to this case.",self.OnChangeDisclosureLetter,""),
155 ("","","",""),
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 ("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 ("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 ("&Alternate Media Folder","Opens the alternate media path for the current selected case.",self.OnOpenAlternateMediaFolder,""),
170 ("Open Case &Folder","Opens the case folder for the current selected case.",self.OnOpenCaseFolder,"")),
171 ("Production",
172 ("&Add Production Entry","Adds a new production to the matter database.",self.OnAddDocProduction,"")),
173 ("Settings",
174 ("Linked &Vendor Folders","Allows you to link vendor folders to this case for copy ups.",self.OnEditVendorFolders,""),
175 ("&Case Paths","Allows you to set or change the alternate media path.",self.OnCasePathsSettings,"")),
176 ("Reporting",
177 ("Create &Produciton Report","Creates or updates the Production Report Page.",self.OnCreateProductionReport,""),
178 ("&Managerial","Managerial reports.",self.NothingYet,"DISABLED")),
179 ("&Help",
180 ("&About", "Displays the About Window.", self.OnAbout,"")))
181
182 def CreateMenuBar(self):
183 menuBar = wx.MenuBar()
184 count = 1
185 for eachMenuData in self.MenuData():
186 menuLabel = eachMenuData[0]
187 menuItems = eachMenuData[1:]
188 menuBar.Append(self.CreateMenu(menuItems), menuLabel)
189 count = count + 1
190 self.SetMenuBar(menuBar)
191
192
193 def CreateMenu(self, menuData):
194 menu = wx.Menu()
195 for eachLabel, eachStatus, eachHandler, eachType in menuData:
196 if not eachLabel:
197 menu.AppendSeparator()
198 continue
199 if eachType == "RADIO":
200 menuItem = menu.AppendRadioItem(-1,eachLabel,eachStatus)
201 else:
202 menuItem = menu.Append(-1, eachLabel, eachStatus)
203 if eachType == 'DISABLED':
204 menuItem.Enable(False)
205 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 currentChargeableBool,currentRespAttorney,currentRespParalegal,currentRespVendorTpl,currentRevPlatform,respTPM,respOffice,caseStatus,uploadCost,storageCost,disclosureLetterBool = self.console.GetCaseData(case)
219 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 if storageCost:
264 self.storageCostStaticText.SetLabel(" Storage:$%s "%str(storageCost))
265 else:
266 self.storageCostStaticText.SetLabel(' Storage:$0 ')
267 if uploadCost:
268 self.uploadCostStaticText.SetLabel(" Upload:$%s "%str(uploadCost))
269 else:
270 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
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
318 def OnChangeCaseView(self,event):
319 self.casesListChoice.Clear()
320 eventID = event.GetId()
321 #print eventID
322 if eventID == 105:
323 #change it to my cases
324 self.casesListChoice.SetItems(self.myCases)
325 self.casesListChoice.SetSelection(0)
326 self.SetFields(self.myCases[0])
327 if eventID == 106:
328 #change it to office cases
329 self.casesListChoice.SetItems(self.officeCases)
330 self.casesListChoice.SetSelection(0)
331 self.SetFields(self.officeCases[0])
332 if eventID == 107:
333 #change it to all cases
334 self.casesListChoice.SetItems(self.allCases)
335 self.casesListChoice.SetSelection(0)
336 self.SetFields(self.allCases[0])
337
338
339 def OnEditCaseName(self,event):
340 caseName = self.casesListChoice.GetStringSelection()
341 office = self.responsibleOfficeTextCtrl.GetValue()
342 CLM = caseName.split("_(")[1]
343 CLM = CLM[:-1]
344 CLM = CLM.replace('-','.')
345 dlg = AddEditCaseNameDialog.AddEditCaseNameDialog(self, CLM,caseName)
346 if dlg.ShowModal() == wx.ID_OK:
347 changed = False
348 newCaseName, clientNumb,matterNumb = dlg.GetValues()
349 newCLM = clientNumb + '.' + matterNumb
350 if caseName.split('_(')[0] != newCaseName:
351 changed = True
352 if newCLM != CLM:
353 changed = True
354 if changed:
355 self.console.ChangeCaseName(caseName,newCaseName,newCLM)
356 doneDlg = wx.MessageDialog(self, "MCP: Case name has been changed to %s_(%s)"%(newCaseName,newCLM), "MCP: Success",wx.OK, wx.DefaultPosition)
357 doneDlg.ShowModal()
358 doneDlg.Destroy()
359 ## Use some list comprehension to edit all three case lists in place to update UI.
360 print "you changed it so new value is %s_(%s)"%(newCaseName,newCLM)
361 self.myCases = [cse.replace(caseName,"%s_(%s)"%(newCaseName,newCLM.replace(".","-")))for cse in self.myCases]
362 self.officeCases = [cse.replace(caseName,"%s_(%s)"%(newCaseName,newCLM.replace(".","-")))for cse in self.officeCases]
363 self.allCases = [cse.replace(caseName,"%s_(%s)"%(newCaseName,newCLM.replace(".","-")))for cse in self.allCases]
364
365 self.casesListChoice.SetItems(self.myCases)
366 self.casesListChoice.SetSelection(0)
367 self.SetFields(self.myCases[0])
368 dlg.Destroy()
369 #err = self.console.ViewCaseNotes(caseName,office)
370
371 def OnViewCaseNotes(self,event):
372 caseName = self.casesListChoice.GetStringSelection()
373 office = self.responsibleOfficeTextCtrl.GetValue()
374 err = self.console.ViewCaseNotes(caseName,office)
375 if err:
376 errDlg = wx.MessageDialog(self, "MCP: The path to this case file could not be found.", "MCP: Does Not Compute",wx.OK, wx.DefaultPosition)
377 errDlg.ShowModal()
378 errDlg.Destroy()
379
380 def OnViewProdSpec(self,event):
381 caseName = self.casesListChoice.GetStringSelection()
382 office = self.responsibleOfficeTextCtrl.GetValue()
383 err = self.console.ViewProdSpec(caseName,office)
384 if err:
385 errDlg = wx.MessageDialog(self, "MCP: The path to this case file could not be found.", "MCP: Does Not Compute",wx.OK, wx.DefaultPosition)
386 errDlg.ShowModal()
387 errDlg.Destroy()
388
389 def OnOpenAlternateMediaFolder(self,event):
390 caseName = self.casesListChoice.GetStringSelection()
391 office = self.responsibleOfficeTextCtrl.GetValue()
392 err = self.console.OpenAlternateMediaFolder(caseName,office)
393 if err:
394 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)
395 errDlg.ShowModal()
396 errDlg.Destroy()
397
398 def OnOpenCaseFolder(self,event):
399 caseName = self.casesListChoice.GetStringSelection()
400 office = self.responsibleOfficeTextCtrl.GetValue()
401 err = self.console.OpenCaseFolder(caseName,office)
402 if err:
403 errDlg = wx.MessageDialog(self, "MCP: The path to this case file could not be found.", "MCP: Does Not Compute",wx.OK, wx.DefaultPosition)
404 errDlg.ShowModal()
405 errDlg.Destroy()
406
407 def OnViewCaseUploads(self, event):
408 uploadList = self.console.GetUploadData(self.casesListChoice.GetStringSelection())
409 numberOfRows = len(uploadList)
410 uploadTotal = self.console.GetUploadTotal(uploadList)
411 caseName = self.casesListChoice.GetStringSelection()
412 CLM = caseName.split("_(")[1]
413 CLM = CLM[:-1]
414 CLM = CLM.replace('-','.')
415 #print CLM
416 if numberOfRows == 0:
417 dlg = wx.MessageDialog(self, "MCP: There are no case uploads for this case.", "MCP: Does Not Compute",wx.OK, wx.DefaultPosition)
418 else:
419 dlg = CaseUploadsDialog.CaseUploadsDialog(self,numberOfRows, uploadList, uploadTotal,CLM)
420 #dlg.Show(True)
421 dlg.ShowModal()
422 dlg.Destroy()
423
424 def OnViewDocProduction(self,event):
425 prodMatrix = self.console.GetProductionData(self.casesListChoice.GetStringSelection())
426 prodList = []
427 for key in prodMatrix.keys():
428 prodList.extend(prodMatrix[key])
429 numberOfRows = len(prodList)
430 prodTotals = self.console.GetProductionTotal(prodList)
431 caseName = self.casesListChoice.GetStringSelection()
432 CLM = caseName.split("_(")[1]
433 CLM = CLM[:-1]
434 CLM = CLM.replace('-','.')
435 #print CLM
436 if numberOfRows == 0:
437 dlg = wx.MessageDialog(self, "MCP: There are no current productions for this case.", "MCP: Does Not Compute",wx.OK, wx.DefaultPosition)
438 else:
439 dlg = CurrentProductionsDialog.CaseUploadsDialog(self,numberOfRows, prodList,CLM, prodTotals)
440 #dlg.Show(True)
441 dlg.ShowModal()
442 dlg.Destroy()
443
444 def OnAddDocProduction(self, event):
445 caseName = self.casesListChoice.GetStringSelection()
446 caseDatabaseList = self.console.GetDatabaseList(caseName)
447 possibleProducedToEntities = self.console.GetPossibleProducedToEntities(caseName)
448 possibleProdReqByNames = self.console.GetPossibleProdReqByNames(caseName)
449 CLM = caseName.split("_(")[1]
450 CLM = CLM[:-1]
451 CLM = CLM.replace('-','.')
452 #print CLM
453 dlg = AddDocumentProductionDialog.AddDocumentProductionDialog(self,CLM, caseDatabaseList, possibleProducedToEntities,possibleProdReqByNames)
454 if dlg.ShowModal() == wx.ID_OK:
455 prodProcessedDate, begBates, endBates, prodDocCount, prodPageCount, prodNotes, prodTo, prodMedia,prodSource,prodReqBy,prodSentDate,prodMediaPassword = dlg.GetValues()
456 #print prodDate
457 dateConverter = NinoGenTools.DateUtilities()
458 prodID = 'prod_' + str(dateConverter.ConvertDateFormat(prodProcessedDate, convertToFormat='computer'))
459 errRpt = self.console.AddProductionEntry(CLM,prodID,prodProcessedDate,begBates,endBates,prodDocCount, prodPageCount, prodNotes, prodTo, prodMedia,prodSource,prodReqBy,prodSentDate,prodMediaPassword)
460 if errRpt:
461 doneDlg = wx.MessageDialog(self, "MCP: All fields need to be filled out.\nPlease try again.", "MCP: Does Not Compute",wx.OK, wx.DefaultPosition)
462 else:
463 doneDlg = wx.MessageDialog(self, "MCP: Production detail added successfully.", "MCP: Success",wx.OK, wx.DefaultPosition)
464 doneDlg.ShowModal()
465 doneDlg.Destroy()
466
467 def OnChangeDisclosureLetter(self,event):
468 office = self.responsibleOfficeTextCtrl.GetValue()
469 altMediaPath, casePath = self.console.GetCasePathsData(self.casesListChoice.GetStringSelection(),office)
470 disclosureLetterSet,disclosureLetterPath = self.console.GetDisclosureLetterData(self.casesListChoice.GetStringSelection())
471 if disclosureLetterPath:
472 disclosureLetterPath = str(disclosureLetterPath)
473 else:
474 disclosureLetterPath = ""
475 dlg = DisclosureLetterDialog.DisclosureLetterDialog(self, disclosureLetterSet, disclosureLetterPath, casePath)
476 if dlg.ShowModal() == wx.ID_OK:
477 newdisclosureLetterPath,errRpt = dlg.GetValues()
478 dlg.Destroy()
479 if errRpt:
480 doneDlg = wx.MessageDialog(self, "MCP: The Disclosure letter could NOT be loaded.\nPlease try again.", "MCP: Does Not Compute",wx.OK, wx.DefaultPosition)
481 else:
482 if newdisclosureLetterPath == disclosureLetterPath:
483 doneDlg = False
484 else:
485 self.console.SetDisclosureLetterData(self.casesListChoice.GetStringSelection(),newdisclosureLetterPath)
486 doneDlg = wx.MessageDialog(self, "MCP: Disclosure letter loaded successfully.", "MCP: Success",wx.OK, wx.DefaultPosition)
487 self.disclosureLetterReminderText.SetLabel('')
488 if doneDlg:
489 doneDlg.ShowModal()
490 doneDlg.Destroy()
491
492 def OnCasePathsSettings(self, event):
493 office = self.responsibleOfficeTextCtrl.GetValue()
494 altMediaPath, casePath = self.console.GetCasePathsData(self.casesListChoice.GetStringSelection(),office)
495 if altMediaPath:
496 pass
497 else:
498 altMediaPath = ""
499 dlg = CasePathsDialog.CasePathsDialog(self, altMediaPath, casePath)
500 if dlg.ShowModal() == wx.ID_OK:
501 newAltMediaPath,errRpt = dlg.GetValues()
502 dlg.Destroy()
503 if errRpt:
504 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)
505 else:
506 if newAltMediaPath == altMediaPath:
507 pass
508 else:
509 self.console.SetAlternateMediaFolder(self.casesListChoice.GetStringSelection(),newAltMediaPath)
510 doneDlg = wx.MessageDialog(self, "MCP: Alternate Media Path updated successfully.", "MCP: Success",wx.OK, wx.DefaultPosition)
511 if doneDlg:
512 doneDlg.ShowModal()
513 doneDlg.Destroy()
514
515 def OnChangePricing(self,event):
516 #StorageUploadCostsDialog
517 office = self.responsibleOfficeTextCtrl.GetValue()
518 currentStorageCosts = self.storageCostStaticText.Label
519 if currentStorageCosts:
520 currentStorageCosts = float(currentStorageCosts.replace(" Storage:$",""))
521 currentUploadCosts = self.uploadCostStaticText.Label
522 if currentUploadCosts:
523 currentUploadCosts = float(currentUploadCosts.replace(" Upload:$",""))
524 dlg = StorageUploadCostsDialog.StorageUploadCostsDialog(self, currentStorageCosts,currentUploadCosts)
525 if dlg.ShowModal() == wx.ID_OK:
526 newStorageCosts,newUploadCosts = dlg.GetValues()
527 dlg.Destroy()
528 self.console.SetUploadAndStorageCosts(self.casesListChoice.GetStringSelection(),str(newUploadCosts),str(newStorageCosts))
529 doneDlg = wx.MessageDialog(self, "MCP: Upload and Storage Pricing updated successfully.", "MCP: Success",wx.OK, wx.DefaultPosition)
530 doneDlg.ShowModal()
531 doneDlg.Destroy()
532
533 def OnEditVendorFolders(self,event):
534 office = self.responsibleOfficeTextCtrl.GetValue()
535 currentVendorFolder = self.console.GetVendorFolders(self.casesListChoice.GetStringSelection())
536 if currentVendorFolder:
537 pass
538 else:
539 currentVendorFolder = "None"
540 vendorFolderList = self.console.GetVendorFoldersList()
541 dlg = EditVendorFolderDialog.EditVendorFolderDialog(self, currentVendorFolder,vendorFolderList)
542 if dlg.ShowModal() == wx.ID_OK:
543 newCurrentVendorFolder = dlg.GetValues()
544 if newCurrentVendorFolder == currentVendorFolder:
545 pass
546 else:
547 self.console.SetVendorFolders(self.casesListChoice.GetStringSelection(), newCurrentVendorFolder)
548 doneDlg = wx.MessageDialog(self, "MCP: Vendor Folder updated successfully.", "MCP: Success",wx.OK, wx.DefaultPosition)
549 doneDlg.ShowModal()
550 doneDlg.Destroy()
551
552 def OnCreateProductionReport(self,event):
553 """This method creates or updates the Produciton Reporting page."""
554 ## Check to see if a alternate media folder exists
555 caseName = self.casesListChoice.GetStringSelection()
556 office = self.responsibleOfficeTextCtrl.GetValue()
557 err = self.console.OpenAlternateMediaFolder(caseName,office,testOnly=True)
558 if err:
559 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)
560 errDlg.ShowModal()
561 errDlg.Destroy()
562 else:
563 err2 = self.console.CreateProductionReport(caseName,office)
564 if err2:
565 err2Dlg = wx.MessageDialog(self, "MCP: There are no productions for this case..", "MCP: Does Not Compute",wx.OK, wx.DefaultPosition)
566 err2Dlg.ShowModal()
567 err2Dlg.Destroy()
568 else:
569 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)
570 sucessDlg.ShowModal()
571 sucessDlg.Destroy()
572
573 def OnAbout(self, event):
574 """
575 OnAbout(self,event) Displays an about dialog with developer and bug reporting info
576 """
577 dlg = wx.MessageDialog(self, "MCP is a case organization program.\n"
578 "\n\n"
579 "For questions or comments about this program\n"
580 "or to report a bug, please email the program\n"
581 "creator at Nino.Borges@gmail.com\n\n"
582 "MCP is\n"
583 "Copyright (c) 2011 Emanuel Borges.\n"
584 "All rights reserved.\n"
585 "(Nino.Borges@gmail.com)\n",
586 "About MCP", wx.OK | wx.ICON_INFORMATION)
587 dlg.ShowModal()
588 dlg.Destroy()
589
590
591 class MyApp(wx.App):
592 def OnInit(self):
593 prgVersion = MCP_Lib.GetMCPVersion()
594 self.frame = MyFrame(None, -1, "View/Edit Case Information %s"%prgVersion)
595 self.frame.Show(True)
596 self.SetTopWindow(self.frame)
597 return True
598
599
600 if __name__ == '__main__':
601 app = MyApp(0)
602 app.MainLoop()