[108440] users/mojca/notes
mojca at macports.org
mojca at macports.org
Tue Jul 23 08:27:23 PDT 2013
Revision: 108440
https://trac.macports.org/changeset/108440
Author: mojca at macports.org
Date: 2013-07-23 08:27:23 -0700 (Tue, 23 Jul 2013)
Log Message:
-----------
gate: a list of patches for review
Added Paths:
-----------
users/mojca/notes/patches-for-review/
users/mojca/notes/patches-for-review/README
users/mojca/notes/patches-for-review/gate-error-redirect-cerr.patch
users/mojca/notes/patches-for-review/gate-visualize-source.patch
users/mojca/notes/patches-for-review/geant4-hack-for-gate-cout.patch
users/mojca/notes/patches-for-review/qt/
users/mojca/notes/patches-for-review/qt/gate-qt.patch
users/mojca/notes/patches-for-review/qt/geant4-qt-open-macro.patch
users/mojca/notes/patches-for-review/qt/geant4-qt-tabs.patch
users/mojca/notes/patches-for-review/root-remove-sighandler.patch
Added: users/mojca/notes/patches-for-review/README
===================================================================
--- users/mojca/notes/patches-for-review/README (rev 0)
+++ users/mojca/notes/patches-for-review/README 2013-07-23 15:27:23 UTC (rev 108440)
@@ -0,0 +1 @@
+Patches written by Jérôme Suhard, copied from http://suhard.fr/gate/patches/
Added: users/mojca/notes/patches-for-review/gate-error-redirect-cerr.patch
===================================================================
--- users/mojca/notes/patches-for-review/gate-error-redirect-cerr.patch (rev 0)
+++ users/mojca/notes/patches-for-review/gate-error-redirect-cerr.patch 2013-07-23 15:27:23 UTC (rev 108440)
@@ -0,0 +1,13 @@
+--- source/general/include/GateMessageManager.hh 2011-03-01 16:51:22.000000000 +0100
++++ source/general/include/GateMessageManager.hh 2011-12-19 16:19:08.000000000 +0100
+@@ -392,8 +392,8 @@
+ f_ << __FILE__ << " (l."<<__LINE__<<"): ";\
+ G4String str_f = f_.str(); \
+ G4String str_s = s_.str(); \
+- std::cout << str_f << str_s << std::endl; \
+- exit(-1); \
++ std::cerr << str_f << str_s << std::endl; \
++ abort(); \
+ G4Exception(str_f,str_s, \
+ FatalException," "); \
+ } \
Added: users/mojca/notes/patches-for-review/gate-visualize-source.patch
===================================================================
--- users/mojca/notes/patches-for-review/gate-visualize-source.patch (rev 0)
+++ users/mojca/notes/patches-for-review/gate-visualize-source.patch 2013-07-23 15:27:23 UTC (rev 108440)
@@ -0,0 +1,27 @@
+--- source/physics/src/GateVSource.cc 2011-03-01 16:51:02.000000000 +0100
++++ source/physics/src/GateVSource.cc 2011-12-19 16:59:18.000000000 +0100
+@@ -124,7 +124,7 @@
+ G4cout << "Invalid count; 2000 used.\n";
+ }
+
+- if(fSize <=0 || fSize > 20) {
++ if(fSize <=0) {
+ G4cout << "Invalid size; 3.0 used.\n";
+ }
+
+@@ -137,13 +137,13 @@
+ G4VisAttributes attribs(colorMapIt->second);
+
+ G4Circle circle;
+- circle.SetScreenSize(fSize);
++ circle.SetWorldSize(fSize);
+ circle.SetFillStyle(G4Circle::filled);
+ circle.SetVisAttributes(attribs);
+
+ for (int k=0; k<iCount; ++k){
+ //m_sps->GeneratePositionStuff();
+- circle.SetPosition( m_sps->GetParticlePosition() );
++ circle.SetPosition( m_posSPS->GenerateOne() );
+ visman->Draw(circle);
+ }
+
Added: users/mojca/notes/patches-for-review/geant4-hack-for-gate-cout.patch
===================================================================
--- users/mojca/notes/patches-for-review/geant4-hack-for-gate-cout.patch (rev 0)
+++ users/mojca/notes/patches-for-review/geant4-hack-for-gate-cout.patch 2013-07-23 15:27:23 UTC (rev 108440)
@@ -0,0 +1,86 @@
+--- source/interfaces/basic/src/G4UIQt.cc 2011-12-19 13:34:32.000000000 +0100
++++ source/interfaces/basic/src/G4UIQt.cc 2011-12-19 15:57:56.000000000 +0100
+@@ -32,6 +32,7 @@
+ #ifdef G4UI_BUILD_QT_SESSION
+
+ #include "G4Types.hh"
++#include "G4strstreambuf.hh"
+
+ #include <string.h>
+
+@@ -65,7 +66,7 @@
+ #include <qmenu.h>
+ #include <qlistwidget.h>
+ #include <qtreewidget.h>
+-
++#include <QMessageBox>
+
+
+ #include <stdlib.h>
+@@ -534,6 +535,11 @@
+ G4UIsession* G4UIQt::SessionStart (
+ )
+ {
++backup_cout = std::cout.rdbuf();
++backup_cerr = std::cerr.rdbuf();
++std::cout.rdbuf( &G4coutbuf );
++std::cerr.rdbuf( &G4cerrbuf );
++
+ #ifdef G4DEBUG_INTERFACES_BASIC
+ printf("G4UIQt::G4UIQt SessionStart\n");
+ #endif
+@@ -609,6 +615,8 @@
+ void G4UIQt::SessionTerminate (
+ )
+ {
++ std::cout.rdbuf( backup_cout);
++ std::cerr.rdbuf( backup_cerr);
+ G4Qt* interactorManager = G4Qt::getInstance ();
+ fMainWindow->close();
+ ((QApplication*)interactorManager->GetMainInteractor())->exit();
+@@ -674,6 +682,14 @@
+ G4String aString
+ )
+ {
++ /*
++ * "Unfreeze" the GUI each time we receive a string in G4cout..
++ * ... but the best solution will be to implement a thread for the simulation
++ * keeping the main thread for compute and refresh the GUI.
++ * Jerome Suhard, jerome at suhard.fr
++ */
++ QCoreApplication::processEvents();
++
+ if (!aString) return 0;
+
+ QStringList newStr;
+@@ -707,6 +723,18 @@
+ {
+ if (!aString) return 0;
+
++ QString aQString((char*)aString.data());
++ aQString = aQString.trimmed();
++ if (aQString.isEmpty()) return 0;
++
++ /*
++ * The MessageBox keep the focus and prevent the thread for quitting
++ * allowing people to see the error message before the GUI disapeared
++ * Jerome Suhard, jerome at suhard.fr
++ */
++ QMessageBox::critical ( fMainWindow, tr("Error"), aQString);
++
++
+ QStringList newStr;
+
+ // Add to stringList
+--- source/interfaces/basic/include/G4UIQt.hh 2011-12-19 13:34:22.000000000 +0100
++++ source/interfaces/basic/include/G4UIQt.hh 2011-12-19 15:41:53.000000000 +0100
+@@ -178,6 +178,9 @@
+ int fLastQTabSizeX;
+ int fLastQTabSizeY;
+
++ std::streambuf *backup_cout;
++ std::streambuf *backup_cerr;
++
+ private Q_SLOTS :
+ void ExitSession();
+ void ClearButtonCallback();
Added: users/mojca/notes/patches-for-review/qt/gate-qt.patch
===================================================================
--- users/mojca/notes/patches-for-review/qt/gate-qt.patch (rev 0)
+++ users/mojca/notes/patches-for-review/qt/gate-qt.patch 2013-07-23 15:27:23 UTC (rev 108440)
@@ -0,0 +1,34 @@
+--- Gate.cc 2011-03-02 12:11:30.000000000 +0100
++++ Gate.cc 2011-12-19 17:09:47.000000000 +0100
+@@ -3,6 +3,7 @@
+
+ #include <queue>
+
++#include "G4UIExecutive.hh"
+ #include "G4UIterminal.hh"
+ #include "G4UItcsh.hh"
+ #include "GateSteppingVerbose.hh"
+@@ -293,7 +294,7 @@
+
+ if (session) // Define UI session for interactive mode
+ {
+- Welcome();
++ //Welcome();
+ // G4UIterminal is a (dumb) terminal //
+ // UI->ApplyCommand("/control/execute vis.mac");
+
+@@ -303,8 +304,12 @@
+ session = new G4UIRoot(argc,argv,"GATE", "Geant4 Application for Tomographic Emission","root_logo.xpm", "logoGate_medium.xpm");
+ #endif
+
+- session->SessionStart();
+- //delete session;
++ G4UIExecutive* ui = new G4UIExecutive(argc, argv);
++ if (ui->IsGUI()) {
++ UI->ApplyCommand("/gate/control/execute gui.mac");
++ }
++ ui->SessionStart();
++ delete ui;
+ }
+ else // Batch mode
+ {
Added: users/mojca/notes/patches-for-review/qt/geant4-qt-open-macro.patch
===================================================================
--- users/mojca/notes/patches-for-review/qt/geant4-qt-open-macro.patch (rev 0)
+++ users/mojca/notes/patches-for-review/qt/geant4-qt-open-macro.patch 2013-07-23 15:27:23 UTC (rev 108440)
@@ -0,0 +1,80 @@
+--- source/interfaces/basic/src/G4UIQt.cc 2011-12-19 13:34:32.000000000 +0100
++++ source/interfaces/basic/src/G4UIQt.cc 2011-12-19 14:22:07.000000000 +0100
+@@ -65,7 +65,7 @@
+ #include <qmenu.h>
+ #include <qlistwidget.h>
+ #include <qtreewidget.h>
+-
++#include <QFileDialog>
+
+
+ #include <stdlib.h>
+@@ -214,11 +214,14 @@
+
+ fMainWindow->setCentralWidget(mainWidget);
+
+-
+ // Add a quit subMenu
+ QMenu *fileMenu = fMainWindow->menuBar()->addMenu("File");
+- fileMenu->addAction("Quit", this, SLOT(ExitSession()));
+-
++ fileMenu->addAction("Open macro...", this, SLOT(OpenMacro()));
++ QAction *aboutAction = fileMenu->addAction("About", this, SLOT(About()));
++ aboutAction->setMenuRole(QAction::AboutRole);
++fileMenu->addSeparator();
++ QAction *quitAction = fileMenu->addAction("Quit", this, SLOT(ExitSession()));
++ quitAction->setMenuRole(QAction::QuitRole);
+
+ AddInteractor ("file",(G4Interactor)fileMenu);
+ #ifdef G4DEBUG_INTERFACES_BASIC
+@@ -739,10 +742,9 @@
+ if (aName == NULL) return;
+ if (aLabel == NULL) return;
+
+- QMenu *fileMenu = new QMenu(aLabel);
+- fMainWindow->menuBar()->insertMenu(fMainWindow->menuBar()->actions().last(),fileMenu);
+-
+- AddInteractor (aName,(G4Interactor)fileMenu);
++ QMenu *aMenu = new QMenu(aLabel);
++ fMainWindow->menuBar()->addMenu(aMenu);
++ AddInteractor (aName,(G4Interactor)aMenu);
+ }
+
+
+@@ -1192,6 +1194,25 @@
+ SessionTerminate();
+ }
+
++void G4UIQt::OpenMacro (
++)
++{
++ QString fileName = QFileDialog::getOpenFileName(fMainWindow, tr("Open Macro"), QDir::homePath(), tr("Macro (*.mac *.g4m);;All (*.*)"), 0, QFileDialog::ReadOnly|QFileDialog::DontResolveSymlinks);
++ if (!fileName.isEmpty()) {
++ fMainWindow->setWindowTitle( fileName);
++ QFileInfo *fileInfo = new QFileInfo(fileName);
++ QDir::setCurrent(fileInfo->absolutePath());
++ ApplyShellCommand("/control/execute "+fileName.toStdString(),exitSession,exitPause);
++ }
++
++}
++
++void G4UIQt::About(
++)
++{
++QMessageBox::about ( fMainWindow, tr("Gate"), QString("\t\tGATE 6.1\n\tCopyright : OpenGATE Collaboration\nReference : Phys. Med. Biol. 49 (2004) 4543-4561\nReference : Phys. Med. Biol. 56 (2011) 881-901\n WWW : http://www.opengatecollaboration.org/") );
++}
++
+ void G4UIQt::ExitHelp(
+ )
+ {
+--- source/interfaces/basic/include/G4UIQt.hh 2011-12-19 13:34:22.000000000 +0100
++++ source/interfaces/basic/include/G4UIQt.hh 2011-12-19 14:23:27.000000000 +0100
+@@ -180,6 +180,8 @@
+
+ private Q_SLOTS :
+ void ExitSession();
++ void OpenMacro();
++ void About();
+ void ClearButtonCallback();
+ void CommandEnteredCallback();
+ void ButtonCallback(const QString&);
Added: users/mojca/notes/patches-for-review/qt/geant4-qt-tabs.patch
===================================================================
--- users/mojca/notes/patches-for-review/qt/geant4-qt-tabs.patch (rev 0)
+++ users/mojca/notes/patches-for-review/qt/geant4-qt-tabs.patch 2013-07-23 15:27:23 UTC (rev 108440)
@@ -0,0 +1,36 @@
+--- source/interfaces/basic/src/G4UIQt.cc 2011-12-19 13:34:32.000000000 +0100
++++ source/interfaces/basic/src/G4UIQt.cc 2011-12-19 15:36:00.000000000 +0100
+@@ -140,7 +140,7 @@
+
+ QWidget *mainWidget = new QWidget(fMainWindow);
+ fMyVSplitter = new QSplitter(Qt::Horizontal,fMainWindow);
+- fToolBox = new QToolBox();
++ fToolBox = new QTabWidget();
+
+ // Set layouts
+
+@@ -180,10 +180,9 @@
+ // the splitter
+ // fToolBox->addItem(fVisParametersTBWidget,"Vis parameters");
+ // fToolBox->addItem(fViewComponentsTBWidget,"Viewer components");
+- fToolBox->addItem(fHelpTBWidget,"Help");
+- fToolBox->addItem(fCoutTBWidget,"Cout");
+- fToolBox->addItem(fHistoryTBWidget,"History");
+-
++ fToolBox->addTab(fCoutTBWidget,"Output");
++ fToolBox->addTab(fHistoryTBWidget,"History");
++ fToolBox->addTab(fHelpTBWidget,"Help");
+
+
+ fToolBox->setSizePolicy (QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed));
+--- source/interfaces/basic/include/G4UIQt.hh 2011-12-19 13:34:22.000000000 +0100
++++ source/interfaces/basic/include/G4UIQt.hh 2011-12-19 15:36:44.000000000 +0100
+@@ -158,7 +158,7 @@
+ QLineEdit * fCommandArea;
+ QTextEdit *fCoutTBTextArea;
+ QTextEdit *fHelpArea;
+- QToolBox* fToolBox;
++ QTabWidget* fToolBox;
+ QStringList fG4cout;
+ QLineEdit * fCoutFilter;
+
Added: users/mojca/notes/patches-for-review/root-remove-sighandler.patch
===================================================================
--- users/mojca/notes/patches-for-review/root-remove-sighandler.patch (rev 0)
+++ users/mojca/notes/patches-for-review/root-remove-sighandler.patch 2013-07-23 15:27:23 UTC (rev 108440)
@@ -0,0 +1,18 @@
+--- core/unix/src/TUnixSystem.cxx 2011-08-18 16:45:41.000000000 +0200
++++ core/unix/src/TUnixSystem.cxx 2011-12-19 16:36:52.000000000 +0100
+@@ -3566,6 +3566,7 @@
+ //______________________________________________________________________________
+ void TUnixSystem::UnixSignal(ESignals sig, SigHandler_t handler)
+ {
++/*
+ // Set a signal handler for a signal.
+
+ if (gSignalMap[sig].fHandler != handler) {
+@@ -3596,6 +3597,7 @@
+ gSignalMap[sig].fOldHandler) < 0)
+ ::SysError("TUnixSystem::UnixSignal", "sigaction");
+ }
++*/
+ }
+
+ //______________________________________________________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20130723/d136e80d/attachment.html>
More information about the macports-changes
mailing list