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: 303
Committed: Wed Mar 6 16:09:57 2013 UTC (13 years ago) by nino.borges
Content type: text/x-python
File size: 27086 byte(s)
Log Message:
Added initial support for upload and hosting pricing and added an initial gui dialog to change it.  Updated version to 1.8.0

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