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: 487
Committed: Thu Nov 21 16:42:23 2013 UTC (12 years, 4 months ago) by nino.borges
Content type: text/x-python
File size: 41050 byte(s)
Log Message:
Changed it so that view edit doesnt make a new access connection (a second one) but instead uses the instance from console. Also added a add case dialog and started making the add case call back.

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