def pullTrayFromDB(self,event):
     print 'pulling tray'
     # let user select TrayId
     #[trayId]=event.argBundle
     tList=X_ROBOT_X02DA_database.xGetTrayList()
     tIndex=wx.GetSingleChoiceIndex('Select Tray to Load:','UserGUI_Robot',tList)
     if tIndex>=0:
         trayId=tList[tIndex]
         [self.mainPtr.CurTray,event.myRobotScript.sequenceText]=X_ROBOT_X02DA_database.xGetWholeTray(trayId)
         self.mainPtr.kPostEvent('gsInit',[])
         self.createGrid()
     else:
         print 'User Cancelled Loading!'
 def OnTrayListListbox(self, event):
     
     try:
         [cTray,scriptText]=X_ROBOT_X02DA_database.xGetWholeTray(event.GetString())
     except:
         print 'Tray '+event.GetString()+' Empty!!!!'
         scriptText=''
     cList=scriptText.split('\n')
     self.writeColorSequence(cList)
     #self.sequenceList.AppendItems([event.GetString()+'-'+str(j) for j in range(1,50)])
     #self.sequenceList.SetChecked(range(0,39))
     #print self.sequenceList
     event.Skip()
        cDlg = SimpleDialog.SimpleDialog(root, text="Which tray?", buttons=tList)
        tIndex = cDlg.go()
        cDlg.wm_delete_window()
        del (cDlg)
        root.destroy()
        del (root)
        if tIndex >= 0:
            trayId = tList[tIndex]
        else:
            sys.exit(-1)
    else:
        trayId = opt.name
    logbookName += ", Tray: " + trayId
    logbookText += "Tray Name: " + trayId + "\n"
    try:
        [cTray, scriptText] = X_ROBOT_X02DA_database.xGetWholeTray(trayId)
    except:
        tkMessageBox.showerror("Database Sequencer", "Database problem or tray does not exist!")
        sys.exit(-1)
else:
    if opt.name is None:
        import tkFileDialog

        fileWin = tkFileDialog.Open()
        fileWin.options["initialdir"] = os.path.expandvars("$HOME/UserGUI")

        fileWin.options["filetypes"] = [("XML Files", "*.xml")]

        fileWin.show()
        filename = fileWin.filename
    else: