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: 461
Committed: Mon Sep 23 19:13:47 2013 UTC (12 years, 6 months ago) by nino.borges
Content type: text/x-python
File size: 36338 byte(s)
Log Message:
Added a busy dialog to the transfer case utility, completing the transfer case module. One day I'll add a separate menu dialog.

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