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: 459
Committed: Fri Sep 20 20:32:02 2013 UTC (12 years, 6 months ago) by nino.borges
Content type: text/x-python
File size: 36090 byte(s)
Log Message:
Added support for transffering cases between TPMs in other offices and intra office. Updated the main View Edit to support this. Now just need a busy dialog and a dialog for transfering through the menu option.

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