72 TSessionViewer *gSessionViewer = 0;
74 const char *kConfigFile =
".proofgui.conf";
76 ClassImp(TQueryDescription);
77 ClassImp(TSessionDescription);
78 ClassImp(TSessionServerFrame);
79 ClassImp(TSessionFrame);
80 ClassImp(TSessionQueryFrame);
81 ClassImp(TSessionOutputFrame);
82 ClassImp(TSessionInputFrame);
83 ClassImp(TSessionViewer);
85 const char *xpm_names[] = {
93 const char *conftypes[] = {
94 "Config files",
"*.conf",
99 const char *pkgtypes[] = {
100 "Package files",
"*.par",
105 const char *macrotypes[] = {
106 "C files",
"*.[C|c]*",
112 const char *kFeedbackHistos[] = {
117 "PROOF_ProcTimeHist",
122 const char*
const kSession_RedirectFile =
".templog";
123 const char*
const kSession_RedirectCmd =
".tempcmd";
126 enum ESessionViewerCommands {
154 kOptionsSlaveStatsTrace,
160 const char *xpm_toolbar[] = {
176 ToolBarData_t tb_data[] = {
177 {
"",
"Open Config File", kFALSE, kFileLoadConfig, 0 },
178 {
"",
"Save Config File", kFALSE, kFileSaveConfig, 0 },
180 {
"",
"Connect", kFALSE, kSessionConnect, 0 },
181 {
"",
"Disconnect", kFALSE, kSessionDisconnect, 0 },
183 {
"",
"New Query", kFALSE, kQueryNew, 0 },
184 {
"",
"Submit Query", kFALSE, kQuerySubmit, 0 },
186 {
"",
"About Root", kFALSE, kHelpAbout, 0 },
188 {
"",
"Exit Root", kFALSE, kFileQuit, 0 },
199 TSessionServerFrame::TSessionServerFrame(TGWindow* p, Int_t w, Int_t h) :
200 TGCompositeFrame(p, w, h), fFrmNewServer(0), fTxtName(0), fTxtAddress(0),
201 fNumPort(0), fLogLevel(0), fTxtConfig(0), fTxtUsrName(0), fSync(0),
202 fViewer(0), fBtnAdd(0), fBtnConnect(0)
209 TSessionServerFrame::~TSessionServerFrame()
217 void TSessionServerFrame::Build(TSessionViewer *gui)
219 SetLayoutManager(
new TGVerticalLayout(
this));
221 SetCleanup(kDeepCleanup);
224 fFrmNewServer =
new TGGroupFrame(
this,
"New Session");
225 fFrmNewServer->SetCleanup(kDeepCleanup);
227 AddFrame(fFrmNewServer,
new TGLayoutHints(kLHintsExpandX, 2, 2, 2, 2));
229 fFrmNewServer->SetLayoutManager(
new TGMatrixLayout(fFrmNewServer, 0, 2, 8));
231 fFrmNewServer->AddFrame(
new TGLabel(fFrmNewServer,
"Session Name:"),
232 new TGLayoutHints(kLHintsLeft, 3, 3, 3, 3));
233 fFrmNewServer->AddFrame(fTxtName =
new TGTextEntry(fFrmNewServer,
234 (
const char *)0, 1),
new TGLayoutHints());
235 fTxtName->Resize(156, fTxtName->GetDefaultHeight());
236 fTxtName->Associate(
this);
237 fFrmNewServer->AddFrame(
new TGLabel(fFrmNewServer,
"Server name:"),
238 new TGLayoutHints(kLHintsLeft, 3, 3, 3, 3));
239 fFrmNewServer->AddFrame(fTxtAddress =
new TGTextEntry(fFrmNewServer,
240 (
const char *)0, 2),
new TGLayoutHints());
241 fTxtAddress->Resize(156, fTxtAddress->GetDefaultHeight());
242 fTxtAddress->Associate(
this);
243 fFrmNewServer->AddFrame(
new TGLabel(fFrmNewServer,
"Port (default: 1093):"),
244 new TGLayoutHints(kLHintsLeft, 3, 3, 3, 3));
245 fFrmNewServer->AddFrame(fNumPort =
new TGNumberEntry(fFrmNewServer, 1093, 5,
246 3, TGNumberFormat::kNESInteger,TGNumberFormat::kNEANonNegative,
247 TGNumberFormat::kNELLimitMinMax, 0, 65535),
new TGLayoutHints());
248 fNumPort->Associate(
this);
249 fFrmNewServer->AddFrame(
new TGLabel(fFrmNewServer,
"Configuration File:"),
250 new TGLayoutHints(kLHintsLeft, 3, 3, 3, 3));
251 fFrmNewServer->AddFrame(fTxtConfig =
new TGTextEntry(fFrmNewServer,
252 (
const char *)0, 4),
new TGLayoutHints());
253 fTxtConfig->Resize(156, fTxtConfig->GetDefaultHeight());
254 fTxtConfig->Associate(
this);
255 fFrmNewServer->AddFrame(
new TGLabel(fFrmNewServer,
"Log Level:"),
256 new TGLayoutHints(kLHintsLeft, 3, 3, 3, 3));
258 fFrmNewServer->AddFrame(fLogLevel =
new TGNumberEntry(fFrmNewServer, 0, 5, 5,
259 TGNumberFormat::kNESInteger,
260 TGNumberFormat::kNEANonNegative,
261 TGNumberFormat::kNELLimitMinMax, 0, 5),
262 new TGLayoutHints(kLHintsLeft, 3, 3, 3, 3));
263 fLogLevel->Associate(
this);
265 fFrmNewServer->AddFrame(
new TGLabel(fFrmNewServer,
"User Name:"),
266 new TGLayoutHints(kLHintsLeft, 3, 3, 3, 3));
267 fFrmNewServer->AddFrame(fTxtUsrName =
new TGTextEntry(fFrmNewServer,
268 (
const char *)0, 6),
new TGLayoutHints());
269 fTxtUsrName->Resize(156, fTxtUsrName->GetDefaultHeight());
270 fTxtUsrName->Associate(
this);
272 fFrmNewServer->AddFrame(
new TGLabel(fFrmNewServer,
"Process mode :"),
273 new TGLayoutHints(kLHintsLeft | kLHintsBottom | kLHintsExpandX,
275 fFrmNewServer->AddFrame(fSync =
new TGCheckButton(fFrmNewServer,
276 "&Synchronous"),
new TGLayoutHints(kLHintsLeft | kLHintsBottom |
277 kLHintsExpandX, 3, 3, 3, 3));
278 fSync->SetToolTipText(
"Default Process Mode");
279 fSync->SetState(kButtonDown);
281 AddFrame(fBtnAdd =
new TGTextButton(
this,
" Save "),
282 new TGLayoutHints(kLHintsTop | kLHintsCenterX, 5, 5, 15, 5));
283 fBtnAdd->SetToolTipText(
"Add server to the list");
284 fBtnAdd->Connect(
"Clicked()",
"TSessionServerFrame",
this,
285 "OnBtnAddClicked()");
286 AddFrame(fBtnConnect =
new TGTextButton(
this,
" Connect "),
287 new TGLayoutHints(kLHintsTop | kLHintsCenterX, 5, 5, 15, 5));
288 fBtnConnect->Connect(
"Clicked()",
"TSessionServerFrame",
this,
289 "OnBtnConnectClicked()");
290 fBtnConnect->SetToolTipText(
"Connect to the selected server");
292 fTxtConfig->Connect(
"DoubleClicked()",
"TSessionServerFrame",
this,
293 "OnConfigFileClicked()");
295 fTxtName->Connect(
"TextChanged(char*)",
"TSessionServerFrame",
this,
296 "SettingsChanged()");
297 fTxtAddress->Connect(
"TextChanged(char*)",
"TSessionServerFrame",
this,
298 "SettingsChanged()");
299 fTxtConfig->Connect(
"TextChanged(char*)",
"TSessionServerFrame",
this,
300 "SettingsChanged()");
301 fTxtUsrName->Connect(
"TextChanged(char*)",
"TSessionServerFrame",
this,
302 "SettingsChanged()");
303 fSync->Connect(
"Clicked()",
"TSessionServerFrame",
this,
304 "SettingsChanged()");
305 fLogLevel->Connect(
"ValueChanged(Long_t)",
"TSessionServerFrame",
this,
306 "SettingsChanged()");
307 fLogLevel->Connect(
"ValueSet(Long_t)",
"TSessionServerFrame",
this,
308 "SettingsChanged()");
309 fNumPort->Connect(
"ValueChanged(Long_t)",
"TSessionServerFrame",
this,
310 "SettingsChanged()");
311 fNumPort->Connect(
"ValueSet(Long_t)",
"TSessionServerFrame",
this,
312 "SettingsChanged()");
319 void TSessionServerFrame::SettingsChanged()
321 TGTextEntry *sender =
dynamic_cast<TGTextEntry*
>((TQObject*)gTQSender);
322 Bool_t issync = (fSync->GetState() == kButtonDown);
323 if ((fViewer->GetActDesc()->fLocal) ||
324 (strcmp(fViewer->GetActDesc()->GetName(), fTxtName->GetText())) ||
325 (strcmp(fViewer->GetActDesc()->fAddress.Data(), fTxtAddress->GetText())) ||
326 (strcmp(fViewer->GetActDesc()->fConfigFile.Data(), fTxtConfig->GetText())) ||
327 (strcmp(fViewer->GetActDesc()->fUserName.Data(), fTxtUsrName->GetText())) ||
328 (fViewer->GetActDesc()->fLogLevel != fLogLevel->GetIntNumber()) ||
329 (fViewer->GetActDesc()->fPort != fNumPort->GetIntNumber()) ||
330 (fViewer->GetActDesc()->fSync != issync)) {
332 HideFrame(fBtnConnect);
336 ShowFrame(fBtnConnect);
347 Bool_t TSessionServerFrame::HandleExpose(Event_t * )
357 void TSessionServerFrame::OnConfigFileClicked()
360 if (fViewer->IsBusy())
363 fi.fFileTypes = conftypes;
364 new TGFileDialog(fClient->GetRoot(), fViewer, kFDOpen, &fi);
365 if (!fi.fFilename)
return;
366 fTxtConfig->SetText(gSystem->BaseName(fi.fFilename));
372 void TSessionServerFrame::OnBtnDeleteClicked()
375 if (fViewer->IsBusy())
377 TString name(fTxtName->GetText());
378 TIter next(fViewer->GetSessions());
379 TSessionDescription *desc = fViewer->GetActDesc();
383 new TGMsgBox(fClient->GetRoot(),
this,
"Error Deleting Session",
384 "Deleting Local Sessions is not allowed !",
385 kMBIconExclamation,kMBOk,&retval);
390 m.Form(
"Are you sure to delete the server \"%s\"",
393 new TGMsgBox(fClient->GetRoot(),
this,
"", m.Data(), 0,
394 kMBOk | kMBCancel, &result);
396 if (result == kMBOk) {
398 if (desc->fConnected && desc->fAttached && desc->fProof) {
399 desc->fProof->Detach(
"S");
402 fViewer->GetSessions()->Remove((TObject *)desc);
404 TGListTreeItem *item = fViewer->GetSessionHierarchy()->GetSelected();
405 fViewer->GetSessionHierarchy()->DeleteItem(item);
407 TObject *obj = fViewer->GetSessions()->Last();
408 item = fViewer->GetSessionHierarchy()->FindChildByData(
409 fViewer->GetSessionItem(), (
void *)obj);
411 fViewer->GetSessionHierarchy()->ClearHighlighted();
412 fViewer->GetSessionHierarchy()->OpenItem(item);
413 fViewer->GetSessionHierarchy()->HighlightItem(item);
414 fViewer->GetSessionHierarchy()->SetSelected(item);
415 fViewer->GetSessionHierarchy()->ClearViewPort();
416 fClient->NeedRedraw(fViewer->GetSessionHierarchy());
417 fViewer->OnListTreeClicked(item, 1, 0, 0);
420 if (fViewer->IsAutoSave())
421 fViewer->WriteConfiguration();
427 void TSessionServerFrame::OnBtnConnectClicked()
430 if (fViewer->IsBusy())
433 if (!fViewer->GetSessions()->FindObject(fTxtName->GetText())) {
437 fViewer->GetActDesc()->fAddress = fTxtAddress->GetText();
438 fViewer->GetActDesc()->fPort = fNumPort->GetIntNumber();
439 if (strlen(fTxtConfig->GetText()) > 1)
440 fViewer->GetActDesc()->fConfigFile = TString(fTxtConfig->GetText());
442 fViewer->GetActDesc()->fConfigFile =
"";
443 fViewer->GetActDesc()->fLogLevel = fLogLevel->GetIntNumber();
444 fViewer->GetActDesc()->fUserName = fTxtUsrName->GetText();
445 fViewer->GetActDesc()->fSync = (fSync->GetState() == kButtonDown);
446 if (fViewer->IsAutoSave())
447 fViewer->WriteConfiguration();
452 fViewer->GetSessionHierarchy()->RemoveInput(kPointerMotionMask |
453 kEnterWindowMask | kLeaveWindowMask | kKeyPressMask);
454 gVirtualX->GrabButton(fViewer->GetSessionHierarchy()->GetId(), kAnyButton,
455 kAnyModifier, kButtonPressMask | kButtonReleaseMask, kNone, kNone, kFALSE);
457 gVirtualX->SetCursor(fViewer->GetSessionHierarchy()->GetId(),
458 gVirtualX->CreateCursor(kWatch));
459 gVirtualX->SetCursor(GetId(),gVirtualX->CreateCursor(kWatch));
461 fViewer->GetStatusBar()->GetBarPart(0)->ShowFrame(fViewer->GetConnectProg());
463 TQObject::Connect(
"TProof",
"StartupMessage(char *,Bool_t,Int_t,Int_t)",
464 "TSessionViewer", fViewer,
"StartupMessage(char *,Bool_t,Int_t,Int_t)");
466 TString address = fTxtAddress->GetText();
468 if (address ==
"lite://") {
473 url = fTxtUsrName->GetText();
474 url +=
"@"; url += address.Data();
475 if (fNumPort->GetIntNumber() > 0) {
477 url += fNumPort->GetIntNumber();
482 fViewer->GetActDesc()->fProofMgr = TProofMgr::Create(url);
483 if (!fViewer->GetActDesc()->fProofMgr ||
484 !fViewer->GetActDesc()->fProofMgr->IsValid()) {
486 fViewer->GetStatusBar()->GetBarPart(0)->HideFrame(fViewer->GetConnectProg());
488 fViewer->SetBusy(kFALSE);
490 gVirtualX->SetCursor(GetId(), 0);
491 gVirtualX->GrabButton(fViewer->GetSessionHierarchy()->GetId(), kAnyButton,
492 kAnyModifier, kButtonPressMask | kButtonReleaseMask, kNone, kNone);
493 fViewer->GetSessionHierarchy()->AddInput(kPointerMotionMask |
494 kEnterWindowMask | kLeaveWindowMask | kKeyPressMask);
495 gVirtualX->SetCursor(fViewer->GetSessionHierarchy()->GetId(), 0);
498 fViewer->UpdateListOfSessions();
500 TList *sessions = fViewer->GetActDesc()->fProofMgr->QuerySessions(
"");
502 TIter nextp(sessions);
504 while ((desc = (TProofDesc *)nextp())) {
505 if ((desc->GetName() == fViewer->GetActDesc()->fTag) ||
506 (desc->GetTitle() == fViewer->GetActDesc()->fName)) {
507 fViewer->GetActDesc()->fProof =
508 fViewer->GetActDesc()->fProofMgr->AttachSession(desc->GetLocalId(), kTRUE);
509 fViewer->GetActDesc()->fTag = desc->GetName();
510 fViewer->GetActDesc()->fProof->SetAlias(fViewer->GetActDesc()->fName);
511 fViewer->GetActDesc()->fConnected = kTRUE;
512 fViewer->GetActDesc()->fAttached = kTRUE;
514 if (fViewer->GetOptionsMenu()->IsEntryChecked(kOptionsFeedback)) {
517 while (kFeedbackHistos[i]) {
518 if (fViewer->GetCascadeMenu()->IsEntryChecked(41+i)) {
519 fViewer->GetActDesc()->fProof->AddFeedback(kFeedbackHistos[i]);
520 fViewer->GetActDesc()->fNbHistos++;
525 fViewer->GetActDesc()->fProof->Connect(
"Feedback(TList *objs)",
526 "TSessionQueryFrame", fViewer->GetQueryFrame(),
527 "Feedback(TList *objs)");
532 fViewer->GetActDesc()->fProof->ClearFeedback();
539 if (fViewer->GetActDesc()->fProof == 0) {
540 if (fViewer->GetActDesc()->fProofMgr->IsValid()) {
541 fViewer->GetActDesc()->fProof = fViewer->GetActDesc()->fProofMgr->CreateSession(
542 fViewer->GetActDesc()->fConfigFile);
544 sessions = fViewer->GetActDesc()->fProofMgr->QuerySessions(
"");
546 desc = (TProofDesc *)sessions->Last();
548 fViewer->GetActDesc()->fProof->SetAlias(fViewer->GetActDesc()->fName);
549 fViewer->GetActDesc()->fTag = desc->GetName();
550 fViewer->GetActDesc()->fConnected = kTRUE;
551 fViewer->GetActDesc()->fAttached = kTRUE;
555 if (fViewer->GetActDesc()->fProof) {
556 fViewer->GetActDesc()->fConfigFile = fViewer->GetActDesc()->fProof->GetConfFile();
557 fViewer->GetActDesc()->fUserName = fViewer->GetActDesc()->fProof->GetUser();
558 fViewer->GetActDesc()->fPort = fViewer->GetActDesc()->fProof->GetPort();
559 fViewer->GetActDesc()->fLogLevel = fViewer->GetActDesc()->fProof->GetLogLevel();
560 if (fViewer->GetActDesc()->fLogLevel < 0)
561 fViewer->GetActDesc()->fLogLevel = 0;
562 if (fViewer->GetActDesc()->fProof->IsLite())
563 fViewer->GetActDesc()->fAddress =
"lite://";
565 fViewer->GetActDesc()->fAddress = fViewer->GetActDesc()->fProof->GetMaster();
566 fViewer->GetActDesc()->fConnected = kTRUE;
567 fViewer->GetActDesc()->fProof->SetBit(TProof::kUsingSessionGui);
569 fViewer->UpdateListOfSessions();
572 if (fViewer->GetActDesc()->fProof &&
573 fViewer->GetActDesc()->fProof->IsValid()) {
575 fViewer->GetActDesc()->fProof->SetLogLevel(fViewer->GetActDesc()->fLogLevel);
577 fViewer->GetActDesc()->fProof->SetQueryMode(fViewer->GetActDesc()->fSync ?
578 TProof::kSync : TProof::kAsync);
580 fViewer->GetActDesc()->fConnected = kTRUE;
582 TGListTreeItem *item = fViewer->GetSessionHierarchy()->FindChildByData(
583 fViewer->GetSessionItem(),fViewer->GetActDesc());
585 item->SetPictures(fViewer->GetProofConPict(), fViewer->GetProofConPict());
587 fViewer->OnListTreeClicked(item, 1, 0, 0);
588 fViewer->GetSessionHierarchy()->ClearViewPort();
589 fClient->NeedRedraw(fViewer->GetSessionHierarchy());
592 fViewer->GetActDesc()->fProof->Connect(
"Progress(Long64_t,Long64_t)",
593 "TSessionQueryFrame", fViewer->GetQueryFrame(),
594 "Progress(Long64_t,Long64_t)");
595 fViewer->GetActDesc()->fProof->Connect(
"Progress(Long64_t,Long64_t,Long64_t,Float_t,Float_t,Float_t,Float_t)",
596 "TSessionQueryFrame", fViewer->GetQueryFrame(),
597 "Progress(Long64_t,Long64_t,Long64_t,Float_t,Float_t,Float_t,Float_t)");
598 fViewer->GetActDesc()->fProof->Connect(
"Progress(Long64_t,Long64_t,Long64_t,Float_t,Float_t,Float_t,Float_t,Int_t,Int_t,Float_t)",
599 "TSessionQueryFrame", fViewer->GetQueryFrame(),
600 "Progress(Long64_t,Long64_t,Long64_t,Float_t,Float_t,Float_t,Float_t,Int_t,Int_t,Float_t)");
601 fViewer->GetActDesc()->fProof->Connect(
"StopProcess(Bool_t)",
602 "TSessionQueryFrame", fViewer->GetQueryFrame(),
603 "IndicateStop(Bool_t)");
604 fViewer->GetActDesc()->fProof->Connect(
605 "ResetProgressDialog(const char*,Int_t,Long64_t,Long64_t)",
606 "TSessionQueryFrame", fViewer->GetQueryFrame(),
607 "ResetProgressDialog(const char*,Int_t,Long64_t,Long64_t)");
609 fViewer->EnableTimer();
611 fViewer->ChangeRightLogo(
"monitor01.xpm");
613 fViewer->SetChangePic(kFALSE);
615 fViewer->GetActDesc()->fProof->Connect(
"QueryResultReady(char *)",
616 "TSessionViewer", fViewer,
"QueryResultReady(char *)");
619 msg.Form(
"PROOF Cluster %s ready", fViewer->GetActDesc()->fName.Data());
620 fViewer->GetStatusBar()->SetText(msg.Data(), 1);
621 fViewer->GetSessionFrame()->ProofInfos();
622 fViewer->UpdateListOfPackages();
623 fViewer->GetSessionFrame()->UpdateListOfDataSets();
625 if (fViewer->GetActDesc()->fAutoEnable) {
626 TPackageDescription *package;
627 TIter next(fViewer->GetActDesc()->fPackages);
628 while ((package = (TPackageDescription *)next())) {
629 if (!package->fEnabled) {
630 if (fViewer->GetActDesc()->fProof->EnablePackage(package->fName) != 0)
631 Error(
"Submit",
"Enable package failed");
633 package->fEnabled = kTRUE;
634 fViewer->GetSessionFrame()->UpdatePackages();
641 fViewer->GetStatusBar()->GetBarPart(0)->HideFrame(fViewer->GetConnectProg());
643 fViewer->SetBusy(kFALSE);
645 gVirtualX->SetCursor(GetId(), 0);
646 gVirtualX->GrabButton(fViewer->GetSessionHierarchy()->GetId(), kAnyButton,
647 kAnyModifier, kButtonPressMask | kButtonReleaseMask, kNone, kNone);
648 fViewer->GetSessionHierarchy()->AddInput(kPointerMotionMask |
649 kEnterWindowMask | kLeaveWindowMask | kKeyPressMask);
650 gVirtualX->SetCursor(fViewer->GetSessionHierarchy()->GetId(), 0);
656 void TSessionServerFrame::OnBtnNewServerClicked()
659 if (fViewer->IsBusy())
661 fViewer->GetSessionHierarchy()->ClearHighlighted();
662 fViewer->GetSessionHierarchy()->OpenItem(fViewer->GetSessionItem());
663 fViewer->GetSessionHierarchy()->HighlightItem(fViewer->GetSessionItem());
664 fViewer->GetSessionHierarchy()->SetSelected(fViewer->GetSessionItem());
665 fViewer->OnListTreeClicked(fViewer->GetSessionItem(), 1, 0, 0);
666 fViewer->GetSessionHierarchy()->ClearViewPort();
667 fClient->NeedRedraw(fViewer->GetSessionHierarchy());
668 fTxtName->SetText(
"");
669 fTxtAddress->SetText(
"");
670 fTxtConfig->SetText(
"");
671 fNumPort->SetIntNumber(1093);
672 fLogLevel->SetIntNumber(0);
673 fTxtUsrName->SetText(
"");
679 void TSessionServerFrame::OnBtnAddClicked()
682 Bool_t newSession = kTRUE;
683 TSessionDescription* desc = 0;
685 if (fViewer->IsBusy())
688 if ((!fTxtName->GetBuffer()->GetTextLength()) ||
689 (!fTxtAddress->GetBuffer()->GetTextLength()) ||
690 (!fTxtUsrName->GetBuffer()->GetTextLength())) {
691 new TGMsgBox(fClient->GetRoot(), fViewer,
"Error Adding Session",
692 "At least one required field is empty !",
693 kMBIconExclamation, kMBOk, &retval);
696 TObject *obj = fViewer->GetSessions()->FindObject(fTxtName->GetText());
698 desc =
dynamic_cast<TSessionDescription*
>(obj);
700 new TGMsgBox(fClient->GetRoot(), fViewer,
"Adding Session",
701 TString::Format(
"The session \"%s\" already exists ! Overwrite ?",
702 fTxtName->GetText()), kMBIconQuestion, kMBYes | kMBNo |
704 if (retval != kMBYes)
709 desc =
new TSessionDescription();
710 desc->fName = fTxtName->GetText();
712 desc->fQueries =
new TList();
713 desc->fPackages =
new TList();
717 desc->fAutoEnable = kFALSE;
718 desc->fAddress = fTxtAddress->GetText();
719 desc->fPort = fNumPort->GetIntNumber();
720 desc->fConnected = kFALSE;
721 desc->fAttached = kFALSE;
722 desc->fLocal = kFALSE;
723 if (strlen(fTxtConfig->GetText()) > 1)
724 desc->fConfigFile = TString(fTxtConfig->GetText());
726 desc->fConfigFile =
"";
727 desc->fLogLevel = fLogLevel->GetIntNumber();
728 desc->fUserName = fTxtUsrName->GetText();
729 desc->fSync = (fSync->GetState() == kButtonDown);
731 fViewer->GetSessions()->Add((TObject *)desc);
733 TGListTreeItem *item = fViewer->GetSessionHierarchy()->AddItem(
734 fViewer->GetSessionItem(), desc->fName.Data(),
735 fViewer->GetProofDisconPict(), fViewer->GetProofDisconPict());
736 fViewer->GetSessionHierarchy()->SetToolTipItem(item,
"Proof Session");
737 item->SetUserData(desc);
738 fViewer->GetSessionHierarchy()->ClearHighlighted();
739 fViewer->GetSessionHierarchy()->OpenItem(fViewer->GetSessionItem());
740 fViewer->GetSessionHierarchy()->OpenItem(item);
741 fViewer->GetSessionHierarchy()->HighlightItem(item);
742 fViewer->GetSessionHierarchy()->SetSelected(item);
743 fViewer->GetSessionHierarchy()->ClearViewPort();
744 fClient->NeedRedraw(fViewer->GetSessionHierarchy());
745 fViewer->OnListTreeClicked(item, 1, 0, 0);
748 fViewer->GetActDesc()->fName = fTxtName->GetText();
749 fViewer->GetActDesc()->fAddress = fTxtAddress->GetText();
750 fViewer->GetActDesc()->fPort = fNumPort->GetIntNumber();
751 if (strlen(fTxtConfig->GetText()) > 1)
752 fViewer->GetActDesc()->fConfigFile = TString(fTxtConfig->GetText());
753 fViewer->GetActDesc()->fLogLevel = fLogLevel->GetIntNumber();
754 fViewer->GetActDesc()->fUserName = fTxtUsrName->GetText();
755 fViewer->GetActDesc()->fSync = (fSync->GetState() == kButtonDown);
756 TGListTreeItem *item2 = fViewer->GetSessionHierarchy()->GetSelected();
757 item2->SetUserData(fViewer->GetActDesc());
758 fViewer->OnListTreeClicked(fViewer->GetSessionHierarchy()->GetSelected(),
762 ShowFrame(fBtnConnect);
763 if (fViewer->IsAutoSave())
764 fViewer->WriteConfiguration();
770 void TSessionServerFrame::Update(TSessionDescription* desc)
773 fTxtName->SetText(
"");
774 fTxtAddress->SetText(
"");
775 fNumPort->SetIntNumber(1093);
776 fTxtConfig->SetText(
"");
777 fTxtUsrName->SetText(
"");
778 fLogLevel->SetIntNumber(0);
782 fTxtName->SetText(desc->fName);
783 fTxtAddress->SetText(desc->fAddress);
784 fNumPort->SetIntNumber(desc->fPort);
785 fLogLevel->SetIntNumber(desc->fLogLevel);
787 if (desc->fConfigFile.Length() > 1) {
788 fTxtConfig->SetText(desc->fConfigFile);
791 fTxtConfig->SetText(
"");
793 fTxtUsrName->SetText(desc->fUserName);
800 Bool_t TSessionServerFrame::ProcessMessage(Long_t msg, Long_t parm1, Long_t)
802 switch (GET_MSG(msg)) {
804 switch (GET_SUBMSG(msg)) {
809 fTxtAddress->SelectAll();
810 fTxtAddress->SetFocus();
813 fNumPort->GetNumberEntry()->SelectAll();
814 fNumPort->GetNumberEntry()->SetFocus();
817 fTxtConfig->SelectAll();
818 fTxtConfig->SetFocus();
821 fLogLevel->GetNumberEntry()->SelectAll();
822 fLogLevel->GetNumberEntry()->SetFocus();
825 fTxtUsrName->SelectAll();
826 fTxtUsrName->SetFocus();
829 fTxtName->SelectAll();
830 fTxtName->SetFocus();
852 TSessionFrame::TSessionFrame(TGWindow* p, Int_t w, Int_t h) :
853 TGCompositeFrame(p, w, h), fTab(0), fFA(0), fFB(0), fFC(0), fFD(0), fFE(0),
854 fCommandTxt(0), fCommandBuf(0), fInfoTextView(0), fClearCheck(0),
855 fBtnShowLog(0), fBtnNewQuery(0), fBtnGetQueries(0), fLBPackages(0),
856 fBtnAdd(0), fBtnRemove(0), fBtnUp(0), fBtnDown(0), fBtnShow(0),
857 fBtnShowEnabled(0), fChkMulti(0), fChkEnable(0), fBtnUpload(0),
858 fBtnEnable(0), fBtnClear(0), fBtnDisable(0), fDSetView(0), fDataSetTree(0),
859 fBtnUploadDSet(0), fBtnRemoveDSet(0), fBtnVerifyDSet(0), fBtnRefresh(0),
860 fTxtParallel(0), fLogLevel(0), fApplyLogLevel(0), fApplyParallel(0),
863 for (
int i=0;i<19;++i) fInfoLine[i] = 0;
869 TSessionFrame::~TSessionFrame()
877 void TSessionFrame::Build(TSessionViewer *gui)
879 SetLayoutManager(
new TGVerticalLayout(
this));
880 SetCleanup(kDeepCleanup);
885 fTab =
new TGTab(
this, 200, 200);
886 AddFrame(fTab,
new TGLayoutHints(kLHintsTop | kLHintsExpandX |
887 kLHintsExpandY, 2, 2, 2, 2));
890 TGCompositeFrame *tf = fTab->AddTab(
"Status");
891 fFA =
new TGCompositeFrame(tf, 100, 100, kVerticalFrame);
892 tf->AddFrame(fFA,
new TGLayoutHints(kLHintsTop | kLHintsLeft |
893 kLHintsExpandX | kLHintsExpandY));
896 fInfoLine[0] =
new TGLabel(fFA,
" ");
897 fFA->AddFrame(fInfoLine[0],
new TGLayoutHints(kLHintsCenterX |
898 kLHintsExpandX, 5, 5, 15, 5));
900 TGCompositeFrame* frmInfos =
new TGHorizontalFrame(fFA, 350, 100);
901 frmInfos->SetLayoutManager(
new TGTableLayout(frmInfos, 9, 2));
905 for (i=0;i<17;i+=2) {
906 fInfoLine[i+1] =
new TGLabel(frmInfos,
" ");
907 frmInfos->AddFrame(fInfoLine[i+1],
new TGTableLayoutHints(0, 1, j, j+1,
908 kLHintsLeft | kLHintsCenterY, 5, 5, 2, 2));
909 fInfoLine[i+2] =
new TGLabel(frmInfos,
" ");
910 frmInfos->AddFrame(fInfoLine[i+2],
new TGTableLayoutHints(1, 2, j, j+1,
911 kLHintsLeft | kLHintsCenterY, 5, 5, 2, 2));
914 fFA->AddFrame(frmInfos,
new TGLayoutHints(kLHintsLeft | kLHintsTop |
915 kLHintsExpandX | kLHintsExpandY, 5, 5, 5, 5));
918 TGCompositeFrame* frmBut1 =
new TGHorizontalFrame(fFA, 350, 100);
919 frmBut1->SetCleanup(kDeepCleanup);
920 frmBut1->AddFrame(fBtnNewQuery =
new TGTextButton(frmBut1,
"New Query..."),
921 new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 5, 5, 5, 5));
922 fBtnNewQuery->SetToolTipText(
"Open New Query Dialog");
923 frmBut1->AddFrame(fBtnGetQueries =
new TGTextButton(frmBut1,
" Get Queries "),
924 new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 5, 5, 5, 5));
925 fBtnGetQueries->SetToolTipText(
"Get List of Queries from the server");
926 fBtnShowLog =
new TGTextButton(frmBut1,
"Show log...");
927 fBtnShowLog->SetToolTipText(
"Show Session log (opens log window)");
928 frmBut1->AddFrame(fBtnShowLog,
new TGLayoutHints(kLHintsLeft |
929 kLHintsExpandX, 5, 5, 5, 5));
930 fFA->AddFrame(frmBut1,
new TGLayoutHints(kLHintsLeft | kLHintsBottom |
934 tf = fTab->AddTab(
"Commands");
935 fFC =
new TGCompositeFrame(tf, 100, 100, kVerticalFrame);
936 tf->AddFrame(fFC,
new TGLayoutHints(kLHintsTop | kLHintsLeft |
937 kLHintsExpandX | kLHintsExpandY));
940 TGCompositeFrame* frmCmd =
new TGHorizontalFrame(fFC, 350, 100);
941 frmCmd->SetCleanup(kDeepCleanup);
942 frmCmd->AddFrame(
new TGLabel(frmCmd,
"Command Line :"),
943 new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 5, 5, 15, 5));
944 fCommandBuf =
new TGTextBuffer(120);
945 frmCmd->AddFrame(fCommandTxt =
new TGTextEntry(frmCmd,
946 fCommandBuf ),
new TGLayoutHints(kLHintsLeft | kLHintsCenterY |
947 kLHintsExpandX, 5, 5, 15, 5));
948 fFC->AddFrame(frmCmd,
new TGLayoutHints(kLHintsExpandX, 5, 5, 10, 5));
950 fCommandTxt->Connect(
"ReturnPressed()",
"TSessionFrame",
this,
954 fClearCheck =
new TGCheckButton(fFC,
"Clear view after each command");
955 fFC->AddFrame(fClearCheck,
new TGLayoutHints(kLHintsLeft | kLHintsTop,
957 fClearCheck->SetState(kButtonUp);
959 fFC->AddFrame(
new TGLabel(fFC,
"Output :"),
960 new TGLayoutHints(kLHintsLeft | kLHintsTop, 10, 5, 5, 5));
961 fInfoTextView =
new TGTextView(fFC, 330, 150,
"", kSunkenFrame |
963 fFC->AddFrame(fInfoTextView,
new TGLayoutHints(kLHintsLeft |
964 kLHintsTop | kLHintsExpandX | kLHintsExpandY, 10, 10, 5, 5));
967 tf = fTab->AddTab(
"Packages");
968 fFB =
new TGCompositeFrame(tf, 100, 100, kVerticalFrame);
969 tf->AddFrame(fFB,
new TGLayoutHints(kLHintsTop | kLHintsLeft |
970 kLHintsExpandX | kLHintsExpandY));
973 TGCompositeFrame* frmcanvas =
new TGHorizontalFrame(fFB, 350, 100);
976 fLBPackages =
new TGListBox(frmcanvas);
977 fLBPackages->Resize(80,150);
978 fLBPackages->SetMultipleSelections(kFALSE);
979 frmcanvas->AddFrame(fLBPackages,
new TGLayoutHints(kLHintsExpandX |
980 kLHintsExpandY, 5, 5, 5, 5));
982 TGCompositeFrame* frmBut2 =
new TGVerticalFrame(frmcanvas, 150, 100);
984 fChkMulti =
new TGCheckButton(frmBut2,
"Multiple Selection");
985 fChkMulti->SetToolTipText(
"Enable multiple selection in the package list");
986 frmBut2->AddFrame(fChkMulti,
new TGLayoutHints(kLHintsLeft, 5, 5, 5, 5));
988 fBtnAdd =
new TGTextButton(frmBut2,
" Add... ");
989 fBtnAdd->SetToolTipText(
"Add a package to the list");
990 frmBut2->AddFrame(fBtnAdd,
new TGLayoutHints(kLHintsTop | kLHintsLeft |
991 kLHintsExpandX, 5, 5, 5, 5));
992 fBtnRemove =
new TGTextButton(frmBut2,
"Remove");
993 fBtnRemove->SetToolTipText(
"Remove package from the list");
994 frmBut2->AddFrame(fBtnRemove,
new TGLayoutHints(kLHintsTop | kLHintsLeft |
995 kLHintsExpandX, 5, 5, 5, 5));
996 fBtnUp =
new TGTextButton(frmBut2,
"Move Up");
997 fBtnUp->SetToolTipText(
"Move package one step upward in the list");
998 frmBut2->AddFrame(fBtnUp,
new TGLayoutHints(kLHintsTop | kLHintsLeft |
999 kLHintsExpandX, 5, 5, 5, 5));
1000 fBtnDown =
new TGTextButton(frmBut2,
"Move Down");
1001 fBtnDown->SetToolTipText(
"Move package one step downward in the list");
1002 frmBut2->AddFrame(fBtnDown,
new TGLayoutHints(kLHintsTop | kLHintsLeft |
1003 kLHintsExpandX, 5, 5, 5, 5));
1004 frmcanvas->AddFrame(frmBut2,
new TGLayoutHints(kLHintsLeft | kLHintsCenterY |
1006 fFB->AddFrame(frmcanvas,
new TGLayoutHints(kLHintsLeft | kLHintsTop |
1007 kLHintsExpandX | kLHintsExpandY));
1009 TGCompositeFrame* frmLeg =
new TGHorizontalFrame(fFB, 300, 100);
1010 frmLeg->SetCleanup(kDeepCleanup);
1011 TGPicture *pic1 = (TGPicture *)fClient->GetPicture(
"package.xpm");
1012 TGIcon *icn1 =
new TGIcon(frmLeg, pic1, pic1->GetWidth(), pic1->GetHeight());
1013 frmLeg->AddFrame(icn1,
new TGLayoutHints(kLHintsLeft | kLHintsTop,
1015 frmLeg->AddFrame(
new TGLabel(frmLeg,
": Local"),
1016 new TGLayoutHints(kLHintsLeft | kLHintsTop, 0, 10, 0, 5));
1018 TGPicture *pic2 = (TGPicture *)fClient->GetPicture(
"package_delete.xpm");
1019 TGIcon *icn2 =
new TGIcon(frmLeg, pic2, pic2->GetWidth(), pic2->GetHeight());
1020 frmLeg->AddFrame(icn2,
new TGLayoutHints(kLHintsLeft | kLHintsTop,
1022 frmLeg->AddFrame(
new TGLabel(frmLeg,
": Uploaded"),
1023 new TGLayoutHints(kLHintsLeft | kLHintsTop, 0, 10, 0, 5));
1025 TGPicture *pic3 = (TGPicture *)fClient->GetPicture(
"package_add.xpm");
1026 TGIcon *icn3 =
new TGIcon(frmLeg, pic3, pic3->GetWidth(), pic3->GetHeight());
1027 frmLeg->AddFrame(icn3,
new TGLayoutHints(kLHintsLeft | kLHintsTop,
1029 frmLeg->AddFrame(
new TGLabel(frmLeg,
": Enabled"),
1030 new TGLayoutHints(kLHintsLeft | kLHintsTop, 0, 10, 0, 5));
1031 fFB->AddFrame(frmLeg,
new TGLayoutHints(kLHintsLeft | kLHintsTop |
1032 kLHintsExpandX, 0, 0, 0, 0));
1034 TGCompositeFrame* frmBtn =
new TGHorizontalFrame(fFB, 300, 100);
1035 frmBtn->SetCleanup(kDeepCleanup);
1036 frmBtn->AddFrame(fBtnUpload =
new TGTextButton(frmBtn,
1037 " Upload "),
new TGLayoutHints(kLHintsLeft | kLHintsExpandX |
1038 kLHintsCenterY, 5, 5, 5, 5));
1039 fBtnUpload->SetToolTipText(
"Upload selected package(s) to the server");
1040 frmBtn->AddFrame(fBtnEnable =
new TGTextButton(frmBtn,
1041 " Enable "),
new TGLayoutHints(kLHintsLeft | kLHintsExpandX |
1042 kLHintsCenterY, 5, 5, 5, 5));
1043 fBtnEnable->SetToolTipText(
"Enable selected package(s) on the server");
1044 frmBtn->AddFrame(fBtnDisable =
new TGTextButton(frmBtn,
1045 " Disable "),
new TGLayoutHints(kLHintsLeft | kLHintsExpandX |
1046 kLHintsCenterY, 5, 5, 5, 5));
1047 fBtnDisable->SetToolTipText(
"Disable selected package(s) on the server");
1048 frmBtn->AddFrame(fBtnClear =
new TGTextButton(frmBtn,
1049 " Clear "),
new TGLayoutHints(kLHintsLeft | kLHintsExpandX |
1050 kLHintsCenterY, 5, 5, 5, 5));
1051 fBtnClear->SetToolTipText(
"Clear all packages on the server");
1052 fFB->AddFrame(frmBtn,
new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
1054 fBtnClear->SetEnabled(kFALSE);
1056 TGCompositeFrame* frmBtn3 =
new TGHorizontalFrame(fFB, 300, 100);
1057 frmBtn3->SetCleanup(kDeepCleanup);
1058 fBtnShow =
new TGTextButton(frmBtn3,
"Show packages");
1059 fBtnShow->SetToolTipText(
"Show (list) available packages on the server");
1060 frmBtn3->AddFrame(fBtnShow,
new TGLayoutHints(kLHintsCenterY | kLHintsLeft |
1061 kLHintsExpandX, 5, 5, 5, 5));
1062 fBtnShowEnabled =
new TGTextButton(frmBtn3,
"Show Enabled");
1063 fBtnShowEnabled->SetToolTipText(
"Show (list) enabled packages on the server");
1064 frmBtn3->AddFrame(fBtnShowEnabled,
new TGLayoutHints(kLHintsCenterY | kLHintsLeft |
1065 kLHintsExpandX, 5, 5, 5, 5));
1066 fFB->AddFrame(frmBtn3,
new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
1068 fChkEnable =
new TGCheckButton(fFB,
"Enable at session startup");
1069 fChkEnable->SetToolTipText(
"Enable packages on the server at startup time");
1070 fFB->AddFrame(fChkEnable,
new TGLayoutHints(kLHintsLeft, 5, 5, 5, 5));
1073 tf = fTab->AddTab(
"DataSets");
1074 fFE =
new TGCompositeFrame(tf, 100, 100, kVerticalFrame);
1075 tf->AddFrame(fFE,
new TGLayoutHints(kLHintsTop | kLHintsLeft |
1076 kLHintsExpandX | kLHintsExpandY));
1079 TGCompositeFrame* frmdataset =
new TGHorizontalFrame(fFE, 350, 100);
1082 fDSetView =
new TGCanvas(frmdataset, 200, 200, kSunkenFrame | kDoubleBorder);
1083 frmdataset->AddFrame(fDSetView,
new TGLayoutHints(kLHintsExpandX | kLHintsExpandY,
1085 fDataSetTree =
new TGListTree(fDSetView, kHorizontalFrame);
1086 fDataSetTree->AddItem(0,
"DataSets");
1089 TGCompositeFrame* frmBut3 =
new TGVerticalFrame(frmdataset, 150, 100);
1091 fBtnUploadDSet =
new TGTextButton(frmBut3,
" Upload... ");
1092 fBtnUploadDSet->SetToolTipText(
"Upload a dataset to the cluster");
1093 frmBut3->AddFrame(fBtnUploadDSet,
new TGLayoutHints(kLHintsTop | kLHintsLeft |
1094 kLHintsExpandX, 5, 5, 5, 5));
1095 fBtnRemoveDSet =
new TGTextButton(frmBut3,
"Remove");
1096 fBtnRemoveDSet->SetToolTipText(
"Remove dataset from the cluster");
1097 frmBut3->AddFrame(fBtnRemoveDSet,
new TGLayoutHints(kLHintsTop | kLHintsLeft |
1098 kLHintsExpandX, 5, 5, 5, 5));
1099 fBtnVerifyDSet =
new TGTextButton(frmBut3,
"Verify");
1100 fBtnVerifyDSet->SetToolTipText(
"Verify dataset on the cluster");
1101 frmBut3->AddFrame(fBtnVerifyDSet,
new TGLayoutHints(kLHintsTop | kLHintsLeft |
1102 kLHintsExpandX, 5, 5, 5, 5));
1103 fBtnRefresh =
new TGTextButton(frmBut3,
"Refresh List");
1104 fBtnRefresh->SetToolTipText(
"Refresh List of DataSet/Files present on the cluster");
1105 frmBut3->AddFrame(fBtnRefresh,
new TGLayoutHints(kLHintsTop | kLHintsLeft |
1106 kLHintsExpandX, 5, 5, 15, 5));
1108 frmdataset->AddFrame(frmBut3,
new TGLayoutHints(kLHintsLeft | kLHintsCenterY |
1109 kLHintsExpandY, 5, 5, 5, 0));
1111 fFE->AddFrame(frmdataset,
new TGLayoutHints(kLHintsLeft | kLHintsTop |
1112 kLHintsExpandX | kLHintsExpandY));
1115 tf = fTab->AddTab(
"Options");
1116 fFD =
new TGCompositeFrame(tf, 100, 100, kVerticalFrame);
1117 tf->AddFrame(fFD,
new TGLayoutHints(kLHintsTop | kLHintsLeft |
1118 kLHintsExpandX | kLHintsExpandY));
1121 TGCompositeFrame* frmLog =
new TGHorizontalFrame(fFD, 310, 100, kFixedWidth);
1122 frmLog->SetCleanup(kDeepCleanup);
1123 frmLog->AddFrame(fApplyLogLevel =
new TGTextButton(frmLog,
1124 " Apply "),
new TGLayoutHints(kLHintsRight |
1125 kLHintsCenterY, 10, 5, 5, 5));
1126 fApplyLogLevel->SetToolTipText(
"Apply currently selected log level");
1127 fLogLevel =
new TGNumberEntry(frmLog, 0, 5, 5, TGNumberFormat::kNESInteger,
1128 TGNumberFormat::kNEANonNegative, TGNumberFormat::kNELLimitMinMax, 0, 5);
1129 frmLog->AddFrame(fLogLevel,
new TGLayoutHints(kLHintsRight |
1130 kLHintsCenterY, 5, 5, 5, 5));
1131 frmLog->AddFrame(
new TGLabel(frmLog,
"Log Level :"),
1132 new TGLayoutHints(kLHintsRight | kLHintsCenterY, 5, 5, 5, 5));
1133 fFD->AddFrame(frmLog,
new TGLayoutHints(kLHintsLeft, 5, 5, 15, 5));
1136 TGCompositeFrame* frmPar =
new TGHorizontalFrame(fFD, 310, 100, kFixedWidth);
1137 frmPar->SetCleanup(kDeepCleanup);
1138 frmPar->AddFrame(fApplyParallel =
new TGTextButton(frmPar,
1139 " Apply "),
new TGLayoutHints(kLHintsRight |
1140 kLHintsCenterY, 10, 5, 5, 5));
1141 fApplyParallel->SetToolTipText(
"Apply currently selected parallel nodes");
1142 fTxtParallel =
new TGTextEntry(frmPar);
1143 fTxtParallel->SetAlignment(kTextRight);
1144 fTxtParallel->SetText(
"99999");
1145 fTxtParallel->Resize(fLogLevel->GetDefaultWidth(), fTxtParallel->GetDefaultHeight());
1146 frmPar->AddFrame(fTxtParallel,
new TGLayoutHints(kLHintsRight |
1147 kLHintsCenterY, 5, 5, 5, 5));
1148 frmPar->AddFrame(
new TGLabel(frmPar,
"Set Parallel Nodes :"),
1149 new TGLayoutHints(kLHintsRight | kLHintsCenterY, 5, 5, 5, 5));
1150 fFD->AddFrame(frmPar,
new TGLayoutHints(kLHintsLeft, 5, 5, 5, 5));
1153 fBtnShowLog->Connect(
"Clicked()",
"TSessionFrame",
this,
1154 "OnBtnShowLogClicked()");
1155 fBtnNewQuery->Connect(
"Clicked()",
"TSessionFrame",
this,
1156 "OnBtnNewQueryClicked()");
1157 fBtnGetQueries->Connect(
"Clicked()",
"TSessionFrame",
this,
1158 "OnBtnGetQueriesClicked()");
1160 fChkEnable->Connect(
"Toggled(Bool_t)",
"TSessionFrame",
this,
1161 "OnStartupEnable(Bool_t)");
1162 fChkMulti->Connect(
"Toggled(Bool_t)",
"TSessionFrame",
this,
1163 "OnMultipleSelection(Bool_t)");
1164 fBtnAdd->Connect(
"Clicked()",
"TSessionFrame",
this,
1165 "OnBtnAddClicked()");
1166 fBtnRemove->Connect(
"Clicked()",
"TSessionFrame",
this,
1167 "OnBtnRemoveClicked()");
1168 fBtnUp->Connect(
"Clicked()",
"TSessionFrame",
this,
1169 "OnBtnUpClicked()");
1170 fBtnDown->Connect(
"Clicked()",
"TSessionFrame",
this,
1171 "OnBtnDownClicked()");
1172 fApplyLogLevel->Connect(
"Clicked()",
"TSessionFrame",
this,
1173 "OnApplyLogLevel()");
1174 fApplyParallel->Connect(
"Clicked()",
"TSessionFrame",
this,
1175 "OnApplyParallel()");
1176 fBtnUpload->Connect(
"Clicked()",
"TSessionFrame",
this,
1177 "OnUploadPackages()");
1178 fBtnEnable->Connect(
"Clicked()",
"TSessionFrame",
this,
1179 "OnEnablePackages()");
1180 fBtnDisable->Connect(
"Clicked()",
"TSessionFrame",
this,
1181 "OnDisablePackages()");
1182 fBtnClear->Connect(
"Clicked()",
"TSessionFrame",
this,
1183 "OnClearPackages()");
1184 fBtnShowEnabled->Connect(
"Clicked()",
"TSessionViewer", fViewer,
1185 "ShowEnabledPackages()");
1186 fBtnShow->Connect(
"Clicked()",
"TSessionViewer", fViewer,
1189 fBtnUploadDSet->Connect(
"Clicked()",
"TSessionFrame",
this,
1190 "OnBtnUploadDSet()");
1191 fBtnRemoveDSet->Connect(
"Clicked()",
"TSessionFrame",
this,
1192 "OnBtnRemoveDSet()");
1193 fBtnVerifyDSet->Connect(
"Clicked()",
"TSessionFrame",
this,
1194 "OnBtnVerifyDSet()");
1195 fBtnRefresh->Connect(
"Clicked()",
"TSessionFrame",
this,
1196 "UpdateListOfDataSets()");
1202 void TSessionFrame::ProofInfos()
1207 if (fViewer->GetActDesc()->fLocal) {
1208 buf.Form(
"*** Local Session on %s ***", gSystem->HostName());
1209 fInfoLine[0]->SetText(buf.Data());
1210 UserGroup_t *userGroup = gSystem->GetUserInfo();
1211 fInfoLine[1]->SetText(
"User :");
1212 if (userGroup) buf.Form(
"%s", userGroup->fRealName.Data());
1213 fInfoLine[2]->SetText(buf.Data());
1214 fInfoLine[3]->SetText(
"Working directory :");
1215 buf.Form(
"%s", gSystem->WorkingDirectory());
1216 fInfoLine[4]->SetText(buf.Data());
1217 fInfoLine[5]->SetText(
" ");
1218 fInfoLine[6]->SetText(
" ");
1219 fInfoLine[7]->SetText(
" ");
1220 fInfoLine[8]->SetText(
" ");
1221 fInfoLine[9]->SetText(
" ");
1222 fInfoLine[10]->SetText(
" ");
1223 fInfoLine[11]->SetText(
" ");
1224 fInfoLine[12]->SetText(
" ");
1225 fInfoLine[13]->SetText(
" ");
1226 fInfoLine[14]->SetText(
" ");
1227 fInfoLine[15]->SetText(
" ");
1228 fInfoLine[16]->SetText(
" ");
1229 fInfoLine[17]->SetText(
" ");
1230 fInfoLine[18]->SetText(
" ");
1231 if (userGroup)
delete userGroup;
1233 Resize(GetDefaultSize());
1237 if (!fViewer->GetActDesc()->fConnected ||
1238 !fViewer->GetActDesc()->fAttached ||
1239 !fViewer->GetActDesc()->fProof ||
1240 !fViewer->GetActDesc()->fProof->IsValid())
1243 if (!fViewer->GetActDesc()->fProof->IsMaster()) {
1244 if (fViewer->GetActDesc()->fProof->IsParallel())
1245 buf.Form(
"*** Connected to %s (parallel mode, %d workers) ***",
1246 fViewer->GetActDesc()->fProof->GetMaster(),
1247 fViewer->GetActDesc()->fProof->GetParallel());
1249 buf.Form(
"*** Connected to %s (sequential mode) ***",
1250 fViewer->GetActDesc()->fProof->GetMaster());
1251 fInfoLine[0]->SetText(buf.Data());
1252 fInfoLine[1]->SetText(
"Port number : ");
1253 buf.Form(
"%d", fViewer->GetActDesc()->fProof->GetPort());
1254 fInfoLine[2]->SetText(buf.Data());
1255 fInfoLine[3]->SetText(
"User : ");
1256 buf.Form(
"%s", fViewer->GetActDesc()->fProof->GetUser());
1257 fInfoLine[4]->SetText(buf.Data());
1258 fInfoLine[5]->SetText(
"Client protocol version : ");
1259 buf.Form(
"%d", fViewer->GetActDesc()->fProof->GetClientProtocol());
1260 fInfoLine[6]->SetText(buf.Data());
1261 fInfoLine[7]->SetText(
"Remote protocol version : ");
1262 buf.Form(
"%d", fViewer->GetActDesc()->fProof->GetRemoteProtocol());
1263 fInfoLine[8]->SetText(buf.Data());
1264 fInfoLine[9]->SetText(
"Log level : ");
1265 buf.Form(
"%d", fViewer->GetActDesc()->fProof->GetLogLevel());
1266 fInfoLine[10]->SetText(buf.Data());
1267 fInfoLine[11]->SetText(
"Session unique tag : ");
1268 buf.Form(
"%s", fViewer->GetActDesc()->fProof->IsValid() ?
1269 fViewer->GetActDesc()->fProof->GetSessionTag() :
" ");
1270 fInfoLine[12]->SetText(buf.Data());
1271 fInfoLine[13]->SetText(
"Total MB's processed :");
1272 buf.Form(
"%.2f",
float(fViewer->GetActDesc()->fProof->GetBytesRead())/(1024*1024));
1273 fInfoLine[14]->SetText(buf.Data());
1274 fInfoLine[15]->SetText(
"Total real time used (s) :");
1275 buf.Form(
"%.3f", fViewer->GetActDesc()->fProof->GetRealTime());
1276 fInfoLine[16]->SetText(buf.Data());
1277 fInfoLine[17]->SetText(
"Total CPU time used (s) :");
1278 buf.Form(
"%.3f", fViewer->GetActDesc()->fProof->GetCpuTime());
1279 fInfoLine[18]->SetText(buf.Data());
1282 if (fViewer->GetActDesc()->fProof->IsParallel())
1283 buf.Form(
"*** Master server %s (parallel mode, %d workers) ***",
1284 fViewer->GetActDesc()->fProof->GetMaster(),
1285 fViewer->GetActDesc()->fProof->GetParallel());
1287 buf.Form(
"*** Master server %s (sequential mode) ***",
1288 fViewer->GetActDesc()->fProof->GetMaster());
1289 fInfoLine[0]->SetText(buf.Data());
1290 fInfoLine[1]->SetText(
"Port number : ");
1291 buf.Form(
"%d", fViewer->GetActDesc()->fProof->GetPort());
1292 fInfoLine[2]->SetText(buf.Data());
1293 fInfoLine[3]->SetText(
"User : ");
1294 buf.Form(
"%s", fViewer->GetActDesc()->fProof->GetUser());
1295 fInfoLine[4]->SetText(buf.Data());
1296 fInfoLine[5]->SetText(
"Protocol version : ");
1297 buf.Form(
"%d", fViewer->GetActDesc()->fProof->GetClientProtocol());
1298 fInfoLine[6]->SetText(buf.Data());
1299 fInfoLine[7]->SetText(
"Image name : ");
1300 buf.Form(
"%s",fViewer->GetActDesc()->fProof->GetImage());
1301 fInfoLine[8]->SetText(buf.Data());
1302 fInfoLine[9]->SetText(
"Config directory : ");
1303 buf.Form(
"%s", fViewer->GetActDesc()->fProof->GetConfDir());
1304 fInfoLine[10]->SetText(buf.Data());
1305 fInfoLine[11]->SetText(
"Config file : ");
1306 buf.Form(
"%s", fViewer->GetActDesc()->fProof->GetConfFile());
1307 fInfoLine[12]->SetText(buf.Data());
1308 fInfoLine[13]->SetText(
"Total MB's processed :");
1309 buf.Form(
"%.2f",
float(fViewer->GetActDesc()->fProof->GetBytesRead())/(1024*1024));
1310 fInfoLine[14]->SetText(buf.Data());
1311 fInfoLine[15]->SetText(
"Total real time used (s) :");
1312 buf.Form(
"%.3f", fViewer->GetActDesc()->fProof->GetRealTime());
1313 fInfoLine[16]->SetText(buf.Data());
1314 fInfoLine[17]->SetText(
"Total CPU time used (s) :");
1315 buf.Form(
"%.3f", fViewer->GetActDesc()->fProof->GetCpuTime());
1316 fInfoLine[18]->SetText(buf.Data());
1319 Resize(GetDefaultSize());
1325 void TSessionFrame::OnBtnUploadDSet()
1327 if (fViewer->IsBusy())
1329 if (fViewer->GetActDesc()->fLocal)
return;
1330 new TUploadDataSetDlg(fViewer, 450, 360);
1336 void TSessionFrame::UpdateListOfDataSets()
1338 TObjString *dsetname;
1339 TFileInfo *dsetfilename;
1341 fDataSetTree->DeleteChildren(fDataSetTree->GetFirstItem());
1342 if (fViewer->GetActDesc()->fConnected && fViewer->GetActDesc()->fAttached &&
1343 fViewer->GetActDesc()->fProof && fViewer->GetActDesc()->fProof->IsValid() &&
1344 fViewer->GetActDesc()->fProof->IsParallel()) {
1346 const TGPicture *dseticon = fClient->GetPicture(
"rootdb_t.xpm");
1350 TList *dsetlist = 0;
1353 TGListTreeItem *dsetitem;
1354 fDataSetTree->OpenItem(fDataSetTree->GetFirstItem());
1355 TIter nextdset(dsetlist);
1356 while ((dsetname = (TObjString *)nextdset())) {
1357 if (!fDataSetTree->FindItemByObj(fDataSetTree->GetFirstItem(), dsetname)) {
1359 dsetitem = fDataSetTree->AddItem(fDataSetTree->GetFirstItem(),
1360 dsetname->GetName(), dsetname);
1362 TList *dsetfilelist = fViewer->GetActDesc()->fProof->GetDataSet(
1363 dsetname->GetName())->GetList();
1365 TIter nextdsetfile(dsetfilelist);
1366 while ((dsetfilename = (TFileInfo *)nextdsetfile())) {
1367 if (! fDataSetTree->FindItemByObj(dsetitem, dsetfilename)) {
1369 fDataSetTree->AddItem(dsetitem,
1370 dsetfilename->GetFirstUrl()->GetUrl(),
1371 dsetfilename, dseticon, dseticon);
1375 fDataSetTree->OpenItem(dsetitem);
1382 fClient->NeedRedraw(fDataSetTree);
1388 void TSessionFrame::OnBtnRemoveDSet()
1390 TGListTreeItem *item;
1391 TObjString *obj = 0;
1392 if (fViewer->GetActDesc()->fLocal)
return;
1394 item = fDataSetTree->GetSelected();
1396 if (item->GetParent() == 0)
return;
1397 if (item->GetParent() == fDataSetTree->GetFirstItem()) {
1399 obj = (TObjString *)item->GetUserData();
1401 else if (item->GetParent()->GetParent() == fDataSetTree->GetFirstItem()) {
1403 obj = (TObjString *)item->GetParent()->GetUserData();
1407 if (obj && fViewer->GetActDesc()->fProof &&
1408 fViewer->GetActDesc()->fProof->IsValid()) {
1409 fViewer->GetActDesc()->fProof->RemoveDataSet(obj->GetName());
1410 UpdateListOfDataSets();
1417 void TSessionFrame::OnBtnVerifyDSet()
1419 TGListTreeItem *item;
1420 TObjString *obj = 0;
1421 if (fViewer->GetActDesc()->fLocal)
return;
1423 item = fDataSetTree->GetSelected();
1425 if (item->GetParent() == 0)
return;
1426 if (item->GetParent() == fDataSetTree->GetFirstItem()) {
1428 obj = (TObjString *)item->GetUserData();
1430 else if (item->GetParent()->GetParent() == fDataSetTree->GetFirstItem()) {
1432 obj = (TObjString *)item->GetParent()->GetUserData();
1436 if (obj && fViewer->GetActDesc()->fProof &&
1437 fViewer->GetActDesc()->fProof->IsValid()) {
1438 fViewer->GetActDesc()->fProof->VerifyDataSet(obj->GetName());
1445 void TSessionFrame::OnApplyLogLevel()
1448 if (fViewer->GetActDesc()->fLocal)
return;
1450 if (fViewer->GetActDesc()->fProof &&
1451 fViewer->GetActDesc()->fProof->IsValid()) {
1452 fViewer->GetActDesc()->fLogLevel = fLogLevel->GetIntNumber();
1453 fViewer->GetActDesc()->fProof->SetLogLevel(fViewer->GetActDesc()->fLogLevel);
1455 fViewer->GetSessionFrame()->ProofInfos();
1461 void TSessionFrame::OnApplyParallel()
1464 if (fViewer->GetActDesc()->fLocal)
return;
1466 if (fViewer->GetActDesc()->fProof &&
1467 fViewer->GetActDesc()->fProof->IsValid()) {
1468 Int_t nodes = atoi(fTxtParallel->GetText());
1469 fViewer->GetActDesc()->fProof->SetParallel(nodes);
1471 fViewer->GetSessionFrame()->ProofInfos();
1477 void TSessionFrame::OnMultipleSelection(Bool_t on)
1479 fLBPackages->SetMultipleSelections(on);
1485 void TSessionFrame::OnStartupEnable(Bool_t on)
1487 if (fViewer->GetActDesc())
1488 fViewer->GetActDesc()->fAutoEnable = on;
1494 void TSessionFrame::UpdatePackages()
1496 TPackageDescription *package;
1497 const TGPicture *pict;
1498 fLBPackages->RemoveEntries(0, fLBPackages->GetNumberOfEntries());
1499 TIter next(fViewer->GetActDesc()->fPackages);
1500 while ((package = (TPackageDescription *)next())) {
1501 if (package->fEnabled)
1502 pict = fClient->GetPicture(
"package_add.xpm");
1503 else if (package->fUploaded)
1504 pict = fClient->GetPicture(
"package_delete.xpm");
1506 pict = fClient->GetPicture(
"package.xpm");
1507 TGIconLBEntry *entry =
new TGIconLBEntry(fLBPackages->GetContainer(),
1508 package->fId, package->fPathName, pict);
1509 fLBPackages->AddEntry(entry,
new TGLayoutHints(kLHintsExpandX | kLHintsTop));
1511 fLBPackages->Layout();
1512 fClient->NeedRedraw(fLBPackages->GetContainer());
1518 void TSessionFrame::OnUploadPackages()
1521 if (fViewer->GetActDesc()->fLocal)
return;
1523 if (fViewer->GetActDesc()->fProof &&
1524 fViewer->GetActDesc()->fProof->IsValid()) {
1527 fLBPackages->GetSelectedEntries(&selected);
1528 TIter next(&selected);
1529 while ((obj = next())) {
1530 TString name = obj->GetTitle();
1531 if (fViewer->GetActDesc()->fProof->UploadPackage(name.Data()) != 0)
1532 Error(
"Submit",
"Upload package failed");
1534 TObject *o = fViewer->GetActDesc()->fPackages->FindObject(gSystem->BaseName(name));
1536 TPackageDescription *
package =
1537 dynamic_cast<TPackageDescription *>(o);
1539 package->fUploaded = kTRUE;
1540 ((TGIconLBEntry *)obj)->SetPicture(
1541 fClient->GetPicture(
"package_delete.xpm"));
1547 fLBPackages->Layout();
1548 fClient->NeedRedraw(fLBPackages->GetContainer());
1554 void TSessionFrame::OnEnablePackages()
1557 if (fViewer->GetActDesc()->fLocal)
return;
1559 if (fViewer->GetActDesc()->fProof &&
1560 fViewer->GetActDesc()->fProof->IsValid()) {
1563 fBtnEnable->SetState(kButtonDisabled);
1564 fLBPackages->GetSelectedEntries(&selected);
1565 TIter next(&selected);
1566 while ((obj = next())) {
1567 TString name = obj->GetTitle();
1568 TObject *o = fViewer->GetActDesc()->fPackages->FindObject(gSystem->BaseName(name));
1570 TPackageDescription *
package =
1571 dynamic_cast<TPackageDescription *>(o);
1573 if (!package->fUploaded) {
1574 if (fViewer->GetActDesc()->fProof->UploadPackage(name.Data()) != 0)
1575 Error(
"Submit",
"Upload package failed");
1577 package->fUploaded = kTRUE;
1578 ((TGIconLBEntry *)obj)->SetPicture(
1579 fClient->GetPicture(
"package_delete.xpm"));
1583 if (fViewer->GetActDesc()->fProof->EnablePackage(name) != 0)
1584 Error(
"Submit",
"Enable package failed");
1586 package->fEnabled = kTRUE;
1587 ((TGIconLBEntry *)obj)->SetPicture(fClient->GetPicture(
"package_add.xpm"));
1591 fBtnEnable->SetState(kButtonUp);
1593 fLBPackages->Layout();
1594 fClient->NeedRedraw(fLBPackages->GetContainer());
1600 void TSessionFrame::OnDisablePackages()
1603 if (fViewer->GetActDesc()->fLocal)
return;
1605 if (fViewer->GetActDesc()->fProof &&
1606 fViewer->GetActDesc()->fProof->IsValid()) {
1609 fLBPackages->GetSelectedEntries(&selected);
1610 TIter next(&selected);
1611 while ((obj = next())) {
1612 TString name = obj->GetTitle();
1613 if (fViewer->GetActDesc()->fProof->ClearPackage(name) != 0)
1614 Error(
"Submit",
"Clear package failed");
1616 TObject *o = fViewer->GetActDesc()->fPackages->FindObject(gSystem->BaseName(name));
1618 TPackageDescription *
package =
1619 dynamic_cast<TPackageDescription *>(o);
1621 package->fEnabled = kFALSE;
1622 package->fUploaded = kFALSE;
1623 ((TGIconLBEntry *)obj)->SetPicture(fClient->GetPicture(
"package.xpm"));
1629 fLBPackages->Layout();
1630 fClient->NeedRedraw(fLBPackages->GetContainer());
1636 void TSessionFrame::OnClearPackages()
1638 TPackageDescription *package;
1640 if (fViewer->GetActDesc()->fLocal)
return;
1642 if (fViewer->GetActDesc()->fProof &&
1643 fViewer->GetActDesc()->fProof->IsValid()) {
1644 if (fViewer->GetActDesc()->fProof->ClearPackages() != 0)
1645 Error(
"Submit",
"Clear packages failed");
1647 TIter next(fViewer->GetActDesc()->fPackages);
1648 while ((package = (TPackageDescription *)next())) {
1649 package->fEnabled = kFALSE;
1653 fLBPackages->Layout();
1654 fClient->NeedRedraw(fLBPackages->GetContainer());
1660 void TSessionFrame::OnBtnAddClicked()
1662 if (fViewer->IsBusy())
1665 TPackageDescription *package;
1666 TGIconLBEntry *entry;
1667 fi.fFileTypes = pkgtypes;
1668 new TGFileDialog(fClient->GetRoot(), fViewer, kFDOpen, &fi);
1669 if (fi.fMultipleSelection && fi.fFileNamesList) {
1671 TIter next(fi.fFileNamesList);
1672 while ((el = (TObjString *) next())) {
1673 package = new TPackageDescription;
1674 package->fName = gSystem->BaseName(gSystem->UnixPathName(el->GetString()));
1675 package->fPathName = gSystem->UnixPathName(el->GetString());
1676 package->fId = fViewer->GetActDesc()->fPackages->GetEntries();
1677 package->fUploaded = kFALSE;
1678 package->fEnabled = kFALSE;
1679 fViewer->GetActDesc()->fPackages->Add((TObject *)package);
1680 entry =
new TGIconLBEntry(fLBPackages->GetContainer(),
1681 package->fId, package->fPathName,
1682 fClient->GetPicture(
"package.xpm"));
1683 fLBPackages->AddEntry(entry,
new TGLayoutHints(kLHintsExpandX | kLHintsTop));
1686 else if (fi.fFilename) {
1687 package = new TPackageDescription;
1688 package->fName = gSystem->BaseName(gSystem->UnixPathName(fi.fFilename));
1689 package->fPathName = gSystem->UnixPathName(fi.fFilename);
1690 package->fId = fViewer->GetActDesc()->fPackages->GetEntries();
1691 package->fUploaded = kFALSE;
1692 package->fEnabled = kFALSE;
1693 fViewer->GetActDesc()->fPackages->Add((TObject *)package);
1694 entry =
new TGIconLBEntry(fLBPackages->GetContainer(),
1695 package->fId, package->fPathName,
1696 fClient->GetPicture(
"package.xpm"));
1697 fLBPackages->AddEntry(entry,
new TGLayoutHints(kLHintsExpandX | kLHintsTop));
1699 fLBPackages->Layout();
1700 fClient->NeedRedraw(fLBPackages->GetContainer());
1706 void TSessionFrame::OnBtnRemoveClicked()
1708 TPackageDescription *package;
1709 const TGPicture *pict;
1710 Int_t pos = fLBPackages->GetSelected();
1711 fLBPackages->RemoveEntries(0, fLBPackages->GetNumberOfEntries());
1712 fViewer->GetActDesc()->fPackages->Remove(
1713 fViewer->GetActDesc()->fPackages->At(pos));
1715 TIter next(fViewer->GetActDesc()->fPackages);
1716 while ((package = (TPackageDescription *)next())) {
1719 if (package->fEnabled)
1720 pict = fClient->GetPicture(
"package_add.xpm");
1721 else if (package->fUploaded)
1722 pict = fClient->GetPicture(
"package_delete.xpm");
1724 pict = fClient->GetPicture(
"package.xpm");
1725 TGIconLBEntry *entry =
new TGIconLBEntry(fLBPackages->GetContainer(),
1726 package->fId, package->fPathName, pict);
1727 fLBPackages->AddEntry(entry,
new TGLayoutHints(kLHintsExpandX | kLHintsTop));
1729 fLBPackages->Layout();
1730 fClient->NeedRedraw(fLBPackages->GetContainer());
1736 void TSessionFrame::OnBtnUpClicked()
1738 TPackageDescription *package;
1739 const TGPicture *pict;
1740 Int_t pos = fLBPackages->GetSelected();
1741 if (pos <= 0)
return;
1742 fLBPackages->RemoveEntries(0, fLBPackages->GetNumberOfEntries());
1743 package = (TPackageDescription *)fViewer->GetActDesc()->fPackages->At(pos);
1744 fViewer->GetActDesc()->fPackages->Remove(
1745 fViewer->GetActDesc()->fPackages->At(pos));
1747 fViewer->GetActDesc()->fPackages->AddAt(package, package->fId);
1749 TIter next(fViewer->GetActDesc()->fPackages);
1750 while ((package = (TPackageDescription *)next())) {
1753 if (package->fEnabled)
1754 pict = fClient->GetPicture(
"package_add.xpm");
1755 else if (package->fUploaded)
1756 pict = fClient->GetPicture(
"package_delete.xpm");
1758 pict = fClient->GetPicture(
"package.xpm");
1759 TGIconLBEntry *entry =
new TGIconLBEntry(fLBPackages->GetContainer(),
1760 package->fId, package->fPathName, pict);
1761 fLBPackages->AddEntry(entry,
new TGLayoutHints(kLHintsExpandX | kLHintsTop));
1763 fLBPackages->Select(pos-1);
1764 fLBPackages->Layout();
1765 fClient->NeedRedraw(fLBPackages->GetContainer());
1771 void TSessionFrame::OnBtnDownClicked()
1773 TPackageDescription *package;
1774 const TGPicture *pict;
1775 Int_t pos = fLBPackages->GetSelected();
1776 if (pos == -1 || pos == fViewer->GetActDesc()->fPackages->GetEntries()-1)
1778 fLBPackages->RemoveEntries(0, fLBPackages->GetNumberOfEntries());
1779 package = (TPackageDescription *)fViewer->GetActDesc()->fPackages->At(pos);
1780 fViewer->GetActDesc()->fPackages->Remove(
1781 fViewer->GetActDesc()->fPackages->At(pos));
1783 fViewer->GetActDesc()->fPackages->AddAt(package, package->fId);
1785 TIter next(fViewer->GetActDesc()->fPackages);
1786 while ((package = (TPackageDescription *)next())) {
1789 if (package->fEnabled)
1790 pict = fClient->GetPicture(
"package_add.xpm");
1791 else if (package->fUploaded)
1792 pict = fClient->GetPicture(
"package_delete.xpm");
1794 pict = fClient->GetPicture(
"package.xpm");
1795 TGIconLBEntry *entry =
new TGIconLBEntry(fLBPackages->GetContainer(),
1796 package->fId, package->fPathName, pict);
1797 fLBPackages->AddEntry(entry,
new TGLayoutHints(kLHintsExpandX | kLHintsTop));
1799 fLBPackages->Select(pos+1);
1800 fLBPackages->Layout();
1801 fClient->NeedRedraw(fLBPackages->GetContainer());
1807 void TSessionFrame::OnBtnDisconnectClicked()
1810 if (fViewer->GetActDesc()->fLocal)
return;
1812 if (fViewer->GetActDesc()->fAttached &&
1813 fViewer->GetActDesc()->fProof &&
1814 fViewer->GetActDesc()->fProof->IsValid()) {
1815 fViewer->GetActDesc()->fProof->Detach();
1818 fViewer->GetActDesc()->fAttached = kFALSE;
1819 fViewer->GetActDesc()->fProof = 0;
1821 fViewer->DisableTimer();
1823 TGListTreeItem *item = fViewer->GetSessionHierarchy()->FindChildByData(
1824 fViewer->GetSessionItem(), fViewer->GetActDesc());
1826 item->SetPictures(fViewer->GetProofDisconPict(),
1827 fViewer->GetProofDisconPict());
1830 fViewer->OnListTreeClicked(fViewer->GetSessionHierarchy()->GetSelected(),
1832 fViewer->GetSessionHierarchy()->ClearViewPort();
1833 fClient->NeedRedraw(fViewer->GetSessionHierarchy());
1834 fViewer->GetStatusBar()->SetText(
"", 1);
1840 void TSessionFrame::OnBtnShowLogClicked()
1842 fViewer->ShowLog(0);
1848 void TSessionFrame::OnBtnNewQueryClicked()
1850 TNewQueryDlg *dlg =
new TNewQueryDlg(fViewer, 350, 310);
1857 void TSessionFrame::OnBtnGetQueriesClicked()
1859 TList *lqueries = 0;
1860 TQueryResult *query = 0;
1861 TQueryDescription *newquery = 0, *lquery = 0;
1862 if (fViewer->GetActDesc()->fProof &&
1863 fViewer->GetActDesc()->fProof->IsValid()) {
1864 lqueries = fViewer->GetActDesc()->fProof->GetListOfQueries();
1867 TIter nextp(lqueries);
1869 while ((query = (TQueryResult *)nextp())) {
1871 newquery =
new TQueryDescription();
1872 newquery->fReference = TString::Format(
"%s:%s", query->GetTitle(),
1875 TGListTreeItem *item =
1876 fViewer->GetSessionHierarchy()->FindChildByData(
1877 fViewer->GetSessionItem(), fViewer->GetActDesc());
1879 if (fViewer->GetSessionHierarchy()->FindChildByName(item,
1880 newquery->fReference.Data()))
1883 Bool_t found = kFALSE;
1884 TIter nextp2(fViewer->GetActDesc()->fQueries);
1885 while ((lquery = (TQueryDescription *)nextp2())) {
1886 if (lquery->fReference.CompareTo(newquery->fReference) == 0) {
1891 if (found)
continue;
1893 newquery->fStatus = query->IsFinalized() ?
1894 TQueryDescription::kSessionQueryFinalized :
1895 (TQueryDescription::ESessionQueryStatus)query->GetStatus();
1896 newquery->fSelectorString = query->GetSelecImp()->GetName();
1897 newquery->fQueryName = TString::Format(
"%s:%s", query->GetTitle(),
1899 newquery->fOptions = query->GetOptions();
1900 newquery->fEventList =
"";
1901 newquery->fNbFiles = 0;
1902 newquery->fNoEntries = query->GetEntries();
1903 newquery->fFirstEntry = query->GetFirst();
1904 newquery->fResult = query;
1905 newquery->fChain = 0;
1906 fViewer->GetActDesc()->fQueries->Add((TObject *)newquery);
1907 TGListTreeItem *item2 = fViewer->GetSessionHierarchy()->AddItem(item,
1908 newquery->fQueryName, fViewer->GetQueryConPict(),
1909 fViewer->GetQueryConPict());
1910 item2->SetUserData(newquery);
1911 if (query->GetInputList())
1912 fViewer->GetSessionHierarchy()->AddItem(item2,
"InputList");
1913 if (query->GetOutputList())
1914 fViewer->GetSessionHierarchy()->AddItem(item2,
"OutputList");
1918 fViewer->GetSessionHierarchy()->ClearViewPort();
1919 fClient->NeedRedraw(fViewer->GetSessionHierarchy());
1925 void TSessionFrame::OnCommandLine()
1928 const char *cmd = fCommandTxt->GetText();
1931 TString pathtmp = TString::Format(
"%s/%s", gSystem->TempDirectory(),
1932 kSession_RedirectCmd);
1935 if (fClearCheck->IsOn())
1936 snprintf(opt, 2,
"w");
1938 snprintf(opt, 2,
"a");
1941 if (fViewer->GetActDesc()->fProof &&
1942 fViewer->GetActDesc()->fProof->IsValid()) {
1944 if (gSystem->RedirectOutput(pathtmp.Data(), opt) != 0) {
1945 Error(
"ShowStatus",
"stdout/stderr redirection failed; skipping");
1949 fViewer->GetActDesc()->fProof->Exec(cmd);
1951 if (gSystem->RedirectOutput(0) != 0) {
1952 Error(
"ShowStatus",
"stdout/stderr retore failed; skipping");
1956 if (fClearCheck->IsOn())
1957 fInfoTextView->Clear();
1959 fInfoTextView->LoadFile(pathtmp.Data());
1961 fCommandTxt->SetFocus();
1968 if (gSystem->RedirectOutput(pathtmp.Data(), opt) != 0) {
1969 Error(
"ShowStatus",
"stdout/stderr redirection failed; skipping");
1972 gApplication->ProcessLine(cmd);
1974 if (gSystem->RedirectOutput(0) != 0) {
1975 Error(
"ShowStatus",
"stdout/stderr retore failed; skipping");
1978 if (fClearCheck->IsOn())
1979 fInfoTextView->Clear();
1981 fInfoTextView->LoadFile(pathtmp.Data());
1983 fCommandTxt->SetFocus();
1986 fInfoTextView->ShowBottom();
1992 void TSessionFrame::SetLocal(Bool_t local)
1995 fBtnGetQueries->SetState(kButtonDisabled);
1996 fBtnShowLog->SetState(kButtonDisabled);
1997 fTab->HideFrame(fTab->GetTabTab(
"Options"));
1998 fTab->HideFrame(fTab->GetTabTab(
"Packages"));
1999 fTab->HideFrame(fTab->GetTabTab(
"DataSets"));
2002 fBtnGetQueries->SetState(kButtonUp);
2003 fBtnShowLog->SetState(kButtonUp);
2004 fTab->ShowFrame(fTab->GetTabTab(
"Options"));
2005 fTab->ShowFrame(fTab->GetTabTab(
"Packages"));
2006 fTab->ShowFrame(fTab->GetTabTab(
"DataSets"));
2013 void TSessionFrame::ShutdownSession()
2016 if (fViewer->IsBusy())
2019 if (fViewer->GetActDesc()->fLocal) {
2021 new TGMsgBox(fClient->GetRoot(),
this,
"Error Shutting down Session",
2022 "Shutting down Local Sessions is not allowed !",
2023 kMBIconExclamation,kMBOk,&retval);
2026 if (!fViewer->GetActDesc()->fAttached ||
2027 !fViewer->GetActDesc()->fProof ||
2028 !fViewer->GetActDesc()->fProof->IsValid())
2032 m.Form(
"Are you sure to shutdown the session \"%s\"",
2033 fViewer->GetActDesc()->fName.Data());
2035 new TGMsgBox(fClient->GetRoot(),
this,
"", m.Data(), 0,
2036 kMBOk | kMBCancel, &result);
2038 if (result != kMBOk)
2041 fViewer->GetActDesc()->fProof->Detach(
"S");
2043 fViewer->GetActDesc()->fAttached = kFALSE;
2044 fViewer->GetActDesc()->fProof = 0;
2046 fViewer->DisableTimer();
2048 TGListTreeItem *item = fViewer->GetSessionHierarchy()->FindChildByData(
2049 fViewer->GetSessionItem(), fViewer->GetActDesc());
2051 item->SetPictures(fViewer->GetProofDisconPict(),
2052 fViewer->GetProofDisconPict());
2055 fViewer->OnListTreeClicked(fViewer->GetSessionHierarchy()->GetSelected(),
2057 fViewer->GetSessionHierarchy()->ClearViewPort();
2058 fClient->NeedRedraw(fViewer->GetSessionHierarchy());
2059 fViewer->GetStatusBar()->SetText(
"", 1);
2070 TEditQueryFrame::TEditQueryFrame(TGWindow* p, Int_t w, Int_t h) :
2071 TGCompositeFrame(p, w, h, kVerticalFrame), fFrmMore(0), fBtnMore(0),
2072 fTxtQueryName(0), fTxtChain(0), fTxtSelector(0), fTxtOptions(0),
2073 fNumEntries(0), fNumFirstEntry(0), fTxtParFile(0), fTxtEventList(0),
2074 fViewer(0), fQuery(0), fChain(0)
2081 TEditQueryFrame::~TEditQueryFrame()
2089 void TEditQueryFrame::Build(TSessionViewer *gui)
2093 SetCleanup(kDeepCleanup);
2094 SetLayoutManager(
new TGTableLayout(
this, 6, 5));
2097 AddFrame(
new TGLabel(
this,
"Query Name :"),
2098 new TGTableLayoutHints(0, 1, 0, 1, kLHintsCenterY, 5, 5, 4, 0));
2099 AddFrame(fTxtQueryName =
new TGTextEntry(
this,
2100 (
const char *)0, 1),
new TGTableLayoutHints(1, 2, 0, 1,
2101 kLHintsCenterY, 5, 5, 4, 0));
2104 AddFrame(
new TGLabel(
this,
"TChain :"),
2105 new TGTableLayoutHints(0, 1, 1, 2, kLHintsCenterY, 5, 5, 4, 0));
2106 AddFrame(fTxtChain =
new TGTextEntry(
this,
2107 (
const char *)0, 2),
new TGTableLayoutHints(1, 2, 1, 2,
2108 kLHintsCenterY, 5, 5, 4, 0));
2109 fTxtChain->SetToolTipText(
"Specify TChain or TDSet from memory or file");
2110 fTxtChain->SetEnabled(kFALSE);
2112 AddFrame(btnTmp =
new TGTextButton(
this,
"Browse..."),
2113 new TGTableLayoutHints(2, 3, 1, 2, kLHintsCenterY, 5, 0, 4, 8));
2114 btnTmp->Connect(
"Clicked()",
"TEditQueryFrame",
this,
"OnBrowseChain()");
2117 AddFrame(
new TGLabel(
this,
"Selector :"),
2118 new TGTableLayoutHints(0, 1, 2, 3, kLHintsCenterY, 5, 5, 0, 0));
2119 AddFrame(fTxtSelector =
new TGTextEntry(
this,
2120 (
const char *)0, 3),
new TGTableLayoutHints(1, 2, 2, 3,
2121 kLHintsCenterY, 5, 5, 0, 0));
2123 AddFrame(btnTmp =
new TGTextButton(
this,
"Browse..."),
2124 new TGTableLayoutHints(2, 3, 2, 3, kLHintsCenterY, 5, 0, 0, 8));
2125 btnTmp->Connect(
"Clicked()",
"TEditQueryFrame",
this,
"OnBrowseSelector()");
2128 AddFrame(fBtnMore =
new TGTextButton(
this,
" Less << "),
2129 new TGTableLayoutHints(2, 3, 4, 5, kLHintsCenterY, 5, 5, 4, 0));
2130 fBtnMore->Connect(
"Clicked()",
"TEditQueryFrame",
this,
"OnNewQueryMore()");
2133 fFrmMore =
new TGCompositeFrame(
this, 200, 200);
2134 fFrmMore->SetCleanup(kDeepCleanup);
2136 AddFrame(fFrmMore,
new TGTableLayoutHints(0, 3, 5, 6,
2137 kLHintsExpandX | kLHintsExpandY));
2138 fFrmMore->SetLayoutManager(
new TGTableLayout(fFrmMore, 4, 3));
2141 fFrmMore->AddFrame(
new TGLabel(fFrmMore,
"Options :"),
2142 new TGTableLayoutHints(0, 1, 0, 1, kLHintsCenterY, 5, 5, 0, 0));
2143 fFrmMore->AddFrame(fTxtOptions =
new TGTextEntry(fFrmMore,
2144 (
const char *)0, 4),
new TGTableLayoutHints(1, 2, 0, 1, 0, 17,
2147 fTxtOptions->SetText(
"");
2150 fFrmMore->AddFrame(
new TGLabel(fFrmMore,
"Nb Entries :"),
2151 new TGTableLayoutHints(0, 1, 1, 2, kLHintsCenterY, 5, 5, 0, 0));
2152 fFrmMore->AddFrame(fNumEntries =
new TGNumberEntry(fFrmMore, 0, 5, -1,
2153 TGNumberFormat::kNESInteger, TGNumberFormat::kNEAAnyNumber,
2154 TGNumberFormat::kNELNoLimits),
new TGTableLayoutHints(1, 2, 1, 2,
2157 fNumEntries->SetIntNumber(-1);
2159 fFrmMore->AddFrame(
new TGLabel(fFrmMore,
"First entry :"),
2160 new TGTableLayoutHints(0, 1, 2, 3, kLHintsCenterY, 5, 5, 0, 0));
2161 fFrmMore->AddFrame(fNumFirstEntry =
new TGNumberEntry(fFrmMore, 0, 5, -1,
2162 TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative,
2163 TGNumberFormat::kNELNoLimits),
new TGTableLayoutHints(1, 2, 2, 3, 0,
2167 fFrmMore->AddFrame(
new TGLabel(fFrmMore,
"Event list :"),
2168 new TGTableLayoutHints(0, 1, 3, 4, kLHintsCenterY, 5, 5, 0, 0));
2169 fFrmMore->AddFrame(fTxtEventList =
new TGTextEntry(fFrmMore,
2170 (
const char *)0, 6),
new TGTableLayoutHints(1, 2, 3, 4, 0, 17,
2173 fFrmMore->AddFrame(btnTmp =
new TGTextButton(fFrmMore,
"Browse..."),
2174 new TGTableLayoutHints(2, 3, 3, 4, 0, 6, 0, 0, 8));
2175 btnTmp->Connect(
"Clicked()",
"TEditQueryFrame",
this,
"OnBrowseEventList()");
2177 fTxtQueryName->Associate(
this);
2178 fTxtChain->Associate(
this);
2179 fTxtSelector->Associate(
this);
2180 fTxtOptions->Associate(
this);
2181 fNumEntries->Associate(
this);
2182 fNumFirstEntry->Associate(
this);
2183 fTxtEventList->Associate(
this);
2185 fTxtQueryName->Connect(
"TextChanged(char*)",
"TEditQueryFrame",
this,
2186 "SettingsChanged()");
2187 fTxtChain->Connect(
"TextChanged(char*)",
"TEditQueryFrame",
this,
2188 "SettingsChanged()");
2189 fTxtSelector->Connect(
"TextChanged(char*)",
"TEditQueryFrame",
this,
2190 "SettingsChanged()");
2191 fTxtOptions->Connect(
"TextChanged(char*)",
"TEditQueryFrame",
this,
2192 "SettingsChanged()");
2193 fNumEntries->Connect(
"ValueChanged(Long_t)",
"TEditQueryFrame",
this,
2194 "SettingsChanged()");
2195 fNumFirstEntry->Connect(
"ValueChanged(Long_t)",
"TEditQueryFrame",
this,
2196 "SettingsChanged()");
2197 fTxtEventList->Connect(
"TextChanged(char*)",
"TEditQueryFrame",
this,
2198 "SettingsChanged()");
2204 void TEditQueryFrame::OnNewQueryMore()
2206 if (IsVisible(fFrmMore)) {
2207 HideFrame(fFrmMore);
2208 fBtnMore->SetText(
" More >> ");
2211 ShowFrame(fFrmMore);
2212 fBtnMore->SetText(
" Less << ");
2219 void TEditQueryFrame::OnBrowseChain()
2221 TNewChainDlg *dlg =
new TNewChainDlg(fClient->GetRoot(),
this);
2222 dlg->Connect(
"OnElementSelected(TObject *)",
"TEditQueryFrame",
2223 this,
"OnElementSelected(TObject *)");
2229 void TEditQueryFrame::OnElementSelected(TObject *obj)
2233 if (obj->IsA() == TChain::Class())
2234 fTxtChain->SetText(((TChain *)fChain)->GetName());
2235 else if (obj->IsA() == TDSet::Class())
2236 fTxtChain->SetText(((TDSet *)fChain)->GetObjName());
2243 void TEditQueryFrame::OnBrowseSelector()
2246 fi.fFileTypes = macrotypes;
2247 new TGFileDialog(fClient->GetRoot(),
this, kFDOpen, &fi);
2248 if (!fi.fFilename)
return;
2249 fTxtSelector->SetText(gSystem->UnixPathName(fi.fFilename));
2255 void TEditQueryFrame::OnBrowseEventList()
2262 void TEditQueryFrame::OnBtnSave()
2266 TQueryDescription *newquery;
2270 newquery =
new TQueryDescription();
2273 newquery->fSelectorString = fTxtSelector->GetText();
2275 newquery->fTDSetString = fChain->GetName();
2276 newquery->fChain = fChain;
2279 newquery->fTDSetString =
"";
2280 newquery->fChain = 0;
2282 newquery->fQueryName = fTxtQueryName->GetText();
2283 newquery->fOptions = fTxtOptions->GetText();
2284 newquery->fNoEntries = fNumEntries->GetIntNumber();
2285 newquery->fFirstEntry = fNumFirstEntry->GetIntNumber();
2286 newquery->fNbFiles = 0;
2287 newquery->fResult = 0;
2289 if (newquery->fChain) {
2290 if (newquery->fChain->IsA() == TChain::Class())
2291 newquery->fNbFiles = ((TChain *)newquery->fChain)->GetListOfFiles()->GetEntriesFast();
2292 else if (newquery->fChain->IsA() == TDSet::Class())
2293 newquery->fNbFiles = ((TDSet *)newquery->fChain)->GetListOfElements()->GetSize();
2296 TGListTreeItem *item = fViewer->GetSessionHierarchy()->GetSelected();
2297 fViewer->GetSessionHierarchy()->RenameItem(item, newquery->fQueryName);
2298 item->SetUserData(newquery);
2300 fViewer->GetSessionHierarchy()->ClearViewPort();
2301 fClient->NeedRedraw(fViewer->GetSessionHierarchy());
2302 fTxtQueryName->SelectAll();
2303 fTxtQueryName->SetFocus();
2304 fViewer->WriteConfiguration();
2305 fViewer->GetQueryFrame()->Modified(kFALSE);
2306 if (fViewer->GetActDesc()->fLocal ||
2307 (fViewer->GetActDesc()->fConnected &&
2308 fViewer->GetActDesc()->fAttached &&
2309 fViewer->GetActDesc()->fProof &&
2310 fViewer->GetActDesc()->fProof->IsValid())) {
2311 fViewer->GetQueryFrame()->GetTab()->SetTab(
"Status");
2312 fViewer->GetQueryFrame()->OnBtnSubmit();
2319 void TEditQueryFrame::SettingsChanged()
2322 if ((strcmp(fQuery->fSelectorString.Data(), fTxtSelector->GetText())) ||
2323 (strcmp(fQuery->fQueryName.Data(), fTxtQueryName->GetText())) ||
2324 (strcmp(fQuery->fOptions.Data(), fTxtOptions->GetText())) ||
2325 (fQuery->fNoEntries != fNumEntries->GetIntNumber()) ||
2326 (fQuery->fFirstEntry != fNumFirstEntry->GetIntNumber()) ||
2327 (fQuery->fChain != fChain)) {
2328 fViewer->GetQueryFrame()->Modified(kTRUE);
2331 fViewer->GetQueryFrame()->Modified(kFALSE);
2335 if ((fTxtQueryName->GetText()) &&
2336 ((fTxtQueryName->GetText()) ||
2337 (fTxtChain->GetText())))
2338 fViewer->GetQueryFrame()->Modified(kTRUE);
2340 fViewer->GetQueryFrame()->Modified(kFALSE);
2347 void TEditQueryFrame::UpdateFields(TQueryDescription *desc)
2351 fTxtChain->SetText(
"");
2353 fChain = desc->fChain;
2354 fTxtChain->SetText(desc->fTDSetString);
2356 fTxtQueryName->SetText(desc->fQueryName);
2357 fTxtSelector->SetText(desc->fSelectorString);
2358 fTxtOptions->SetText(desc->fOptions);
2359 fNumEntries->SetIntNumber(desc->fNoEntries);
2360 fNumFirstEntry->SetIntNumber(desc->fFirstEntry);
2361 fTxtEventList->SetText(desc->fEventList);
2370 TSessionQueryFrame::TSessionQueryFrame(TGWindow* p, Int_t w, Int_t h) :
2371 TGCompositeFrame(p, w, h), fBtnSubmit(0), fBtnFinalize(0), fBtnStop(0),
2372 fBtnAbort(0), fBtnShowLog(0), fBtnRetrieve(0), fBtnSave(0), fInfoTextView(0),
2373 fModified(0), fFiles(0), fFirst(0), fEntries(0), fPrevTotal(0),
2374 fPrevProcessed(0), fLabInfos(0), fLabStatus(0), fTotal(0), fRate(0),
2375 fStatus(kStopped), fTab(0), fFA(0), fFB(0), fFC(0), fFD(0), frmProg(0),
2376 fECanvas(0), fStatsCanvas(0), fViewer(0), fDesc(0)
2383 TSessionQueryFrame::~TSessionQueryFrame()
2391 void TSessionQueryFrame::Build(TSessionViewer *gui)
2393 SetLayoutManager(
new TGVerticalLayout(
this));
2394 SetCleanup(kDeepCleanup);
2395 fFirst = fEntries = fPrevTotal = 0;
2401 fTab =
new TGTab(
this, 200, 200);
2402 AddFrame(fTab,
new TGLayoutHints(kLHintsTop | kLHintsExpandX |
2403 kLHintsExpandY, 2, 2, 2, 2));
2406 TGCompositeFrame *tf = fTab->AddTab(
"Status");
2407 fFB =
new TGCompositeFrame(tf, 100, 100, kVerticalFrame);
2408 tf->AddFrame(fFB,
new TGLayoutHints(kLHintsTop | kLHintsLeft |
2409 kLHintsExpandX | kLHintsExpandY));
2412 TGCompositeFrame* frmcanvas =
new TGHorizontalFrame(fFB, 350, 100);
2414 TGCompositeFrame* frmBut2 =
new TGVerticalFrame(frmcanvas, 150, 100);
2415 fBtnSubmit =
new TGTextButton(frmBut2,
" Submit ");
2416 fBtnSubmit->SetToolTipText(
"Submit (process) selected query");
2417 frmBut2->AddFrame(fBtnSubmit,
new TGLayoutHints(kLHintsCenterY | kLHintsLeft |
2418 kLHintsExpandX, 5, 5, 5, 5));
2419 fBtnStop =
new TGTextButton(frmBut2,
"Stop");
2420 fBtnStop->SetToolTipText(
"Stop processing query");
2421 frmBut2->AddFrame(fBtnStop,
new TGLayoutHints(kLHintsCenterY | kLHintsLeft |
2422 kLHintsExpandX, 5, 5, 5, 5));
2423 fBtnAbort =
new TGTextButton(frmBut2,
"Abort");
2424 fBtnAbort->SetToolTipText(
"Abort processing query");
2425 frmBut2->AddFrame(fBtnAbort,
new TGLayoutHints(kLHintsCenterY | kLHintsLeft |
2426 kLHintsExpandX, 5, 5, 5, 5));
2427 frmcanvas->AddFrame(frmBut2,
new TGLayoutHints(kLHintsLeft | kLHintsCenterY |
2430 fECanvas =
new TRootEmbeddedCanvas(
"fECanvas", frmcanvas, 400, 150);
2431 fStatsCanvas = fECanvas->GetCanvas();
2432 fStatsCanvas->SetFillColor(10);
2433 fStatsCanvas->SetBorderMode(0);
2434 frmcanvas->AddFrame(fECanvas,
new TGLayoutHints(kLHintsExpandX | kLHintsExpandY,
2436 fFB->AddFrame(frmcanvas,
new TGLayoutHints(kLHintsLeft | kLHintsTop |
2437 kLHintsExpandX | kLHintsExpandY));
2440 fLabInfos =
new TGLabel(fFB,
" ");
2441 fFB->AddFrame(fLabInfos,
new TGLayoutHints(kLHintsLeft, 5, 5, 5, 5));
2443 fLabStatus =
new TGLabel(fFB,
" ");
2444 fFB->AddFrame(fLabStatus,
new TGLayoutHints(kLHintsLeft, 5, 5, 5, 5));
2447 frmProg =
new TGHProgressBar(fFB, TGProgressBar::kFancy, 350 - 20);
2448 frmProg->ShowPosition();
2449 frmProg->SetBarColor(
"green");
2450 fFB->AddFrame(frmProg,
new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
2452 fFB->AddFrame(fTotal =
new TGLabel(fFB,
2453 " Estimated time left : 0 sec (--- events of --- processed) "),
2454 new TGLayoutHints(kLHintsLeft, 5, 5, 5, 5));
2456 fFB->AddFrame(fRate =
new TGLabel(fFB,
2457 " Processing Rate : -- events/sec "),
2458 new TGLayoutHints(kLHintsLeft, 5, 5, 5, 5));
2461 tf = fTab->AddTab(
"Results");
2462 fFC =
new TGCompositeFrame(tf, 100, 100, kVerticalFrame);
2463 tf->AddFrame(fFC,
new TGLayoutHints(kLHintsTop | kLHintsLeft |
2464 kLHintsExpandX | kLHintsExpandY));
2466 fInfoTextView =
new TGTextView(fFC, 330, 185,
"", kSunkenFrame |
2468 fFC->AddFrame(fInfoTextView,
new TGLayoutHints(kLHintsTop | kLHintsLeft |
2469 kLHintsExpandY | kLHintsExpandX, 5, 5, 10, 10));
2472 TGCompositeFrame* frmBut3 =
new TGHorizontalFrame(fFC, 350, 100);
2473 fBtnRetrieve =
new TGTextButton(frmBut3,
"Retrieve");
2474 fBtnRetrieve->SetToolTipText(
"Retrieve query results");
2475 frmBut3->AddFrame(fBtnRetrieve,
new TGLayoutHints(kLHintsTop | kLHintsLeft |
2476 kLHintsExpandX, 5, 5, 10, 10));
2477 fBtnFinalize =
new TGTextButton(frmBut3,
"Finalize");
2478 fBtnFinalize->SetToolTipText(
"Finalize query");
2479 frmBut3->AddFrame(fBtnFinalize,
new TGLayoutHints(kLHintsTop | kLHintsLeft |
2480 kLHintsExpandX, 5, 5, 10, 10));
2481 fBtnShowLog =
new TGTextButton(frmBut3,
"Show Log");
2482 fBtnShowLog->SetToolTipText(
"Show query log (open log window)");
2483 frmBut3->AddFrame(fBtnShowLog,
new TGLayoutHints(kLHintsTop | kLHintsLeft |
2484 kLHintsExpandX, 5, 5, 10, 10));
2485 fFC->AddFrame(frmBut3,
new TGLayoutHints(kLHintsLeft | kLHintsTop | kLHintsExpandX));
2488 tf = fTab->AddTab(
"Edit Query");
2489 fFD =
new TEditQueryFrame(tf, 100, 100);
2490 fFD->Build(fViewer);
2491 tf->AddFrame(fFD,
new TGLayoutHints(kLHintsTop | kLHintsLeft, 5, 5, 10, 0));
2493 if (fViewer->GetActDesc()->fLocal ||
2494 (fViewer->GetActDesc()->fProof &&
2495 fViewer->GetActDesc()->fProof->IsValid())) {
2496 btntxt =
" Submit ";
2499 btntxt =
" Apply changes ";
2501 tf->AddFrame(fBtnSave =
new TGTextButton(tf, btntxt),
2502 new TGLayoutHints(kLHintsTop | kLHintsLeft, 10, 5, 25, 5));
2505 fBtnSave->Connect(
"Clicked()",
"TEditQueryFrame", fFD,
2507 fBtnSubmit->Connect(
"Clicked()",
"TSessionQueryFrame",
this,
2509 fBtnFinalize->Connect(
"Clicked()",
"TSessionQueryFrame",
this,
2511 fBtnStop->Connect(
"Clicked()",
"TSessionQueryFrame",
this,
2513 fBtnAbort->Connect(
"Clicked()",
"TSessionQueryFrame",
this,
2515 fBtnShowLog->Connect(
"Clicked()",
"TSessionQueryFrame",
this,
2517 fBtnRetrieve->Connect(
"Clicked()",
"TSessionQueryFrame",
this,
2526 void TSessionQueryFrame::Modified(Bool_t mod)
2530 fBtnSave->SetState(kButtonUp);
2533 fBtnSave->SetState(kButtonDisabled);
2535 if (fViewer->GetActDesc()->fLocal ||
2536 (fViewer->GetActDesc()->fProof &&
2537 fViewer->GetActDesc()->fProof->IsValid()))
2538 fBtnSave->SetState(kButtonUp);
2545 void TSessionQueryFrame::Feedback(TList *objs)
2548 if (!fViewer->GetActDesc()->fAttached)
2550 if (!fViewer->GetActDesc()->fProof)
2552 if ((fViewer->GetActDesc()->fActQuery) &&
2553 (fViewer->GetActDesc()->fActQuery->fStatus !=
2554 TQueryDescription::kSessionQuerySubmitted) &&
2555 (fViewer->GetActDesc()->fActQuery->fStatus !=
2556 TQueryDescription::kSessionQueryRunning) )
2558 TProof *sender =
dynamic_cast<TProof*
>((TQObject*)gTQSender);
2560 if (sender && (sender == fViewer->GetActDesc()->fProof))
2567 void TSessionQueryFrame::UpdateHistos(TList *objs)
2569 TVirtualPad *save = gPad;
2573 while (kFeedbackHistos[i]) {
2575 if (fViewer->GetCascadeMenu()->IsEntryChecked(41+i)) {
2576 if ( (o = objs->FindObject(kFeedbackHistos[i]))) {
2577 fStatsCanvas->cd(pos);
2578 gPad->SetEditable(kTRUE);
2579 if (TH1 *h = dynamic_cast<TH1*>(o)) {
2581 h->SetBarWidth(0.75);
2582 h->SetBarOffset(0.125);
2587 else if (TH2 *h2 = dynamic_cast<TH2*>(o)) {
2598 fStatsCanvas->Modified();
2599 fStatsCanvas->Update();
2610 void TSessionQueryFrame::Progress(Long64_t total, Long64_t processed)
2613 UInt_t hh=0, mm=0, ss=0;
2616 if (!fViewer->GetActDesc()->fProof)
2619 TProof *sender =
dynamic_cast<TProof*
>((TQObject*)gTQSender);
2620 if (!sender || (sender != fViewer->GetActDesc()->fProof))
2623 if ((fViewer->GetActDesc()->fActQuery) &&
2624 (fViewer->GetActDesc()->fActQuery->fStatus !=
2625 TQueryDescription::kSessionQuerySubmitted) &&
2626 (fViewer->GetActDesc()->fActQuery->fStatus !=
2627 TQueryDescription::kSessionQueryRunning) ) {
2628 fTotal->SetText(
" Estimated time left : 0 sec (0 events of 0 processed) ");
2629 fRate->SetText(
" Processing Rate : 0.0f events/sec ");
2641 if (fPrevProcessed == processed)
2646 if (fEntries != total) {
2647 buf.Form(
"PROOF cluster : \"%s\" - %d worker nodes",
2648 fViewer->GetActDesc()->fProof->GetMaster(),
2649 fViewer->GetActDesc()->fProof->GetParallel());
2650 fLabInfos->SetText(buf);
2653 buf.Form(
" %d files, %lld events, starting event %lld",
2654 fFiles, fEntries, fFirst);
2655 fLabStatus->SetText(buf);
2659 Float_t pos = (Float_t)((Double_t)(processed * 100)/(Double_t)total);
2660 frmProg->SetPosition(pos);
2663 fViewer->SetChangePic(kFALSE);
2664 fViewer->ChangeRightLogo(
"monitor01.xpm");
2668 if ((fViewer->GetActDesc()->fActQuery->fStatus ==
2669 TQueryDescription::kSessionQueryRunning) ||
2670 (fViewer->GetActDesc()->fActQuery->fStatus ==
2671 TQueryDescription::kSessionQuerySubmitted))
2672 fViewer->GetActDesc()->fActQuery->fEndTime = gSystem->Now();
2673 TTime tdiff = fViewer->GetActDesc()->fActQuery->fEndTime -
2674 fViewer->GetActDesc()->fActQuery->fStartTime;
2677 eta = ((Float_t)((Long64_t)tdiff)*total/Float_t(processed) -
2678 Long64_t(tdiff))/1000.;
2682 hh = (UInt_t)(tt / 3600);
2683 mm = (UInt_t)((tt % 3600) / 60);
2684 ss = (UInt_t)((tt % 3600) % 60);
2687 stm.Form(
"%d h %d min %d sec", hh, mm, ss);
2689 stm.Form(
"%d min %d sec", mm, ss);
2691 stm.Form(
"%d sec", ss);
2692 if (processed == total) {
2694 tt = (Long_t) Long64_t(tdiff)/1000;
2696 hh = (UInt_t)(tt / 3600);
2697 mm = (UInt_t)((tt % 3600) / 60);
2698 ss = (UInt_t)((tt % 3600) % 60);
2701 stm.Form(
"%d h %d min %d sec", hh, mm, ss);
2703 stm.Form(
"%d min %d sec", mm, ss);
2705 stm.Form(
"%d sec", ss);
2706 buf.Form(
" Processed : %lld events in %s", total, stm.Data());
2707 fTotal->SetText(buf.Data());
2710 buf.Form(
" Estimated time left : %s (%lld events of %lld processed) ",
2711 stm.Data(), processed, total);
2712 fTotal->SetText(buf.Data());
2714 if (processed > 0 && (Long64_t)tdiff > 0) {
2715 buf.Form(
" Processing Rate : %.1f events/sec ",
2716 (Float_t)processed/(Long64_t)tdiff*1000.);
2717 fRate->SetText(buf);
2719 fPrevProcessed = processed;
2728 void TSessionQueryFrame::Progress(Long64_t total, Long64_t processed,
2729 Long64_t , Float_t ,
2734 Progress(total, processed);
2740 void TSessionQueryFrame::ProgressLocal(Long64_t total, Long64_t processed)
2743 UInt_t hh=0, mm=0, ss=0;
2748 switch (fViewer->GetActDesc()->fActQuery->fStatus) {
2750 case TQueryDescription::kSessionQueryAborted:
2751 cproc =
" - ABORTED";
2754 case TQueryDescription::kSessionQueryStopped:
2755 cproc =
" - STOPPED";
2758 case TQueryDescription::kSessionQueryRunning:
2762 case TQueryDescription::kSessionQueryCompleted:
2763 case TQueryDescription::kSessionQueryFinalized:
2771 if (processed < 0) processed = 0;
2773 frmProg->SetBarColor(
"green");
2774 if (status == kAborted)
2775 frmProg->SetBarColor(
"red");
2776 else if (status == kStopped)
2777 frmProg->SetBarColor(
"yellow");
2778 else if (status == -1 ) {
2779 fTotal->SetText(
" Estimated time left : 0 sec (0 events of 0 processed) ");
2780 fRate->SetText(
" Processing Rate : 0.0f events/sec ");
2795 if (fEntries != total) {
2796 fLabInfos->SetText(
"Local Session");
2799 buf.Form(
" %d files, %lld events, starting event %lld",
2800 fFiles, fEntries, fFirst);
2801 fLabStatus->SetText(buf.Data());
2806 if (processed > 0 && total > 0)
2807 pos = (Float_t)((Double_t)(processed * 100)/(Double_t)total);
2808 frmProg->SetPosition(pos);
2811 fViewer->SetChangePic(kFALSE);
2812 fViewer->ChangeRightLogo(
"monitor01.xpm");
2816 if (status == kRunning)
2817 fViewer->GetActDesc()->fActQuery->fEndTime = gSystem->Now();
2818 TTime tdiff = fViewer->GetActDesc()->fActQuery->fEndTime -
2819 fViewer->GetActDesc()->fActQuery->fStartTime;
2822 eta = ((Float_t)((Long64_t)tdiff)*total/(Float_t)(processed) -
2823 (Long64_t)(tdiff))/1000.;
2827 hh = (UInt_t)(tt / 3600);
2828 mm = (UInt_t)((tt % 3600) / 60);
2829 ss = (UInt_t)((tt % 3600) % 60);
2832 stm = TString::Format(
"%d h %d min %d sec", hh, mm, ss);
2834 stm = TString::Format(
"%d min %d sec", mm, ss);
2836 stm = TString::Format(
"%d sec", ss);
2837 if ((processed != total) && (status == kRunning)) {
2839 buf.Form(
" Estimated time left : %s (%lld events of %lld processed) ",
2840 stm.Data(), processed, total);
2841 fTotal->SetText(buf);
2843 tt = (Long_t) Long64_t(tdiff)/1000;
2845 hh = (UInt_t)(tt / 3600);
2846 mm = (UInt_t)((tt % 3600) / 60);
2847 ss = (UInt_t)((tt % 3600) % 60);
2850 stm = TString::Format(
"%d h %d min %d sec", hh, mm, ss);
2852 stm = TString::Format(
"%d min %d sec", mm, ss);
2854 stm = TString::Format(
"%d sec", ss);
2855 buf.Form(
" Processed : %ld events in %s",
2856 (Long_t)processed, stm.Data());
2858 fTotal->SetText(buf.Data());
2860 if (processed > 0 && (Long64_t)tdiff > 0) {
2861 buf.Form(
" Processing Rate : %.1f events/sec ",
2862 (Float_t)processed/(Long64_t)tdiff*1000.);
2863 fRate->SetText(buf.Data());
2865 fPrevProcessed = processed;
2873 void TSessionQueryFrame::IndicateStop(Bool_t aborted)
2875 if (aborted == kTRUE) {
2877 frmProg->SetBarColor(
"red");
2881 frmProg->SetBarColor(
"yellow");
2884 if (fViewer->GetActDesc()->fProof &&
2885 fViewer->GetActDesc()->fProof->IsValid()) {
2886 fViewer->GetActDesc()->fProof->Disconnect(
"Progress(Long64_t,Long64_t)",
2887 this,
"Progress(Long64_t,Long64_t)");
2888 fViewer->GetActDesc()->fProof->Disconnect(
"Progress(Long64_t,Long64_t,Long64_t,Float_t,Float_t,Float_t,Float_t)",
2889 this,
"Progress(Long64_t,Long64_t,Long64_t,Float_t,Float_t,Float_t,Float_t)");
2890 fViewer->GetActDesc()->fProof->Disconnect(
"Progress(Long64_t,Long64_t,Long64_t,Float_t,Float_t,Float_t,Float_t,Int_t,Int_t,Float_t)",
2891 this,
"Progress(Long64_t,Long64_t,Long64_t,Float_t,Float_t,Float_t,Float_t,Int_t,Int_t,Float_t)");
2892 fViewer->GetActDesc()->fProof->Disconnect(
"StopProcess(Bool_t)",
this,
2893 "IndicateStop(Bool_t)");
2900 void TSessionQueryFrame::ResetProgressDialog(
const char * , Int_t files,
2901 Long64_t first, Long64_t entries)
2904 fFiles = files > 0 ? files : 0;
2910 if (!fViewer->GetActDesc()->fLocal) {
2911 frmProg->SetBarColor(
"green");
2915 buf.Form(
"%0d files, %0lld events, starting event %0lld",
2916 fFiles > 0 ? fFiles : 0, fEntries > 0 ? fEntries : 0,
2917 fFirst >= 0 ? fFirst : 0);
2918 fLabStatus->SetText(buf.Data());
2920 if (fViewer->GetActDesc()->fProof &&
2921 fViewer->GetActDesc()->fProof->IsValid()) {
2922 fViewer->GetActDesc()->fProof->Connect(
"Progress(Long64_t,Long64_t)",
2923 "TSessionQueryFrame",
this,
"Progress(Long64_t,Long64_t)");
2924 fViewer->GetActDesc()->fProof->Connect(
"Progress(Long64_t,Long64_t,Long64_t,Float_t,Float_t,Float_t,Float_t)",
2925 "TSessionQueryFrame",
this,
2926 "Progress(Long64_t,Long64_t,Long64_t,Float_t,Float_t,Float_t,Float_t)");
2927 fViewer->GetActDesc()->fProof->Connect(
"StopProcess(Bool_t)",
2928 "TSessionQueryFrame",
this,
"IndicateStop(Bool_t)");
2929 buf.Form(
"PROOF cluster : \"%s\" - %d worker nodes",
2930 fViewer->GetActDesc()->fProof->GetMaster(),
2931 fViewer->GetActDesc()->fProof->GetParallel());
2932 fLabInfos->SetText(buf.Data());
2934 else if (fViewer->GetActDesc()->fLocal) {
2935 fStatsCanvas->Clear();
2936 fLabInfos->SetText(
"Local Session");
2937 fLabStatus->SetText(
" ");
2940 fLabInfos->SetText(
" ");
2941 fLabStatus->SetText(
" ");
2949 void TSessionQueryFrame::OnBtnFinalize()
2952 if (fViewer->GetActDesc()->fProof &&
2953 fViewer->GetActDesc()->fProof->IsValid()) {
2954 gPad->SetEditable(kFALSE);
2955 TGListTreeItem *item = fViewer->GetSessionHierarchy()->GetSelected();
2957 TObject *obj = (TObject *)item->GetUserData();
2958 if ((obj) && (obj->IsA() == TQueryDescription::Class())) {
2960 gVirtualX->SetCursor(GetId(),gVirtualX->CreateCursor(kWatch));
2961 TQueryDescription *query = (TQueryDescription *)obj;
2962 fViewer->GetActDesc()->fProof->Finalize(query->fReference);
2963 UpdateButtons(query);
2965 gVirtualX->SetCursor(GetId(), 0);
2968 if (fViewer->GetActDesc()->fLocal) {
2969 gPad->SetEditable(kFALSE);
2970 TChain *chain = (TChain *)fViewer->GetActDesc()->fActQuery->fChain;
2972 ((TTreePlayer *)(chain->GetPlayer()))->GetSelectorFromFile()->Terminate();
2979 void TSessionQueryFrame::OnBtnStop()
2982 if (fViewer->GetActDesc()->fProof &&
2983 fViewer->GetActDesc()->fProof->IsValid()) {
2984 fViewer->GetActDesc()->fProof->StopProcess(kFALSE);
2986 if (fViewer->GetActDesc()->fLocal) {
2987 gROOT->SetInterrupt();
2988 fViewer->GetActDesc()->fActQuery->fStatus =
2989 TQueryDescription::kSessionQueryStopped;
2992 fViewer->ChangeRightLogo(
"monitor01.xpm");
2993 fViewer->SetChangePic(kFALSE);
2999 void TSessionQueryFrame::OnBtnShowLog()
3001 TGListTreeItem *item = fViewer->GetSessionHierarchy()->GetSelected();
3003 TObject *obj = (TObject *)item->GetUserData();
3004 if ((!obj) || (obj->IsA() != TQueryDescription::Class()))
3006 TQueryDescription *query = (TQueryDescription *)obj;
3007 fViewer->ShowLog(query->fReference.Data());
3013 void TSessionQueryFrame::OnBtnRetrieve()
3016 if (fViewer->GetActDesc()->fAttached &&
3017 fViewer->GetActDesc()->fProof &&
3018 fViewer->GetActDesc()->fProof->IsValid()) {
3019 TGListTreeItem *item = fViewer->GetSessionHierarchy()->GetSelected();
3021 TObject *obj = (TObject *)item->GetUserData();
3022 if (obj && obj->IsA() == TQueryDescription::Class()) {
3024 gVirtualX->SetCursor(GetId(), gVirtualX->CreateCursor(kWatch));
3025 TQueryDescription *query = (TQueryDescription *)obj;
3026 Int_t rc = fViewer->GetActDesc()->fProof->Retrieve(query->fReference);
3028 fViewer->OnCascadeMenu();
3030 gVirtualX->SetCursor(GetId(), 0);
3033 if (fViewer->GetActDesc()->fLocal) {
3034 TGListTreeItem *item=0, *item2=0;
3035 item = fViewer->GetSessionHierarchy()->FindItemByObj(fViewer->GetSessionItem(),
3036 fViewer->GetActDesc());
3038 item2 = fViewer->GetSessionHierarchy()->FindItemByObj(item,
3039 fViewer->GetActDesc()->fActQuery);
3043 TChain *chain = (TChain *)fViewer->GetActDesc()->fActQuery->fChain;
3045 TSelector *selector = ((TTreePlayer *)(chain->GetPlayer()))->GetSelectorFromFile();
3047 TList *objlist = selector->GetOutputList();
3049 if (!fViewer->GetSessionHierarchy()->FindChildByName(item2,
"OutputList"))
3050 fViewer->GetSessionHierarchy()->AddItem(item2,
"OutputList");
3055 fViewer->GetSessionHierarchy()->ClearViewPort();
3056 fClient->NeedRedraw(fViewer->GetSessionHierarchy());
3058 UpdateButtons(fViewer->GetActDesc()->fActQuery);
3065 void TSessionQueryFrame::OnBtnAbort()
3068 if (fViewer->GetActDesc()->fProof &&
3069 fViewer->GetActDesc()->fProof->IsValid()) {
3070 fViewer->GetActDesc()->fProof->StopProcess(kTRUE);
3072 if (fViewer->GetActDesc()->fLocal) {
3073 gROOT->SetInterrupt();
3074 fViewer->GetActDesc()->fActQuery->fStatus =
3075 TQueryDescription::kSessionQueryAborted;
3078 fViewer->ChangeRightLogo(
"monitor01.xpm");
3079 fViewer->SetChangePic(kFALSE);
3085 void TSessionQueryFrame::OnBtnSubmit()
3089 TGListTreeItem *item = fViewer->GetSessionHierarchy()->GetSelected();
3092 TObject *obj = (TObject *)item->GetUserData();
3093 if (!obj || obj->IsA() != TQueryDescription::Class())
3095 TQueryDescription *newquery = (TQueryDescription *)obj;
3097 ResetProgressDialog(newquery->fSelectorString,
3098 newquery->fNbFiles, newquery->fFirstEntry, newquery->fNoEntries);
3100 newquery->fStartTime = gSystem->Now();
3101 fViewer->GetActDesc()->fNbHistos = 0;
3103 if (fViewer->GetActDesc()->fProof &&
3104 fViewer->GetActDesc()->fProof->IsValid()) {
3105 fViewer->GetActDesc()->fProof->SetBit(TProof::kUsingSessionGui);
3107 newquery->fStatus = TQueryDescription::kSessionQuerySubmitted;
3109 if (fViewer->GetOptionsMenu()->IsEntryChecked(kOptionsFeedback)) {
3112 while (kFeedbackHistos[i]) {
3113 if (fViewer->GetCascadeMenu()->IsEntryChecked(41+i)) {
3114 fViewer->GetActDesc()->fProof->AddFeedback(kFeedbackHistos[i]);
3115 fViewer->GetActDesc()->fNbHistos++;
3120 fViewer->GetActDesc()->fProof->Connect(
"Feedback(TList *objs)",
3121 "TSessionQueryFrame", fViewer->GetQueryFrame(),
3122 "Feedback(TList *objs)");
3127 fViewer->GetActDesc()->fProof->ClearFeedback();
3130 fViewer->GetActDesc()->fProof->cd();
3132 if (newquery->fChain) {
3133 if (fViewer->GetActDesc()->fProof->IsLite()) {
3134 newquery->fOptions =
"";
3137 newquery->fReference= TString::Format(
"session-%s:q%d",
3138 fViewer->GetActDesc()->fProof->GetSessionTag(),
3139 fViewer->GetActDesc()->fProof->GetSeqNum()+1);
3140 if (newquery->fChain->IsA() == TChain::Class()) {
3142 newquery->fStatus = TQueryDescription::kSessionQuerySubmitted;
3143 ((TChain *)newquery->fChain)->SetProof(fViewer->GetActDesc()->fProof);
3144 id = ((TChain *)newquery->fChain)->Process(newquery->fSelectorString,
3146 newquery->fNoEntries > 0 ? newquery->fNoEntries : 1234567890,
3147 newquery->fFirstEntry);
3149 else if (newquery->fChain->IsA() == TDSet::Class()) {
3151 newquery->fStatus = TQueryDescription::kSessionQuerySubmitted;
3152 id = ((TDSet *)newquery->fChain)->Process(newquery->fSelectorString,
3154 newquery->fNoEntries,
3155 newquery->fFirstEntry);
3159 Error(
"Submit",
"No TChain defined; skipping");
3160 newquery->fStatus = TQueryDescription::kSessionQueryCreated;
3164 newquery->fReference= TString::Format(
"session-%s:q%lld",
3165 fViewer->GetActDesc()->fProof->GetSessionTag(), id);
3167 fViewer->SetChangePic(kTRUE);
3169 else if (fViewer->GetActDesc()->fLocal) {
3171 if (fViewer->GetOptionsMenu()->IsEntryChecked(kOptionsFeedback)) {
3174 while (kFeedbackHistos[i]) {
3175 if (fViewer->GetCascadeMenu()->IsEntryChecked(41+i)) {
3176 fViewer->GetActDesc()->fNbHistos++;
3181 if (newquery->fChain) {
3182 if (newquery->fChain->IsA() == TChain::Class()) {
3184 newquery->fStatus = TQueryDescription::kSessionQueryRunning;
3185 fViewer->EnableTimer();
3186 UpdateButtons(newquery);
3187 gPad->SetEditable(kFALSE);
3188 ((TChain *)newquery->fChain)->SetTimerInterval(100);
3189 id = ((TChain *)newquery->fChain)->Process(newquery->fSelectorString,
3191 newquery->fNoEntries > 0 ? newquery->fNoEntries : 1234567890,
3192 newquery->fFirstEntry);
3193 ((TChain *)newquery->fChain)->SetTimerInterval(0);
3195 TChain *chain = (TChain *)newquery->fChain;
3196 ProgressLocal(chain->GetEntries(),
3197 chain->GetReadEntry()+1);
3198 if ((newquery->fStatus != TQueryDescription::kSessionQueryAborted) &&
3199 (newquery->fStatus != TQueryDescription::kSessionQueryStopped))
3200 newquery->fStatus = TQueryDescription::kSessionQueryCompleted;
3201 UpdateButtons(newquery);
3204 new TGMsgBox(fClient->GetRoot(),
this,
"Error Submitting Query",
3205 "Only TChains are allowed in Local Session (no TDSet) !",
3206 kMBIconExclamation,kMBOk,&retval);
3210 Error(
"Submit",
"No TChain defined; skipping");
3211 newquery->fStatus = TQueryDescription::kSessionQueryCreated;
3215 newquery->fReference = TString::Format(
"local-session-%s:q%lld", newquery->fQueryName.Data(), id);
3218 UpdateButtons(newquery);
3224 void TSessionQueryFrame::UpdateButtons(TQueryDescription *desc)
3226 TGListTreeItem *item = fViewer->GetSessionHierarchy()->GetSelected();
3229 TObject *obj = (TObject *)item->GetUserData();
3230 if (!obj || obj->IsA() != TQueryDescription::Class())
3232 TQueryDescription *query = (TQueryDescription *)obj;
3233 if (desc != query)
return;
3235 Bool_t submit_en = kFALSE;
3236 if ((fViewer->GetActDesc()->fProof &&
3237 fViewer->GetActDesc()->fProof->IsValid()) ||
3238 fViewer->GetActDesc()->fLocal)
3241 switch (desc->fStatus) {
3242 case TQueryDescription::kSessionQueryFromProof:
3243 fBtnSubmit->SetEnabled(submit_en);
3244 fBtnFinalize->SetEnabled(kTRUE);
3245 fBtnStop->SetEnabled(kFALSE);
3246 fBtnAbort->SetEnabled(kFALSE);
3247 fBtnShowLog->SetEnabled(kTRUE);
3248 fBtnRetrieve->SetEnabled(kTRUE);
3251 case TQueryDescription::kSessionQueryCompleted:
3252 fBtnSubmit->SetEnabled(submit_en);
3253 fBtnFinalize->SetEnabled(kTRUE);
3254 if (((desc->fResult == 0) || (desc->fResult &&
3255 (desc->fResult->IsFinalized() ||
3256 (desc->fResult->GetInputObject(
"TDSet") == 0)))) &&
3257 !(fViewer->GetActDesc()->fLocal))
3258 fBtnFinalize->SetEnabled(kFALSE);
3259 fBtnStop->SetEnabled(kFALSE);
3260 fBtnAbort->SetEnabled(kFALSE);
3261 fBtnShowLog->SetEnabled(kTRUE);
3262 fBtnRetrieve->SetEnabled(kTRUE);
3265 case TQueryDescription::kSessionQueryCreated:
3266 fBtnSubmit->SetEnabled(submit_en);
3267 fBtnFinalize->SetEnabled(kFALSE);
3268 fBtnStop->SetEnabled(kFALSE);
3269 fBtnAbort->SetEnabled(kFALSE);
3270 fBtnShowLog->SetEnabled(kTRUE);
3271 fBtnRetrieve->SetEnabled(kFALSE);
3274 case TQueryDescription::kSessionQuerySubmitted:
3275 fBtnSubmit->SetEnabled(kFALSE);
3276 fBtnFinalize->SetEnabled(kFALSE);
3277 fBtnStop->SetEnabled(kTRUE);
3278 fBtnAbort->SetEnabled(kTRUE);
3279 fBtnShowLog->SetEnabled(kTRUE);
3280 fBtnRetrieve->SetEnabled(kFALSE);
3283 case TQueryDescription::kSessionQueryRunning:
3284 fBtnSubmit->SetEnabled(kFALSE);
3285 fBtnFinalize->SetEnabled(kFALSE);
3286 fBtnStop->SetEnabled(kTRUE);
3287 fBtnAbort->SetEnabled(kTRUE);
3288 fBtnShowLog->SetEnabled(kTRUE);
3289 fBtnRetrieve->SetEnabled(kFALSE);
3292 case TQueryDescription::kSessionQueryStopped:
3293 fBtnSubmit->SetEnabled(submit_en);
3294 fBtnFinalize->SetEnabled(kTRUE);
3295 fBtnStop->SetEnabled(kFALSE);
3296 fBtnAbort->SetEnabled(kFALSE);
3297 fBtnShowLog->SetEnabled(kTRUE);
3298 fBtnRetrieve->SetEnabled(kTRUE);
3301 case TQueryDescription::kSessionQueryAborted:
3302 fBtnSubmit->SetEnabled(submit_en);
3303 fBtnFinalize->SetEnabled(kFALSE);
3304 fBtnStop->SetEnabled(kFALSE);
3305 fBtnAbort->SetEnabled(kFALSE);
3306 fBtnShowLog->SetEnabled(kTRUE);
3307 fBtnRetrieve->SetEnabled(kFALSE);
3310 case TQueryDescription::kSessionQueryFinalized:
3311 fBtnSubmit->SetEnabled(submit_en);
3312 fBtnFinalize->SetEnabled(kFALSE);
3313 fBtnStop->SetEnabled(kFALSE);
3314 fBtnAbort->SetEnabled(kFALSE);
3315 fBtnShowLog->SetEnabled(kTRUE);
3316 fBtnRetrieve->SetEnabled(kFALSE);
3322 if (fViewer->GetActDesc()->fLocal &&
3323 !(fViewer->GetActDesc()->fActQuery->fChain)) {
3324 fBtnFinalize->SetEnabled(kFALSE);
3325 fBtnRetrieve->SetEnabled(kFALSE);
3332 void TSessionQueryFrame::UpdateInfos()
3335 const char *qst[] = {
"aborted ",
"submitted",
"running ",
3336 "stopped ",
"completed"};
3338 if (fViewer->GetActDesc()->fActQuery)
3339 fFD->UpdateFields(fViewer->GetActDesc()->fActQuery);
3341 if (fViewer->GetActDesc()->fLocal ||
3342 (fViewer->GetActDesc()->fConnected &&
3343 fViewer->GetActDesc()->fAttached &&
3344 fViewer->GetActDesc()->fProof &&
3345 fViewer->GetActDesc()->fProof->IsValid())) {
3346 fBtnSave->SetText(
" Submit ");
3349 fBtnSave->SetText(
" Apply changes ");
3351 fClient->NeedRedraw(fBtnSave);
3352 fInfoTextView->Clear();
3353 if (!fViewer->GetActDesc()->fActQuery ||
3354 !fViewer->GetActDesc()->fActQuery->fResult) {
3355 ResetProgressDialog(
"", 0, 0, 0);
3356 if (fViewer->GetActDesc()->fLocal) {
3357 if (fViewer->GetActDesc()->fActQuery) {
3358 TChain *chain = (TChain *)fViewer->GetActDesc()->fActQuery->fChain;
3360 ProgressLocal(chain->GetEntries(),
3361 chain->GetReadEntry()+1);
3364 ProgressLocal(0, 0);
3366 UpdateButtons(fViewer->GetActDesc()->fActQuery);
3370 fTotal->SetText(
" Estimated time left : 0 sec (0 events of 0 processed) ");
3371 fRate->SetText(
" Processing Rate : 0.0f events/sec ");
3377 TQueryResult *result = fViewer->GetActDesc()->fActQuery->fResult;
3380 Int_t st = (result->GetStatus() > 0 && result->GetStatus() <=
3381 TQueryResult::kCompleted) ? result->GetStatus() : 0;
3383 Int_t qry = result->GetSeqNum();
3385 buffer = TString::Format(
"------------------------------------------------------\n");
3387 if (!result->IsDraw()) {
3388 const char *fin = result->IsFinalized() ?
"finalized" : qst[st];
3389 const char *arc = result->IsArchived() ?
"(A)" :
"";
3390 buffer = TString::Format(
" Query No : %d\n", qry);
3391 buffer += TString::Format(
" Ref : \"%s:%s\"\n", result->GetTitle(),
3393 buffer += TString::Format(
" Selector : %s\n",
3394 result->GetSelecImp()->GetTitle());
3395 buffer += TString::Format(
"Status : %9s%s\n", fin, arc);
3396 buffer += TString::Format(
"------------------------------------------------------\n");
3398 buffer += TString::Format(
" Query No : %d\n", qry);
3399 buffer += TString::Format(
" Ref : \"%s:%s\"\n", result->GetTitle(),
3401 buffer += TString::Format(
" Selector : %s\n",
3402 result->GetSelecImp()->GetTitle());
3403 buffer += TString::Format(
"------------------------------------------------------\n");
3407 Int_t elapsed = (Int_t)(result->GetEndTime().Convert() -
3408 result->GetStartTime().Convert());
3409 buffer += TString::Format(
" Started : %s\n",
3410 result->GetStartTime().AsString());
3411 buffer += TString::Format(
" Real time : %d sec (CPU time: %.1f sec)\n",
3412 elapsed, result->GetUsedCPU());
3415 Double_t rate = 0.0;
3416 if (result->GetEntries() > -1 && elapsed > 0)
3417 rate = result->GetEntries() / (Double_t)elapsed ;
3418 Float_t size = ((Float_t)result->GetBytes())/(1024*1024);
3419 buffer += TString::Format(
" Processed : %lld events (size: %.3f MBs)\n",
3420 result->GetEntries(), size);
3421 buffer += TString::Format(
" Rate : %.1f evts/sec\n", rate);
3424 if (strlen(result->GetParList()) > 1) {
3425 buffer += TString::Format(
" Packages : %s\n", result->GetParList());
3429 TString res = result->GetResultFile();
3430 if (!result->IsArchived()) {
3431 Int_t dq = res.Index(
"queries");
3433 res.Remove(0,res.Index(
"queries"));
3434 res.Insert(0,
"<PROOF_SandBox>/");
3436 if (res.BeginsWith(
"-")) {
3437 res = (result->GetStatus() == TQueryResult::kAborted) ?
3438 "not available" :
"sent to client";
3441 if (res.Length() > 1) {
3442 buffer += TString::Format(
"------------------------------------------------------\n");
3443 buffer += TString::Format(
" Results : %s\n", res.Data());
3446 if (result->GetOutputList() && result->GetOutputList()->GetSize() > 0) {
3447 buffer += TString::Format(
" Outlist : %d objects\n",
3448 result->GetOutputList()->GetSize());
3449 buffer += TString::Format(
"------------------------------------------------------\n");
3451 fInfoTextView->LoadBuffer(buffer.Data());
3454 if (result->GetStatus() == TQueryResult::kAborted)
3455 frmProg->SetBarColor(
"red");
3456 else if (result->GetStatus() == TQueryResult::kStopped)
3457 frmProg->SetBarColor(
"yellow");
3459 frmProg->SetBarColor(
"green");
3461 frmProg->SetPosition(100.0);
3463 buffer = TString::Format(
" Processed : %lld events in %.1f sec", result->GetEntries(),
3465 fTotal->SetText(buffer.Data());
3466 buffer = TString::Format(
" Processing Rate : %.1f events/sec ", rate);
3467 fRate->SetText(buffer.Data());
3477 TSessionOutputFrame::TSessionOutputFrame(TGWindow* p, Int_t w, Int_t h) :
3478 TGCompositeFrame(p, w, h), fEntryTmp(0), fLVContainer(0), fViewer(0)
3485 TSessionOutputFrame::~TSessionOutputFrame()
3487 delete fLVContainer;
3495 void TSessionOutputFrame::Build(TSessionViewer *gui)
3498 SetLayoutManager(
new TGVerticalLayout(
this));
3499 SetCleanup(kDeepCleanup);
3502 TGListView *frmListView =
new TGListView(
this, 340, 190);
3503 fLVContainer =
new TGLVContainer(frmListView, kSunkenFrame, GetWhitePixel());
3504 fLVContainer->Associate(frmListView);
3505 fLVContainer->SetCleanup(kDeepCleanup);
3506 AddFrame(frmListView,
new TGLayoutHints(kLHintsExpandX | kLHintsExpandY,
3509 frmListView->Connect(
"Clicked(TGLVEntry*, Int_t, Int_t, Int_t)",
3510 "TSessionOutputFrame",
this,
3511 "OnElementClicked(TGLVEntry* ,Int_t, Int_t, Int_t)");
3512 frmListView->Connect(
"DoubleClicked(TGLVEntry*, Int_t, Int_t, Int_t)",
3513 "TSessionOutputFrame",
this,
3514 "OnElementDblClicked(TGLVEntry* ,Int_t, Int_t, Int_t)");
3520 void TSessionOutputFrame::OnElementClicked(TGLVEntry* entry, Int_t btn, Int_t x,
3523 TObject *obj = (TObject *)entry->GetUserData();
3524 if ((obj) && (btn ==3)) {
3526 fViewer->GetContextMenu()->Popup(x, y, obj, (TBrowser *)0);
3533 void TSessionOutputFrame::OnElementDblClicked(TGLVEntry* entry, Int_t , Int_t, Int_t)
3537 TObject *obj = (TObject *)entry->GetUserData();
3539 TString ext = obj->GetName();
3540 gPad->SetEditable(kFALSE);
3542 if (fClient->GetMimeTypeList()->GetAction(obj->IsA()->GetName(), action)) {
3543 act = TString::Format(
"((%s*)0x%lx)%s", obj->IsA()->GetName(), (Long_t)obj, action);
3544 if (act[0] ==
'!') {
3546 gSystem->Exec(act.Data());
3549 if (!act.Contains(
"Browse"))
3550 gROOT->ProcessLine(act.Data());
3558 void TSessionOutputFrame::AddObject(TObject *obj)
3562 item =
new TGLVEntry(fLVContainer, obj->GetName(), obj->IsA()->GetName());
3563 item->SetUserData(obj);
3564 fLVContainer->AddItem(item);
3574 TSessionInputFrame::TSessionInputFrame(TGWindow* p, Int_t w, Int_t h) :
3575 TGCompositeFrame(p, w, h), fViewer(0), fLVContainer(0)
3582 TSessionInputFrame::~TSessionInputFrame()
3584 delete fLVContainer;
3592 void TSessionInputFrame::Build(TSessionViewer *gui)
3595 SetLayoutManager(
new TGVerticalLayout(
this));
3596 SetCleanup(kDeepCleanup);
3599 TGListView *frmListView =
new TGListView(
this, 340, 190);
3600 fLVContainer =
new TGLVContainer(frmListView, kSunkenFrame, GetWhitePixel());
3601 fLVContainer->Associate(frmListView);
3602 fLVContainer->SetCleanup(kDeepCleanup);
3603 AddFrame(frmListView,
new TGLayoutHints(kLHintsExpandX | kLHintsExpandY,
3610 void TSessionInputFrame::AddObject(TObject *obj)
3614 item =
new TGLVEntry(fLVContainer, obj->GetName(), obj->IsA()->GetName());
3615 item->SetUserData(obj);
3616 fLVContainer->AddItem(item);
3626 TSessionViewer::TSessionViewer(
const char *name, UInt_t w, UInt_t h) :
3627 TGMainFrame(gClient->GetRoot(), w, h), fSessionHierarchy(0), fSessionItem(0)
3634 SetWindowName(name);
3636 gSessionViewer =
this;
3642 TSessionViewer::TSessionViewer(
const char *name, Int_t x, Int_t y, UInt_t w,
3643 UInt_t h) : TGMainFrame(gClient->GetRoot(), w, h),
3644 fSessionHierarchy(0), fSessionItem(0)
3651 SetWindowName(name);
3654 gSessionViewer =
this;
3662 void TSessionViewer::ReadConfiguration(
const char *filename)
3666 fViewerEnv =
new TEnv();
3668 const char *fn = (filename && strlen(filename)) ? filename : fConfigFile.Data();
3670 fViewerEnv->ReadFile(fn, kEnvUser);
3672 Bool_t bval = (Bool_t)fViewerEnv->GetValue(
"Option.Feedback", 1);
3674 fOptionsMenu->CheckEntry(kOptionsFeedback);
3676 fOptionsMenu->UnCheckEntry(kOptionsFeedback);
3678 bval = (Bool_t)fViewerEnv->GetValue(
"Option.MasterHistos", 1);
3680 fOptionsMenu->CheckEntry(kOptionsStatsHist);
3681 gEnv->SetValue(
"Proof.StatsHist", 1);
3684 fOptionsMenu->UnCheckEntry(kOptionsStatsHist);
3685 gEnv->SetValue(
"Proof.StatsHist", 0);
3687 bval = (Bool_t)fViewerEnv->GetValue(
"Option.MasterEvents", 0);
3689 fOptionsMenu->CheckEntry(kOptionsStatsTrace);
3691 fOptionsMenu->UnCheckEntry(kOptionsStatsTrace);
3692 bval = (Bool_t)fViewerEnv->GetValue(
"Option.WorkerEvents", 0);
3694 fOptionsMenu->CheckEntry(kOptionsSlaveStatsTrace);
3696 fOptionsMenu->UnCheckEntry(kOptionsSlaveStatsTrace);
3699 while (kFeedbackHistos[i]) {
3700 bval = (Bool_t)fViewerEnv->GetValue(Form(
"Option.%s",kFeedbackHistos[i]),
3703 fCascadeMenu->CheckEntry(41+i);
3705 fCascadeMenu->UnCheckEntry(41+i);
3708 TSessionDescription *proofDesc;
3709 fSessions->Delete();
3711 fSessionHierarchy->DeleteChildren(fSessionItem);
3713 fSessionItem = fSessionHierarchy->AddItem(0,
"Sessions", fBaseIcon,
3716 TGListTreeItem *item = fSessionHierarchy->AddItem(fSessionItem,
"Local",
3718 fSessionHierarchy->SetToolTipItem(item,
"Local Session");
3719 TSessionDescription *localdesc =
new TSessionDescription();
3720 localdesc->fTag =
"";
3721 localdesc->fName =
"Local";
3722 localdesc->fAddress =
"Local";
3723 localdesc->fPort = 0;
3724 localdesc->fConfigFile =
"";
3725 localdesc->fLogLevel = 0;
3726 localdesc->fUserName =
"";
3727 localdesc->fQueries =
new TList();
3728 localdesc->fPackages =
new TList();
3729 localdesc->fActQuery = 0;
3730 localdesc->fProof = 0;
3731 localdesc->fProofMgr = 0;
3732 localdesc->fAttached = kFALSE;
3733 localdesc->fConnected = kFALSE;
3734 localdesc->fLocal = kTRUE;
3735 localdesc->fSync = kTRUE;
3736 localdesc->fAutoEnable = kFALSE;
3737 localdesc->fNbHistos = 0;
3738 item->SetUserData(localdesc);
3739 fSessions->Add((TObject *)localdesc);
3740 fActDesc = localdesc;
3743 gSystem->GetSysInfo(&info);
3746 if (!info.fOS.Contains(
"Microsoft") && info.fCpus > 1) {
3748 item = fSessionHierarchy->AddItem(fSessionItem,
"Lite",
3749 fProofDiscon, fProofDiscon);
3750 fSessionHierarchy->SetToolTipItem(item,
"PROOF Lite");
3751 TSessionDescription *litedesc =
new TSessionDescription();
3752 litedesc->fTag =
"";
3753 litedesc->fName =
"PROOF Lite";
3754 litedesc->fAddress =
"lite://";
3755 litedesc->fPort = 0;
3756 litedesc->fConfigFile =
"";
3757 litedesc->fLogLevel = 0;
3758 litedesc->fUserName =
"";
3759 litedesc->fQueries =
new TList();
3760 litedesc->fPackages =
new TList();
3761 litedesc->fActQuery = 0;
3762 litedesc->fProof = 0;
3763 litedesc->fProofMgr = 0;
3764 litedesc->fAttached = kFALSE;
3765 litedesc->fConnected = kFALSE;
3766 litedesc->fLocal = kFALSE;
3767 litedesc->fSync = kTRUE;
3768 litedesc->fAutoEnable = kFALSE;
3769 litedesc->fNbHistos = 0;
3770 item->SetUserData(litedesc);
3771 fSessions->Add((TObject *)litedesc);
3772 fActDesc = litedesc;
3774 TIter next(fViewerEnv->GetTable());
3776 while ((er = (TEnvRec*) next())) {
3778 if ((s = strstr(er->GetName(),
"SessionDescription."))) {
3779 const char *val = fViewerEnv->GetValue(s, (
const char*)0);
3782 char *v = StrDup(val);
3785 TString name = strtok(!cnt ? v : 0,
";");
3786 if (name.IsNull())
break;
3787 TString sessiontag = strtok(0,
";");
3788 TString address = strtok(0,
";");
3789 if (address.IsNull())
break;
3790 TString port = strtok(0,
";");
3791 if (port.IsNull())
break;
3792 TString loglevel = strtok(0,
";");
3793 if (loglevel.IsNull())
break;
3794 TString configfile = strtok(0,
";");
3795 TString user = strtok(0,
";");
3796 if (user.IsNull())
break;
3797 TString sync = strtok(0,
";");
3798 TString autoen = strtok(0,
";");
3801 proofDesc =
new TSessionDescription();
3802 proofDesc->fTag = sessiontag.Length() > 2 ? sessiontag.Data() :
"";
3803 proofDesc->fName = name;
3804 proofDesc->fAddress = address;
3805 proofDesc->fPort = atoi(port);
3806 proofDesc->fConfigFile = configfile.Length() > 2 ? configfile.Data() :
"";
3807 proofDesc->fLogLevel = atoi(loglevel);
3808 proofDesc->fConnected = kFALSE;
3809 proofDesc->fAttached = kFALSE;
3810 proofDesc->fLocal = kFALSE;
3811 proofDesc->fQueries =
new TList();
3812 proofDesc->fPackages =
new TList();
3813 proofDesc->fActQuery = 0;
3814 proofDesc->fProof = 0;
3815 proofDesc->fProofMgr = 0;
3816 proofDesc->fSync = (Bool_t)(atoi(sync));
3817 proofDesc->fAutoEnable = (Bool_t)(atoi(autoen));
3818 proofDesc->fUserName = user;
3819 fSessions->Add((TObject *)proofDesc);
3820 item = fSessionHierarchy->AddItem(
3821 fSessionItem, proofDesc->fName.Data(),
3822 fProofDiscon, fProofDiscon);
3823 fSessionHierarchy->SetToolTipItem(item,
"Proof Session");
3824 item->SetUserData(proofDesc);
3825 fActDesc = proofDesc;
3831 if ((s = strstr(er->GetName(),
"QueryDescription."))) {
3832 const char *val = fViewerEnv->GetValue(s, (
const char*)0);
3835 char *v = StrDup(val);
3839 TString status = strtok(!cnt ? v : 0,
";");
3840 if (status.IsNull())
break;
3842 TString reference = strtok(0,
";");
3843 if (reference.IsNull())
break;
3844 TString queryname = strtok(0,
";");
3845 if (queryname.IsNull())
break;
3846 TString selector = strtok(0,
";");
3847 if (selector.IsNull())
break;
3848 TString dset = strtok(0,
";");
3849 TString options = strtok(0,
";");
3850 TString eventlist = strtok(0,
";");
3851 TString nbfiles = strtok(0,
";");
3852 TString nbentries = strtok(0,
";");
3853 TString firstentry = strtok(0,
";");
3855 TQueryDescription *newquery =
new TQueryDescription();
3857 (TQueryDescription::ESessionQueryStatus)(atoi(status));
3858 newquery->fSelectorString = selector.Length() > 2 ? selector.Data() :
"";
3859 newquery->fReference = reference.Length() > 2 ? reference.Data() :
"";
3860 newquery->fTDSetString = dset.Length() > 2 ? dset.Data() :
"";
3861 newquery->fQueryName = queryname.Length() > 2 ? queryname.Data() :
"";
3862 newquery->fOptions = options.Length() > 2 ? options.Data() :
"";
3863 newquery->fEventList = eventlist.Length() > 2 ? eventlist.Data() :
"";
3864 newquery->fNbFiles = atoi(nbfiles);
3865 newquery->fNoEntries = atoi(nbentries);
3866 newquery->fFirstEntry = atoi(firstentry);
3867 newquery->fResult = 0;
3868 newquery->fChain = 0;
3869 fActDesc->fQueries->Add((TObject *)newquery);
3871 TGListTreeItem *item1 = fSessionHierarchy->FindChildByData(
3872 fSessionItem, fActDesc);
3873 TGListTreeItem *item2 = fSessionHierarchy->AddItem(
3874 item1, newquery->fQueryName, fQueryCon, fQueryCon);
3875 item2->SetUserData(newquery);
3881 fSessionHierarchy->ClearHighlighted();
3882 fSessionHierarchy->OpenItem(fSessionItem);
3883 if (fActDesc == localdesc) {
3884 fSessionHierarchy->HighlightItem(fSessionItem);
3885 fSessionHierarchy->SetSelected(fSessionItem);
3888 fSessionHierarchy->OpenItem(item);
3889 fSessionHierarchy->HighlightItem(item);
3890 fSessionHierarchy->SetSelected(item);
3892 fSessionHierarchy->ClearViewPort();
3893 fClient->NeedRedraw(fSessionHierarchy);
3899 void TSessionViewer::UpdateListOfProofs()
3902 Bool_t found = kFALSE;
3903 Bool_t exists = kFALSE;
3904 TGListTreeItem *item = 0;
3905 TSeqCollection *proofs = gROOT->GetListOfProofs();
3906 TSessionDescription *desc = 0;
3907 TSessionDescription *newdesc;
3909 TObject *o = proofs->First();
3910 if (o && dynamic_cast<TProofMgr *>(o)) {
3911 TProofMgr *mgr =
dynamic_cast<TProofMgr *
>(o);
3912 if (mgr && mgr->QuerySessions(
"L")) {
3913 TIter nxd(mgr->QuerySessions(
"L"));
3916 while ((d = (TProofDesc *)nxd())) {
3917 TIter nextfs(fSessions);
3920 while ((desc = (TSessionDescription *)nextfs())) {
3921 if ((desc->fTag == d->GetName()) ||
3922 (desc->fName == d->GetTitle())) {
3927 TIter nexts(fSessions);
3930 while ((desc = (TSessionDescription *)nexts())) {
3931 if (desc->fConnected && desc->fAttached)
3933 if (p && ((exists && ((desc->fTag == d->GetName()) ||
3934 (desc->fName == d->GetTitle()))) ||
3935 (!exists && (desc->fAddress == p->GetMaster())))) {
3936 desc->fConnected = kTRUE;
3937 desc->fAttached = kTRUE;
3939 desc->fProofMgr = mgr;
3940 desc->fTag = d->GetName();
3941 item = fSessionHierarchy->FindChildByData(fSessionItem,
3944 item->SetPictures(fProofCon, fProofCon);
3945 if (item == fSessionHierarchy->GetSelected()) {
3946 fActDesc->fProof->Connect(
"Progress(Long64_t,Long64_t)",
3947 "TSessionQueryFrame", fQueryFrame,
3948 "Progress(Long64_t,Long64_t)");
3949 fActDesc->fProof->Connect(
"Progress(Long64_t,Long64_t,Long64_t,Float_t,Float_t,Float_t,Float_t)",
3950 "TSessionQueryFrame", fQueryFrame,
3951 "Progress(Long64_t,Long64_t,Long64_t,Float_t,Float_t,Float_t,Float_t)");
3952 fActDesc->fProof->Connect(
"StopProcess(Bool_t)",
3953 "TSessionQueryFrame", fQueryFrame,
3954 "IndicateStop(Bool_t)");
3955 fActDesc->fProof->Connect(
3956 "ResetProgressDialog(const char*, Int_t,Long64_t,Long64_t)",
3957 "TSessionQueryFrame", fQueryFrame,
3958 "ResetProgressDialog(const char*,Int_t,Long64_t,Long64_t)");
3962 ChangeRightLogo(
"monitor01.xpm");
3964 SetChangePic(kFALSE);
3966 fActDesc->fProof->Connect(
"QueryResultReady(char *)",
3967 "TSessionViewer",
this,
"QueryResultReady(char *)");
3970 msg.Form(
"PROOF Cluster %s ready", fActDesc->fName.Data());
3971 fStatusBar->SetText(msg.Data(), 1);
3972 UpdateListOfPackages();
3973 fSessionFrame->UpdatePackages();
3974 fSessionFrame->UpdateListOfDataSets();
3975 fPopupSrv->DisableEntry(kSessionConnect);
3976 fSessionMenu->DisableEntry(kSessionConnect);
3977 fPopupSrv->EnableEntry(kSessionDisconnect);
3978 fSessionMenu->EnableEntry(kSessionDisconnect);
3979 if (fToolBar->GetButton(kSessionDisconnect))
3980 fToolBar->GetButton(kSessionDisconnect)->SetState(kButtonUp);
3981 if (fToolBar->GetButton(kSessionConnect))
3982 fToolBar->GetButton(kSessionConnect)->SetState(kButtonDisabled);
3983 fSessionFrame->SetLogLevel(fActDesc->fLogLevel);
3985 fSessionFrame->ProofInfos();
3986 fSessionFrame->SetLocal(kFALSE);
3987 if (fActFrame != fSessionFrame) {
3988 fV2->HideFrame(fActFrame);
3989 fV2->ShowFrame(fSessionFrame);
3990 fActFrame = fSessionFrame;
3994 if (desc->fLogLevel < 0)
3995 desc->fLogLevel = 0;
4000 if (found)
continue;
4001 newdesc =
new TSessionDescription();
4003 newdesc->fTag = d->GetName();
4004 newdesc->fName = d->GetTitle();
4005 newdesc->fAddress = d->GetTitle();
4006 newdesc->fConnected = kFALSE;
4007 newdesc->fAttached = kFALSE;
4008 newdesc->fProofMgr = mgr;
4011 newdesc->fConnected = kTRUE;
4012 newdesc->fAttached = kTRUE;
4014 newdesc->fAddress =
"lite://";
4016 newdesc->fAddress = p->GetMaster();
4017 newdesc->fConfigFile = p->GetConfFile();
4018 newdesc->fUserName = p->GetUser();
4019 newdesc->fPort = p->GetPort();
4020 newdesc->fLogLevel = p->GetLogLevel();
4021 newdesc->fProof = p;
4022 newdesc->fProof->Connect(
"Progress(Long64_t,Long64_t)",
4023 "TSessionQueryFrame", fQueryFrame,
4024 "Progress(Long64_t,Long64_t)");
4025 newdesc->fProof->Connect(
"Progress(Long64_t,Long64_t,Long64_t,Float_t,Float_t,Float_t,Float_t)",
4026 "TSessionQueryFrame", fQueryFrame,
4027 "Progress(Long64_t,Long64_t,Long64_t,Float_t,Float_t,Float_t,Float_t)");
4028 newdesc->fProof->Connect(
"StopProcess(Bool_t)",
4029 "TSessionQueryFrame", fQueryFrame,
4030 "IndicateStop(Bool_t)");
4031 newdesc->fProof->Connect(
4032 "ResetProgressDialog(const char*, Int_t,Long64_t,Long64_t)",
4033 "TSessionQueryFrame", fQueryFrame,
4034 "ResetProgressDialog(const char*,Int_t,Long64_t,Long64_t)");
4038 ChangeRightLogo(
"monitor01.xpm");
4040 SetChangePic(kFALSE);
4042 newdesc->fProof->Connect(
"QueryResultReady(char *)",
4043 "TSessionViewer",
this,
"QueryResultReady(char *)");
4045 newdesc->fQueries =
new TList();
4046 newdesc->fPackages =
new TList();
4047 if (newdesc->fLogLevel < 0)
4048 newdesc->fLogLevel = 0;
4049 newdesc->fActQuery = 0;
4050 newdesc->fLocal = kFALSE;
4051 newdesc->fSync = kFALSE;
4052 newdesc->fAutoEnable = kFALSE;
4053 newdesc->fNbHistos = 0;
4056 item = fSessionHierarchy->AddItem(fSessionItem, newdesc->fName.Data(),
4057 fProofCon, fProofCon);
4059 item = fSessionHierarchy->AddItem(fSessionItem, newdesc->fName.Data(),
4060 fProofDiscon, fProofDiscon);
4061 fSessionHierarchy->SetToolTipItem(item,
"Proof Session");
4062 item ->SetUserData(newdesc);
4064 fSessions->Add(newdesc);
4069 TIter nextp(proofs);
4072 while ((proof = (TProof *)nextp())) {
4073 TIter nexts(fSessions);
4076 while ((desc = (TSessionDescription *)nexts())) {
4077 if (desc->fProof == proof) {
4078 desc->fConnected = kTRUE;
4079 desc->fAttached = kTRUE;
4084 if (found)
continue;
4086 newdesc =
new TSessionDescription();
4088 newdesc->fName = proof->GetMaster();
4089 newdesc->fConfigFile = proof->GetConfFile();
4090 newdesc->fUserName = proof->GetUser();
4091 newdesc->fPort = proof->GetPort();
4092 newdesc->fLogLevel = proof->GetLogLevel();
4093 if (newdesc->fLogLevel < 0)
4094 newdesc->fLogLevel = 0;
4095 if (proof->IsLite())
4096 newdesc->fAddress =
"lite://";
4098 newdesc->fAddress = proof->GetMaster();
4099 newdesc->fQueries =
new TList();
4100 newdesc->fPackages =
new TList();
4101 newdesc->fProof = proof;
4102 newdesc->fActQuery = 0;
4103 newdesc->fConnected = kTRUE;
4104 newdesc->fAttached = kTRUE;
4105 newdesc->fLocal = kFALSE;
4106 newdesc->fSync = kFALSE;
4107 newdesc->fAutoEnable = kFALSE;
4108 newdesc->fNbHistos = 0;
4110 item = fSessionHierarchy->AddItem(fSessionItem, newdesc->fName.Data(),
4111 fProofCon, fProofCon);
4112 fSessionHierarchy->SetToolTipItem(item,
"Proof Session");
4113 item ->SetUserData(newdesc);
4115 fSessions->Add(newdesc);
4123 void TSessionViewer::UpdateListOfSessions()
4126 TGListTreeItem *item;
4127 TList *sessions = fActDesc->fProofMgr->QuerySessions(
"");
4129 TIter nextp(sessions);
4132 TSessionDescription *newdesc;
4134 while ((pdesc = (TProofDesc *)nextp())) {
4135 TIter nexts(fSessions);
4136 TSessionDescription *desc = 0;
4137 Bool_t found = kFALSE;
4139 while ((desc = (TSessionDescription *)nexts())) {
4140 if ((desc->fTag == pdesc->GetName()) ||
4141 (desc->fName == pdesc->GetTitle())) {
4142 desc->fConnected = kTRUE;
4147 if (found)
continue;
4149 newdesc =
new TSessionDescription();
4151 newdesc->fTag = pdesc->GetName();
4152 newdesc->fName = pdesc->GetTitle();
4153 proof = pdesc->GetProof();
4155 newdesc->fConfigFile = proof->GetConfFile();
4156 newdesc->fUserName = proof->GetUser();
4157 newdesc->fPort = proof->GetPort();
4158 newdesc->fLogLevel = proof->GetLogLevel();
4159 if (newdesc->fLogLevel < 0)
4160 newdesc->fLogLevel = 0;
4161 if (proof->IsLite())
4162 newdesc->fAddress =
"lite://";
4164 newdesc->fAddress = proof->GetMaster();
4165 newdesc->fProof = proof;
4168 newdesc->fProof = 0;
4169 newdesc->fConfigFile =
"";
4170 newdesc->fUserName = fActDesc->fUserName;
4171 newdesc->fPort = fActDesc->fPort;
4172 newdesc->fLogLevel = 0;
4173 newdesc->fAddress = fActDesc->fAddress;
4175 newdesc->fQueries =
new TList();
4176 newdesc->fPackages =
new TList();
4177 newdesc->fProofMgr = fActDesc->fProofMgr;
4178 newdesc->fActQuery = 0;
4179 newdesc->fConnected = kTRUE;
4180 newdesc->fAttached = kFALSE;
4181 newdesc->fLocal = kFALSE;
4182 newdesc->fSync = kFALSE;
4183 newdesc->fAutoEnable = kFALSE;
4184 newdesc->fNbHistos = 0;
4186 item = fSessionHierarchy->AddItem(fSessionItem, newdesc->fName.Data(),
4187 fProofDiscon, fProofDiscon);
4188 fSessionHierarchy->SetToolTipItem(item,
"Proof Session");
4189 item ->SetUserData(newdesc);
4191 fSessions->Add(newdesc);
4200 void TSessionViewer::WriteConfiguration(
const char *filename)
4202 TSessionDescription *session;
4203 TQueryDescription *query;
4204 Int_t scnt = 0, qcnt = 1;
4205 const char *fname = filename ? filename : fConfigFile.Data();
4208 gSystem->Unlink(fname);
4209 fViewerEnv =
new TEnv();
4211 fViewerEnv->SetValue(
"Option.Feedback",
4212 (Int_t)fOptionsMenu->IsEntryChecked(kOptionsFeedback));
4213 fViewerEnv->SetValue(
"Option.MasterHistos",
4214 (Int_t)fOptionsMenu->IsEntryChecked(kOptionsStatsHist));
4215 fViewerEnv->SetValue(
"Option.MasterEvents",
4216 (Int_t)fOptionsMenu->IsEntryChecked(kOptionsStatsTrace));
4217 fViewerEnv->SetValue(
"Option.WorkerEvents",
4218 (Int_t)fOptionsMenu->IsEntryChecked(kOptionsSlaveStatsTrace));
4222 while (kFeedbackHistos[i]) {
4223 fViewerEnv->SetValue(Form(
"Option.%s",kFeedbackHistos[i]),
4224 (Int_t)fCascadeMenu->IsEntryChecked(41+i));
4228 TIter snext(fSessions);
4229 while ((session = (TSessionDescription *) snext())) {
4230 if ((scnt > 0) && ((session->fAddress.Length() < 3) ||
4231 session->fUserName.Length() < 2)) {
4235 if ((scnt > 0) && (session->fName == session->fAddress)) {
4239 TString sessionstring;
4240 sessionstring += session->fName;
4241 sessionstring +=
";";
4242 sessionstring += session->fTag.Length() > 1 ? session->fTag.Data() :
" ";
4243 sessionstring +=
";";
4244 sessionstring += session->fAddress;
4245 sessionstring +=
";";
4246 sessionstring += TString::Format(
"%d", session->fPort);
4247 sessionstring +=
";";
4248 sessionstring += TString::Format(
"%d", session->fLogLevel);
4249 sessionstring +=
";";
4250 sessionstring += session->fConfigFile.Length() > 1 ? session->fConfigFile.Data() :
" ";
4251 sessionstring +=
";";
4252 sessionstring += session->fUserName;
4253 sessionstring +=
";";
4254 sessionstring += TString::Format(
"%d", session->fSync);
4255 sessionstring +=
";";
4256 sessionstring += TString::Format(
"%d", session->fAutoEnable);
4258 fViewerEnv->SetValue(Form(
"SessionDescription.%d",scnt), sessionstring);
4261 TIter qnext(session->fQueries);
4262 while ((query = (TQueryDescription *) qnext())) {
4263 TString querystring;
4264 querystring += TString::Format(
"%d", query->fStatus);
4266 querystring += query->fReference.Length() > 1 ? query->fReference.Data() :
" ";
4268 querystring += query->fQueryName;
4270 querystring += query->fSelectorString.Length() > 1 ? query->fSelectorString.Data() :
" ";
4272 querystring += query->fTDSetString.Length() > 1 ? query->fTDSetString.Data() :
" ";
4274 querystring += query->fOptions.Length() > 1 ? query->fOptions.Data() :
" ";
4276 querystring += query->fEventList.Length() > 1 ? query->fEventList.Data() :
" ";
4278 querystring += TString::Format(
"%d",query->fNbFiles);
4280 querystring += TString::Format(
"%lld",query->fNoEntries);
4282 querystring += TString::Format(
"%lld",query->fFirstEntry);
4283 fViewerEnv->SetValue(Form(
"QueryDescription.%d",qcnt), querystring);
4288 fViewerEnv->WriteFile(fname);
4294 void TSessionViewer::Build()
4302 fChangePic = kFALSE;
4303 fStart = fElapsed = 0;
4305 SetCleanup(kDeepCleanup);
4307 SetWMSizeHints(400 + 200, 370+50, 2000, 1000, 1, 1);
4310 fLocal = fClient->GetPicture(
"local_session.xpm");
4311 fProofCon = fClient->GetPicture(
"proof_connected.xpm");
4312 fProofDiscon = fClient->GetPicture(
"proof_disconnected.xpm");
4313 fQueryCon = fClient->GetPicture(
"query_connected.xpm");
4314 fQueryDiscon = fClient->GetPicture(
"query_disconnected.xpm");
4315 fBaseIcon = fClient->GetPicture(
"proof_base.xpm");
4318 fFileMenu =
new TGPopupMenu(fClient->GetDefaultRoot());
4319 fFileMenu->AddEntry(
"&Load Config...", kFileLoadConfig);
4320 fFileMenu->AddEntry(
"&Save Config...", kFileSaveConfig);
4321 fFileMenu->AddSeparator();
4322 fFileMenu->AddEntry(
"&Close Viewer", kFileCloseViewer);
4323 fFileMenu->AddSeparator();
4324 fFileMenu->AddEntry(
"&Quit ROOT", kFileQuit);
4327 fSessionMenu =
new TGPopupMenu(gClient->GetDefaultRoot());
4328 fSessionMenu->AddLabel(
"Session Management");
4329 fSessionMenu->AddSeparator();
4330 fSessionMenu->AddEntry(
"&New Session", kSessionNew);
4331 fSessionMenu->AddEntry(
"&Add to the list", kSessionAdd);
4332 fSessionMenu->AddEntry(
"De&lete", kSessionDelete);
4333 fSessionMenu->AddSeparator();
4334 fSessionMenu->AddEntry(
"&Connect...", kSessionConnect);
4335 fSessionMenu->AddEntry(
"&Disconnect", kSessionDisconnect);
4336 fSessionMenu->AddEntry(
"Shutdo&wn", kSessionShutdown);
4337 fSessionMenu->AddEntry(
"&Show status",kSessionShowStatus);
4338 fSessionMenu->AddEntry(
"&Get Queries",kSessionGetQueries);
4339 fSessionMenu->AddSeparator();
4340 fSessionMenu->AddEntry(
"&Cleanup", kSessionCleanup);
4341 fSessionMenu->AddEntry(
"&Reset",kSessionReset);
4342 fSessionMenu->DisableEntry(kSessionAdd);
4345 fQueryMenu =
new TGPopupMenu(gClient->GetDefaultRoot());
4346 fQueryMenu->AddLabel(
"Query Management");
4347 fQueryMenu->AddSeparator();
4348 fQueryMenu->AddEntry(
"&New...", kQueryNew);
4349 fQueryMenu->AddEntry(
"&Edit", kQueryEdit);
4350 fQueryMenu->AddEntry(
"&Submit", kQuerySubmit);
4351 fQueryMenu->AddSeparator();
4352 fQueryMenu->AddEntry(
"Start &Viewer", kQueryStartViewer);
4353 fQueryMenu->AddSeparator();
4354 fQueryMenu->AddEntry(
"&Delete", kQueryDelete);
4358 fConfigFile = TString::Format(
"%s\\%s", gSystem->HomeDirectory(), kConfigFile);
4360 fConfigFile = TString::Format(
"%s/%s", gSystem->HomeDirectory(), kConfigFile);
4363 fCascadeMenu =
new TGPopupMenu(fClient->GetDefaultRoot());
4365 while (kFeedbackHistos[i]) {
4366 fCascadeMenu->AddEntry(kFeedbackHistos[i], 41+i);
4369 fCascadeMenu->AddEntry(
"User defined...", 50);
4371 fCascadeMenu->DisableEntry(50);
4374 fOptionsMenu =
new TGPopupMenu(fClient->GetDefaultRoot());
4375 fOptionsMenu->AddLabel(
"Global Options");
4376 fOptionsMenu->AddSeparator();
4377 fOptionsMenu->AddEntry(
"&Autosave Config", kOptionsAutoSave);
4378 fOptionsMenu->AddSeparator();
4379 fOptionsMenu->AddEntry(
"Master &Histos", kOptionsStatsHist);
4380 fOptionsMenu->AddEntry(
"&Master Events", kOptionsStatsTrace);
4381 fOptionsMenu->AddEntry(
"&Worker Events", kOptionsSlaveStatsTrace);
4382 fOptionsMenu->AddSeparator();
4383 fOptionsMenu->AddEntry(
"Feedback &Active", kOptionsFeedback);
4384 fOptionsMenu->AddSeparator();
4385 fOptionsMenu->AddPopup(
"&Feedback Histos", fCascadeMenu);
4386 fOptionsMenu->CheckEntry(kOptionsAutoSave);
4389 fHelpMenu =
new TGPopupMenu(gClient->GetDefaultRoot());
4390 fHelpMenu->AddEntry(
"&About ROOT...", kHelpAbout);
4392 fFileMenu->Associate(
this);
4393 fSessionMenu->Associate(
this);
4394 fQueryMenu->Associate(
this);
4395 fOptionsMenu->Associate(
this);
4396 fCascadeMenu->Associate(
this);
4397 fHelpMenu->Associate(
this);
4400 fMenuBar =
new TGMenuBar(
this, 1, 1, kHorizontalFrame);
4402 fMenuBar->AddPopup(
"&File", fFileMenu,
new TGLayoutHints(kLHintsTop |
4403 kLHintsLeft, 0, 4, 0, 0));
4404 fMenuBar->AddPopup(
"&Session", fSessionMenu,
new TGLayoutHints(kLHintsTop |
4405 kLHintsLeft, 0, 4, 0, 0));
4406 fMenuBar->AddPopup(
"&Query", fQueryMenu,
new TGLayoutHints(kLHintsTop |
4407 kLHintsLeft, 0, 4, 0, 0));
4408 fMenuBar->AddPopup(
"&Options", fOptionsMenu,
new TGLayoutHints(kLHintsTop |
4409 kLHintsLeft, 0, 4, 0, 0));
4410 fMenuBar->AddPopup(
"&Help", fHelpMenu,
new TGLayoutHints(kLHintsTop |
4413 TGHorizontal3DLine *toolBarSep =
new TGHorizontal3DLine(
this);
4414 AddFrame(toolBarSep,
new TGLayoutHints(kLHintsTop | kLHintsExpandX));
4416 AddFrame(fMenuBar,
new TGLayoutHints(kLHintsTop | kLHintsLeft |
4417 kLHintsExpandX, 0, 0, 1, 1));
4419 toolBarSep =
new TGHorizontal3DLine(
this);
4420 AddFrame(toolBarSep,
new TGLayoutHints(kLHintsTop | kLHintsExpandX));
4425 fToolBar =
new TGToolBar(
this, 60, 20, kHorizontalFrame);
4426 for (
int ii = 0; xpm_toolbar[ii]; ii++) {
4427 tb_data[ii].fPixmap = xpm_toolbar[ii];
4428 if (strlen(xpm_toolbar[ii]) == 0) {
4432 fToolBar->AddButton(
this, &tb_data[ii], spacing);
4435 AddFrame(fToolBar,
new TGLayoutHints(kLHintsTop | kLHintsExpandX, 0, 0, 0, 0));
4436 toolBarSep =
new TGHorizontal3DLine(
this);
4437 AddFrame(toolBarSep,
new TGLayoutHints(kLHintsTop | kLHintsExpandX));
4438 if (fToolBar->GetButton(kQuerySubmit))
4439 fToolBar->GetButton(kQuerySubmit)->SetState(kButtonDisabled);
4441 fPopupSrv =
new TGPopupMenu(fClient->GetDefaultRoot());
4442 fPopupSrv->AddEntry(
"Connect",kSessionConnect);
4443 fPopupSrv->AddEntry(
"Disconnect",kSessionDisconnect);
4444 fPopupSrv->AddEntry(
"Shutdown",kSessionShutdown);
4445 fPopupSrv->AddEntry(
"Browse",kSessionBrowse);
4446 fPopupSrv->AddEntry(
"Show status",kSessionShowStatus);
4447 fPopupSrv->AddEntry(
"Delete", kSessionDelete);
4448 fPopupSrv->AddEntry(
"Get Queries",kSessionGetQueries);
4449 fPopupSrv->AddSeparator();
4450 fPopupSrv->AddEntry(
"Cleanup", kSessionCleanup);
4451 fPopupSrv->AddEntry(
"Reset",kSessionReset);
4452 fPopupSrv->Connect(
"Activated(Int_t)",
"TSessionViewer",
this,
4453 "MyHandleMenu(Int_t)");
4455 fPopupQry =
new TGPopupMenu(fClient->GetDefaultRoot());
4456 fPopupQry->AddEntry(
"Edit",kQueryEdit);
4457 fPopupQry->AddEntry(
"Submit",kQuerySubmit);
4458 fPopupQry->AddSeparator();
4459 fPopupQry->AddEntry(
"Start &Viewer", kQueryStartViewer);
4460 fPopupQry->AddSeparator();
4461 fPopupQry->AddEntry(
"Delete",kQueryDelete);
4462 fPopupQry->Connect(
"Activated(Int_t)",
"TSessionViewer",
this,
4463 "MyHandleMenu(Int_t)");
4466 fSessionMenu->DisableEntry(kSessionGetQueries);
4467 fSessionMenu->DisableEntry(kSessionShowStatus);
4468 fPopupSrv->DisableEntry(kSessionGetQueries);
4469 fPopupSrv->DisableEntry(kSessionShowStatus);
4470 fPopupSrv->DisableEntry(kSessionDisconnect);
4471 fPopupSrv->DisableEntry(kSessionShutdown);
4472 fPopupSrv->DisableEntry(kSessionCleanup);
4473 fPopupSrv->DisableEntry(kSessionReset);
4474 fSessionMenu->DisableEntry(kSessionDisconnect);
4475 fSessionMenu->DisableEntry(kSessionShutdown);
4476 fSessionMenu->DisableEntry(kSessionCleanup);
4477 fSessionMenu->DisableEntry(kSessionReset);
4478 if (fToolBar->GetButton(kSessionDisconnect))
4479 fToolBar->GetButton(kSessionDisconnect)->SetState(kButtonDisabled);
4482 fHf =
new TGHorizontalFrame(
this, 10, 10);
4483 fHf->SetCleanup(kDeepCleanup);
4486 fV1 =
new TGVerticalFrame(fHf, 100, 100, kFixedWidth);
4487 fV1->SetCleanup(kDeepCleanup);
4489 fTreeView =
new TGCanvas(fV1, 100, 200, kSunkenFrame | kDoubleBorder);
4490 fV1->AddFrame(fTreeView,
new TGLayoutHints(kLHintsExpandX | kLHintsExpandY,
4492 fSessionHierarchy =
new TGListTree(fTreeView, kHorizontalFrame);
4493 fSessionHierarchy->DisableOpen();
4494 fSessionHierarchy->Connect(
"Clicked(TGListTreeItem*,Int_t,Int_t,Int_t)",
4495 "TSessionViewer",
this,
4496 "OnListTreeClicked(TGListTreeItem*, Int_t, Int_t, Int_t)");
4497 fSessionHierarchy->Connect(
"DoubleClicked(TGListTreeItem*,Int_t)",
4498 "TSessionViewer",
this,
4499 "OnListTreeDoubleClicked(TGListTreeItem*, Int_t)");
4500 fV1->Resize(fTreeView->GetDefaultWidth()+100, fV1->GetDefaultHeight());
4503 fV2 =
new TGVerticalFrame(fHf, 350, 310);
4504 fV2->SetCleanup(kDeepCleanup);
4507 fServerFrame =
new TSessionServerFrame(fV2, 350, 310);
4508 fSessions =
new TList;
4509 ReadConfiguration();
4510 fServerFrame->Build(
this);
4511 fV2->AddFrame(fServerFrame,
new TGLayoutHints(kLHintsTop | kLHintsExpandX |
4512 kLHintsExpandY, 2, 0, 1, 2));
4515 fSessionFrame =
new TSessionFrame(fV2, 350, 310);
4516 fSessionFrame->Build(
this);
4517 fV2->AddFrame(fSessionFrame,
new TGLayoutHints(kLHintsTop | kLHintsExpandX |
4518 kLHintsExpandY, 2, 0, 1, 2));
4521 fQueryFrame =
new TSessionQueryFrame(fV2, 350, 310);
4522 fQueryFrame->Build(
this);
4523 fV2->AddFrame(fQueryFrame,
new TGLayoutHints(kLHintsTop | kLHintsExpandX |
4524 kLHintsExpandY, 2, 0, 1, 2));
4527 fOutputFrame =
new TSessionOutputFrame(fV2, 350, 310);
4528 fOutputFrame->Build(
this);
4529 fV2->AddFrame(fOutputFrame,
new TGLayoutHints(kLHintsTop | kLHintsExpandX |
4530 kLHintsExpandY, 2, 0, 1, 2));
4533 fInputFrame =
new TSessionInputFrame(fV2, 350, 310);
4534 fInputFrame->Build(
this);
4535 fV2->AddFrame(fInputFrame,
new TGLayoutHints(kLHintsTop | kLHintsExpandX |
4536 kLHintsExpandY, 2, 0, 1, 2));
4538 fHf->AddFrame(fV1,
new TGLayoutHints(kLHintsLeft | kLHintsExpandY));
4541 TGVSplitter *splitter =
new TGVSplitter(fHf, 4);
4542 splitter->SetFrame(fV1, kTRUE);
4543 fHf->AddFrame(splitter,
new TGLayoutHints(kLHintsLeft | kLHintsExpandY));
4544 fHf->AddFrame(
new TGVertical3DLine(fHf),
new TGLayoutHints(kLHintsLeft |
4547 fHf->AddFrame(fV2,
new TGLayoutHints(kLHintsRight | kLHintsExpandX |
4550 AddFrame(fHf,
new TGLayoutHints(kLHintsRight | kLHintsExpandX |
4555 if (!fActDesc->fLocal) {
4556 fServerFrame->Update(fActDesc);
4559 fServerFrame->SetAddEnabled();
4560 fServerFrame->SetConnectEnabled(kFALSE);
4565 int parts[] = { 36, 49, 15 };
4566 fStatusBar =
new TGStatusBar(
this, 10, 10);
4567 fStatusBar->SetCleanup(kDeepCleanup);
4568 fStatusBar->SetParts(parts, 3);
4569 for (
int p = 0; p < 3; ++p)
4570 fStatusBar->GetBarPart(p)->SetCleanup(kDeepCleanup);
4571 AddFrame(fStatusBar,
new TGLayoutHints(kLHintsTop | kLHintsLeft |
4572 kLHintsExpandX, 0, 0, 1, 1));
4575 fStatusBar->SetText(
" 00:00:00", 2);
4576 TGCompositeFrame *leftpart = fStatusBar->GetBarPart(2);
4577 fRightIconPicture = (TGPicture *)fClient->GetPicture(
"proof_disconnected.xpm");
4578 fRightIcon =
new TGIcon(leftpart, fRightIconPicture,
4579 fRightIconPicture->GetWidth(),fRightIconPicture->GetHeight());
4580 leftpart->AddFrame(fRightIcon,
new TGLayoutHints(kLHintsLeft, 2, 0, 0, 0));
4583 TGCompositeFrame *rightpart = fStatusBar->GetBarPart(0);
4584 fConnectProg =
new TGHProgressBar(rightpart, TGProgressBar::kStandard, 100);
4585 fConnectProg->ShowPosition();
4586 fConnectProg->SetBarColor(
"green");
4587 rightpart->AddFrame(fConnectProg,
new TGLayoutHints(kLHintsExpandX, 1, 1, 1, 1));
4590 fUserGroup = gSystem->GetUserInfo();
4591 buf.Form(
"User : %s - %s", fUserGroup->fRealName.Data(),
4592 fUserGroup->fGroup.Data());
4593 fStatusBar->SetText(buf.Data(), 1);
4598 fContextMenu =
new TContextMenu(
"SessionViewerContextMenu") ;
4600 SetWindowName(
"ROOT Session Viewer");
4605 fServerFrame->SetAddEnabled(kFALSE);
4606 fStatusBar->GetBarPart(0)->HideFrame(fConnectProg);
4607 fV2->HideFrame(fSessionFrame);
4608 fV2->HideFrame(fQueryFrame);
4609 fV2->HideFrame(fOutputFrame);
4610 fV2->HideFrame(fInputFrame);
4611 fQueryFrame->GetQueryEditFrame()->OnNewQueryMore();
4612 fActFrame = fServerFrame;
4613 UpdateListOfProofs();
4620 TSessionViewer::~TSessionViewer()
4623 if (gSessionViewer ==
this)
4630 void TSessionViewer::OnListTreeClicked(TGListTreeItem *entry, Int_t btn,
4637 fSessionMenu->DisableEntry(kSessionAdd);
4638 if (fToolBar->GetButton(kQuerySubmit))
4639 fToolBar->GetButton(kQuerySubmit)->SetState(kButtonDisabled);
4640 if (entry->GetParent() == 0) {
4642 if (fActFrame != fServerFrame) {
4643 fV2->HideFrame(fActFrame);
4644 fV2->ShowFrame(fServerFrame);
4645 fActFrame = fServerFrame;
4647 fSessionMenu->DisableEntry(kSessionDelete);
4648 fSessionMenu->EnableEntry(kSessionAdd);
4649 fServerFrame->SetAddEnabled();
4650 fServerFrame->SetConnectEnabled(kFALSE);
4651 fPopupSrv->DisableEntry(kSessionConnect);
4652 fSessionMenu->DisableEntry(kSessionConnect);
4653 if (fToolBar->GetButton(kSessionConnect))
4654 fToolBar->GetButton(kSessionConnect)->SetState(kButtonDisabled);
4656 else if (entry->GetParent()->GetParent() == 0) {
4657 if (entry->GetUserData()) {
4658 obj = (TObject *)entry->GetUserData();
4659 if (!obj || obj->IsA() != TSessionDescription::Class())
4662 fServerFrame->Update((TSessionDescription *)obj);
4663 fActDesc = (TSessionDescription*)obj;
4665 if (fActDesc->fConnected && fActDesc->fAttached &&
4666 fActDesc->fProof && fActDesc->fProof->IsValid()) {
4667 fActDesc->fProof->cd();
4668 msg.Form(
"PROOF Cluster %s ready", fActDesc->fName.Data());
4671 msg.Form(
"PROOF Cluster %s not connected", fActDesc->fName.Data());
4673 fStatusBar->SetText(msg.Data(), 1);
4675 if ((fActDesc->fConnected) && (fActDesc->fAttached)) {
4676 fPopupSrv->DisableEntry(kSessionConnect);
4677 fSessionMenu->DisableEntry(kSessionConnect);
4678 if (fToolBar->GetButton(kSessionConnect))
4679 fToolBar->GetButton(kSessionConnect)->SetState(kButtonDisabled);
4680 UpdateListOfPackages();
4681 fSessionFrame->UpdateListOfDataSets();
4684 fPopupSrv->EnableEntry(kSessionConnect);
4685 fSessionMenu->EnableEntry(kSessionConnect);
4686 if (fToolBar->GetButton(kSessionConnect))
4687 fToolBar->GetButton(kSessionConnect)->SetState(kButtonUp);
4690 if (fActDesc->fLocal) {
4691 if (fActFrame != fSessionFrame) {
4692 fV2->HideFrame(fActFrame);
4693 fV2->ShowFrame(fSessionFrame);
4694 fActFrame = fSessionFrame;
4695 UpdateListOfPackages();
4696 fSessionFrame->UpdateListOfDataSets();
4698 fSessionFrame->SetLocal();
4699 fServerFrame->SetAddEnabled();
4700 fServerFrame->SetConnectEnabled(kFALSE);
4703 if ((!fActDesc->fLocal) && (!fActDesc->fAttached) &&
4704 (fActFrame != fServerFrame)) {
4705 fV2->HideFrame(fActFrame);
4706 fV2->ShowFrame(fServerFrame);
4707 fActFrame = fServerFrame;
4710 if ((!fActDesc->fLocal) && (fActDesc->fConnected) &&
4711 (fActDesc->fAttached)) {
4712 if (fActFrame != fSessionFrame) {
4713 fV2->HideFrame(fActFrame);
4714 fV2->ShowFrame(fSessionFrame);
4715 fActFrame = fSessionFrame;
4717 fSessionFrame->SetLocal(kFALSE);
4719 fSessionFrame->SetLogLevel(fActDesc->fLogLevel);
4720 fServerFrame->SetLogLevel(fActDesc->fLogLevel);
4721 if (fActDesc->fAutoEnable)
4722 fSessionFrame->CheckAutoEnPack(kTRUE);
4724 fSessionFrame->CheckAutoEnPack(kFALSE);
4726 fSessionFrame->ProofInfos();
4727 fSessionFrame->UpdatePackages();
4728 fServerFrame->SetAddEnabled(kFALSE);
4729 fServerFrame->SetConnectEnabled();
4731 else if (entry->GetParent()->GetParent()->GetParent() == 0) {
4732 obj = (TObject *)entry->GetParent()->GetUserData();
4733 if (obj && obj->IsA() == TSessionDescription::Class()) {
4734 fActDesc = (TSessionDescription *)obj;
4736 obj = (TObject *)entry->GetUserData();
4737 if (obj && obj->IsA() == TQueryDescription::Class()) {
4738 fActDesc->fActQuery = (TQueryDescription *)obj;
4741 fQueryFrame->UpdateInfos();
4742 fQueryFrame->UpdateButtons(fActDesc->fActQuery);
4743 if (fActFrame != fQueryFrame) {
4744 fV2->HideFrame(fActFrame);
4745 fV2->ShowFrame(fQueryFrame);
4746 fActFrame = fQueryFrame;
4748 if ((fActDesc->fConnected) && (fActDesc->fAttached) &&
4749 (fActDesc->fActQuery->fStatus != TQueryDescription::kSessionQueryRunning) &&
4750 (fActDesc->fActQuery->fStatus != TQueryDescription::kSessionQuerySubmitted) &&
4751 (fToolBar->GetButton(kQuerySubmit)) )
4752 fToolBar->GetButton(kQuerySubmit)->SetState(kButtonUp);
4757 obj = (TObject *)entry->GetParent()->GetParent()->GetUserData();
4758 if (obj && obj->IsA() == TSessionDescription::Class()) {
4759 fActDesc = (TSessionDescription *)obj;
4761 obj = (TObject *)entry->GetParent()->GetUserData();
4762 if (obj && obj->IsA() == TQueryDescription::Class()) {
4763 fActDesc->fActQuery = (TQueryDescription *)obj;
4765 if (fActDesc->fActQuery) {
4767 fInputFrame->RemoveAll();
4768 fOutputFrame->RemoveAll();
4769 if (fActDesc->fActQuery->fResult) {
4770 objlist = fActDesc->fActQuery->fResult->GetOutputList();
4772 TIter nexto(objlist);
4773 while ((obj = (TObject *) nexto())) {
4774 fOutputFrame->AddObject(obj);
4777 objlist = fActDesc->fActQuery->fResult->GetInputList();
4779 TIter nexti(objlist);
4780 while ((obj = (TObject *) nexti())) {
4781 fInputFrame->AddObject(obj);
4786 TChain *chain = (TChain *)fActDesc->fActQuery->fChain;
4788 objlist = ((TTreePlayer *)(chain->GetPlayer()))->GetSelectorFromFile()->GetOutputList();
4790 TIter nexto(objlist);
4791 while ((obj = (TObject *) nexto())) {
4792 fOutputFrame->AddObject(obj);
4797 fInputFrame->Resize();
4798 fOutputFrame->Resize();
4799 fClient->NeedRedraw(fOutputFrame->GetLVContainer());
4800 fClient->NeedRedraw(fInputFrame->GetLVContainer());
4803 if (strstr(entry->GetText(),
"Output")) {
4804 if (fActFrame != fOutputFrame) {
4805 fV2->HideFrame(fActFrame);
4806 fV2->ShowFrame(fOutputFrame);
4807 fActFrame = fOutputFrame;
4810 else if (strstr(entry->GetText(),
"Input")) {
4811 if (fActFrame != fInputFrame) {
4812 fV2->HideFrame(fActFrame);
4813 fV2->ShowFrame(fInputFrame);
4814 fActFrame = fInputFrame;
4820 TGListTreeItem *item = fSessionHierarchy->GetSelected();
4822 obj = (TObject *)item->GetUserData();
4823 if (obj && obj->IsA() == TQueryDescription::Class()) {
4824 fPopupQry->PlaceMenu(x, y, 1, 1);
4826 else if (obj && obj->IsA() == TSessionDescription::Class()) {
4827 if (!fActDesc->fLocal)
4828 fPopupSrv->PlaceMenu(x, y, 1, 1);
4832 if (fActDesc->fConnected && fActDesc->fAttached) {
4833 fSessionMenu->EnableEntry(kSessionGetQueries);
4834 fSessionMenu->EnableEntry(kSessionShowStatus);
4835 fPopupSrv->EnableEntry(kSessionGetQueries);
4836 fPopupSrv->EnableEntry(kSessionShowStatus);
4837 fPopupSrv->EnableEntry(kSessionDisconnect);
4838 fPopupSrv->EnableEntry(kSessionShutdown);
4839 fPopupSrv->EnableEntry(kSessionCleanup);
4840 fPopupSrv->EnableEntry(kSessionReset);
4841 fSessionMenu->EnableEntry(kSessionDisconnect);
4842 fSessionMenu->EnableEntry(kSessionShutdown);
4843 fSessionMenu->EnableEntry(kSessionCleanup);
4844 fSessionMenu->EnableEntry(kSessionReset);
4845 if (fToolBar->GetButton(kSessionDisconnect))
4846 fToolBar->GetButton(kSessionDisconnect)->SetState(kButtonUp);
4847 fQueryMenu->EnableEntry(kQuerySubmit);
4848 fPopupQry->EnableEntry(kQuerySubmit);
4851 fSessionMenu->DisableEntry(kSessionGetQueries);
4852 fSessionMenu->DisableEntry(kSessionShowStatus);
4853 fPopupSrv->DisableEntry(kSessionGetQueries);
4854 fPopupSrv->DisableEntry(kSessionShowStatus);
4855 if (entry->GetParent() != 0)
4856 fSessionMenu->EnableEntry(kSessionDelete);
4857 fPopupSrv->EnableEntry(kSessionDelete);
4858 fPopupSrv->DisableEntry(kSessionDisconnect);
4859 fPopupSrv->DisableEntry(kSessionShutdown);
4860 fPopupSrv->DisableEntry(kSessionCleanup);
4861 fPopupSrv->DisableEntry(kSessionReset);
4862 fSessionMenu->DisableEntry(kSessionDisconnect);
4863 fSessionMenu->DisableEntry(kSessionShutdown);
4864 fSessionMenu->DisableEntry(kSessionCleanup);
4865 fSessionMenu->DisableEntry(kSessionReset);
4866 if (fToolBar->GetButton(kSessionDisconnect))
4867 fToolBar->GetButton(kSessionDisconnect)->SetState(kButtonDisabled);
4868 fQueryMenu->DisableEntry(kQuerySubmit);
4869 fPopupQry->DisableEntry(kQuerySubmit);
4871 if (fActDesc->fLocal) {
4872 fSessionMenu->DisableEntry(kSessionDelete);
4873 fSessionMenu->DisableEntry(kSessionConnect);
4874 fSessionMenu->DisableEntry(kSessionDisconnect);
4875 fSessionMenu->DisableEntry(kSessionShutdown);
4876 fSessionMenu->DisableEntry(kSessionCleanup);
4877 fSessionMenu->DisableEntry(kSessionReset);
4878 if (fToolBar->GetButton(kSessionDisconnect))
4879 fToolBar->GetButton(kSessionDisconnect)->SetState(kButtonDisabled);
4880 if (fToolBar->GetButton(kSessionConnect))
4881 fToolBar->GetButton(kSessionConnect)->SetState(kButtonDisabled);
4882 fQueryMenu->EnableEntry(kQuerySubmit);
4883 fPopupQry->EnableEntry(kQuerySubmit);
4890 void TSessionViewer::OnListTreeDoubleClicked(TGListTreeItem *entry, Int_t )
4892 if (entry == fSessionItem)
4894 if (entry->GetParent()->GetParent() == 0) {
4895 if (entry->GetUserData()) {
4896 TObject *obj = (TObject *)entry->GetUserData();
4897 if ((!obj) || (obj->IsA() != TSessionDescription::Class()))
4899 fActDesc = (TSessionDescription*)obj;
4902 if ((!fActDesc->fLocal) && ((!fActDesc->fConnected) ||
4903 (!fActDesc->fAttached))) {
4904 fServerFrame->OnBtnConnectClicked();
4913 void TSessionViewer::Terminate()
4917 pathtmp = TString::Format(
"%s/%s", gSystem->TempDirectory(), kSession_RedirectFile);
4918 if (!gSystem->AccessPathName(pathtmp)) {
4919 gSystem->Unlink(pathtmp);
4921 pathtmp = TString::Format(
"%s/%s", gSystem->TempDirectory(), kSession_RedirectCmd);
4922 if (!gSystem->AccessPathName(pathtmp)) {
4923 gSystem->Unlink(pathtmp);
4926 TIter next(fSessions);
4927 TSessionDescription *desc = 0;
4928 while ((desc = (TSessionDescription *)next())) {
4929 if (desc->fAttached && desc->fProof &&
4930 desc->fProof->IsValid())
4931 desc->fProof->Detach();
4935 WriteConfiguration();
4941 void TSessionViewer::CloseWindow()
4945 pathtmp = TString::Format(
"%s/%s", gSystem->TempDirectory(), kSession_RedirectFile);
4946 if (!gSystem->AccessPathName(pathtmp)) {
4947 gSystem->Unlink(pathtmp);
4949 pathtmp = TString::Format(
"%s/%s", gSystem->TempDirectory(), kSession_RedirectCmd);
4950 if (!gSystem->AccessPathName(pathtmp)) {
4951 gSystem->Unlink(pathtmp);
4955 WriteConfiguration();
4957 fSessions->Delete();
4959 fSessionHierarchy->DeleteChildren(fSessionItem);
4960 delete fSessionHierarchy;
4962 fClient->FreePicture(fLocal);
4963 fClient->FreePicture(fProofCon);
4964 fClient->FreePicture(fProofDiscon);
4965 fClient->FreePicture(fQueryCon);
4966 fClient->FreePicture(fQueryDiscon);
4967 fClient->FreePicture(fBaseIcon);
4975 void TSessionViewer::ChangeRightLogo(
const char *name)
4977 fClient->FreePicture(fRightIconPicture);
4978 fRightIconPicture = (TGPicture *)fClient->GetPicture(name);
4979 fRightIcon->SetPicture(fRightIconPicture);
4985 void TSessionViewer::EnableTimer()
4987 if (!fTimer) fTimer =
new TTimer(
this, 500);
4996 void TSessionViewer::DisableTimer()
5000 ChangeRightLogo(
"proof_disconnected.xpm");
5006 Bool_t TSessionViewer::HandleTimer(TTimer *)
5009 struct tm *connected;
5010 Int_t count = gRandom->Integer(4);
5015 ChangeRightLogo(xpm_names[count]);
5017 time_t elapsed_time = (time_t)difftime( fElapsed, fStart );
5018 connected = gmtime( &elapsed_time );
5020 buf.Form(
" %02d:%02d:%02d", connected->tm_hour,
5021 connected->tm_min, connected->tm_sec);
5022 fStatusBar->SetText(buf.Data(), 2);
5025 fStatusBar->SetText(
" 00:00:00", 2);
5028 if (fActDesc->fLocal) {
5029 if ((fActDesc->fActQuery) &&
5030 (fActDesc->fActQuery->fStatus ==
5031 TQueryDescription::kSessionQueryRunning)) {
5032 TChain *chain = (TChain *)fActDesc->fActQuery->fChain;
5034 fQueryFrame->ProgressLocal(chain->GetEntries(),
5035 chain->GetReadEntry()+1);
5046 void TSessionViewer::LogMessage(
const char *msg, Bool_t all)
5051 fLogWindow->LoadBuffer(msg);
5054 fLogWindow->AddBuffer(msg);
5062 void TSessionViewer::QueryResultReady(
char *query)
5065 strtmp.Form(
"Query Result Ready for %s", query);
5067 ShowInfo(strtmp.Data());
5068 TGListTreeItem *item=0, *item2=0;
5069 TQueryDescription *lquery = 0;
5072 TIter nexts(fSessions);
5073 TSessionDescription *desc = 0;
5075 while ((desc = (TSessionDescription *)nexts())) {
5076 if (desc && !desc->fAttached)
5078 TIter nextp(desc->fQueries);
5079 while ((lquery = (TQueryDescription *)nextp())) {
5080 if (lquery->fReference.Contains(query)) {
5082 lquery->fResult = desc->fProof->GetQueryResult(query);
5083 lquery->fStatus = TQueryDescription::kSessionQueryFromProof;
5084 if (!lquery->fResult)
5087 lquery->fStatus = lquery->fResult->IsFinalized() ?
5088 TQueryDescription::kSessionQueryFinalized :
5089 (TQueryDescription::ESessionQueryStatus)lquery->fResult->GetStatus();
5091 TObject *o = lquery->fResult->GetInputObject(
"TDSet");
5093 lquery->fChain = (TDSet *) o;
5094 item = fSessionHierarchy->FindItemByObj(fSessionItem, desc);
5096 item2 = fSessionHierarchy->FindItemByObj(item, lquery);
5100 if (lquery->fResult->GetInputList())
5101 if (!fSessionHierarchy->FindChildByName(item2,
"InputList"))
5102 fSessionHierarchy->AddItem(item2,
"InputList");
5103 if (lquery->fResult->GetOutputList())
5104 if (!fSessionHierarchy->FindChildByName(item2,
"OutputList"))
5105 fSessionHierarchy->AddItem(item2,
"OutputList");
5108 fSessionHierarchy->ClearViewPort();
5109 fClient->NeedRedraw(fSessionHierarchy);
5110 fQueryFrame->UpdateInfos();
5111 fQueryFrame->UpdateButtons(lquery);
5121 void TSessionViewer::CleanupSession()
5123 TGListTreeItem *item = fSessionHierarchy->GetSelected();
5125 TObject *obj = (TObject *)item->GetUserData();
5126 if (!obj || obj->IsA() != TSessionDescription::Class())
return;
5127 if (!fActDesc->fProof || !fActDesc->fProof->IsValid())
return;
5129 m.Form(
"Are you sure to cleanup the session \"%s::%s\"",
5130 fActDesc->fName.Data(), fActDesc->fTag.Data());
5132 new TGMsgBox(fClient->GetRoot(),
this,
"", m.Data(), 0,
5133 kMBYes | kMBNo | kMBCancel, &result);
5134 if (result == kMBYes) {
5137 sessiontag.Form(
"session-%s",fActDesc->fTag.Data());
5138 fActDesc->fProof->CleanupSession(sessiontag.Data());
5140 fActDesc->fQueries->Clear();
5141 fSessionHierarchy->DeleteChildren(item);
5142 fSessionFrame->OnBtnGetQueriesClicked();
5144 WriteConfiguration();
5147 fSessionHierarchy->ClearViewPort();
5148 fClient->NeedRedraw(fSessionHierarchy);
5154 void TSessionViewer::ResetSession()
5156 TGListTreeItem *item = fSessionHierarchy->GetSelected();
5158 TObject *obj = (TObject *)item->GetUserData();
5159 if (!obj || obj->IsA() != TSessionDescription::Class())
return;
5160 if (!fActDesc->fProof || !fActDesc->fProof->IsValid())
return;
5162 m.Form(
"Do you really want to reset the session \"%s::%s\"",
5163 fActDesc->fName.Data(), fActDesc->fAddress.Data());
5165 new TGMsgBox(fClient->GetRoot(),
this,
"", m.Data(), 0,
5166 kMBYes | kMBNo | kMBCancel, &result);
5167 if (result == kMBYes) {
5169 TProofMgr *mgr = TProof::Mgr(fActDesc->fAddress);
5170 if (mgr && mgr->IsValid()) {
5171 mgr->Reset(fActDesc->fUserName);
5174 fActDesc->fAttached = kFALSE;
5175 fActDesc->fProof = 0;
5179 TGListTreeItem *item2 = fSessionHierarchy->FindChildByData(
5180 fSessionItem, fActDesc);
5181 if (item2) item2->SetPictures(fProofDiscon, fProofDiscon);
5183 OnListTreeClicked(fSessionHierarchy->GetSelected(), 1, 0, 0);
5184 fSessionHierarchy->ClearViewPort();
5185 fClient->NeedRedraw(fSessionHierarchy);
5186 fStatusBar->SetText(
"", 1);
5189 fSessionHierarchy->ClearViewPort();
5190 fClient->NeedRedraw(fSessionHierarchy);
5197 void TSessionViewer::DeleteQuery()
5199 TGListTreeItem *item = fSessionHierarchy->GetSelected();
5201 TObject *obj = (TObject *)item->GetUserData();
5202 if (!obj || obj->IsA() != TQueryDescription::Class())
return;
5203 TQueryDescription *query = (TQueryDescription *)obj;
5207 if (fActDesc->fAttached && fActDesc->fProof && fActDesc->fProof->IsValid()) {
5208 if ((fActDesc->fActQuery->fStatus == TQueryDescription::kSessionQuerySubmitted) ||
5209 (fActDesc->fActQuery->fStatus == TQueryDescription::kSessionQueryRunning) ) {
5210 new TGMsgBox(fClient->GetRoot(),
this,
"Delete Query",
5211 "Deleting running queries is not allowed", kMBIconExclamation,
5215 m.Form(
"Do you want to delete query \"%s\" from server too ?",
5216 query->fQueryName.Data());
5217 new TGMsgBox(fClient->GetRoot(),
this,
"", m.Data(), kMBIconQuestion,
5218 kMBYes | kMBNo | kMBCancel, &result);
5221 m.Form(
"Dou you really want to delete query \"%s\" ?",
5222 query->fQueryName.Data());
5223 new TGMsgBox(fClient->GetRoot(),
this,
"", m.Data(), kMBIconQuestion,
5224 kMBOk | kMBCancel, &result);
5226 if (result == kMBYes) {
5227 fActDesc->fProof->Remove(query->fReference.Data());
5228 fActDesc->fQueries->Remove((TObject *)query);
5229 fSessionHierarchy->DeleteItem(item);
5232 else if (result == kMBNo || result == kMBOk) {
5233 fActDesc->fQueries->Remove((TObject *)query);
5234 fSessionHierarchy->DeleteItem(item);
5237 fSessionHierarchy->ClearViewPort();
5238 fClient->NeedRedraw(fSessionHierarchy);
5240 WriteConfiguration();
5246 void TSessionViewer::EditQuery()
5248 TGListTreeItem *item = fSessionHierarchy->GetSelected();
5250 TObject *obj = (TObject *)item->GetUserData();
5251 if (!obj || obj->IsA() != TQueryDescription::Class())
return;
5252 TQueryDescription *query = (TQueryDescription *)obj;
5253 TNewQueryDlg *dlg =
new TNewQueryDlg(
this, 350, 310, query, kTRUE);
5260 void TSessionViewer::StartViewer()
5262 TGListTreeItem *item = fSessionHierarchy->GetSelected();
5264 TObject *obj = (TObject *)item->GetUserData();
5265 if (!obj || obj->IsA() != TQueryDescription::Class())
return;
5266 TQueryDescription *query = (TQueryDescription *)obj;
5267 if (!query->fChain && query->fResult &&
5268 (obj = query->fResult->GetInputObject(
"TDSet"))) {
5269 query->fChain = (TDSet *) obj;
5271 if (!query->fChain)
return;
5272 if (query->fChain->IsA() == TChain::Class())
5273 ((TChain *)query->fChain)->StartViewer();
5274 else if (query->fChain->IsA() == TDSet::Class())
5275 ((TDSet *)query->fChain)->StartViewer();
5282 void TSessionViewer::ShowPackages()
5287 if (fActDesc->fLocal)
return;
5288 if (!fActDesc->fProof || !fActDesc->fProof->IsValid())
5290 TString pathtmp = TString::Format(
"%s/%s", gSystem->TempDirectory(),
5291 kSession_RedirectFile);
5293 if (gSystem->RedirectOutput(pathtmp.Data(),
"w") != 0) {
5294 Error(
"ShowStatus",
"stdout/stderr redirection failed; skipping");
5297 fActDesc->fProof->ShowPackages(kTRUE);
5299 if (gSystem->RedirectOutput(0) != 0) {
5300 Error(
"ShowStatus",
"stdout/stderr retore failed; skipping");
5304 fLogWindow =
new TSessionLogView(
this, 700, 100);
5307 fLogWindow->Clear();
5309 fLogWindow->LoadFile(pathtmp.Data());
5310 gVirtualX->TranslateCoordinates(GetId(), fClient->GetDefaultRoot()->GetId(),
5311 0, 0, ax, ay, wdummy);
5312 fLogWindow->Move(ax, ay + GetHeight() + 35);
5313 fLogWindow->Popup();
5319 void TSessionViewer::UpdateListOfPackages()
5321 TObjString *packname;
5322 TPackageDescription *package;
5323 if (fActDesc->fConnected && fActDesc->fAttached &&
5324 fActDesc->fProof && fActDesc->fProof->IsValid() &&
5325 fActDesc->fProof->IsParallel()) {
5327 TList *packlist = fActDesc->fProof->GetListOfEnabledPackages();
5329 TIter nextenabled(packlist);
5330 while ((packname = (TObjString *)nextenabled())) {
5331 package = new TPackageDescription;
5332 package->fName = packname->GetName();
5333 package->fName +=
".par";
5334 package->fPathName = package->fName;
5335 package->fId = fActDesc->fPackages->GetEntries();
5336 package->fUploaded = kTRUE;
5337 package->fEnabled = kTRUE;
5338 if (!fActDesc->fPackages->FindObject(package->fName)) {
5339 fActDesc->fPackages->Add((TObject *)package);
5343 packlist = fActDesc->fProof->GetListOfPackages();
5345 TIter nextpack(packlist);
5346 while ((packname = (TObjString *)nextpack())) {
5347 package = new TPackageDescription;
5348 package->fName = packname->GetName();
5349 package->fName +=
".par";
5350 package->fPathName = package->fName;
5351 package->fId = fActDesc->fPackages->GetEntries();
5352 package->fUploaded = kTRUE;
5353 package->fEnabled = kFALSE;
5354 if (!fActDesc->fPackages->FindObject(package->fName)) {
5355 fActDesc->fPackages->Add((TObject *)package);
5367 void TSessionViewer::ShowEnabledPackages()
5372 if (fActDesc->fLocal)
return;
5373 if (!fActDesc->fProof || !fActDesc->fProof->IsValid())
5375 TString pathtmp = TString::Format(
"%s/%s", gSystem->TempDirectory(),
5376 kSession_RedirectFile);
5378 if (gSystem->RedirectOutput(pathtmp.Data(),
"w") != 0) {
5379 Error(
"ShowStatus",
"stdout/stderr redirection failed; skipping");
5382 fActDesc->fProof->ShowEnabledPackages(kTRUE);
5384 if (gSystem->RedirectOutput(0) != 0) {
5385 Error(
"ShowStatus",
"stdout/stderr retore failed; skipping");
5389 fLogWindow =
new TSessionLogView(
this, 700, 100);
5392 fLogWindow->Clear();
5394 fLogWindow->LoadFile(pathtmp.Data());
5395 gVirtualX->TranslateCoordinates(GetId(), fClient->GetDefaultRoot()->GetId(),
5396 0, 0, ax, ay, wdummy);
5397 fLogWindow->Move(ax, ay + GetHeight() + 35);
5398 fLogWindow->Popup();
5405 void TSessionViewer::ShowLog(
const char *queryref)
5410 if (fActDesc->fProof) {
5411 gVirtualX->SetCursor(GetId(),gVirtualX->CreateCursor(kWatch));
5413 fLogWindow =
new TSessionLogView(
this, 700, 100);
5416 fLogWindow->Clear();
5418 fActDesc->fProof->Connect(
"LogMessage(const char*,Bool_t)",
5419 "TSessionViewer",
this,
"LogMessage(const char*,Bool_t)");
5420 Bool_t logonly = fActDesc->fProof->SendingLogToWindow();
5421 fActDesc->fProof->SendLogToWindow(kTRUE);
5423 fActDesc->fProof->ShowLog(queryref);
5425 fActDesc->fProof->ShowLog(0);
5426 fActDesc->fProof->SendLogToWindow(logonly);
5428 gVirtualX->TranslateCoordinates(GetId(),
5429 fClient->GetDefaultRoot()->GetId(), 0, 0, ax, ay, wdummy);
5430 fLogWindow->Move(ax, ay + GetHeight() + 35);
5431 fLogWindow->Popup();
5432 gVirtualX->SetCursor(GetId(), 0);
5439 void TSessionViewer::ShowInfo(
const char *txt)
5441 fStatusBar->SetText(txt,0);
5442 fClient->NeedRedraw(fStatusBar);
5443 gSystem->ProcessEvents();
5449 void TSessionViewer::ShowStatus()
5454 if (!fActDesc->fProof || !fActDesc->fProof->IsValid())
5456 TString pathtmp = TString::Format(
"%s/%s", gSystem->TempDirectory(),
5457 kSession_RedirectFile);
5459 if (gSystem->RedirectOutput(pathtmp.Data(),
"w") != 0) {
5460 Error(
"ShowStatus",
"stdout/stderr redirection failed; skipping");
5463 fActDesc->fProof->GetStatus();
5465 if (gSystem->RedirectOutput(0) != 0) {
5466 Error(
"ShowStatus",
"stdout/stderr retore failed; skipping");
5470 fLogWindow =
new TSessionLogView(
this, 700, 100);
5473 fLogWindow->Clear();
5475 fLogWindow->LoadFile(pathtmp.Data());
5476 gVirtualX->TranslateCoordinates(GetId(), fClient->GetDefaultRoot()->GetId(),
5477 0, 0, ax, ay, wdummy);
5478 fLogWindow->Move(ax, ay + GetHeight() + 35);
5479 fLogWindow->Popup();
5485 void TSessionViewer::StartupMessage(
char *msg, Bool_t, Int_t done, Int_t total)
5487 Float_t pos = Float_t(Double_t(done * 100)/Double_t(total));
5488 fConnectProg->SetPosition(pos);
5489 fStatusBar->SetText(msg, 1);
5495 void TSessionViewer::MyHandleMenu(Int_t
id)
5499 case kSessionDelete:
5500 fServerFrame->OnBtnDeleteClicked();
5503 case kSessionConnect:
5504 fServerFrame->OnBtnConnectClicked();
5507 case kSessionDisconnect:
5508 fSessionFrame->OnBtnDisconnectClicked();
5511 case kSessionShutdown:
5512 fSessionFrame->ShutdownSession();
5515 case kSessionCleanup:
5523 case kSessionBrowse:
5524 if (fActDesc->fProof && fActDesc->fProof->IsValid()) {
5525 TBrowser *b =
new TBrowser();
5526 fActDesc->fProof->Browse(b);
5530 case kSessionShowStatus:
5534 case kSessionGetQueries:
5535 fSessionFrame->OnBtnGetQueriesClicked();
5546 case kQueryStartViewer:
5551 fQueryFrame->OnBtnSubmit();
5559 void TSessionViewer::OnCascadeMenu()
5562 fQueryFrame->GetStatsCanvas()->cd();
5563 fQueryFrame->GetStatsCanvas()->Clear();
5564 fQueryFrame->GetStatsCanvas()->Modified();
5565 fQueryFrame->GetStatsCanvas()->Update();
5566 if (!fActDesc || !fActDesc->fActQuery)
return;
5567 fActDesc->fNbHistos = 0;
5570 if (fActDesc->fAttached && fActDesc->fProof &&
5571 fActDesc->fProof->IsValid()) {
5572 if (fOptionsMenu->IsEntryChecked(kOptionsFeedback)) {
5574 while (kFeedbackHistos[i]) {
5575 if (fCascadeMenu->IsEntryChecked(41+i)) {
5576 fActDesc->fProof->AddFeedback(kFeedbackHistos[i]);
5583 fActDesc->fProof->ClearFeedback();
5589 while (kFeedbackHistos[i]) {
5591 if (fCascadeMenu->IsEntryChecked(41+i))
5592 fActDesc->fNbHistos++;
5595 fQueryFrame->GetStatsCanvas()->SetEditable(kTRUE);
5596 fQueryFrame->GetStatsCanvas()->Clear();
5597 if (fActDesc->fNbHistos == 4)
5598 fQueryFrame->GetStatsCanvas()->Divide(2, 2);
5599 else if (fActDesc->fNbHistos > 4)
5600 fQueryFrame->GetStatsCanvas()->Divide(3, 2);
5602 fQueryFrame->GetStatsCanvas()->Divide(fActDesc->fNbHistos, 1);
5605 if (fActDesc->fActQuery && fActDesc->fActQuery->fResult &&
5606 fActDesc->fActQuery->fResult->GetOutputList()) {
5607 fQueryFrame->UpdateHistos(fActDesc->fActQuery->fResult->GetOutputList());
5608 fQueryFrame->ResetProgressDialog(
"", 0, 0, 0);
5610 else if (fActDesc->fActQuery) {
5611 fQueryFrame->ResetProgressDialog(fActDesc->fActQuery->fSelectorString,
5612 fActDesc->fActQuery->fNbFiles,
5613 fActDesc->fActQuery->fFirstEntry,
5614 fActDesc->fActQuery->fNoEntries);
5616 fQueryFrame->UpdateInfos();
5622 Bool_t TSessionViewer::ProcessMessage(Long_t msg, Long_t parm1, Long_t)
5626 switch (GET_MSG(msg)) {
5628 switch (GET_SUBMSG(msg)) {
5633 case kFileCloseViewer:
5637 case kFileLoadConfig:
5640 fi.fFilename = strdup((
char *)gSystem->BaseName(fConfigFile));
5641 fi.fIniDir = strdup((
char *)gSystem->HomeDirectory());
5642 fi.fFileTypes = conftypes;
5643 new TGFileDialog(fClient->GetRoot(),
this, kFDOpen, &fi);
5645 fConfigFile = fi.fFilename;
5646 ReadConfiguration(fConfigFile);
5647 OnListTreeClicked(fSessionHierarchy->GetSelected(), 1, 0, 0);
5652 case kFileSaveConfig:
5655 fi.fFilename = strdup((
char *)gSystem->BaseName(fConfigFile));
5656 fi.fIniDir = strdup((
char *)gSystem->HomeDirectory());
5657 fi.fFileTypes = conftypes;
5658 new TGFileDialog(fClient->GetRoot(),
this, kFDSave, &fi);
5660 fConfigFile = fi.fFilename;
5661 WriteConfiguration(fConfigFile);
5668 if (!gApplication->ReturnFromRun())
5670 gApplication->Terminate(0);
5674 fServerFrame->OnBtnNewServerClicked();
5678 fServerFrame->OnBtnAddClicked();
5681 case kSessionDelete:
5682 fServerFrame->OnBtnDeleteClicked();
5685 case kSessionCleanup:
5693 case kSessionConnect:
5694 fServerFrame->OnBtnConnectClicked();
5697 case kSessionDisconnect:
5698 fSessionFrame->OnBtnDisconnectClicked();
5701 case kSessionShutdown:
5702 fSessionFrame->ShutdownSession();
5705 case kSessionShowStatus:
5709 case kSessionGetQueries:
5710 fSessionFrame->OnBtnGetQueriesClicked();
5714 dlg =
new TNewQueryDlg(
this, 350, 310);
5726 case kQueryStartViewer:
5731 fQueryFrame->OnBtnSubmit();
5734 case kOptionsAutoSave:
5735 if(fOptionsMenu->IsEntryChecked(kOptionsAutoSave)) {
5736 fOptionsMenu->UnCheckEntry(kOptionsAutoSave);
5740 fOptionsMenu->CheckEntry(kOptionsAutoSave);
5745 case kOptionsStatsHist:
5746 if(fOptionsMenu->IsEntryChecked(kOptionsStatsHist)) {
5747 fOptionsMenu->UnCheckEntry(kOptionsStatsHist);
5748 gEnv->SetValue(
"Proof.StatsHist", 0);
5751 fOptionsMenu->CheckEntry(kOptionsStatsHist);
5752 gEnv->SetValue(
"Proof.StatsHist", 1);
5756 case kOptionsStatsTrace:
5757 if(fOptionsMenu->IsEntryChecked(kOptionsStatsTrace)) {
5758 fOptionsMenu->UnCheckEntry(kOptionsStatsTrace);
5759 gEnv->SetValue(
"Proof.StatsTrace", 0);
5762 fOptionsMenu->CheckEntry(kOptionsStatsTrace);
5763 gEnv->SetValue(
"Proof.StatsTrace", 1);
5767 case kOptionsSlaveStatsTrace:
5768 if(fOptionsMenu->IsEntryChecked(kOptionsSlaveStatsTrace)) {
5769 fOptionsMenu->UnCheckEntry(kOptionsSlaveStatsTrace);
5770 gEnv->SetValue(
"Proof.SlaveStatsTrace", 0);
5773 fOptionsMenu->CheckEntry(kOptionsSlaveStatsTrace);
5774 gEnv->SetValue(
"Proof.SlaveStatsTrace", 1);
5778 case kOptionsFeedback:
5779 if(fOptionsMenu->IsEntryChecked(kOptionsFeedback)) {
5780 fOptionsMenu->UnCheckEntry(kOptionsFeedback);
5783 fOptionsMenu->CheckEntry(kOptionsFeedback);
5793 if (fCascadeMenu->IsEntryChecked(parm1)) {
5794 fCascadeMenu->UnCheckEntry(parm1);
5797 fCascadeMenu->CheckEntry(parm1);
5803 if (fCascadeMenu->IsEntryChecked(parm1)) {
5804 fCascadeMenu->UnCheckEntry(parm1);
5807 fCascadeMenu->CheckEntry(parm1);
5815 TString rootx = TROOT::GetBinDir() +
"/root -a &";
5816 gSystem->Exec(rootx);
5819 new TWin32SplashThread(kTRUE);
5822 sprintf(str,
"About ROOT %s...", gROOT->GetVersion());
5823 TRootHelpDialog *hd =
new TRootHelpDialog(
this, str, 600, 400);
5824 hd->SetText(gHelpAbout);