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: 462
Committed: Tue Oct 1 19:53:25 2013 UTC (12 years, 5 months ago) by nino.borges
Content type: text/x-python
File size: 39468 byte(s)
Log Message:
Added support in view edit for the case path style setting and added a popup that forces you to choose if you select an IDS system. Also added ability to have the MCP create the data folders.

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