ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/ns_dev/Python/NinoCode/Active_prgs/MCP/Trunk/MCP_ViewEdit_UI.py
Revision: 158
Committed: Thu Oct 11 18:54:28 2012 UTC (13 years, 5 months ago) by nino.borges
Content type: text/x-python
Original Path: Python/NinoCode/Active_prgs/MCP/MCP_ViewEdit_UI.py
File size: 19241 byte(s)
Log Message:
Added 'View My Case Notes' and 'View Production Spec' to the View Edit Module.

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