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: 343
Committed: Thu Apr 25 12:54:55 2013 UTC (12 years, 11 months ago) by nino.borges
Content type: text/x-python
File size: 33300 byte(s)
Log Message:
Adding case name editing ability

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     self.myCases, self.officeCases, self.allCases, casesDir = MCP_Lib.GetCaseList()
27     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     ("My Office Cases", "Chooses from cases assigned to everyone in your office.",self.OnChangeCaseView,"RADIO"),
162     ("All Cases", "Chooses from all cases.",self.OnChangeCaseView,"RADIO"),
163     ("","","",""),
164     ("Case &Uploads", "Displays the Case Uploads for this case.",self.OnViewCaseUploads,""),
165     ("&Production History", "Displays the Production History for this case.",self.OnViewDocProduction,""),
166     ("","","",""),
167 nino.borges 258 ("My Case &Notes","Opens the case notes file for the current selected case.",self.OnViewCaseNotes,""),
168     ("My Production &Spec","Opens the production specifications file for the current selected case.",self.OnViewProdSpec,""),
169 nino.borges 261 ("&Alternate Media Folder","Opens the alternate media path for the current selected case.",self.OnOpenAlternateMediaFolder,""),
170 nino.borges 174 ("Open Case &Folder","Opens the case folder for the current selected case.",self.OnOpenCaseFolder,"")),
171 ninoborges 8 ("Production",
172 nino.borges 174 ("&Add Production Entry","Adds a new production to the matter database.",self.OnAddDocProduction,"")),
173 nino.borges 258 ("Settings",
174 nino.borges 268 ("Linked &Vendor Folders","Allows you to link vendor folders to this case for copy ups.",self.OnEditVendorFolders,""),
175 nino.borges 262 ("&Case Paths","Allows you to set or change the alternate media path.",self.OnCasePathsSettings,"")),
176 nino.borges 321 ("Reporting",
177     ("Create &Produciton Report","Creates or updates the Production Report Page.",self.OnCreateProductionReport,""),
178     ("&Managerial","Managerial reports.",self.NothingYet,"DISABLED")),
179 ninoborges 8 ("&Help",
180 nino.borges 174 ("&About", "Displays the About Window.", self.OnAbout,"")))
181 ninoborges 8
182     def CreateMenuBar(self):
183     menuBar = wx.MenuBar()
184 nino.borges 158 count = 1
185 ninoborges 8 for eachMenuData in self.MenuData():
186     menuLabel = eachMenuData[0]
187     menuItems = eachMenuData[1:]
188     menuBar.Append(self.CreateMenu(menuItems), menuLabel)
189 nino.borges 158 count = count + 1
190 ninoborges 8 self.SetMenuBar(menuBar)
191    
192    
193     def CreateMenu(self, menuData):
194     menu = wx.Menu()
195 nino.borges 174 for eachLabel, eachStatus, eachHandler, eachType in menuData:
196 ninoborges 8 if not eachLabel:
197     menu.AppendSeparator()
198     continue
199 nino.borges 174 if eachType == "RADIO":
200     menuItem = menu.AppendRadioItem(-1,eachLabel,eachStatus)
201     else:
202     menuItem = menu.Append(-1, eachLabel, eachStatus)
203 nino.borges 303 if eachType == 'DISABLED':
204     menuItem.Enable(False)
205 ninoborges 8 self.Bind(wx.EVT_MENU, eachHandler, menuItem)
206     return menu
207    
208    
209     def OnFormChanged(self,event):
210     self.oKButton.Enable()
211    
212     def OnSetFields(self,event):
213     #print self.casesListChoice.GetStringSelection()
214     self.SetFields(self.casesListChoice.GetStringSelection())
215     self.oKButton.Disable()
216    
217     def SetFields(self, case):
218 nino.borges 321 currentChargeableBool,currentRespAttorney,currentRespParalegal,currentRespVendorTpl,currentRevPlatform,respTPM,respOffice,caseStatus,uploadCost,storageCost,disclosureLetterBool = self.console.GetCaseData(case)
219 ninoborges 8 if currentChargeableBool:
220     self.chargeableCheckBox.SetValue(True)
221     else:
222     self.chargeableCheckBox.SetValue(False)
223     if currentRevPlatform == 'Concordance':
224     ## Make an assumption
225     currentRevPlatform = "Concordance DIS"
226     if currentRevPlatform:
227     #print currentRevPlatform
228     self.reviewPlatformChoice.SetStringSelection(currentRevPlatform)
229     else:
230     self.reviewPlatformChoice.SetStringSelection('')
231     if currentRespAttorney:
232     self.responsibleAttnyTextCtrl.SetValue(currentRespAttorney)
233     else:
234     self.responsibleAttnyTextCtrl.SetValue('')
235     if currentRespParalegal:
236     self.responsibleParalegalTextCtrl.SetValue(currentRespParalegal)
237     else:
238     self.responsibleParalegalTextCtrl.SetValue('')
239     if currentRespVendorTpl[0]:
240     self.responsibleProcessingVendorTextCtrl.SetValue(currentRespVendorTpl[0])
241     else:
242     self.responsibleProcessingVendorTextCtrl.SetValue("")
243     if currentRespVendorTpl[1]:
244     self.responsibleScanningVendorTextCtrl.SetValue(currentRespVendorTpl[1])
245     else:
246     self.responsibleScanningVendorTextCtrl.SetValue('')
247     if currentRespVendorTpl[2]:
248     self.responsibleHostingVendorTextCtrl.SetValue(currentRespVendorTpl[2])
249     else:
250     self.responsibleHostingVendorTextCtrl.SetValue('')
251     if respTPM:
252     self.responsibleTPMTextCtrl.SetValue(respTPM)
253     else:
254     self.responsibleTPMTextCtrl.SetValue('')
255     if respOffice:
256     self.responsibleOfficeTextCtrl.SetValue(respOffice)
257     else:
258     self.responsibleOfficeTextCtrl.SetValue('')
259     if caseStatus:
260     self.caseStatusChoice.SetStringSelection(caseStatus)
261     else:
262     self.caseStatusChoice.SetStringSelection('')
263 nino.borges 303 if storageCost:
264     self.storageCostStaticText.SetLabel(" Storage:$%s "%str(storageCost))
265     else:
266 nino.borges 321 self.storageCostStaticText.SetLabel(' Storage:$0 ')
267 nino.borges 303 if uploadCost:
268     self.uploadCostStaticText.SetLabel(" Upload:$%s "%str(uploadCost))
269     else:
270 nino.borges 321 self.uploadCostStaticText.SetLabel(' Upload:$0 ')
271     if currentChargeableBool:
272     if currentRevPlatform:
273     if disclosureLetterBool:
274     self.disclosureLetterReminderText.SetLabel('')
275     else:
276     self.disclosureLetterReminderText.SetLabel('WARNING: There is no disclosure letter for this case on file!')
277     else:
278     self.disclosureLetterReminderText.SetLabel('')
279     else:
280     self.disclosureLetterReminderText.SetLabel('')
281 ninoborges 8
282     def OnProcess(self, event):
283     caseName = self.casesListChoice.GetStringSelection()
284     if self.chargeableCheckBox.GetValue():
285     chargeableBool = True
286     else:
287     chargeableBool = False
288     currentRevPlatform = self.reviewPlatformChoice.GetStringSelection()
289     caseStatus = self.caseStatusChoice.GetStringSelection()
290     currentRespAttorney = self.responsibleAttnyTextCtrl.GetValue()
291     currentRespParalegal = self.responsibleParalegalTextCtrl.GetValue()
292     currentRespVendorTpl = (self.responsibleProcessingVendorTextCtrl.GetValue(),self.responsibleScanningVendorTextCtrl.GetValue(),
293     self.responsibleHostingVendorTextCtrl.GetValue())
294     respTPM = self.responsibleTPMTextCtrl.GetValue()
295     respOffice = self.responsibleOfficeTextCtrl.GetValue()
296     print "Updating Access DB..."
297     self.console.EditCaseData(caseName,chargeableBool,currentRespAttorney,currentRespParalegal,currentRespVendorTpl,currentRevPlatform,
298     respTPM,respOffice, caseStatus)
299     print "Complete!"
300     finishedDlg = wx.MessageDialog(self, "MCP: Your settings have been saved to the Matter Management database.", "MCP: Process Complete",wx.OK, wx.DefaultPosition)
301     finishedDlg.ShowModal()
302     finishedDlg.Destroy()
303     self.oKButton.Disable()
304    
305     def CreateBoxesSection(self):
306     self.oKButton = wx.Button(self.panel, wx.ID_OK,'Save')
307     self.oKButton.SetDefault()
308     self.oKButton.SetSize(self.oKButton.GetBestSize())
309     self.cancelButton = wx.Button(self.panel, wx.ID_CANCEL,'Close')
310     self.cancelButton.SetSize(self.cancelButton.GetBestSize())
311     self.buttonSizer = wx.BoxSizer(wx.HORIZONTAL)
312     self.buttonSizer.Add(self.oKButton,0,wx.ALL,10)
313     self.buttonSizer.Add(self.cancelButton,0,wx.ALL,10)
314    
315     def CloseWindow(self, event):
316     self.Close(True)
317 nino.borges 158
318 nino.borges 174 def OnChangeCaseView(self,event):
319     self.casesListChoice.Clear()
320     eventID = event.GetId()
321 nino.borges 303 #print eventID
322     if eventID == 105:
323 nino.borges 174 #change it to my cases
324 nino.borges 189 self.casesListChoice.SetItems(self.myCases)
325     self.casesListChoice.SetSelection(0)
326     self.SetFields(self.myCases[0])
327 nino.borges 303 if eventID == 106:
328 nino.borges 174 #change it to office cases
329 nino.borges 189 self.casesListChoice.SetItems(self.officeCases)
330     self.casesListChoice.SetSelection(0)
331     self.SetFields(self.officeCases[0])
332 nino.borges 303 if eventID == 107:
333 nino.borges 174 #change it to all cases
334 nino.borges 189 self.casesListChoice.SetItems(self.allCases)
335     self.casesListChoice.SetSelection(0)
336     self.SetFields(self.allCases[0])
337 nino.borges 174
338    
339 nino.borges 343 def OnEditCaseName(self,event):
340     caseName = self.casesListChoice.GetStringSelection()
341     office = self.responsibleOfficeTextCtrl.GetValue()
342     CLM = caseName.split("_(")[1]
343     CLM = CLM[:-1]
344     CLM = CLM.replace('-','.')
345     dlg = AddEditCaseNameDialog.AddEditCaseNameDialog(self, CLM,caseName)
346     if dlg.ShowModal() == wx.ID_OK:
347     changed = False
348     newCaseName, clientNumb,matterNumb = dlg.GetValues()
349     newCLM = clientNumb + '.' + matterNumb
350     if caseName.split('_(')[0] != newCaseName:
351     changed = True
352     if newCLM != CLM:
353     changed = True
354     if changed:
355     self.console.ChangeCaseName(caseName,newCaseName,newCLM)
356     doneDlg = wx.MessageDialog(self, "MCP: Case name has been changed to %s_(%s)"%(newCaseName,newCLM), "MCP: Success",wx.OK, wx.DefaultPosition)
357     doneDlg.ShowModal()
358     doneDlg.Destroy()
359     print "you changed it so new value is %s_(%s)"%(newCaseName,newCLM)
360     self.myCases = self.myCases.replace(caseName,"%s_(%s)"%(newCaseName,newCLM.replace(".","-")))
361     self.officeCases = self.officeCases.replace(caseName,"%s_(%s)"%(newCaseName,newCLM.replace(".","-")))
362     self.allCases = self.allCases.replace(caseName,"%s_(%s)"%(newCaseName,newCLM.replace(".","-")))
363    
364     self.casesListChoice.SetItems(self.myCases)
365     self.casesListChoice.SetSelection(0)
366     self.SetFields(self.myCases[0])
367     dlg.Destroy()
368     #err = self.console.ViewCaseNotes(caseName,office)
369    
370 nino.borges 158 def OnViewCaseNotes(self,event):
371     caseName = self.casesListChoice.GetStringSelection()
372     office = self.responsibleOfficeTextCtrl.GetValue()
373     err = self.console.ViewCaseNotes(caseName,office)
374     if err:
375     errDlg = wx.MessageDialog(self, "MCP: The path to this case file could not be found.", "MCP: Does Not Compute",wx.OK, wx.DefaultPosition)
376     errDlg.ShowModal()
377     errDlg.Destroy()
378    
379     def OnViewProdSpec(self,event):
380     caseName = self.casesListChoice.GetStringSelection()
381     office = self.responsibleOfficeTextCtrl.GetValue()
382     err = self.console.ViewProdSpec(caseName,office)
383     if err:
384     errDlg = wx.MessageDialog(self, "MCP: The path to this case file could not be found.", "MCP: Does Not Compute",wx.OK, wx.DefaultPosition)
385     errDlg.ShowModal()
386     errDlg.Destroy()
387 ninoborges 8
388 nino.borges 261 def OnOpenAlternateMediaFolder(self,event):
389     caseName = self.casesListChoice.GetStringSelection()
390     office = self.responsibleOfficeTextCtrl.GetValue()
391     err = self.console.OpenAlternateMediaFolder(caseName,office)
392     if err:
393     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)
394     errDlg.ShowModal()
395     errDlg.Destroy()
396    
397 ninoborges 8 def OnOpenCaseFolder(self,event):
398     caseName = self.casesListChoice.GetStringSelection()
399     office = self.responsibleOfficeTextCtrl.GetValue()
400     err = self.console.OpenCaseFolder(caseName,office)
401     if err:
402     errDlg = wx.MessageDialog(self, "MCP: The path to this case file could not be found.", "MCP: Does Not Compute",wx.OK, wx.DefaultPosition)
403     errDlg.ShowModal()
404     errDlg.Destroy()
405    
406     def OnViewCaseUploads(self, event):
407     uploadList = self.console.GetUploadData(self.casesListChoice.GetStringSelection())
408     numberOfRows = len(uploadList)
409     uploadTotal = self.console.GetUploadTotal(uploadList)
410     caseName = self.casesListChoice.GetStringSelection()
411     CLM = caseName.split("_(")[1]
412     CLM = CLM[:-1]
413     CLM = CLM.replace('-','.')
414     #print CLM
415     if numberOfRows == 0:
416     dlg = wx.MessageDialog(self, "MCP: There are no case uploads for this case.", "MCP: Does Not Compute",wx.OK, wx.DefaultPosition)
417     else:
418     dlg = CaseUploadsDialog.CaseUploadsDialog(self,numberOfRows, uploadList, uploadTotal,CLM)
419     #dlg.Show(True)
420     dlg.ShowModal()
421     dlg.Destroy()
422    
423     def OnViewDocProduction(self,event):
424 nino.borges 321 prodMatrix = self.console.GetProductionData(self.casesListChoice.GetStringSelection())
425     prodList = []
426     for key in prodMatrix.keys():
427     prodList.extend(prodMatrix[key])
428 ninoborges 8 numberOfRows = len(prodList)
429     prodTotals = self.console.GetProductionTotal(prodList)
430     caseName = self.casesListChoice.GetStringSelection()
431     CLM = caseName.split("_(")[1]
432     CLM = CLM[:-1]
433     CLM = CLM.replace('-','.')
434     #print CLM
435     if numberOfRows == 0:
436     dlg = wx.MessageDialog(self, "MCP: There are no current productions for this case.", "MCP: Does Not Compute",wx.OK, wx.DefaultPosition)
437     else:
438     dlg = CurrentProductionsDialog.CaseUploadsDialog(self,numberOfRows, prodList,CLM, prodTotals)
439     #dlg.Show(True)
440     dlg.ShowModal()
441     dlg.Destroy()
442    
443     def OnAddDocProduction(self, event):
444     caseName = self.casesListChoice.GetStringSelection()
445 nino.borges 321 caseDatabaseList = self.console.GetDatabaseList(caseName)
446     possibleProducedToEntities = self.console.GetPossibleProducedToEntities(caseName)
447     possibleProdReqByNames = self.console.GetPossibleProdReqByNames(caseName)
448 ninoborges 8 CLM = caseName.split("_(")[1]
449     CLM = CLM[:-1]
450     CLM = CLM.replace('-','.')
451     #print CLM
452 nino.borges 321 dlg = AddDocumentProductionDialog.AddDocumentProductionDialog(self,CLM, caseDatabaseList, possibleProducedToEntities,possibleProdReqByNames)
453 ninoborges 8 if dlg.ShowModal() == wx.ID_OK:
454 nino.borges 321 prodProcessedDate, begBates, endBates, prodDocCount, prodPageCount, prodNotes, prodTo, prodMedia,prodSource,prodReqBy,prodSentDate,prodMediaPassword = dlg.GetValues()
455 ninoborges 8 #print prodDate
456     dateConverter = NinoGenTools.DateUtilities()
457 nino.borges 321 prodID = 'prod_' + str(dateConverter.ConvertDateFormat(prodProcessedDate, convertToFormat='computer'))
458     errRpt = self.console.AddProductionEntry(CLM,prodID,prodProcessedDate,begBates,endBates,prodDocCount, prodPageCount, prodNotes, prodTo, prodMedia,prodSource,prodReqBy,prodSentDate,prodMediaPassword)
459 ninoborges 8 if errRpt:
460     doneDlg = wx.MessageDialog(self, "MCP: All fields need to be filled out.\nPlease try again.", "MCP: Does Not Compute",wx.OK, wx.DefaultPosition)
461     else:
462     doneDlg = wx.MessageDialog(self, "MCP: Production detail added successfully.", "MCP: Success",wx.OK, wx.DefaultPosition)
463     doneDlg.ShowModal()
464     doneDlg.Destroy()
465    
466 nino.borges 321 def OnChangeDisclosureLetter(self,event):
467     office = self.responsibleOfficeTextCtrl.GetValue()
468     altMediaPath, casePath = self.console.GetCasePathsData(self.casesListChoice.GetStringSelection(),office)
469     disclosureLetterSet,disclosureLetterPath = self.console.GetDisclosureLetterData(self.casesListChoice.GetStringSelection())
470     if disclosureLetterPath:
471     disclosureLetterPath = str(disclosureLetterPath)
472     else:
473     disclosureLetterPath = ""
474     dlg = DisclosureLetterDialog.DisclosureLetterDialog(self, disclosureLetterSet, disclosureLetterPath, casePath)
475     if dlg.ShowModal() == wx.ID_OK:
476     newdisclosureLetterPath,errRpt = dlg.GetValues()
477     dlg.Destroy()
478     if errRpt:
479     doneDlg = wx.MessageDialog(self, "MCP: The Disclosure letter could NOT be loaded.\nPlease try again.", "MCP: Does Not Compute",wx.OK, wx.DefaultPosition)
480     else:
481     if newdisclosureLetterPath == disclosureLetterPath:
482     doneDlg = False
483     else:
484     self.console.SetDisclosureLetterData(self.casesListChoice.GetStringSelection(),newdisclosureLetterPath)
485     doneDlg = wx.MessageDialog(self, "MCP: Disclosure letter loaded successfully.", "MCP: Success",wx.OK, wx.DefaultPosition)
486     self.disclosureLetterReminderText.SetLabel('')
487     if doneDlg:
488     doneDlg.ShowModal()
489     doneDlg.Destroy()
490    
491 nino.borges 262 def OnCasePathsSettings(self, event):
492     office = self.responsibleOfficeTextCtrl.GetValue()
493     altMediaPath, casePath = self.console.GetCasePathsData(self.casesListChoice.GetStringSelection(),office)
494     if altMediaPath:
495     pass
496     else:
497     altMediaPath = ""
498     dlg = CasePathsDialog.CasePathsDialog(self, altMediaPath, casePath)
499     if dlg.ShowModal() == wx.ID_OK:
500 nino.borges 265 newAltMediaPath,errRpt = dlg.GetValues()
501 nino.borges 262 dlg.Destroy()
502 nino.borges 265 if errRpt:
503     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)
504     else:
505     if newAltMediaPath == altMediaPath:
506     pass
507     else:
508     self.console.SetAlternateMediaFolder(self.casesListChoice.GetStringSelection(),newAltMediaPath)
509     doneDlg = wx.MessageDialog(self, "MCP: Alternate Media Path updated successfully.", "MCP: Success",wx.OK, wx.DefaultPosition)
510     if doneDlg:
511     doneDlg.ShowModal()
512     doneDlg.Destroy()
513 nino.borges 303
514     def OnChangePricing(self,event):
515 nino.borges 321 #StorageUploadCostsDialog
516 nino.borges 303 office = self.responsibleOfficeTextCtrl.GetValue()
517     currentStorageCosts = self.storageCostStaticText.Label
518     if currentStorageCosts:
519     currentStorageCosts = float(currentStorageCosts.replace(" Storage:$",""))
520     currentUploadCosts = self.uploadCostStaticText.Label
521     if currentUploadCosts:
522     currentUploadCosts = float(currentUploadCosts.replace(" Upload:$",""))
523     dlg = StorageUploadCostsDialog.StorageUploadCostsDialog(self, currentStorageCosts,currentUploadCosts)
524     if dlg.ShowModal() == wx.ID_OK:
525 nino.borges 321 newStorageCosts,newUploadCosts = dlg.GetValues()
526 nino.borges 303 dlg.Destroy()
527     self.console.SetUploadAndStorageCosts(self.casesListChoice.GetStringSelection(),str(newUploadCosts),str(newStorageCosts))
528     doneDlg = wx.MessageDialog(self, "MCP: Upload and Storage Pricing updated successfully.", "MCP: Success",wx.OK, wx.DefaultPosition)
529     doneDlg.ShowModal()
530     doneDlg.Destroy()
531 ninoborges 8
532 nino.borges 268 def OnEditVendorFolders(self,event):
533     office = self.responsibleOfficeTextCtrl.GetValue()
534 nino.borges 271 currentVendorFolder = self.console.GetVendorFolders(self.casesListChoice.GetStringSelection())
535     if currentVendorFolder:
536     pass
537     else:
538     currentVendorFolder = "None"
539     vendorFolderList = self.console.GetVendorFoldersList()
540     dlg = EditVendorFolderDialog.EditVendorFolderDialog(self, currentVendorFolder,vendorFolderList)
541     if dlg.ShowModal() == wx.ID_OK:
542     newCurrentVendorFolder = dlg.GetValues()
543     if newCurrentVendorFolder == currentVendorFolder:
544     pass
545     else:
546     self.console.SetVendorFolders(self.casesListChoice.GetStringSelection(), newCurrentVendorFolder)
547     doneDlg = wx.MessageDialog(self, "MCP: Vendor Folder updated successfully.", "MCP: Success",wx.OK, wx.DefaultPosition)
548     doneDlg.ShowModal()
549     doneDlg.Destroy()
550 nino.borges 321
551     def OnCreateProductionReport(self,event):
552     """This method creates or updates the Produciton Reporting page."""
553     ## Check to see if a alternate media folder exists
554     caseName = self.casesListChoice.GetStringSelection()
555     office = self.responsibleOfficeTextCtrl.GetValue()
556     err = self.console.OpenAlternateMediaFolder(caseName,office,testOnly=True)
557     if err:
558     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)
559     errDlg.ShowModal()
560     errDlg.Destroy()
561     else:
562     err2 = self.console.CreateProductionReport(caseName,office)
563     if err2:
564     err2Dlg = wx.MessageDialog(self, "MCP: There are no productions for this case..", "MCP: Does Not Compute",wx.OK, wx.DefaultPosition)
565     err2Dlg.ShowModal()
566     err2Dlg.Destroy()
567     else:
568     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)
569     sucessDlg.ShowModal()
570     sucessDlg.Destroy()
571 nino.borges 268
572 ninoborges 8 def OnAbout(self, event):
573     """
574     OnAbout(self,event) Displays an about dialog with developer and bug reporting info
575     """
576     dlg = wx.MessageDialog(self, "MCP is a case organization program.\n"
577     "\n\n"
578     "For questions or comments about this program\n"
579     "or to report a bug, please email the program\n"
580     "creator at Nino.Borges@gmail.com\n\n"
581     "MCP is\n"
582     "Copyright (c) 2011 Emanuel Borges.\n"
583     "All rights reserved.\n"
584     "(Nino.Borges@gmail.com)\n",
585     "About MCP", wx.OK | wx.ICON_INFORMATION)
586     dlg.ShowModal()
587     dlg.Destroy()
588    
589    
590     class MyApp(wx.App):
591     def OnInit(self):
592     prgVersion = MCP_Lib.GetMCPVersion()
593     self.frame = MyFrame(None, -1, "View/Edit Case Information %s"%prgVersion)
594     self.frame.Show(True)
595     self.SetTopWindow(self.frame)
596     return True
597    
598    
599     if __name__ == '__main__':
600     app = MyApp(0)
601     app.MainLoop()