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: 189
Committed: Fri Nov 2 15:18:39 2012 UTC (13 years, 4 months ago) by nino.borges
Content type: text/x-python
File size: 20648 byte(s)
Log Message:
Added backend 'view my case notes' ability to view edit and added same to ui and back end of copyUp.

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     import wx, MCP_Lib, MCP_Console,os,CurrentProductionsDialog,CaseUploadsDialog,AddDocumentProductionDialog,NinoGenTools
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 nino.borges 189 #casesList,casesDir = MCP_Lib.GetCaseList()
26     self.myCases, self.officeCases, self.allCases, casesDir = MCP_Lib.GetCaseList()
27     self.casesListChoice = wx.Choice(self.panel, -1, wx.DefaultPosition, choices=self.myCases)
28 ninoborges 8 self.casesListChoice.SetSelection(0)
29     self.chargeableCheckBox = wx.CheckBox(self.panel,-1,"Chargeable?")
30     responsibleAttnyStaticText = wx.StaticText(self.panel, -1, "Responsible Attorney: ",wx.DefaultPosition)
31     self.responsibleAttnyTextCtrl = wx.TextCtrl(self.panel, -1, "", wx.DefaultPosition, (110,-1))
32     responsibleParalegalStaticText = wx.StaticText(self.panel, -1, "Responsible Paralegal: ",wx.DefaultPosition)
33     self.responsibleParalegalTextCtrl = wx.TextCtrl(self.panel, -1, "", wx.DefaultPosition, (110,-1))
34     platformChoicesList = ["",'Concordance DIS','Concordance LN','Relativity']
35     reviewPlatformStaticText = wx.StaticText(self.panel, -1, "Platform: ",wx.DefaultPosition)
36     self.reviewPlatformChoice = wx.Choice(self.panel, -1, wx.DefaultPosition, choices=platformChoicesList)
37     responsibleProcessingVendorStaticText = wx.StaticText(self.panel, -1, "Processing Vendor: ",wx.DefaultPosition)
38     self.responsibleProcessingVendorTextCtrl = wx.TextCtrl(self.panel, -1, "", wx.DefaultPosition, (150,-1))
39     responsibleScanningVendorStaticText = wx.StaticText(self.panel, -1, "Scanning Vendor: ",wx.DefaultPosition)
40     self.responsibleScanningVendorTextCtrl = wx.TextCtrl(self.panel, -1, "", wx.DefaultPosition, (150,-1))
41     responsibleHostingVendorStaticText = wx.StaticText(self.panel, -1, "Hosting Vendor: ",wx.DefaultPosition)
42     self.responsibleHostingVendorTextCtrl = wx.TextCtrl(self.panel, -1, "", wx.DefaultPosition, (150,-1))
43     responsibleTPMStaticText = wx.StaticText(self.panel, -1, "TPM: ",wx.DefaultPosition)
44     self.responsibleTPMTextCtrl = wx.TextCtrl(self.panel, -1, "", wx.DefaultPosition, (110,-1))
45     responsibleOfficeStaticText = wx.StaticText(self.panel, -1, "Office: ",wx.DefaultPosition)
46     self.responsibleOfficeTextCtrl = wx.TextCtrl(self.panel, -1, "", wx.DefaultPosition, (110,-1))
47     caseStatusStaticText = wx.StaticText(self.panel, -1, "Case Status: ",wx.DefaultPosition)
48     statusChoicesList = ['Active','Dormant','Closed','Archived']## Selecting archived automatically unchecks chareable.
49     self.caseStatusChoice = wx.Choice(self.panel, -1, wx.DefaultPosition, choices=statusChoicesList)
50    
51    
52 nino.borges 189 self.SetFields(self.myCases[0])
53 ninoborges 8
54     self.CreateBoxesSection()
55    
56     casesSizer = wx.BoxSizer(wx.HORIZONTAL)
57     casesSizer.Add(casesListStaticText,0,wx.ALL,5)
58     casesSizer.Add(self.casesListChoice,0,wx.ALL,5)
59    
60     secondHalfSizer = wx.GridBagSizer(5,5)
61     secondHalfSizer.Add(reviewPlatformStaticText, pos=(0,0))
62     secondHalfSizer.Add(self.reviewPlatformChoice, pos=(0,1))
63     secondHalfSizer.Add(self.chargeableCheckBox,pos=(0,3))
64     #secondHalfSizer.Add(self.chargeableCheckBox,pos=(0,2), span=(1,2), flag = wx.EXPAND|wx.ALIGN_CENTER_HORIZONTAL)
65     secondHalfSizer.Add(responsibleAttnyStaticText, pos=(1,0))
66     secondHalfSizer.Add(self.responsibleAttnyTextCtrl, pos=(1,1))
67     secondHalfSizer.Add(responsibleTPMStaticText, pos = (1,2))
68     secondHalfSizer.Add(self.responsibleTPMTextCtrl, pos = (1,3))
69     secondHalfSizer.Add(responsibleParalegalStaticText, pos=(2,0))
70     secondHalfSizer.Add(self.responsibleParalegalTextCtrl, pos=(2,1))
71     secondHalfSizer.Add(responsibleOfficeStaticText, pos=(2,2))
72     secondHalfSizer.Add(self.responsibleOfficeTextCtrl, pos=(2,3))
73     secondHalfSizer.Add(caseStatusStaticText, pos=(3,0))
74     secondHalfSizer.Add(self.caseStatusChoice, pos=(3,1))
75    
76     respVendorsStaticBox = wx.StaticBox(self.panel, -1, 'Responsible Vendors:')
77     respVendorsStaticBoxSizer = wx.StaticBoxSizer(respVendorsStaticBox, wx.VERTICAL)
78     respVendorsFlexGridSizer = wx.FlexGridSizer(3,2,10,10)
79     respVendorsFlexGridSizer.Add(responsibleProcessingVendorStaticText,5)
80     respVendorsFlexGridSizer.Add(self.responsibleProcessingVendorTextCtrl,5)
81     respVendorsFlexGridSizer.Add(responsibleScanningVendorStaticText,5)
82     respVendorsFlexGridSizer.Add(self.responsibleScanningVendorTextCtrl,5)
83     respVendorsFlexGridSizer.Add(responsibleHostingVendorStaticText,5)
84     respVendorsFlexGridSizer.Add(self.responsibleHostingVendorTextCtrl,5)
85     respVendorsStaticBoxSizer.Add(respVendorsFlexGridSizer,0,wx.ALL,20)
86    
87     mainSizer = wx.BoxSizer(wx.VERTICAL)
88     mainSizer.Add(casesSizer,0,wx.ALL, 20)
89     mainSizer.Add(secondHalfSizer,0,wx.ALL,20)
90     mainSizer.Add(respVendorsStaticBoxSizer,0,wx.ALL,20)
91     #mainSizer.Add(self.chargeableCheckBox,0,wx.ALL,5)
92     #mainSizer.Add(self.reviewPlatformChoice,0,wx.ALL,5)
93     #mainSizer.Add(self.responsibleAttnyTextCtrl,0,wx.ALL,5)
94     #mainSizer.Add(self.responsibleParalegalTextCtrl,0,wx.ALL,5)
95     #mainSizer.Add(self.responsibleProcessingVendorTextCtrl,0,wx.ALL,5)
96     #mainSizer.Add(self.responsibleScanningVendorTextCtrl,0,wx.ALL,5)
97     #mainSizer.Add(self.responsibleHostingVendorTextCtrl,0,wx.ALL,5)
98     #mainSizer.Add(workDirSizer,0,wx.ALL, 10)
99     #mainSizer.Add(copyUpTypeStaticBoxSizer, 0, wx.ALL, 10)
100     mainSizer.Add(self.buttonSizer,0, wx.ALL|wx.ALIGN_BOTTOM|wx.ALIGN_CENTER, 10)
101    
102     self.oKButton.Disable()
103    
104     #self.chargeableCheckBox.Disable() ## Remove me.
105    
106     self.panel.SetSizer(mainSizer)
107    
108     self.CreateStatusBar()
109     self.SetStatusText("Ready.")
110     self.CreateMenuBar()
111    
112     self.Bind(wx.EVT_CHOICE, self.OnSetFields, self.casesListChoice)
113     self.Bind(wx.EVT_CHOICE, self.OnFormChanged, self.reviewPlatformChoice)
114     self.Bind(wx.EVT_CHOICE, self.OnFormChanged, self.caseStatusChoice)
115     self.Bind(wx.EVT_CHECKBOX, self.OnFormChanged, self.chargeableCheckBox)
116     self.Bind(wx.EVT_TEXT, self.OnFormChanged, self.responsibleAttnyTextCtrl)
117     self.Bind(wx.EVT_TEXT, self.OnFormChanged, self.responsibleTPMTextCtrl)
118     self.Bind(wx.EVT_TEXT, self.OnFormChanged, self.responsibleParalegalTextCtrl)
119     self.Bind(wx.EVT_TEXT, self.OnFormChanged, self.responsibleOfficeTextCtrl)
120     self.Bind(wx.EVT_TEXT, self.OnFormChanged, self.responsibleProcessingVendorTextCtrl)
121     self.Bind(wx.EVT_TEXT, self.OnFormChanged, self.responsibleScanningVendorTextCtrl)
122     self.Bind(wx.EVT_TEXT, self.OnFormChanged, self.responsibleHostingVendorTextCtrl)
123    
124     self.Bind(wx.EVT_BUTTON, self.OnProcess, self.oKButton)
125     self.Bind(wx.EVT_BUTTON, self.CloseWindow, self.cancelButton)
126    
127     def NothingYet(self,event):
128     """ A simple place holder function that is used to be a PASS statment when I'm creating controls"""
129     diag = wx.MessageDialog(self,"Nothing here yet!", "Disabled...",wx.OK | wx.ICON_INFORMATION)
130     diag.ShowModal()
131     diag.Destroy()
132    
133     def MenuData(self):
134     return(("View",
135 nino.borges 174 ("My Cases", "Chooses from your assigned cases.",self.OnChangeCaseView,"RADIO"),
136     ("My Office Cases", "Chooses from cases assigned to everyone in your office.",self.OnChangeCaseView,"RADIO"),
137     ("All Cases", "Chooses from all cases.",self.OnChangeCaseView,"RADIO"),
138     ("","","",""),
139     ("Case &Uploads", "Displays the Case Uploads for this case.",self.OnViewCaseUploads,""),
140     ("&Production History", "Displays the Production History for this case.",self.OnViewDocProduction,""),
141     ("","","",""),
142     ("My Case &Notes","Opens the case folder for the current selected case.",self.OnViewCaseNotes,""),
143     ("My Production &Spec","Opens the case folder for the current selected case.",self.OnViewProdSpec,""),
144     ("Open Case &Folder","Opens the case folder for the current selected case.",self.OnOpenCaseFolder,"")),
145 ninoborges 8 ("Production",
146 nino.borges 174 ("&Add Production Entry","Adds a new production to the matter database.",self.OnAddDocProduction,"")),
147 ninoborges 8 ("&Help",
148 nino.borges 174 ("&About", "Displays the About Window.", self.OnAbout,"")))
149 ninoborges 8
150     def CreateMenuBar(self):
151     menuBar = wx.MenuBar()
152 nino.borges 158 count = 1
153 ninoborges 8 for eachMenuData in self.MenuData():
154     menuLabel = eachMenuData[0]
155     menuItems = eachMenuData[1:]
156     menuBar.Append(self.CreateMenu(menuItems), menuLabel)
157 nino.borges 158 count = count + 1
158 ninoborges 8 self.SetMenuBar(menuBar)
159    
160    
161     def CreateMenu(self, menuData):
162     menu = wx.Menu()
163 nino.borges 174 for eachLabel, eachStatus, eachHandler, eachType in menuData:
164 ninoborges 8 if not eachLabel:
165     menu.AppendSeparator()
166     continue
167 nino.borges 174 if eachType == "RADIO":
168     menuItem = menu.AppendRadioItem(-1,eachLabel,eachStatus)
169     else:
170     menuItem = menu.Append(-1, eachLabel, eachStatus)
171 ninoborges 8 self.Bind(wx.EVT_MENU, eachHandler, menuItem)
172     return menu
173    
174    
175     def OnFormChanged(self,event):
176     self.oKButton.Enable()
177    
178     def OnSetFields(self,event):
179     #print self.casesListChoice.GetStringSelection()
180     self.SetFields(self.casesListChoice.GetStringSelection())
181     self.oKButton.Disable()
182    
183     def SetFields(self, case):
184     currentChargeableBool,currentRespAttorney,currentRespParalegal,currentRespVendorTpl,currentRevPlatform,respTPM,respOffice,caseStatus = self.console.GetCaseData(case)
185     if currentChargeableBool:
186     self.chargeableCheckBox.SetValue(True)
187     else:
188     self.chargeableCheckBox.SetValue(False)
189     if currentRevPlatform == 'Concordance':
190     ## Make an assumption
191     currentRevPlatform = "Concordance DIS"
192     if currentRevPlatform:
193     #print currentRevPlatform
194     self.reviewPlatformChoice.SetStringSelection(currentRevPlatform)
195     else:
196     self.reviewPlatformChoice.SetStringSelection('')
197     if currentRespAttorney:
198     self.responsibleAttnyTextCtrl.SetValue(currentRespAttorney)
199     else:
200     self.responsibleAttnyTextCtrl.SetValue('')
201     if currentRespParalegal:
202     self.responsibleParalegalTextCtrl.SetValue(currentRespParalegal)
203     else:
204     self.responsibleParalegalTextCtrl.SetValue('')
205     if currentRespVendorTpl[0]:
206     self.responsibleProcessingVendorTextCtrl.SetValue(currentRespVendorTpl[0])
207     else:
208     self.responsibleProcessingVendorTextCtrl.SetValue("")
209     if currentRespVendorTpl[1]:
210     self.responsibleScanningVendorTextCtrl.SetValue(currentRespVendorTpl[1])
211     else:
212     self.responsibleScanningVendorTextCtrl.SetValue('')
213     if currentRespVendorTpl[2]:
214     self.responsibleHostingVendorTextCtrl.SetValue(currentRespVendorTpl[2])
215     else:
216     self.responsibleHostingVendorTextCtrl.SetValue('')
217     if respTPM:
218     self.responsibleTPMTextCtrl.SetValue(respTPM)
219     else:
220     self.responsibleTPMTextCtrl.SetValue('')
221     if respOffice:
222     self.responsibleOfficeTextCtrl.SetValue(respOffice)
223     else:
224     self.responsibleOfficeTextCtrl.SetValue('')
225     if caseStatus:
226     self.caseStatusChoice.SetStringSelection(caseStatus)
227     else:
228     self.caseStatusChoice.SetStringSelection('')
229    
230    
231     def OnProcess(self, event):
232     caseName = self.casesListChoice.GetStringSelection()
233     if self.chargeableCheckBox.GetValue():
234     chargeableBool = True
235     else:
236     chargeableBool = False
237     currentRevPlatform = self.reviewPlatformChoice.GetStringSelection()
238     caseStatus = self.caseStatusChoice.GetStringSelection()
239     currentRespAttorney = self.responsibleAttnyTextCtrl.GetValue()
240     currentRespParalegal = self.responsibleParalegalTextCtrl.GetValue()
241     currentRespVendorTpl = (self.responsibleProcessingVendorTextCtrl.GetValue(),self.responsibleScanningVendorTextCtrl.GetValue(),
242     self.responsibleHostingVendorTextCtrl.GetValue())
243     respTPM = self.responsibleTPMTextCtrl.GetValue()
244     respOffice = self.responsibleOfficeTextCtrl.GetValue()
245     print "Updating Access DB..."
246     self.console.EditCaseData(caseName,chargeableBool,currentRespAttorney,currentRespParalegal,currentRespVendorTpl,currentRevPlatform,
247     respTPM,respOffice, caseStatus)
248     print "Complete!"
249     finishedDlg = wx.MessageDialog(self, "MCP: Your settings have been saved to the Matter Management database.", "MCP: Process Complete",wx.OK, wx.DefaultPosition)
250     finishedDlg.ShowModal()
251     finishedDlg.Destroy()
252     self.oKButton.Disable()
253    
254     def CreateBoxesSection(self):
255     self.oKButton = wx.Button(self.panel, wx.ID_OK,'Save')
256     self.oKButton.SetDefault()
257     self.oKButton.SetSize(self.oKButton.GetBestSize())
258     self.cancelButton = wx.Button(self.panel, wx.ID_CANCEL,'Close')
259     self.cancelButton.SetSize(self.cancelButton.GetBestSize())
260     self.buttonSizer = wx.BoxSizer(wx.HORIZONTAL)
261     self.buttonSizer.Add(self.oKButton,0,wx.ALL,10)
262     self.buttonSizer.Add(self.cancelButton,0,wx.ALL,10)
263    
264     def CloseWindow(self, event):
265     self.Close(True)
266 nino.borges 158
267 nino.borges 174 def OnChangeCaseView(self,event):
268     self.casesListChoice.Clear()
269     eventID = event.GetId()
270     if eventID == 100:
271     #change it to my cases
272 nino.borges 189 self.casesListChoice.SetItems(self.myCases)
273     self.casesListChoice.SetSelection(0)
274     self.SetFields(self.myCases[0])
275 nino.borges 174 if eventID == 101:
276     #change it to office cases
277 nino.borges 189 self.casesListChoice.SetItems(self.officeCases)
278     self.casesListChoice.SetSelection(0)
279     self.SetFields(self.officeCases[0])
280 nino.borges 174 if eventID == 102:
281     #change it to all cases
282 nino.borges 189 self.casesListChoice.SetItems(self.allCases)
283     self.casesListChoice.SetSelection(0)
284     self.SetFields(self.allCases[0])
285 nino.borges 174
286    
287 nino.borges 158 def OnViewCaseNotes(self,event):
288     caseName = self.casesListChoice.GetStringSelection()
289     office = self.responsibleOfficeTextCtrl.GetValue()
290     err = self.console.ViewCaseNotes(caseName,office)
291     if err:
292     errDlg = wx.MessageDialog(self, "MCP: The path to this case file could not be found.", "MCP: Does Not Compute",wx.OK, wx.DefaultPosition)
293     errDlg.ShowModal()
294     errDlg.Destroy()
295    
296     def OnViewProdSpec(self,event):
297     caseName = self.casesListChoice.GetStringSelection()
298     office = self.responsibleOfficeTextCtrl.GetValue()
299     err = self.console.ViewProdSpec(caseName,office)
300     if err:
301     errDlg = wx.MessageDialog(self, "MCP: The path to this case file could not be found.", "MCP: Does Not Compute",wx.OK, wx.DefaultPosition)
302     errDlg.ShowModal()
303     errDlg.Destroy()
304 ninoborges 8
305     def OnOpenCaseFolder(self,event):
306     caseName = self.casesListChoice.GetStringSelection()
307     office = self.responsibleOfficeTextCtrl.GetValue()
308     err = self.console.OpenCaseFolder(caseName,office)
309     if err:
310     errDlg = wx.MessageDialog(self, "MCP: The path to this case file could not be found.", "MCP: Does Not Compute",wx.OK, wx.DefaultPosition)
311     errDlg.ShowModal()
312     errDlg.Destroy()
313    
314     def OnViewCaseUploads(self, event):
315     uploadList = self.console.GetUploadData(self.casesListChoice.GetStringSelection())
316     numberOfRows = len(uploadList)
317     uploadTotal = self.console.GetUploadTotal(uploadList)
318     caseName = self.casesListChoice.GetStringSelection()
319     CLM = caseName.split("_(")[1]
320     CLM = CLM[:-1]
321     CLM = CLM.replace('-','.')
322     #print CLM
323     if numberOfRows == 0:
324     dlg = wx.MessageDialog(self, "MCP: There are no case uploads for this case.", "MCP: Does Not Compute",wx.OK, wx.DefaultPosition)
325     else:
326     dlg = CaseUploadsDialog.CaseUploadsDialog(self,numberOfRows, uploadList, uploadTotal,CLM)
327     #dlg.Show(True)
328     dlg.ShowModal()
329     dlg.Destroy()
330    
331     def OnViewDocProduction(self,event):
332     prodList = self.console.GetProductionData(self.casesListChoice.GetStringSelection())
333     numberOfRows = len(prodList)
334     prodTotals = self.console.GetProductionTotal(prodList)
335     caseName = self.casesListChoice.GetStringSelection()
336     CLM = caseName.split("_(")[1]
337     CLM = CLM[:-1]
338     CLM = CLM.replace('-','.')
339     #print CLM
340     if numberOfRows == 0:
341     dlg = wx.MessageDialog(self, "MCP: There are no current productions for this case.", "MCP: Does Not Compute",wx.OK, wx.DefaultPosition)
342     else:
343     dlg = CurrentProductionsDialog.CaseUploadsDialog(self,numberOfRows, prodList,CLM, prodTotals)
344     #dlg.Show(True)
345     dlg.ShowModal()
346     dlg.Destroy()
347    
348     def OnAddDocProduction(self, event):
349     caseName = self.casesListChoice.GetStringSelection()
350     CLM = caseName.split("_(")[1]
351     CLM = CLM[:-1]
352     CLM = CLM.replace('-','.')
353     #print CLM
354     dlg = AddDocumentProductionDialog.AddDocumentProductionDialog(self,CLM)
355     if dlg.ShowModal() == wx.ID_OK:
356     prodDate, begBates, endBates, prodDocCount, prodPageCount, prodNotes = dlg.GetValues()
357     #print prodDate
358     dateConverter = NinoGenTools.DateUtilities()
359     prodID = 'prod_' + str(dateConverter.ConvertDateFormat(prodDate, convertToFormat='computer'))
360     errRpt = self.console.AddProductionEntry(CLM,prodID,prodDate,begBates,endBates,prodDocCount, prodPageCount, prodNotes)
361     if errRpt:
362     doneDlg = wx.MessageDialog(self, "MCP: All fields need to be filled out.\nPlease try again.", "MCP: Does Not Compute",wx.OK, wx.DefaultPosition)
363     else:
364     doneDlg = wx.MessageDialog(self, "MCP: Production detail added successfully.", "MCP: Success",wx.OK, wx.DefaultPosition)
365     doneDlg.ShowModal()
366     doneDlg.Destroy()
367    
368    
369    
370     def OnAbout(self, event):
371     """
372     OnAbout(self,event) Displays an about dialog with developer and bug reporting info
373     """
374     dlg = wx.MessageDialog(self, "MCP is a case organization program.\n"
375     "\n\n"
376     "For questions or comments about this program\n"
377     "or to report a bug, please email the program\n"
378     "creator at Nino.Borges@gmail.com\n\n"
379     "MCP is\n"
380     "Copyright (c) 2011 Emanuel Borges.\n"
381     "All rights reserved.\n"
382     "(Nino.Borges@gmail.com)\n",
383     "About MCP", wx.OK | wx.ICON_INFORMATION)
384     dlg.ShowModal()
385     dlg.Destroy()
386    
387    
388     class MyApp(wx.App):
389     def OnInit(self):
390     prgVersion = MCP_Lib.GetMCPVersion()
391     self.frame = MyFrame(None, -1, "View/Edit Case Information %s"%prgVersion)
392     self.frame.Show(True)
393     self.SetTopWindow(self.frame)
394     return True
395    
396    
397     if __name__ == '__main__':
398     app = MyApp(0)
399     app.MainLoop()