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: 258
Committed: Tue Jan 29 15:56:46 2013 UTC (13 years, 2 months ago) by nino.borges
Content type: text/x-python
File size: 20947 byte(s)
Log Message:
Finished adding feature Copy From Vendor Folder (#39) to copyup. Added menu items for settings, linked vendor folders and alternate media path to view edit ui

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,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.myCases, self.officeCases, self.allCases, casesDir = MCP_Lib.GetCaseList()
27 self.casesListChoice = wx.Choice(self.panel, -1, wx.DefaultPosition, choices=self.myCases)
28 self.casesListChoice.SetSelection(0)
29 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 self.SetFields(self.myCases[0])
53
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 ("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 notes file for the current selected case.",self.OnViewCaseNotes,""),
143 ("My Production &Spec","Opens the production specifications file for the current selected case.",self.OnViewProdSpec,""),
144 ("Open Case &Folder","Opens the case folder for the current selected case.",self.OnOpenCaseFolder,"")),
145 ("Production",
146 ("&Add Production Entry","Adds a new production to the matter database.",self.OnAddDocProduction,"")),
147 ("Settings",
148 ("Linked &Vendor Folders","Allows you to link vendor folders to this case for copy ups.",self.NothingYet,""),
149 ("&Alternate Media Path","Allows you to set or change the alternate media path.",self.NothingYet,"")),
150 ("&Help",
151 ("&About", "Displays the About Window.", self.OnAbout,"")))
152
153 def CreateMenuBar(self):
154 menuBar = wx.MenuBar()
155 count = 1
156 for eachMenuData in self.MenuData():
157 menuLabel = eachMenuData[0]
158 menuItems = eachMenuData[1:]
159 menuBar.Append(self.CreateMenu(menuItems), menuLabel)
160 count = count + 1
161 self.SetMenuBar(menuBar)
162
163
164 def CreateMenu(self, menuData):
165 menu = wx.Menu()
166 for eachLabel, eachStatus, eachHandler, eachType in menuData:
167 if not eachLabel:
168 menu.AppendSeparator()
169 continue
170 if eachType == "RADIO":
171 menuItem = menu.AppendRadioItem(-1,eachLabel,eachStatus)
172 else:
173 menuItem = menu.Append(-1, eachLabel, eachStatus)
174 self.Bind(wx.EVT_MENU, eachHandler, menuItem)
175 return menu
176
177
178 def OnFormChanged(self,event):
179 self.oKButton.Enable()
180
181 def OnSetFields(self,event):
182 #print self.casesListChoice.GetStringSelection()
183 self.SetFields(self.casesListChoice.GetStringSelection())
184 self.oKButton.Disable()
185
186 def SetFields(self, case):
187 currentChargeableBool,currentRespAttorney,currentRespParalegal,currentRespVendorTpl,currentRevPlatform,respTPM,respOffice,caseStatus = self.console.GetCaseData(case)
188 if currentChargeableBool:
189 self.chargeableCheckBox.SetValue(True)
190 else:
191 self.chargeableCheckBox.SetValue(False)
192 if currentRevPlatform == 'Concordance':
193 ## Make an assumption
194 currentRevPlatform = "Concordance DIS"
195 if currentRevPlatform:
196 #print currentRevPlatform
197 self.reviewPlatformChoice.SetStringSelection(currentRevPlatform)
198 else:
199 self.reviewPlatformChoice.SetStringSelection('')
200 if currentRespAttorney:
201 self.responsibleAttnyTextCtrl.SetValue(currentRespAttorney)
202 else:
203 self.responsibleAttnyTextCtrl.SetValue('')
204 if currentRespParalegal:
205 self.responsibleParalegalTextCtrl.SetValue(currentRespParalegal)
206 else:
207 self.responsibleParalegalTextCtrl.SetValue('')
208 if currentRespVendorTpl[0]:
209 self.responsibleProcessingVendorTextCtrl.SetValue(currentRespVendorTpl[0])
210 else:
211 self.responsibleProcessingVendorTextCtrl.SetValue("")
212 if currentRespVendorTpl[1]:
213 self.responsibleScanningVendorTextCtrl.SetValue(currentRespVendorTpl[1])
214 else:
215 self.responsibleScanningVendorTextCtrl.SetValue('')
216 if currentRespVendorTpl[2]:
217 self.responsibleHostingVendorTextCtrl.SetValue(currentRespVendorTpl[2])
218 else:
219 self.responsibleHostingVendorTextCtrl.SetValue('')
220 if respTPM:
221 self.responsibleTPMTextCtrl.SetValue(respTPM)
222 else:
223 self.responsibleTPMTextCtrl.SetValue('')
224 if respOffice:
225 self.responsibleOfficeTextCtrl.SetValue(respOffice)
226 else:
227 self.responsibleOfficeTextCtrl.SetValue('')
228 if caseStatus:
229 self.caseStatusChoice.SetStringSelection(caseStatus)
230 else:
231 self.caseStatusChoice.SetStringSelection('')
232
233
234 def OnProcess(self, event):
235 caseName = self.casesListChoice.GetStringSelection()
236 if self.chargeableCheckBox.GetValue():
237 chargeableBool = True
238 else:
239 chargeableBool = False
240 currentRevPlatform = self.reviewPlatformChoice.GetStringSelection()
241 caseStatus = self.caseStatusChoice.GetStringSelection()
242 currentRespAttorney = self.responsibleAttnyTextCtrl.GetValue()
243 currentRespParalegal = self.responsibleParalegalTextCtrl.GetValue()
244 currentRespVendorTpl = (self.responsibleProcessingVendorTextCtrl.GetValue(),self.responsibleScanningVendorTextCtrl.GetValue(),
245 self.responsibleHostingVendorTextCtrl.GetValue())
246 respTPM = self.responsibleTPMTextCtrl.GetValue()
247 respOffice = self.responsibleOfficeTextCtrl.GetValue()
248 print "Updating Access DB..."
249 self.console.EditCaseData(caseName,chargeableBool,currentRespAttorney,currentRespParalegal,currentRespVendorTpl,currentRevPlatform,
250 respTPM,respOffice, caseStatus)
251 print "Complete!"
252 finishedDlg = wx.MessageDialog(self, "MCP: Your settings have been saved to the Matter Management database.", "MCP: Process Complete",wx.OK, wx.DefaultPosition)
253 finishedDlg.ShowModal()
254 finishedDlg.Destroy()
255 self.oKButton.Disable()
256
257 def CreateBoxesSection(self):
258 self.oKButton = wx.Button(self.panel, wx.ID_OK,'Save')
259 self.oKButton.SetDefault()
260 self.oKButton.SetSize(self.oKButton.GetBestSize())
261 self.cancelButton = wx.Button(self.panel, wx.ID_CANCEL,'Close')
262 self.cancelButton.SetSize(self.cancelButton.GetBestSize())
263 self.buttonSizer = wx.BoxSizer(wx.HORIZONTAL)
264 self.buttonSizer.Add(self.oKButton,0,wx.ALL,10)
265 self.buttonSizer.Add(self.cancelButton,0,wx.ALL,10)
266
267 def CloseWindow(self, event):
268 self.Close(True)
269
270 def OnChangeCaseView(self,event):
271 self.casesListChoice.Clear()
272 eventID = event.GetId()
273 if eventID == 100:
274 #change it to my cases
275 self.casesListChoice.SetItems(self.myCases)
276 self.casesListChoice.SetSelection(0)
277 self.SetFields(self.myCases[0])
278 if eventID == 101:
279 #change it to office cases
280 self.casesListChoice.SetItems(self.officeCases)
281 self.casesListChoice.SetSelection(0)
282 self.SetFields(self.officeCases[0])
283 if eventID == 102:
284 #change it to all cases
285 self.casesListChoice.SetItems(self.allCases)
286 self.casesListChoice.SetSelection(0)
287 self.SetFields(self.allCases[0])
288
289
290 def OnViewCaseNotes(self,event):
291 caseName = self.casesListChoice.GetStringSelection()
292 office = self.responsibleOfficeTextCtrl.GetValue()
293 err = self.console.ViewCaseNotes(caseName,office)
294 if err:
295 errDlg = wx.MessageDialog(self, "MCP: The path to this case file could not be found.", "MCP: Does Not Compute",wx.OK, wx.DefaultPosition)
296 errDlg.ShowModal()
297 errDlg.Destroy()
298
299 def OnViewProdSpec(self,event):
300 caseName = self.casesListChoice.GetStringSelection()
301 office = self.responsibleOfficeTextCtrl.GetValue()
302 err = self.console.ViewProdSpec(caseName,office)
303 if err:
304 errDlg = wx.MessageDialog(self, "MCP: The path to this case file could not be found.", "MCP: Does Not Compute",wx.OK, wx.DefaultPosition)
305 errDlg.ShowModal()
306 errDlg.Destroy()
307
308 def OnOpenCaseFolder(self,event):
309 caseName = self.casesListChoice.GetStringSelection()
310 office = self.responsibleOfficeTextCtrl.GetValue()
311 err = self.console.OpenCaseFolder(caseName,office)
312 if err:
313 errDlg = wx.MessageDialog(self, "MCP: The path to this case file could not be found.", "MCP: Does Not Compute",wx.OK, wx.DefaultPosition)
314 errDlg.ShowModal()
315 errDlg.Destroy()
316
317 def OnViewCaseUploads(self, event):
318 uploadList = self.console.GetUploadData(self.casesListChoice.GetStringSelection())
319 numberOfRows = len(uploadList)
320 uploadTotal = self.console.GetUploadTotal(uploadList)
321 caseName = self.casesListChoice.GetStringSelection()
322 CLM = caseName.split("_(")[1]
323 CLM = CLM[:-1]
324 CLM = CLM.replace('-','.')
325 #print CLM
326 if numberOfRows == 0:
327 dlg = wx.MessageDialog(self, "MCP: There are no case uploads for this case.", "MCP: Does Not Compute",wx.OK, wx.DefaultPosition)
328 else:
329 dlg = CaseUploadsDialog.CaseUploadsDialog(self,numberOfRows, uploadList, uploadTotal,CLM)
330 #dlg.Show(True)
331 dlg.ShowModal()
332 dlg.Destroy()
333
334 def OnViewDocProduction(self,event):
335 prodList = self.console.GetProductionData(self.casesListChoice.GetStringSelection())
336 numberOfRows = len(prodList)
337 prodTotals = self.console.GetProductionTotal(prodList)
338 caseName = self.casesListChoice.GetStringSelection()
339 CLM = caseName.split("_(")[1]
340 CLM = CLM[:-1]
341 CLM = CLM.replace('-','.')
342 #print CLM
343 if numberOfRows == 0:
344 dlg = wx.MessageDialog(self, "MCP: There are no current productions for this case.", "MCP: Does Not Compute",wx.OK, wx.DefaultPosition)
345 else:
346 dlg = CurrentProductionsDialog.CaseUploadsDialog(self,numberOfRows, prodList,CLM, prodTotals)
347 #dlg.Show(True)
348 dlg.ShowModal()
349 dlg.Destroy()
350
351 def OnAddDocProduction(self, event):
352 caseName = self.casesListChoice.GetStringSelection()
353 CLM = caseName.split("_(")[1]
354 CLM = CLM[:-1]
355 CLM = CLM.replace('-','.')
356 #print CLM
357 dlg = AddDocumentProductionDialog.AddDocumentProductionDialog(self,CLM)
358 if dlg.ShowModal() == wx.ID_OK:
359 prodDate, begBates, endBates, prodDocCount, prodPageCount, prodNotes = dlg.GetValues()
360 #print prodDate
361 dateConverter = NinoGenTools.DateUtilities()
362 prodID = 'prod_' + str(dateConverter.ConvertDateFormat(prodDate, convertToFormat='computer'))
363 errRpt = self.console.AddProductionEntry(CLM,prodID,prodDate,begBates,endBates,prodDocCount, prodPageCount, prodNotes)
364 if errRpt:
365 doneDlg = wx.MessageDialog(self, "MCP: All fields need to be filled out.\nPlease try again.", "MCP: Does Not Compute",wx.OK, wx.DefaultPosition)
366 else:
367 doneDlg = wx.MessageDialog(self, "MCP: Production detail added successfully.", "MCP: Success",wx.OK, wx.DefaultPosition)
368 doneDlg.ShowModal()
369 doneDlg.Destroy()
370
371
372
373 def OnAbout(self, event):
374 """
375 OnAbout(self,event) Displays an about dialog with developer and bug reporting info
376 """
377 dlg = wx.MessageDialog(self, "MCP is a case organization program.\n"
378 "\n\n"
379 "For questions or comments about this program\n"
380 "or to report a bug, please email the program\n"
381 "creator at Nino.Borges@gmail.com\n\n"
382 "MCP is\n"
383 "Copyright (c) 2011 Emanuel Borges.\n"
384 "All rights reserved.\n"
385 "(Nino.Borges@gmail.com)\n",
386 "About MCP", wx.OK | wx.ICON_INFORMATION)
387 dlg.ShowModal()
388 dlg.Destroy()
389
390
391 class MyApp(wx.App):
392 def OnInit(self):
393 prgVersion = MCP_Lib.GetMCPVersion()
394 self.frame = MyFrame(None, -1, "View/Edit Case Information %s"%prgVersion)
395 self.frame.Show(True)
396 self.SetTopWindow(self.frame)
397 return True
398
399
400 if __name__ == '__main__':
401 app = MyApp(0)
402 app.MainLoop()