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: 455
Committed: Wed Sep 11 18:57:58 2013 UTC (12 years, 6 months ago) by nino.borges
Content type: text/x-python
File size: 33829 byte(s)
Log Message:
Added a new view called My Active Cases, filtering the case list to only show your active cases for all modules.

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