| 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 |
nino.borges |
458 |
from math import pi
|
| 15 |
|
|
import wx.lib.agw.speedmeter as SM
|
| 16 |
ninoborges |
8 |
import wx.lib.filebrowsebutton as filebrowse
|
| 17 |
|
|
|
| 18 |
|
|
class MyFrame(wx.Frame):
|
| 19 |
|
|
def __init__(self, parent, ID, title, pos=wx.DefaultPosition):
|
| 20 |
nino.borges |
258 |
self.workDir = os.path.join(os.environ.get("USERPROFILE"),"Desktop\\Working")
|
| 21 |
nino.borges |
203 |
wx.Frame.__init__(self, parent, ID, title, pos, size =(585,450))
|
| 22 |
ninoborges |
8 |
self.panel = wx.Panel(self,-1)
|
| 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 |
232 |
print "connecting to matter tracking access db..."
|
| 27 |
|
|
self.accessDB = MCP_Lib.AccessDBConnection(r"\\chiads01\app\DS_CaseTrack\TPM_CaseTracking.mdb")
|
| 28 |
|
|
print "connected to DB."
|
| 29 |
nino.borges |
462 |
self.myCases, self.myActiveCases, self.officeCases, self.allCases, casesDir, self.casePathStyleMatrix = MCP_Lib.GetCaseList('',self.accessDB)
|
| 30 |
nino.borges |
189 |
self.casesListChoice = wx.Choice(self.panel, -1, wx.DefaultPosition, choices=self.myCases)
|
| 31 |
ninoborges |
8 |
platformStaticText = wx.StaticText(self.panel, -1, "Select Platform:",wx.DefaultPosition)
|
| 32 |
|
|
platformChoices = ["Concordance DIS","Concordance LN","Relativity"]
|
| 33 |
|
|
self.platformListChoice = wx.Choice(self.panel, -1, wx.DefaultPosition, choices=platformChoices)
|
| 34 |
nino.borges |
258 |
|
| 35 |
nino.borges |
453 |
upLoadCatagoryStaticText = wx.StaticText(self.panel, -1, "Upload Type:",wx.DefaultPosition)
|
| 36 |
nino.borges |
458 |
upLoadCatagoriesList = ['Processed Review Data','Hard Copy Review Data','Loose Unprocessed Review Data','Subset Tiffs','Other Party Production Data','Generic (Old Cases Only)',]
|
| 37 |
nino.borges |
453 |
self.upLoadCatagory = wx.Choice(self.panel, -1, wx.DefaultPosition, choices=upLoadCatagoriesList)
|
| 38 |
|
|
self.upLoadCatagory.SetSelection(0)
|
| 39 |
|
|
self.upLoadCatagory.Enable(False)
|
| 40 |
|
|
|
| 41 |
nino.borges |
203 |
#workDirStaticText = wx.StaticText(self.panel, -1, "Select Work Dir:",wx.DefaultPosition)
|
| 42 |
|
|
#self.workDirControl = wx.TextCtrl(self.panel,-1,os.path.join(os.environ.get("USERPROFILE"),"Desktop\\Working"), size=(296,-1))
|
| 43 |
|
|
#workDirBrowseButton = wx.Button(self.panel, -1, "Browse", (10, 10))
|
| 44 |
ninoborges |
8 |
|
| 45 |
|
|
|
| 46 |
|
|
self.radio1 = wx.RadioButton(self.panel, -1, 'Individual File',style=wx.RB_GROUP)
|
| 47 |
|
|
self.fileBowserControl = wx.TextCtrl(self.panel, -1,size=(296,-1))
|
| 48 |
|
|
self.fileBowserButton = wx.Button(self.panel, -1, "Browse", (10, 10))
|
| 49 |
|
|
|
| 50 |
|
|
self.requestAssistanceCheckBox = wx.CheckBox(self.panel,-1,": Request Data Analyst Assistance")
|
| 51 |
|
|
self.requestAssistanceCheckBox.Enable(False) ## Change me when you go live with this service.
|
| 52 |
|
|
|
| 53 |
|
|
self.radio2 = wx.RadioButton(self.panel, -1, 'Entire folder of Files')
|
| 54 |
|
|
self.dirBowserControl = wx.TextCtrl(self.panel, -1, size=(296,-1))
|
| 55 |
|
|
self.dirBowserButton = wx.Button(self.panel, -1, "Browse", (10, 10))
|
| 56 |
|
|
self.dirBowserControl.Enable(False)
|
| 57 |
|
|
self.dirBowserButton.Enable(False)
|
| 58 |
|
|
|
| 59 |
nino.borges |
203 |
self.radio3 = wx.RadioButton(self.panel, -1, 'From Vendor Folder')
|
| 60 |
|
|
self.vendorBowserControl = wx.TextCtrl(self.panel, -1, size=(296,-1))
|
| 61 |
|
|
self.vendorBowserButton = wx.Button(self.panel, -1, "Browse", (10, 10))
|
| 62 |
|
|
self.vendorBowserControl.Enable(False)
|
| 63 |
|
|
self.vendorBowserButton.Enable(False)
|
| 64 |
ninoborges |
8 |
|
| 65 |
nino.borges |
203 |
|
| 66 |
ninoborges |
8 |
self.CreateBoxesSection()
|
| 67 |
|
|
copyUpTypeStaticBox = wx.StaticBox(self.panel, -1, 'Copy Up:')
|
| 68 |
|
|
copyUpTypeStaticBoxSizer = wx.StaticBoxSizer(copyUpTypeStaticBox, wx.VERTICAL)
|
| 69 |
|
|
|
| 70 |
|
|
radio1Sizer = wx.FlexGridSizer(1,3,10,10)
|
| 71 |
|
|
radio1Sizer.Add(self.radio1, 0, 0)
|
| 72 |
|
|
radio1Sizer.Add(self.fileBowserControl, 0)
|
| 73 |
|
|
radio1Sizer.Add(self.fileBowserButton, 0)
|
| 74 |
|
|
copyUpTypeStaticBoxSizer.Add(radio1Sizer, 0, wx.ALL|wx.ALIGN_LEFT,20)
|
| 75 |
nino.borges |
203 |
|
| 76 |
ninoborges |
8 |
radio2Sizer = wx.FlexGridSizer(1,3,10,10)
|
| 77 |
|
|
radio2Sizer.Add(self.radio2, 0)
|
| 78 |
|
|
radio2Sizer.Add(self.dirBowserControl, 0)
|
| 79 |
|
|
radio2Sizer.Add(self.dirBowserButton, 0)
|
| 80 |
nino.borges |
203 |
|
| 81 |
ninoborges |
8 |
copyUpTypeStaticBoxSizer.Add(radio2Sizer, 0, wx.ALL|wx.ALIGN_LEFT,20)
|
| 82 |
nino.borges |
203 |
radio3Sizer = wx.FlexGridSizer(1,3,10,10)
|
| 83 |
|
|
radio3Sizer.Add(self.radio3, 0)
|
| 84 |
|
|
radio3Sizer.Add(self.vendorBowserControl, 0)
|
| 85 |
|
|
radio3Sizer.Add(self.vendorBowserButton, 0)
|
| 86 |
|
|
copyUpTypeStaticBoxSizer.Add(radio3Sizer, 0, wx.ALL|wx.ALIGN_LEFT,20)
|
| 87 |
ninoborges |
8 |
|
| 88 |
nino.borges |
453 |
#casesSizer = wx.FlexGridSizer(2,2,15,5)
|
| 89 |
|
|
#casesSizer.Add(casesListStaticText)
|
| 90 |
|
|
#casesSizer.Add(self.casesListChoice)
|
| 91 |
|
|
#casesSizer.Add(platformStaticText)
|
| 92 |
|
|
#casesSizer.Add(self.platformListChoice)
|
| 93 |
|
|
|
| 94 |
|
|
casesSizer = wx.GridBagSizer(8,12)
|
| 95 |
|
|
casesSizer.Add(casesListStaticText,pos=(0,0))
|
| 96 |
|
|
casesSizer.Add(self.casesListChoice,pos=(0,1), span = (1,3))
|
| 97 |
|
|
casesSizer.Add(platformStaticText,pos=(1,0))
|
| 98 |
|
|
casesSizer.Add(self.platformListChoice,pos=(1,1))
|
| 99 |
|
|
casesSizer.Add(upLoadCatagoryStaticText,pos=(1,2))
|
| 100 |
|
|
casesSizer.Add(self.upLoadCatagory,pos=(1,3))
|
| 101 |
|
|
|
| 102 |
ninoborges |
8 |
#casesSizer = wx.BoxSizer(wx.HORIZONTAL)
|
| 103 |
|
|
#casesSizer.Add(casesListStaticText,0,wx.ALL,5)
|
| 104 |
|
|
#casesSizer.Add(self.casesListChoice,0,wx.ALL,5)
|
| 105 |
|
|
#casesSizer.Add(platformStaticText,0,wx.ALL,5)
|
| 106 |
|
|
#casesSizer.Add(self.platformListChoice,0,wx.ALL,5)
|
| 107 |
nino.borges |
203 |
#workDirSizer = wx.BoxSizer(wx.HORIZONTAL)
|
| 108 |
|
|
#workDirSizer.Add(workDirStaticText,0,wx.ALL,5)
|
| 109 |
|
|
#workDirSizer.Add(self.workDirControl,0,wx.ALL,5)
|
| 110 |
|
|
#workDirSizer.Add(workDirBrowseButton,0,wx.ALL,5)
|
| 111 |
ninoborges |
8 |
mainSizer = wx.BoxSizer(wx.VERTICAL)
|
| 112 |
|
|
mainSizer.Add(casesSizer,0,wx.ALL, 20)
|
| 113 |
nino.borges |
203 |
#mainSizer.Add(workDirSizer,0,wx.ALL, 10)
|
| 114 |
ninoborges |
8 |
mainSizer.Add(copyUpTypeStaticBoxSizer, 0, wx.ALL, 10)
|
| 115 |
|
|
mainSizer.Add(self.requestAssistanceCheckBox,0,wx.ALL|wx.ALIGN_CENTER,5)
|
| 116 |
nino.borges |
203 |
|
| 117 |
|
|
|
| 118 |
ninoborges |
8 |
mainSizer.Add(self.buttonSizer,0, wx.ALL|wx.ALIGN_BOTTOM|wx.ALIGN_CENTER, 10)
|
| 119 |
|
|
|
| 120 |
|
|
self.panel.SetSizer(mainSizer)
|
| 121 |
nino.borges |
189 |
self.CreateMenuBar()
|
| 122 |
nino.borges |
453 |
self.Bind(wx.EVT_CHOICE, self.OnPlatformSelect, self.platformListChoice)
|
| 123 |
ninoborges |
8 |
self.Bind(wx.EVT_RADIOBUTTON, self.OnRadio, self.radio1)
|
| 124 |
|
|
self.Bind(wx.EVT_RADIOBUTTON, self.OnRadio, self.radio2)
|
| 125 |
nino.borges |
203 |
self.Bind(wx.EVT_RADIOBUTTON, self.OnRadio, self.radio3)
|
| 126 |
|
|
#self.Bind(wx.EVT_BUTTON, self.OnBrowseClick, workDirBrowseButton)
|
| 127 |
ninoborges |
8 |
self.Bind(wx.EVT_BUTTON, self.OnBrowseClick, self.fileBowserButton)
|
| 128 |
|
|
self.Bind(wx.EVT_BUTTON, self.OnBrowseClick, self.dirBowserButton)
|
| 129 |
nino.borges |
203 |
self.Bind(wx.EVT_BUTTON, self.OnBrowseClick, self.vendorBowserButton)
|
| 130 |
ninoborges |
8 |
self.Bind(wx.EVT_BUTTON, self.OnProcess, self.oKButton)
|
| 131 |
|
|
self.Bind(wx.EVT_BUTTON, self.CloseWindow, self.cancelButton)
|
| 132 |
|
|
|
| 133 |
|
|
def OnRadio(self,event):
|
| 134 |
|
|
radioObj = event.GetEventObject()
|
| 135 |
|
|
selection = radioObj.GetLabel()
|
| 136 |
|
|
if selection == "Individual File":
|
| 137 |
|
|
self.fileBowserControl.Enable(True)
|
| 138 |
|
|
self.fileBowserButton.Enable(True)
|
| 139 |
|
|
|
| 140 |
|
|
self.dirBowserControl.Enable(False)
|
| 141 |
|
|
self.dirBowserButton.Enable(False)
|
| 142 |
nino.borges |
203 |
self.vendorBowserControl.Enable(False)
|
| 143 |
|
|
self.vendorBowserButton.Enable(False)
|
| 144 |
|
|
|
| 145 |
ninoborges |
8 |
self.dirBowserControl.SetValue("")
|
| 146 |
nino.borges |
203 |
self.vendorBowserControl.SetValue("")
|
| 147 |
|
|
|
| 148 |
|
|
elif selection == "Entire folder of Files":
|
| 149 |
|
|
self.dirBowserControl.Enable(True)
|
| 150 |
|
|
self.dirBowserButton.Enable(True)
|
| 151 |
|
|
|
| 152 |
|
|
self.fileBowserControl.Enable(False)
|
| 153 |
|
|
self.fileBowserButton.Enable(False)
|
| 154 |
|
|
self.vendorBowserControl.Enable(False)
|
| 155 |
|
|
self.vendorBowserButton.Enable(False)
|
| 156 |
|
|
|
| 157 |
|
|
self.fileBowserControl.SetValue("")
|
| 158 |
|
|
self.vendorBowserControl.SetValue("")
|
| 159 |
|
|
|
| 160 |
ninoborges |
8 |
else:
|
| 161 |
nino.borges |
203 |
self.vendorBowserControl.Enable(True)
|
| 162 |
|
|
self.vendorBowserButton.Enable(True)
|
| 163 |
|
|
|
| 164 |
ninoborges |
8 |
self.fileBowserControl.Enable(False)
|
| 165 |
|
|
self.fileBowserButton.Enable(False)
|
| 166 |
nino.borges |
203 |
self.dirBowserControl.Enable(False)
|
| 167 |
|
|
self.dirBowserButton.Enable(False)
|
| 168 |
|
|
|
| 169 |
ninoborges |
8 |
self.fileBowserControl.SetValue("")
|
| 170 |
nino.borges |
203 |
self.dirBowserControl.SetValue("")
|
| 171 |
ninoborges |
8 |
|
| 172 |
|
|
#if self.selectedText:
|
| 173 |
|
|
# self.selectedText.Enable(False)
|
| 174 |
|
|
#radioSelected = event.GetEventObject()
|
| 175 |
|
|
#text = self.texts[radioSelected.GetLabel()]
|
| 176 |
|
|
#text.Enable(True)
|
| 177 |
|
|
#self.selectedText = text
|
| 178 |
|
|
|
| 179 |
nino.borges |
453 |
def OnPlatformSelect(self,event):
|
| 180 |
|
|
platform = self.platformListChoice.GetStringSelection()
|
| 181 |
|
|
if platform == 'Concordance DIS':
|
| 182 |
|
|
self.upLoadCatagory.Enable(False)
|
| 183 |
|
|
else:
|
| 184 |
|
|
self.upLoadCatagory.Enable(True)
|
| 185 |
|
|
|
| 186 |
|
|
|
| 187 |
ninoborges |
8 |
def OnBrowseClick(self,event):
|
| 188 |
|
|
eventCode = event.GetId()
|
| 189 |
|
|
#print eventCode
|
| 190 |
nino.borges |
203 |
#if eventCode == -209:
|
| 191 |
|
|
# dlg = wx.DirDialog(self, message = "Working Directory Path: ", defaultPath = os.path.join(os.environ.get("USERPROFILE"),"Desktop\\Working"))
|
| 192 |
|
|
# if dlg.ShowModal() == wx.ID_OK:
|
| 193 |
|
|
# dirPath = dlg.GetPath()
|
| 194 |
|
|
# dlg.Destroy()
|
| 195 |
|
|
# self.workDirControl.SetValue(dirPath)
|
| 196 |
nino.borges |
453 |
if eventCode == -211:
|
| 197 |
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)
|
| 198 |
|
|
#dlg = wx.FileDialog(self, message = "Select directory to copy up: ", defaultPath = os.path.join(os.environ.get("USERPROFILE"),"Desktop\\Working"))
|
| 199 |
|
|
if dlg.ShowModal() == wx.ID_OK:
|
| 200 |
|
|
filePath = dlg.GetPath()
|
| 201 |
|
|
dlg.Destroy()
|
| 202 |
nino.borges |
235 |
## Test here to see if it's a zip. if not, give them warning about uncompressed size.
|
| 203 |
nino.borges |
266 |
if os.path.splitext(filePath)[1].upper() in MCP_Lib.GetArchiveFileTypeList():
|
| 204 |
|
|
if os.path.splitext(filePath)[1].upper() == ".ZIP":
|
| 205 |
|
|
pass
|
| 206 |
|
|
else:
|
| 207 |
|
|
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)
|
| 208 |
|
|
warningDlg.ShowModal()
|
| 209 |
|
|
warningDlg.Destroy()
|
| 210 |
ninoborges |
8 |
self.fileBowserControl.SetValue(filePath)
|
| 211 |
nino.borges |
453 |
elif eventCode == -215:
|
| 212 |
ninoborges |
8 |
dlg = wx.DirDialog(self, message = "Select directory to copy up:", defaultPath = os.path.join(os.environ.get("USERPROFILE"),"Desktop\\Working"))
|
| 213 |
|
|
if dlg.ShowModal() == wx.ID_OK:
|
| 214 |
|
|
dirPath = dlg.GetPath()
|
| 215 |
|
|
dlg.Destroy()
|
| 216 |
|
|
self.dirBowserControl.SetValue(dirPath)
|
| 217 |
nino.borges |
453 |
elif eventCode == -218:
|
| 218 |
nino.borges |
232 |
platform = self.platformListChoice.GetStringSelection()
|
| 219 |
|
|
if platform == 'Concordance LN':
|
| 220 |
|
|
platform = 'Concordance'
|
| 221 |
|
|
elif platform == 'Concordance DIS':
|
| 222 |
|
|
platform = None
|
| 223 |
|
|
if platform:
|
| 224 |
nino.borges |
458 |
#expdtObj = MCP_Lib.ExpeDatConnection(platform)
|
| 225 |
nino.borges |
232 |
caseName = self.casesListChoice.GetStringSelection()
|
| 226 |
|
|
clientMatter = caseName.split("_(")[1]
|
| 227 |
|
|
clientMatter = clientMatter[:-1]
|
| 228 |
|
|
clientMatter = clientMatter.replace('-','.')
|
| 229 |
|
|
vendorFolder = self.accessDB.GetVendorFolderPath(clientMatter)
|
| 230 |
|
|
if vendorFolder:
|
| 231 |
nino.borges |
458 |
#waitDlg = WaitingOnDialog(self,"IDS Connection")
|
| 232 |
|
|
#waitDlg.ShowModal()
|
| 233 |
|
|
#waitDlg.Show(True)
|
| 234 |
|
|
#folderMatrix = expdtObj.GatherFullDirListMatrix('Uploads/%s'%vendorFolder)
|
| 235 |
|
|
#waitDlg.Destroy()
|
| 236 |
|
|
dlg = VendorBrowserDialog(self,vendorFolder,'Uploads/%s'%vendorFolder,platform)
|
| 237 |
nino.borges |
232 |
if dlg.ShowModal() == wx.ID_OK:
|
| 238 |
|
|
vendorPath = dlg.GetValues()
|
| 239 |
|
|
dlg.Destroy()
|
| 240 |
nino.borges |
266 |
if os.path.splitext(vendorPath)[1].upper() in MCP_Lib.GetArchiveFileTypeList():
|
| 241 |
|
|
if os.path.splitext(vendorPath)[1].upper() == ".ZIP":
|
| 242 |
|
|
pass
|
| 243 |
|
|
else:
|
| 244 |
|
|
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)
|
| 245 |
|
|
warningDlg.ShowModal()
|
| 246 |
|
|
warningDlg.Destroy()
|
| 247 |
nino.borges |
232 |
self.vendorBowserControl.SetValue(vendorPath)
|
| 248 |
|
|
else:
|
| 249 |
|
|
diag = wx.MessageDialog(self,"MCP: No vendor folder is currently linked to this case.","Does not exist",wx.OK | wx.ICON_INFORMATION)
|
| 250 |
|
|
diag.ShowModal()
|
| 251 |
|
|
diag.Destroy()
|
| 252 |
|
|
else:
|
| 253 |
|
|
diag = wx.MessageDialog(self,"MCP: Copying from LN to DIS is not yet supported.","ERROR",wx.OK | wx.ICON_INFORMATION)
|
| 254 |
|
|
diag.ShowModal()
|
| 255 |
|
|
diag.Destroy()
|
| 256 |
ninoborges |
8 |
|
| 257 |
|
|
def CreateBoxesSection(self):
|
| 258 |
|
|
self.oKButton = wx.Button(self.panel, wx.ID_OK)
|
| 259 |
|
|
self.oKButton.SetDefault()
|
| 260 |
|
|
self.oKButton.SetSize(self.oKButton.GetBestSize())
|
| 261 |
|
|
self.cancelButton = wx.Button(self.panel, wx.ID_CANCEL)
|
| 262 |
|
|
self.cancelButton.SetSize(self.cancelButton.GetBestSize())
|
| 263 |
|
|
self.buttonSizer = wx.BoxSizer(wx.HORIZONTAL)
|
| 264 |
|
|
self.buttonSizer.Add(self.oKButton,0,wx.ALL,10)
|
| 265 |
|
|
self.buttonSizer.Add(self.cancelButton,0,wx.ALL,10)
|
| 266 |
|
|
|
| 267 |
nino.borges |
189 |
def MenuData(self):
|
| 268 |
|
|
return(("View",
|
| 269 |
|
|
("My Cases", "Chooses from your assigned cases.",self.OnChangeCaseView,"RADIO"),
|
| 270 |
nino.borges |
454 |
("My Active Cases", "Chooses from your assigned cases, filtered by Active Cases.",self.OnChangeCaseView,"RADIO"),
|
| 271 |
nino.borges |
189 |
("My Office Cases", "Chooses from cases assigned to everyone in your office.",self.OnChangeCaseView,"RADIO"),
|
| 272 |
|
|
("All Cases", "Chooses from all cases.",self.OnChangeCaseView,"RADIO")),
|
| 273 |
nino.borges |
203 |
("&Settings",
|
| 274 |
|
|
("&Working Directory", "Allows you to change the local Buffer directory.", self.OnChangeWorkDir,"")),
|
| 275 |
nino.borges |
189 |
("&Help",
|
| 276 |
|
|
("&About", "Displays the About Window.", self.OnAbout,"")))
|
| 277 |
|
|
|
| 278 |
|
|
def CreateMenuBar(self):
|
| 279 |
|
|
menuBar = wx.MenuBar()
|
| 280 |
|
|
count = 1
|
| 281 |
|
|
for eachMenuData in self.MenuData():
|
| 282 |
|
|
menuLabel = eachMenuData[0]
|
| 283 |
|
|
menuItems = eachMenuData[1:]
|
| 284 |
|
|
menuBar.Append(self.CreateMenu(menuItems), menuLabel)
|
| 285 |
|
|
count = count + 1
|
| 286 |
|
|
self.SetMenuBar(menuBar)
|
| 287 |
|
|
|
| 288 |
|
|
|
| 289 |
|
|
def CreateMenu(self, menuData):
|
| 290 |
|
|
menu = wx.Menu()
|
| 291 |
|
|
for eachLabel, eachStatus, eachHandler, eachType in menuData:
|
| 292 |
|
|
if not eachLabel:
|
| 293 |
|
|
menu.AppendSeparator()
|
| 294 |
|
|
continue
|
| 295 |
|
|
if eachType == "RADIO":
|
| 296 |
|
|
menuItem = menu.AppendRadioItem(-1,eachLabel,eachStatus)
|
| 297 |
|
|
else:
|
| 298 |
|
|
menuItem = menu.Append(-1, eachLabel, eachStatus)
|
| 299 |
|
|
self.Bind(wx.EVT_MENU, eachHandler, menuItem)
|
| 300 |
|
|
return menu
|
| 301 |
|
|
|
| 302 |
ninoborges |
8 |
def CloseWindow(self, event):
|
| 303 |
|
|
self.Close(True)
|
| 304 |
nino.borges |
189 |
|
| 305 |
|
|
def OnChangeCaseView(self,event):
|
| 306 |
|
|
self.casesListChoice.Clear()
|
| 307 |
|
|
eventID = event.GetId()
|
| 308 |
nino.borges |
454 |
#print eventID
|
| 309 |
nino.borges |
189 |
if eventID == 100:
|
| 310 |
|
|
#change it to my cases
|
| 311 |
|
|
self.casesListChoice.SetItems(self.myCases)
|
| 312 |
|
|
|
| 313 |
nino.borges |
454 |
if eventID == 101:
|
| 314 |
|
|
#change it to my active cases
|
| 315 |
|
|
self.casesListChoice.SetItems(self.myActiveCases)
|
| 316 |
nino.borges |
189 |
|
| 317 |
nino.borges |
454 |
if eventID == 102:
|
| 318 |
nino.borges |
189 |
#change it to office cases
|
| 319 |
|
|
self.casesListChoice.SetItems(self.officeCases)
|
| 320 |
|
|
|
| 321 |
|
|
|
| 322 |
nino.borges |
454 |
if eventID == 103:
|
| 323 |
nino.borges |
189 |
#change it to all cases
|
| 324 |
|
|
self.casesListChoice.SetItems(self.allCases)
|
| 325 |
|
|
|
| 326 |
|
|
|
| 327 |
nino.borges |
203 |
def OnChangeWorkDir(self,event):
|
| 328 |
nino.borges |
258 |
dlg = WorkDirDialog.WorkDirDialog(self, self.workDir)
|
| 329 |
|
|
if dlg.ShowModal() == wx.ID_OK:
|
| 330 |
|
|
self.workDir = dlg.GetValues()
|
| 331 |
|
|
#print self.workDir
|
| 332 |
|
|
dlg.Destroy()
|
| 333 |
|
|
|
| 334 |
ninoborges |
8 |
|
| 335 |
|
|
def OnProcess(self, event):
|
| 336 |
|
|
caseName = self.casesListChoice.GetStringSelection()
|
| 337 |
|
|
platform = self.platformListChoice.GetStringSelection()
|
| 338 |
nino.borges |
457 |
uploadType = self.upLoadCatagory.GetStringSelection()
|
| 339 |
nino.borges |
235 |
## CHANGE to the new place
|
| 340 |
|
|
#workDir = self.workDirControl.GetValue()
|
| 341 |
nino.borges |
258 |
#workDir = os.path.join(os.environ.get("USERPROFILE"),"Desktop\\Working")
|
| 342 |
nino.borges |
235 |
|
| 343 |
ninoborges |
8 |
if self.radio1.GetValue():
|
| 344 |
|
|
startSelection = self.fileBowserControl.GetValue()
|
| 345 |
nino.borges |
236 |
sourceMediaLocation = 'local'
|
| 346 |
|
|
elif self.radio2.GetValue():
|
| 347 |
|
|
startSelection = self.dirBowserControl.GetValue()
|
| 348 |
|
|
sourceMediaLocation = 'local'
|
| 349 |
ninoborges |
8 |
else:
|
| 350 |
nino.borges |
236 |
startSelection = self.vendorBowserControl.GetValue()
|
| 351 |
|
|
sourceMediaLocation = 'remote'
|
| 352 |
ninoborges |
8 |
#startSelection = r"C:\Documents and Settings\eborges\Desktop\Working\Misc_Documents.zip"
|
| 353 |
|
|
self.Show(False)
|
| 354 |
|
|
#print "workdir is %s"%workDir
|
| 355 |
nino.borges |
457 |
MCP_CopyUp_Request.Process(caseName, self.workDir, startSelection, platform, sourceMediaLocation, uploadType)
|
| 356 |
ninoborges |
8 |
|
| 357 |
|
|
#diag = wx.MessageDialog(self,"All Items processed and copied!!", "Complete",wx.OK | wx.ICON_INFORMATION)
|
| 358 |
|
|
#diag.ShowModal()
|
| 359 |
|
|
#diag.Destroy()
|
| 360 |
|
|
self.Destroy()
|
| 361 |
|
|
|
| 362 |
nino.borges |
189 |
def OnAbout(self, event):
|
| 363 |
|
|
"""
|
| 364 |
|
|
OnAbout(self,event) Displays an about dialog with developer and bug reporting info
|
| 365 |
|
|
"""
|
| 366 |
|
|
dlg = wx.MessageDialog(self, "MCP is a case organization program.\n"
|
| 367 |
|
|
"\n\n"
|
| 368 |
|
|
"For questions or comments about this program\n"
|
| 369 |
|
|
"or to report a bug, please email the program\n"
|
| 370 |
|
|
"creator at Nino.Borges@gmail.com\n\n"
|
| 371 |
|
|
"MCP is\n"
|
| 372 |
|
|
"Copyright (c) 2011 Emanuel Borges.\n"
|
| 373 |
|
|
"All rights reserved.\n"
|
| 374 |
|
|
"(Nino.Borges@gmail.com)\n",
|
| 375 |
|
|
"About MCP", wx.OK | wx.ICON_INFORMATION)
|
| 376 |
|
|
dlg.ShowModal()
|
| 377 |
|
|
dlg.Destroy()
|
| 378 |
ninoborges |
8 |
|
| 379 |
|
|
|
| 380 |
nino.borges |
203 |
class VendorBrowserDialog(wx.Dialog):
|
| 381 |
nino.borges |
458 |
def __init__(self, parent, vendorFolder, rootPath,platform):
|
| 382 |
nino.borges |
203 |
wx.Dialog.__init__(self, parent, -1, "Vendor Folder Browser", style = wx.DEFAULT_DIALOG_STYLE, size = (300,400))
|
| 383 |
|
|
#wx.Dialog.__init__(self, parent,title= "Vendor Folder Browser", size = (300,400))
|
| 384 |
|
|
self.vendorFolder = vendorFolder
|
| 385 |
nino.borges |
458 |
self.rootPath = rootPath
|
| 386 |
|
|
self.expedatObj = MCP_Lib.ExpeDatConnection(platform)
|
| 387 |
nino.borges |
203 |
|
| 388 |
|
|
il = wx.ImageList(16,16)
|
| 389 |
|
|
self.fldridx = il.Add(wx.ArtProvider.GetBitmap(wx.ART_FOLDER,wx.ART_OTHER, (16,16)))
|
| 390 |
|
|
self.fldropenidx = il.Add(wx.ArtProvider.GetBitmap(wx.ART_FILE_OPEN,wx.ART_OTHER, (16,16)))
|
| 391 |
|
|
self.fileidx = il.Add(wx.ArtProvider.GetBitmap(wx.ART_NORMAL_FILE,wx.ART_OTHER, (16,16)))
|
| 392 |
|
|
|
| 393 |
|
|
self.vendorTree = wx.TreeCtrl(self, size=(200,310))
|
| 394 |
|
|
self.vendorTree.AssignImageList(il)
|
| 395 |
|
|
|
| 396 |
|
|
rootVendorFolderId = self.vendorTree.AddRoot(vendorFolder)
|
| 397 |
nino.borges |
458 |
ids = {self.rootPath:rootVendorFolderId}
|
| 398 |
nino.borges |
203 |
|
| 399 |
nino.borges |
458 |
waitDlg = WaitingOnDialog(self,"IDS Connection")
|
| 400 |
|
|
waitDlg.Show(True)
|
| 401 |
|
|
#wx.Yield()
|
| 402 |
|
|
self.AddTreeNodes(ids)
|
| 403 |
|
|
waitDlg.Destroy()
|
| 404 |
|
|
|
| 405 |
nino.borges |
203 |
#childVendorFolderId2 = self.vendorTree.AppendItem(rootVendorFolderId,"test2")
|
| 406 |
|
|
#childVendorFolderId = self.vendorTree.AppendItem(childVendorFolderId2,"test")
|
| 407 |
|
|
self.vendorTree.Expand(rootVendorFolderId)
|
| 408 |
|
|
|
| 409 |
|
|
|
| 410 |
|
|
self.vendorTree.SetItemImage(rootVendorFolderId, self.fldridx, wx.TreeItemIcon_Normal)
|
| 411 |
|
|
self.vendorTree.SetItemImage(rootVendorFolderId, self.fldropenidx, wx.TreeItemIcon_Expanded)
|
| 412 |
|
|
## this will need a if its a file do this else do the previous
|
| 413 |
|
|
#self.vendorTree.SetItemImage(childVendorFolderId, self.fileidx, wx.TreeItemIcon_Normal)
|
| 414 |
|
|
|
| 415 |
|
|
mainSizer = wx.BoxSizer(wx.VERTICAL)
|
| 416 |
|
|
mainSizer.Add(self.vendorTree, 0, wx.EXPAND|wx.ALL, 5)
|
| 417 |
|
|
|
| 418 |
|
|
oKButton = wx.Button(self, wx.ID_OK)
|
| 419 |
|
|
oKButton.SetDefault()
|
| 420 |
|
|
cancelButton = wx.Button(self, wx.ID_CANCEL)
|
| 421 |
|
|
buttonSizer = wx.BoxSizer(wx.HORIZONTAL)
|
| 422 |
|
|
buttonSizer.Add(oKButton,0,wx.ALL,5)
|
| 423 |
|
|
buttonSizer.Add(cancelButton,0,wx.ALL,5)
|
| 424 |
|
|
mainSizer.Add(buttonSizer, 0, wx.ALIGN_CENTER|wx.ALL, 15)
|
| 425 |
|
|
self.SetSizer(mainSizer)
|
| 426 |
|
|
self.Bind(wx.EVT_TREE_SEL_CHANGED, self.OnSelChanged, self.vendorTree)
|
| 427 |
ninoborges |
8 |
|
| 428 |
nino.borges |
203 |
|
| 429 |
nino.borges |
458 |
def AddTreeNodes(self, ids):
|
| 430 |
|
|
for (dirpath, dirnames, filenames) in self.expedatObj.ExpeDatWalk(self.rootPath):
|
| 431 |
|
|
for dirname in dirnames:
|
| 432 |
|
|
fullpath = os.path.join(dirpath, dirname)
|
| 433 |
|
|
ids[fullpath] = self.vendorTree.AppendItem(ids[dirpath], dirname)
|
| 434 |
|
|
self.vendorTree.SetItemImage(ids[fullpath], self.fldridx,wx.TreeItemIcon_Normal)
|
| 435 |
|
|
self.vendorTree.SetItemImage(ids[fullpath], self.fldropenidx,wx.TreeItemIcon_Expanded)
|
| 436 |
|
|
for filename in sorted(filenames):
|
| 437 |
|
|
newItem = self.vendorTree.AppendItem(ids[dirpath], filename)
|
| 438 |
|
|
self.vendorTree.SetItemImage(newItem, self.fileidx, wx.TreeItemIcon_Normal)
|
| 439 |
|
|
|
| 440 |
|
|
|
| 441 |
|
|
#def AddTreeNodes(self, parentItem, items):
|
| 442 |
|
|
# """
|
| 443 |
|
|
# Recursively traverses the data structure, adding tree nodes to
|
| 444 |
|
|
# match it.
|
| 445 |
|
|
# """
|
| 446 |
|
|
# for item in items:
|
| 447 |
|
|
# if type(item) == str:
|
| 448 |
|
|
# newItem = self.vendorTree.AppendItem(parentItem, item)
|
| 449 |
|
|
# #self.tree.SetItemText(newItem, "A description of %s" % item, 1)
|
| 450 |
|
|
# self.vendorTree.SetItemImage(newItem, self.fileidx,
|
| 451 |
|
|
# wx.TreeItemIcon_Normal)
|
| 452 |
|
|
# else:
|
| 453 |
|
|
# newItem = self.vendorTree.AppendItem(parentItem, item[0])
|
| 454 |
|
|
# #self.tree.SetItemText(newItem, "A description of %s" % item[0], 1)
|
| 455 |
|
|
# self.vendorTree.SetItemImage(newItem, self.fldridx,
|
| 456 |
|
|
# wx.TreeItemIcon_Normal)
|
| 457 |
|
|
# self.vendorTree.SetItemImage(newItem, self.fldropenidx,
|
| 458 |
|
|
# wx.TreeItemIcon_Expanded)
|
| 459 |
|
|
#
|
| 460 |
|
|
# self.AddTreeNodes(newItem, item[1])
|
| 461 |
|
|
|
| 462 |
nino.borges |
203 |
def OnSelChanged(self, event):
|
| 463 |
|
|
self.item = event.GetItem()
|
| 464 |
|
|
if self.item:
|
| 465 |
|
|
self.vendorFileSelected = self.vendorTree.GetItemText(self.item)
|
| 466 |
|
|
event.Skip()
|
| 467 |
|
|
|
| 468 |
|
|
def GetValues(self):
|
| 469 |
|
|
vendorPath = self.vendorFileSelected
|
| 470 |
|
|
upItem = self.vendorTree.GetItemParent(self.item)
|
| 471 |
|
|
while upItem:
|
| 472 |
|
|
vendorPath = os.path.join(self.vendorTree.GetItemText(upItem),vendorPath)
|
| 473 |
|
|
upItem = self.vendorTree.GetItemParent(upItem)
|
| 474 |
|
|
return vendorPath
|
| 475 |
|
|
|
| 476 |
nino.borges |
458 |
class WaitingOnDialog(wx.Dialog):
|
| 477 |
|
|
def __init__(self, parent, waitingOnThing):
|
| 478 |
|
|
wx.Dialog.__init__(self, parent, -1, "Waiting on %s ..."%waitingOnThing, style = wx.DEFAULT_DIALOG_STYLE, size = (200,200))
|
| 479 |
|
|
self.SpeedWindow2 = SM.SpeedMeter(self,agwStyle=SM.SM_DRAW_HAND |SM.SM_DRAW_SECTORS |SM.SM_DRAW_MIDDLE_TEXT |
|
| 480 |
|
|
SM.SM_DRAW_SECONDARY_TICKS |
|
| 481 |
|
|
SM.SM_DRAW_PARTIAL_FILLER |
|
| 482 |
|
|
SM.SM_DRAW_SHADOW
|
| 483 |
|
|
)
|
| 484 |
|
|
# We Want To Simulate A Clock. Somewhat Tricky, But Did The Job
|
| 485 |
|
|
self.SpeedWindow2.SetAngleRange(pi/2, 5*pi/2)
|
| 486 |
nino.borges |
203 |
|
| 487 |
nino.borges |
458 |
intervals = range(0, 13)
|
| 488 |
|
|
self.SpeedWindow2.SetIntervals(intervals)
|
| 489 |
|
|
|
| 490 |
|
|
colours = [wx.SystemSettings_GetColour(0)]*12
|
| 491 |
|
|
self.SpeedWindow2.SetIntervalColours(colours)
|
| 492 |
|
|
|
| 493 |
|
|
ticks = [str(interval) for interval in intervals]
|
| 494 |
|
|
ticks[-1] = ""
|
| 495 |
|
|
ticks[0] = "12"
|
| 496 |
|
|
self.SpeedWindow2.SetTicks(ticks)
|
| 497 |
|
|
self.SpeedWindow2.SetTicksColour(wx.BLUE)
|
| 498 |
|
|
self.SpeedWindow2.SetTicksFont(wx.Font(11, wx.SCRIPT, wx.NORMAL, wx.BOLD, True))
|
| 499 |
|
|
self.SpeedWindow2.SetNumberOfSecondaryTicks(4)
|
| 500 |
|
|
|
| 501 |
|
|
# Set The Colour For The External Arc
|
| 502 |
|
|
self.SpeedWindow2.SetArcColour(wx.BLUE)
|
| 503 |
|
|
|
| 504 |
|
|
self.SpeedWindow2.SetHandColour(wx.BLACK)
|
| 505 |
|
|
|
| 506 |
|
|
self.SpeedWindow2.SetMiddleText("0 s")
|
| 507 |
|
|
self.SpeedWindow2.SetMiddleTextColour(wx.RED)
|
| 508 |
|
|
|
| 509 |
|
|
# We Set The Background Colour Of The SpeedMeter OutSide The Control
|
| 510 |
|
|
self.SpeedWindow2.SetSpeedBackground(wx.WHITE)
|
| 511 |
|
|
|
| 512 |
|
|
# Set The Colour For The Shadow
|
| 513 |
|
|
self.SpeedWindow2.SetShadowColour(wx.Colour(128, 128, 128))
|
| 514 |
|
|
|
| 515 |
|
|
self.SpeedWindow2.SetSpeedValue(0.0)
|
| 516 |
|
|
|
| 517 |
|
|
|
| 518 |
|
|
# These Are Cosmetics For The Second SpeedMeter Control
|
| 519 |
|
|
|
| 520 |
|
|
# Create The Timer For The Clock
|
| 521 |
|
|
self.timer = wx.PyTimer(self.ClockTimer)
|
| 522 |
|
|
self.currvalue = 0
|
| 523 |
|
|
|
| 524 |
|
|
bsizer2 = wx.BoxSizer(wx.VERTICAL)
|
| 525 |
|
|
|
| 526 |
|
|
#hsizer2 = wx.BoxSizer(wx.HORIZONTAL)
|
| 527 |
|
|
#stattext2 = wx.StaticText(self, -1, "A Simple Clock", style=wx.ALIGN_CENTER)
|
| 528 |
|
|
|
| 529 |
|
|
#button2 = wx.Button(self, -1, "Stop")
|
| 530 |
|
|
self.stopped = 0
|
| 531 |
|
|
#button2.Bind(wx.EVT_BUTTON, self.OnStopClock)
|
| 532 |
|
|
#button2.SetToolTip(wx.ToolTip("Click To Stop/Resume The Clock"))
|
| 533 |
|
|
|
| 534 |
|
|
#hsizer2.Add(button2, 0, wx.LEFT, 5)
|
| 535 |
|
|
#hsizer2.Add(stattext2, 1, wx.EXPAND)
|
| 536 |
|
|
|
| 537 |
|
|
bsizer2.Add(self.SpeedWindow2, 1, wx.EXPAND)
|
| 538 |
|
|
#bsizer2.Add(hsizer2, 0, wx.EXPAND)
|
| 539 |
|
|
self.SetSizer(bsizer2)
|
| 540 |
|
|
wx.Yield()
|
| 541 |
|
|
self.timer.Start(1000)
|
| 542 |
|
|
#self.timer3.Start(500)
|
| 543 |
|
|
wx.Yield()
|
| 544 |
|
|
|
| 545 |
|
|
|
| 546 |
|
|
#mainSizer = wx.BoxSizer(wx.VERTICAL)
|
| 547 |
|
|
#mainSizer.Add(SpeedWindow2, 0, wx.EXPAND|wx.ALL, 5)
|
| 548 |
|
|
#self.SetSizer(mainSizer)
|
| 549 |
|
|
def ClockTimer(self):
|
| 550 |
|
|
if self.currvalue >= 59:
|
| 551 |
|
|
self.currvalue = 0
|
| 552 |
|
|
else:
|
| 553 |
|
|
self.currvalue = self.currvalue + 1
|
| 554 |
|
|
wx.Yield()
|
| 555 |
|
|
|
| 556 |
|
|
self.SpeedWindow2.SetMiddleText(str(self.currvalue) + " s")
|
| 557 |
|
|
self.SpeedWindow2.SetSpeedValue(self.currvalue/5.0)
|
| 558 |
|
|
|
| 559 |
|
|
|
| 560 |
|
|
def OnStopClock(self, event):
|
| 561 |
|
|
|
| 562 |
|
|
btn = event.GetEventObject()
|
| 563 |
|
|
|
| 564 |
|
|
if self.stopped == 0:
|
| 565 |
|
|
self.stopped = 1
|
| 566 |
|
|
self.timer.Stop()
|
| 567 |
|
|
btn.SetLabel("Resume")
|
| 568 |
|
|
else:
|
| 569 |
|
|
self.stopped = 0
|
| 570 |
|
|
self.timer.Start()
|
| 571 |
|
|
btn.SetLabel("Stop")
|
| 572 |
|
|
|
| 573 |
|
|
|
| 574 |
|
|
|
| 575 |
ninoborges |
8 |
class MyApp(wx.App):
|
| 576 |
|
|
def OnInit(self):
|
| 577 |
|
|
prgVersion = MCP_Lib.GetMCPVersion()
|
| 578 |
|
|
self.frame = MyFrame(None, -1, "MCP Copy Up Request %s"%prgVersion)
|
| 579 |
|
|
self.frame.Show(True)
|
| 580 |
|
|
self.SetTopWindow(self.frame)
|
| 581 |
|
|
return True
|
| 582 |
|
|
|
| 583 |
|
|
|
| 584 |
|
|
if __name__ == '__main__':
|
| 585 |
|
|
app = MyApp(0)
|
| 586 |
|
|
app.MainLoop() |