ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/ns_dev/Python/NinoCode/Active_prgs/MCP/Trunk/MCP_CopyUp_Request_UI.py
Revision: 453
Committed: Wed Sep 11 17:59:42 2013 UTC (12 years, 6 months ago) by nino.borges
Content type: text/x-python
Original Path: Python/NinoCode/Active_prgs/MCP/MCP_CopyUp_Request_UI.py
File size: 22091 byte(s)
Log Message:
Added support for the working folder, IDS and made expedat library encrypted.  Also fixed a bug where it would error out if copy up was less than 1k.

File Contents

# User Rev Content
1 ninoborges 8 """
2    
3     MCP_CopyUp_Request_UI
4    
5     Created by
6     Emanuel Borges
7     10.25.2010
8    
9     This is the GUI to the MCP_CopyUp_Request program.
10    
11     """
12    
13 nino.borges 258 import wx, MCP_Lib, MCP_CopyUp_Request,os,WorkDirDialog
14 ninoborges 8 import wx.lib.filebrowsebutton as filebrowse
15    
16     class MyFrame(wx.Frame):
17     def __init__(self, parent, ID, title, pos=wx.DefaultPosition):
18 nino.borges 258 self.workDir = os.path.join(os.environ.get("USERPROFILE"),"Desktop\\Working")
19 nino.borges 203 wx.Frame.__init__(self, parent, ID, title, pos, size =(585,450))
20 ninoborges 8 self.panel = wx.Panel(self,-1)
21     #self.panel.SetBackgroundColour("yellow green")
22     casesListStaticText = wx.StaticText(self.panel, -1, "Select Case: ",wx.DefaultPosition)
23 nino.borges 189 #casesList,casesDir = MCP_Lib.GetCaseList()
24 nino.borges 232 print "connecting to matter tracking access db..."
25     self.accessDB = MCP_Lib.AccessDBConnection(r"\\chiads01\app\DS_CaseTrack\TPM_CaseTracking.mdb")
26     print "connected to DB."
27     self.myCases, self.officeCases, self.allCases, casesDir = MCP_Lib.GetCaseList('',self.accessDB)
28 nino.borges 189 self.casesListChoice = wx.Choice(self.panel, -1, wx.DefaultPosition, choices=self.myCases)
29 ninoborges 8 platformStaticText = wx.StaticText(self.panel, -1, "Select Platform:",wx.DefaultPosition)
30     platformChoices = ["Concordance DIS","Concordance LN","Relativity"]
31     self.platformListChoice = wx.Choice(self.panel, -1, wx.DefaultPosition, choices=platformChoices)
32 nino.borges 258
33 nino.borges 453 upLoadCatagoryStaticText = wx.StaticText(self.panel, -1, "Upload Type:",wx.DefaultPosition)
34     upLoadCatagoriesList = ['Generic (Working dir)',]
35     self.upLoadCatagory = wx.Choice(self.panel, -1, wx.DefaultPosition, choices=upLoadCatagoriesList)
36     self.upLoadCatagory.SetSelection(0)
37     self.upLoadCatagory.Enable(False)
38    
39 nino.borges 203 #workDirStaticText = wx.StaticText(self.panel, -1, "Select Work Dir:",wx.DefaultPosition)
40     #self.workDirControl = wx.TextCtrl(self.panel,-1,os.path.join(os.environ.get("USERPROFILE"),"Desktop\\Working"), size=(296,-1))
41     #workDirBrowseButton = wx.Button(self.panel, -1, "Browse", (10, 10))
42 ninoborges 8
43    
44     self.radio1 = wx.RadioButton(self.panel, -1, 'Individual File',style=wx.RB_GROUP)
45     self.fileBowserControl = wx.TextCtrl(self.panel, -1,size=(296,-1))
46     self.fileBowserButton = wx.Button(self.panel, -1, "Browse", (10, 10))
47    
48     self.requestAssistanceCheckBox = wx.CheckBox(self.panel,-1,": Request Data Analyst Assistance")
49     self.requestAssistanceCheckBox.Enable(False) ## Change me when you go live with this service.
50    
51     self.radio2 = wx.RadioButton(self.panel, -1, 'Entire folder of Files')
52     self.dirBowserControl = wx.TextCtrl(self.panel, -1, size=(296,-1))
53     self.dirBowserButton = wx.Button(self.panel, -1, "Browse", (10, 10))
54     self.dirBowserControl.Enable(False)
55     self.dirBowserButton.Enable(False)
56    
57 nino.borges 203 self.radio3 = wx.RadioButton(self.panel, -1, 'From Vendor Folder')
58     self.vendorBowserControl = wx.TextCtrl(self.panel, -1, size=(296,-1))
59     self.vendorBowserButton = wx.Button(self.panel, -1, "Browse", (10, 10))
60     self.vendorBowserControl.Enable(False)
61     self.vendorBowserButton.Enable(False)
62 ninoborges 8
63 nino.borges 203
64 ninoborges 8 self.CreateBoxesSection()
65     copyUpTypeStaticBox = wx.StaticBox(self.panel, -1, 'Copy Up:')
66     copyUpTypeStaticBoxSizer = wx.StaticBoxSizer(copyUpTypeStaticBox, wx.VERTICAL)
67    
68     radio1Sizer = wx.FlexGridSizer(1,3,10,10)
69     radio1Sizer.Add(self.radio1, 0, 0)
70     radio1Sizer.Add(self.fileBowserControl, 0)
71     radio1Sizer.Add(self.fileBowserButton, 0)
72     copyUpTypeStaticBoxSizer.Add(radio1Sizer, 0, wx.ALL|wx.ALIGN_LEFT,20)
73 nino.borges 203
74 ninoborges 8 radio2Sizer = wx.FlexGridSizer(1,3,10,10)
75     radio2Sizer.Add(self.radio2, 0)
76     radio2Sizer.Add(self.dirBowserControl, 0)
77     radio2Sizer.Add(self.dirBowserButton, 0)
78 nino.borges 203
79 ninoborges 8 copyUpTypeStaticBoxSizer.Add(radio2Sizer, 0, wx.ALL|wx.ALIGN_LEFT,20)
80 nino.borges 203 radio3Sizer = wx.FlexGridSizer(1,3,10,10)
81     radio3Sizer.Add(self.radio3, 0)
82     radio3Sizer.Add(self.vendorBowserControl, 0)
83     radio3Sizer.Add(self.vendorBowserButton, 0)
84     copyUpTypeStaticBoxSizer.Add(radio3Sizer, 0, wx.ALL|wx.ALIGN_LEFT,20)
85 ninoborges 8
86 nino.borges 453 #casesSizer = wx.FlexGridSizer(2,2,15,5)
87     #casesSizer.Add(casesListStaticText)
88     #casesSizer.Add(self.casesListChoice)
89     #casesSizer.Add(platformStaticText)
90     #casesSizer.Add(self.platformListChoice)
91    
92     casesSizer = wx.GridBagSizer(8,12)
93     casesSizer.Add(casesListStaticText,pos=(0,0))
94     casesSizer.Add(self.casesListChoice,pos=(0,1), span = (1,3))
95     casesSizer.Add(platformStaticText,pos=(1,0))
96     casesSizer.Add(self.platformListChoice,pos=(1,1))
97     casesSizer.Add(upLoadCatagoryStaticText,pos=(1,2))
98     casesSizer.Add(self.upLoadCatagory,pos=(1,3))
99    
100 ninoborges 8 #casesSizer = wx.BoxSizer(wx.HORIZONTAL)
101     #casesSizer.Add(casesListStaticText,0,wx.ALL,5)
102     #casesSizer.Add(self.casesListChoice,0,wx.ALL,5)
103     #casesSizer.Add(platformStaticText,0,wx.ALL,5)
104     #casesSizer.Add(self.platformListChoice,0,wx.ALL,5)
105 nino.borges 203 #workDirSizer = wx.BoxSizer(wx.HORIZONTAL)
106     #workDirSizer.Add(workDirStaticText,0,wx.ALL,5)
107     #workDirSizer.Add(self.workDirControl,0,wx.ALL,5)
108     #workDirSizer.Add(workDirBrowseButton,0,wx.ALL,5)
109 ninoborges 8 mainSizer = wx.BoxSizer(wx.VERTICAL)
110     mainSizer.Add(casesSizer,0,wx.ALL, 20)
111 nino.borges 203 #mainSizer.Add(workDirSizer,0,wx.ALL, 10)
112 ninoborges 8 mainSizer.Add(copyUpTypeStaticBoxSizer, 0, wx.ALL, 10)
113     mainSizer.Add(self.requestAssistanceCheckBox,0,wx.ALL|wx.ALIGN_CENTER,5)
114 nino.borges 203
115    
116 ninoborges 8 mainSizer.Add(self.buttonSizer,0, wx.ALL|wx.ALIGN_BOTTOM|wx.ALIGN_CENTER, 10)
117    
118     self.panel.SetSizer(mainSizer)
119 nino.borges 189 self.CreateMenuBar()
120 nino.borges 453 self.Bind(wx.EVT_CHOICE, self.OnPlatformSelect, self.platformListChoice)
121 ninoborges 8 self.Bind(wx.EVT_RADIOBUTTON, self.OnRadio, self.radio1)
122     self.Bind(wx.EVT_RADIOBUTTON, self.OnRadio, self.radio2)
123 nino.borges 203 self.Bind(wx.EVT_RADIOBUTTON, self.OnRadio, self.radio3)
124     #self.Bind(wx.EVT_BUTTON, self.OnBrowseClick, workDirBrowseButton)
125 ninoborges 8 self.Bind(wx.EVT_BUTTON, self.OnBrowseClick, self.fileBowserButton)
126     self.Bind(wx.EVT_BUTTON, self.OnBrowseClick, self.dirBowserButton)
127 nino.borges 203 self.Bind(wx.EVT_BUTTON, self.OnBrowseClick, self.vendorBowserButton)
128 ninoborges 8 self.Bind(wx.EVT_BUTTON, self.OnProcess, self.oKButton)
129     self.Bind(wx.EVT_BUTTON, self.CloseWindow, self.cancelButton)
130    
131     def OnRadio(self,event):
132     radioObj = event.GetEventObject()
133     selection = radioObj.GetLabel()
134     if selection == "Individual File":
135     self.fileBowserControl.Enable(True)
136     self.fileBowserButton.Enable(True)
137    
138     self.dirBowserControl.Enable(False)
139     self.dirBowserButton.Enable(False)
140 nino.borges 203 self.vendorBowserControl.Enable(False)
141     self.vendorBowserButton.Enable(False)
142    
143 ninoborges 8 self.dirBowserControl.SetValue("")
144 nino.borges 203 self.vendorBowserControl.SetValue("")
145    
146     elif selection == "Entire folder of Files":
147     self.dirBowserControl.Enable(True)
148     self.dirBowserButton.Enable(True)
149    
150     self.fileBowserControl.Enable(False)
151     self.fileBowserButton.Enable(False)
152     self.vendorBowserControl.Enable(False)
153     self.vendorBowserButton.Enable(False)
154    
155     self.fileBowserControl.SetValue("")
156     self.vendorBowserControl.SetValue("")
157    
158 ninoborges 8 else:
159 nino.borges 203 self.vendorBowserControl.Enable(True)
160     self.vendorBowserButton.Enable(True)
161    
162 ninoborges 8 self.fileBowserControl.Enable(False)
163     self.fileBowserButton.Enable(False)
164 nino.borges 203 self.dirBowserControl.Enable(False)
165     self.dirBowserButton.Enable(False)
166    
167 ninoborges 8 self.fileBowserControl.SetValue("")
168 nino.borges 203 self.dirBowserControl.SetValue("")
169 ninoborges 8
170     #if self.selectedText:
171     # self.selectedText.Enable(False)
172     #radioSelected = event.GetEventObject()
173     #text = self.texts[radioSelected.GetLabel()]
174     #text.Enable(True)
175     #self.selectedText = text
176    
177 nino.borges 453 def OnPlatformSelect(self,event):
178     platform = self.platformListChoice.GetStringSelection()
179     if platform == 'Concordance DIS':
180     self.upLoadCatagory.Enable(False)
181     else:
182     self.upLoadCatagory.Enable(True)
183    
184    
185 ninoborges 8 def OnBrowseClick(self,event):
186     eventCode = event.GetId()
187     #print eventCode
188 nino.borges 203 #if eventCode == -209:
189     # dlg = wx.DirDialog(self, message = "Working Directory Path: ", defaultPath = os.path.join(os.environ.get("USERPROFILE"),"Desktop\\Working"))
190     # if dlg.ShowModal() == wx.ID_OK:
191     # dirPath = dlg.GetPath()
192     # dlg.Destroy()
193     # self.workDirControl.SetValue(dirPath)
194 nino.borges 453 if eventCode == -211:
195 ninoborges 8 dlg = wx.FileDialog(self, message="Select file to copy up:",defaultDir=os.path.join(os.environ.get("USERPROFILE"),"Desktop\\Working"), defaultFile="",wildcard= "*.*",style=wx.OPEN | wx.CHANGE_DIR)
196     #dlg = wx.FileDialog(self, message = "Select directory to copy up: ", defaultPath = os.path.join(os.environ.get("USERPROFILE"),"Desktop\\Working"))
197     if dlg.ShowModal() == wx.ID_OK:
198     filePath = dlg.GetPath()
199     dlg.Destroy()
200 nino.borges 235 ## Test here to see if it's a zip. if not, give them warning about uncompressed size.
201 nino.borges 266 if os.path.splitext(filePath)[1].upper() in MCP_Lib.GetArchiveFileTypeList():
202     if os.path.splitext(filePath)[1].upper() == ".ZIP":
203     pass
204     else:
205     warningDlg = wx.MessageDialog(self,"MCP: You are attempting to copy an archive file that is not ZIP. The COMPRESSED SIZE will be gathered only.\nPlease change this size, once uncompressed, in View Edit.","WARNING!",wx.OK | wx.ICON_INFORMATION)
206     warningDlg.ShowModal()
207     warningDlg.Destroy()
208 ninoborges 8 self.fileBowserControl.SetValue(filePath)
209 nino.borges 453 elif eventCode == -215:
210 ninoborges 8 dlg = wx.DirDialog(self, message = "Select directory to copy up:", defaultPath = os.path.join(os.environ.get("USERPROFILE"),"Desktop\\Working"))
211     if dlg.ShowModal() == wx.ID_OK:
212     dirPath = dlg.GetPath()
213     dlg.Destroy()
214     self.dirBowserControl.SetValue(dirPath)
215 nino.borges 453 elif eventCode == -218:
216 nino.borges 232 platform = self.platformListChoice.GetStringSelection()
217     if platform == 'Concordance LN':
218     platform = 'Concordance'
219     elif platform == 'Concordance DIS':
220     platform = None
221     if platform:
222     expdtObj = MCP_Lib.ExpeDatConnection(platform)
223     caseName = self.casesListChoice.GetStringSelection()
224     clientMatter = caseName.split("_(")[1]
225     clientMatter = clientMatter[:-1]
226     clientMatter = clientMatter.replace('-','.')
227     vendorFolder = self.accessDB.GetVendorFolderPath(clientMatter)
228     if vendorFolder:
229     folderMatrix = expdtObj.GatherFullDirListMatrix('Uploads/%s'%vendorFolder)
230     dlg = VendorBrowserDialog(self,vendorFolder,folderMatrix)
231     if dlg.ShowModal() == wx.ID_OK:
232     vendorPath = dlg.GetValues()
233     dlg.Destroy()
234 nino.borges 266 if os.path.splitext(vendorPath)[1].upper() in MCP_Lib.GetArchiveFileTypeList():
235     if os.path.splitext(vendorPath)[1].upper() == ".ZIP":
236     pass
237     else:
238     warningDlg = wx.MessageDialog(self,"MCP: You are attempting to copy an archive file that is not ZIP. The COMPRESSED SIZE will be gathered only. Please change this value when you uncompress, in View Edit.","WARNING!",wx.OK | wx.ICON_INFORMATION)
239     warningDlg.ShowModal()
240     warningDlg.Destroy()
241 nino.borges 232 self.vendorBowserControl.SetValue(vendorPath)
242     else:
243     diag = wx.MessageDialog(self,"MCP: No vendor folder is currently linked to this case.","Does not exist",wx.OK | wx.ICON_INFORMATION)
244     diag.ShowModal()
245     diag.Destroy()
246     else:
247     diag = wx.MessageDialog(self,"MCP: Copying from LN to DIS is not yet supported.","ERROR",wx.OK | wx.ICON_INFORMATION)
248     diag.ShowModal()
249     diag.Destroy()
250 ninoborges 8
251     def CreateBoxesSection(self):
252     self.oKButton = wx.Button(self.panel, wx.ID_OK)
253     self.oKButton.SetDefault()
254     self.oKButton.SetSize(self.oKButton.GetBestSize())
255     self.cancelButton = wx.Button(self.panel, wx.ID_CANCEL)
256     self.cancelButton.SetSize(self.cancelButton.GetBestSize())
257     self.buttonSizer = wx.BoxSizer(wx.HORIZONTAL)
258     self.buttonSizer.Add(self.oKButton,0,wx.ALL,10)
259     self.buttonSizer.Add(self.cancelButton,0,wx.ALL,10)
260    
261 nino.borges 189 def MenuData(self):
262     return(("View",
263     ("My Cases", "Chooses from your assigned cases.",self.OnChangeCaseView,"RADIO"),
264     ("My Office Cases", "Chooses from cases assigned to everyone in your office.",self.OnChangeCaseView,"RADIO"),
265     ("All Cases", "Chooses from all cases.",self.OnChangeCaseView,"RADIO")),
266 nino.borges 203 ("&Settings",
267     ("&Working Directory", "Allows you to change the local Buffer directory.", self.OnChangeWorkDir,"")),
268 nino.borges 189 ("&Help",
269     ("&About", "Displays the About Window.", self.OnAbout,"")))
270    
271     def CreateMenuBar(self):
272     menuBar = wx.MenuBar()
273     count = 1
274     for eachMenuData in self.MenuData():
275     menuLabel = eachMenuData[0]
276     menuItems = eachMenuData[1:]
277     menuBar.Append(self.CreateMenu(menuItems), menuLabel)
278     count = count + 1
279     self.SetMenuBar(menuBar)
280    
281    
282     def CreateMenu(self, menuData):
283     menu = wx.Menu()
284     for eachLabel, eachStatus, eachHandler, eachType in menuData:
285     if not eachLabel:
286     menu.AppendSeparator()
287     continue
288     if eachType == "RADIO":
289     menuItem = menu.AppendRadioItem(-1,eachLabel,eachStatus)
290     else:
291     menuItem = menu.Append(-1, eachLabel, eachStatus)
292     self.Bind(wx.EVT_MENU, eachHandler, menuItem)
293     return menu
294    
295 ninoborges 8 def CloseWindow(self, event):
296     self.Close(True)
297 nino.borges 189
298     def OnChangeCaseView(self,event):
299     self.casesListChoice.Clear()
300     eventID = event.GetId()
301     if eventID == 100:
302     #change it to my cases
303     self.casesListChoice.SetItems(self.myCases)
304    
305    
306     if eventID == 101:
307     #change it to office cases
308     self.casesListChoice.SetItems(self.officeCases)
309    
310    
311     if eventID == 102:
312     #change it to all cases
313     self.casesListChoice.SetItems(self.allCases)
314    
315    
316 nino.borges 203 def OnChangeWorkDir(self,event):
317 nino.borges 258 dlg = WorkDirDialog.WorkDirDialog(self, self.workDir)
318     if dlg.ShowModal() == wx.ID_OK:
319     self.workDir = dlg.GetValues()
320     #print self.workDir
321     dlg.Destroy()
322    
323 ninoborges 8
324     def OnProcess(self, event):
325     caseName = self.casesListChoice.GetStringSelection()
326     platform = self.platformListChoice.GetStringSelection()
327 nino.borges 235 ## CHANGE to the new place
328     #workDir = self.workDirControl.GetValue()
329 nino.borges 258 #workDir = os.path.join(os.environ.get("USERPROFILE"),"Desktop\\Working")
330 nino.borges 235
331 ninoborges 8 if self.radio1.GetValue():
332     startSelection = self.fileBowserControl.GetValue()
333 nino.borges 236 sourceMediaLocation = 'local'
334     elif self.radio2.GetValue():
335     startSelection = self.dirBowserControl.GetValue()
336     sourceMediaLocation = 'local'
337 ninoborges 8 else:
338 nino.borges 236 startSelection = self.vendorBowserControl.GetValue()
339     sourceMediaLocation = 'remote'
340 ninoborges 8 #startSelection = r"C:\Documents and Settings\eborges\Desktop\Working\Misc_Documents.zip"
341     self.Show(False)
342     #print "workdir is %s"%workDir
343 nino.borges 258 MCP_CopyUp_Request.Process(caseName, self.workDir, startSelection, platform, sourceMediaLocation)
344 ninoborges 8
345     #diag = wx.MessageDialog(self,"All Items processed and copied!!", "Complete",wx.OK | wx.ICON_INFORMATION)
346     #diag.ShowModal()
347     #diag.Destroy()
348     self.Destroy()
349    
350 nino.borges 189 def OnAbout(self, event):
351     """
352     OnAbout(self,event) Displays an about dialog with developer and bug reporting info
353     """
354     dlg = wx.MessageDialog(self, "MCP is a case organization program.\n"
355     "\n\n"
356     "For questions or comments about this program\n"
357     "or to report a bug, please email the program\n"
358     "creator at Nino.Borges@gmail.com\n\n"
359     "MCP is\n"
360     "Copyright (c) 2011 Emanuel Borges.\n"
361     "All rights reserved.\n"
362     "(Nino.Borges@gmail.com)\n",
363     "About MCP", wx.OK | wx.ICON_INFORMATION)
364     dlg.ShowModal()
365     dlg.Destroy()
366 ninoborges 8
367    
368 nino.borges 203 class VendorBrowserDialog(wx.Dialog):
369     def __init__(self, parent, vendorFolder, treeMatrix):
370     wx.Dialog.__init__(self, parent, -1, "Vendor Folder Browser", style = wx.DEFAULT_DIALOG_STYLE, size = (300,400))
371     #wx.Dialog.__init__(self, parent,title= "Vendor Folder Browser", size = (300,400))
372     self.vendorFolder = vendorFolder
373    
374     il = wx.ImageList(16,16)
375     self.fldridx = il.Add(wx.ArtProvider.GetBitmap(wx.ART_FOLDER,wx.ART_OTHER, (16,16)))
376     self.fldropenidx = il.Add(wx.ArtProvider.GetBitmap(wx.ART_FILE_OPEN,wx.ART_OTHER, (16,16)))
377     self.fileidx = il.Add(wx.ArtProvider.GetBitmap(wx.ART_NORMAL_FILE,wx.ART_OTHER, (16,16)))
378    
379     self.vendorTree = wx.TreeCtrl(self, size=(200,310))
380     self.vendorTree.AssignImageList(il)
381    
382     rootVendorFolderId = self.vendorTree.AddRoot(vendorFolder)
383    
384     self.AddTreeNodes(rootVendorFolderId, treeMatrix)
385     #childVendorFolderId2 = self.vendorTree.AppendItem(rootVendorFolderId,"test2")
386     #childVendorFolderId = self.vendorTree.AppendItem(childVendorFolderId2,"test")
387     self.vendorTree.Expand(rootVendorFolderId)
388    
389    
390     self.vendorTree.SetItemImage(rootVendorFolderId, self.fldridx, wx.TreeItemIcon_Normal)
391     self.vendorTree.SetItemImage(rootVendorFolderId, self.fldropenidx, wx.TreeItemIcon_Expanded)
392     ## this will need a if its a file do this else do the previous
393     #self.vendorTree.SetItemImage(childVendorFolderId, self.fileidx, wx.TreeItemIcon_Normal)
394    
395     mainSizer = wx.BoxSizer(wx.VERTICAL)
396     mainSizer.Add(self.vendorTree, 0, wx.EXPAND|wx.ALL, 5)
397    
398     oKButton = wx.Button(self, wx.ID_OK)
399     oKButton.SetDefault()
400     cancelButton = wx.Button(self, wx.ID_CANCEL)
401     buttonSizer = wx.BoxSizer(wx.HORIZONTAL)
402     buttonSizer.Add(oKButton,0,wx.ALL,5)
403     buttonSizer.Add(cancelButton,0,wx.ALL,5)
404     mainSizer.Add(buttonSizer, 0, wx.ALIGN_CENTER|wx.ALL, 15)
405     self.SetSizer(mainSizer)
406     self.Bind(wx.EVT_TREE_SEL_CHANGED, self.OnSelChanged, self.vendorTree)
407 ninoborges 8
408 nino.borges 203 def AddTreeNodes(self, parentItem, items):
409     """
410     Recursively traverses the data structure, adding tree nodes to
411     match it.
412     """
413     for item in items:
414     if type(item) == str:
415     newItem = self.vendorTree.AppendItem(parentItem, item)
416     #self.tree.SetItemText(newItem, "A description of %s" % item, 1)
417     self.vendorTree.SetItemImage(newItem, self.fileidx,
418     wx.TreeItemIcon_Normal)
419     else:
420     newItem = self.vendorTree.AppendItem(parentItem, item[0])
421     #self.tree.SetItemText(newItem, "A description of %s" % item[0], 1)
422     self.vendorTree.SetItemImage(newItem, self.fldridx,
423     wx.TreeItemIcon_Normal)
424     self.vendorTree.SetItemImage(newItem, self.fldropenidx,
425     wx.TreeItemIcon_Expanded)
426    
427     self.AddTreeNodes(newItem, item[1])
428    
429     def OnSelChanged(self, event):
430     self.item = event.GetItem()
431     if self.item:
432     self.vendorFileSelected = self.vendorTree.GetItemText(self.item)
433     event.Skip()
434    
435     def GetValues(self):
436     vendorPath = self.vendorFileSelected
437     upItem = self.vendorTree.GetItemParent(self.item)
438     while upItem:
439     vendorPath = os.path.join(self.vendorTree.GetItemText(upItem),vendorPath)
440     upItem = self.vendorTree.GetItemParent(upItem)
441     return vendorPath
442    
443    
444 ninoborges 8 class MyApp(wx.App):
445     def OnInit(self):
446     prgVersion = MCP_Lib.GetMCPVersion()
447     self.frame = MyFrame(None, -1, "MCP Copy Up Request %s"%prgVersion)
448     self.frame.Show(True)
449     self.SetTopWindow(self.frame)
450     return True
451    
452    
453     if __name__ == '__main__':
454     app = MyApp(0)
455     app.MainLoop()