Commit f8e909f7 authored by Alessandro Mirone's avatar Alessandro Mirone
Browse files

change print to print()

parent 35e559e8
......@@ -42,7 +42,7 @@ try:
sip.setapi("QString", 2)
sip.setapi("QVariant", 2)
except:
print " SIP NO "
print( " SIP NO ")
pass
......@@ -745,7 +745,7 @@ class many_Number(Parametro):
exec(ss,{"math":math,"numpy":np,"np":np,"pylab":pylab},resdic)
test = resdic["test"]
else:
print "cowardly refusing to execude suspicious code :", ss
print( "cowardly refusing to execude suspicious code :", ss)
except:
pass
return test
......@@ -777,12 +777,12 @@ def makeintervalfromfirst(value):
test = resdic["test"]
val = test[0]
else:
print "cowardly refusing to execude suspicious code :", ss
print( "cowardly refusing to execude suspicious code :", ss)
return "unsafe code : "+value
return "[%d,%d]"%(val,val+1)
except:
print " failed in makeintervalfromfirst with value = %s"% value
print( " failed in makeintervalfromfirst with value = %s"% value)
return value+" <<== PROBLEM "
......@@ -829,7 +829,7 @@ class aNumber4SpecScan(aNumber):
specfile_name =self.specfile.getValue()
warning=""
if not self.specfile.isReady( ):
if DEBUG : print "\nWARNING : cannot open file ", specfile_name
if DEBUG : print( "\nWARNING : cannot open file ", specfile_name)
warning += "\nWARNING : cannot open file "
self.mywarning = warning
return
......@@ -1995,7 +1995,7 @@ class creationtab2(Qt.QWidget):
edw.par.value = ""
if type(edw.par.value) != type(""):
if True or DEBUG :
print " in refresh normale " , edw.par.value
print( " in refresh normale " , edw.par.value)
edw.par.value="problem"
else:
edw.take_par_value(edw.par, no_automatic=0 )
......@@ -2005,7 +2005,7 @@ class creationtab2(Qt.QWidget):
for edw in self.edws:
if type(edw.par.value) != type(""):
if True or DEBUG :
print " in refresh forward ", edw.par.value
print( " in refresh forward ", edw.par.value)
edw.par.value="problem"
else:
edw.take_par_value(edw.par, no_automatic=1 )
......@@ -2320,7 +2320,7 @@ class MyTree( QtGui.QTreeView):
if DEBUG :print pippo
pippo = index.model().filePath(index)
print pippo
print( pippo)
pippo_name = os.path.basename(pippo)
if pippo_name[-3:]==".py":
......@@ -2335,7 +2335,7 @@ class MyTree( QtGui.QTreeView):
if hasattr(foo, "OPTIONS"):
options = foo.OPTIONS
print " LE OPZIONI SONO " , options
print( " LE OPZIONI SONO " , options)
i=0
for chiave, (valore,aiuto) in options.items():
rb = QtGui.QCheckBox(chiave)
......@@ -2361,7 +2361,7 @@ class MyTree( QtGui.QTreeView):
if DEBUG :print pippo
pippo = index.model().filePath(index)
if DEBUG : print str(pippo)
if DEBUG : print( str(pippo))
pippo=str(pippo)
if not( sys.platform =="win32"):
......@@ -2889,7 +2889,7 @@ class mainwindow2(Qt.QMainWindow):
if DEBUG :print " rinfresco self " , self
for edw in self.edws:
if type(edw.par.value) != type(""):
print " PROBLEMA in refresh mainwindow2 ", edw.par.value
print( " PROBLEMA in refresh mainwindow2 ", edw.par.value)
edw.par.value="problem"
else:
edw.take_par_value(edw.par )
......@@ -2902,7 +2902,7 @@ class mainwindow2(Qt.QMainWindow):
self.InterfaceDescription["init_initialiser"]( dico_copy_buffer )
self.refresh()
else:
print " non predisposto per init_initialiser"
print( " non predisposto per init_initialiser")
def CreateInputsListsGuided(self):
......@@ -3008,7 +3008,7 @@ class hdf5dialog(Qt.QDialog):
self.loadUi() # load the ui file
self.hdf5File=None
def closeEvent(self,event):
print " CLOSE EVENT "
print( " CLOSE EVENT " )
if self.hdf5File is not None:
self.hdf5File.close()
event.accept()
......@@ -3568,3 +3568,4 @@ def wizardMain(filename, metodi, extrawpaths, options ):
app.exec_()
# wizardMain("../../data/shadok_eb-003.gif", metodi )
......@@ -51,21 +51,22 @@ def make_obj( h5group , h5, groupname ):
if key[:len("python_")]=="python_":
func_name = key[len("python_"):]
sfunc = h5group[key].value
print " SFUNC " , sfunc
print( " SFUNC " , sfunc)
s="def %s(self):\n"%func_name
sl = sfunc.split("\n")
for l in sl:
s+=" "+l+"\n"
s+="foo=%s\n"%func_name
if python_code_is_safe(s):
print " ESEGUO " , s
print( " ESEGUO " , s)
exec(s )
dictio[func_name] = foo
if func_name == runit:
runit = foo
else:
print "cowardly refusing to execute suspicious python code ", s
print( "cowardly refusing to execute suspicious python code ", s)
oggetto = type('MyObject',(object,),dictio)()
return runit, oggetto
......@@ -25,13 +25,13 @@ def main():
try:
opts, args = getopt.getopt(sys.argv[1:],"h",["shift_the_reference=","do_deconvolution=","wroot="])
except getopt.GetoptError:
print usage
print( usage)
sys.exit(2)
print opts, args
print( opts, args)
extrawpaths=[]
for opt, arg in opts:
if opt == '-h':
print usage
print( usage)
sys.exit()
elif opt in ("--shift_the_reference"):
shift_the_reference = int(arg)
......@@ -58,9 +58,10 @@ def main():
# metodi["XRS Prediction"] = metodo_xrsprediction
print animation_filename
print( animation_filename)
wizardMain(animation_filename, metodi, extrawpaths, options)
if __name__=="__main__":
main()
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
......@@ -28,7 +28,7 @@ from PyQt4 import QtGui
import IPython
print IPython.__version__
print( IPython.__version__)
if IPython.__version__.startswith("2"):
QTCONSOLE = False
else:
......@@ -100,3 +100,4 @@ if __name__ =="__main__":
## widget.console.printText(message)
app.exec_()
......@@ -61,3 +61,4 @@ view.setModel(proxy)
view.show()
sys.exit(app.exec_())
......@@ -14,7 +14,7 @@ class MyLoop(QtCore.QEventLoop):
QtCore.QEventLoop.__init__(self)
def quit(self,path):
print " loaded " , path
print( " loaded " , path)
QtCore.QEventLoop.quit(self)
My_loop = MyLoop()
......@@ -27,7 +27,7 @@ class MyTree( QtGui.QTreeView):
def itemClicked(self, modelIndex):
event ="itemDoubleClicked"
print event, modelIndex
print( event, modelIndex)
index = self.selectedIndexes()[0]
......@@ -36,10 +36,10 @@ class MyTree( QtGui.QTreeView):
# index = self.model().mapToSource(index )
pippo = index.model().data(index)
print pippo
print( pippo)
pippo = index.model().filePath(index)
print str(pippo)
print( str(pippo))
class MethodsProxyModel(Qt.QAbstractProxyModel):
......@@ -55,16 +55,16 @@ class MethodsProxyModel(Qt.QAbstractProxyModel):
def fixModel(self):
print " fix model "
print( " fix model ")
self.mapping.clear()
for ir, root in enumerate(self.rootIndexes):
print root
print( root)
sourceIndex = self.model.index(root)
print " sourceIndex.internalPointer() " , sourceIndex.internalId()
print( " sourceIndex.internalPointer() " , sourceIndex.internalId())
proxy = self.createIndex(ir, 0, sourceIndex.internalId())
......@@ -74,23 +74,23 @@ class MethodsProxyModel(Qt.QAbstractProxyModel):
print " STACK AGGIUNGO ", sourceIndex.data().toString(), " con rowcount ", self.model.rowCount(sourceIndex )
print( " STACK AGGIUNGO ", sourceIndex.data().toString(), " con rowcount ", self.model.rowCount(sourceIndex ) )
todo = range( self.model.rowCount(sourceIndex ) )
stack = [ ( iter(todo) , sourceIndex ) ]
print stack
print( stack)
while len(stack):
try:
it, si = stack[-1]
ir = it.next()
for ic in range(4):
print ic
print( ic)
sourceIndex = self.model.index( ir,ic, si)
if sourceIndex and sourceIndex != Qt.QModelIndex():
print " AGGIUNGO per ir ic ", ir, ic, " ITEM sourceIndex ", sourceIndex.data().toString()
print( " AGGIUNGO per ir ic ", ir, ic, " ITEM sourceIndex ", sourceIndex.data().toString())
proxy = self.createIndex(ir, ic, sourceIndex.internalId())
tmp = Qt.QPersistentModelIndex(sourceIndex)
......@@ -103,38 +103,38 @@ class MethodsProxyModel(Qt.QAbstractProxyModel):
self.model.setRootPath(percorso)
My_loop.exec_()
print " STACK AGGIUNGO ", sourceIndex.data().toString(), " con rowcount ", self.model.rowCount(sourceIndex )
print( " STACK AGGIUNGO ", sourceIndex.data().toString(), " con rowcount ", self.model.rowCount(sourceIndex ) )
todo = range( self.model.rowCount(sourceIndex ) )
stack.append( ( iter(todo) , sourceIndex ) )
except StopIteration:
stack = stack[:-1]
def columnCount( self, index ):
print " column count "
print( " column count " )
return 4
def rowCount( self, parent ):
print " row count A"
print( " row count A")
sourceParent = Qt.QModelIndex()
if parent.isValid():
sourceParent = self.mapToSource(parent)
if sourceParent ==Qt.QModelIndex():
print " row count B", 1
print( " row count B", 1)
return 1
count = self.model.rowCount(sourceParent)
print " row count C", count
print( " row count C", count)
return count
def mapToSource(self, proxyIndex):
print "DB1 map to source "
print( "DB1 map to source ")
index = proxyIndex
coords = []
while index != QtCore.QModelIndex():
......@@ -143,44 +143,44 @@ class MethodsProxyModel(Qt.QAbstractProxyModel):
coords.reverse()
print "DB1 coords ", coords
print( "DB1 coords ", coords)
if len(coords)==0:
print "DB1 RITORNO 0"
print( "DB1 RITORNO 0")
return QtCore.QModelIndex()
r,c = coords[0]
if c>0 or r>= len(self.rootIndexes):
print "DB1 RITORNO 0b None"
print( "DB1 RITORNO 0b None")
return QtCore.QModelIndex()
# return None
# index = self.rootIndexes[c]
index = self.model.index(self.rootIndexes[0])
print "DB1 RADICE ", self.model.filePath(index)
print( "DB1 RADICE ", self.model.filePath(index))
for r,c in coords[1:]:
index = index.child(r,c)
print "DB1 in profondita ", self.model.filePath(index)
print( "DB1 in profondita ", self.model.filePath(index))
print "DB1 RITORNO ", index
print "DB1 RITORNO ", self.model.filePath(index)
print( "DB1 RITORNO ", index)
print( "DB1 RITORNO ", self.model.filePath(index))
return index
def mapFromSource(self, sourceIndex):
print "DB1 map from source "
print( "DB1 map from source ")
if not sourceIndex.isValid():
print "DB1 map from source non valido "
print( "DB1 map from source non valido ")
return Qt.QModelIndex()
print "DB1 map from sourc filePath ", self.model.filePath(sourceIndex)
print( "DB1 map from sourc filePath ", self.model.filePath(sourceIndex))
pi = Qt.QPersistentModelIndex(sourceIndex)
if pi in self.mapping:
print "DB1 mapfrom source ben in mapping"
print( "DB1 mapfrom source ben in mapping")
return self.mapping[pi]
else:
print " DB1 non c'e'"
print( " DB1 non c'e'")
return Qt.QModelIndex()
......@@ -206,15 +206,15 @@ class MethodsProxyModel(Qt.QAbstractProxyModel):
def index(self, row, column, parent):
print " IndEX , parent", parent.data().toString()
print( " IndEX , parent", parent.data().toString())
sourceParent= Qt.QModelIndex()
if parent.isValid() :
sourceParent = self.mapToSource(parent)
print "DEB2 good ", sourceParent.model().filePath(sourceParent), row, column
print( "DEB2 good ", sourceParent.model().filePath(sourceParent), row, column)
else:
print "DEB2 fault"
print( "DEB2 fault")
if (row,column)==(0,0):
sourceParent = self.model.index(self.rootIndexes[row])
return self.mapFromSource(sourceParent)
......@@ -224,7 +224,7 @@ class MethodsProxyModel(Qt.QAbstractProxyModel):
#sourceParent = self.model.invisibleRootItem()
print " IndEX , parent", sourceParent.model().filePath(sourceParent)
print( " IndEX , parent", sourceParent.model().filePath(sourceParent))
sind = self.model.index(row, column, sourceParent )
......@@ -273,14 +273,14 @@ if(1):
rindexes.append(methods_model.index(p.lower()))
# methods_proxy = MethodsProxyModel( model=methods_model, rootIndexes = rindexes )
print " CREO PROXY"
print( " CREO PROXY")
methods_proxy = MethodsProxyModel( model=methods_model, rootIndexes = wpaths )
# methods_proxy.fixModel()
print " CREO OK "
print( " CREO OK ")
# tree_view.setRootIndex(Qt.QModelIndex())
......@@ -323,7 +323,7 @@ if (0):
# index = self.tree_view.model().mapToSource(index )
pippo = index.model().data(index)
print pippo
print( pippo)
pippo = index.model().filePath(index)
pippo = str(pippo)
......@@ -334,3 +334,4 @@ if (0):
self.viewsTab.addTab(view, "Go create : %s"% os.path.basename( pippo ))
......@@ -17,7 +17,7 @@ list = []
print " SORTYPROXY "
print( " SORTYPROXY " )
class SortProxy(Qt.QAbstractProxyModel):
......@@ -119,7 +119,7 @@ class SortProxy(Qt.QAbstractProxyModel):
# print " RITORNO ", a
return Qt.QModelIndex(a)
print " NON TROVATO "
print( " NON TROVATO ")
return Qt.QModelIndex()
......@@ -183,7 +183,7 @@ class SortProxy(Qt.QAbstractProxyModel):
# continue
if ( (not si.text().startsWith(Qt.QString("A")))):
continue
print si.text(), si.row(), si.column()
print( si.text(), si.row(), si.column())
row = si.row()
......@@ -223,7 +223,7 @@ class SortProxy(Qt.QAbstractProxyModel):
self.proxySourceParent[proxy] = sourceParent
print " Tree "
print( " Tree " )
......@@ -249,7 +249,7 @@ class Tree(Qt.QTreeView):
QtCore.QEventLoop.__init__(self)
def quit(self,path):
print " loaded " , path
print( " loaded " , path)
QtCore.QEventLoop.quit(self)
loop = MyLoop()
methods_model.connect(methods_model,QtCore.SIGNAL("directoryLoaded(QString)"), loop.quit )
......@@ -350,7 +350,7 @@ class Tree(Qt.QTreeView):
#include "main.moc"
def main() :
print " qui "
print( " qui " )
app = Qt.QApplication(sys.argv)
widget = Qt.QWidget()
......@@ -366,6 +366,7 @@ def main() :
lay.addWidget(tree)
widget.show()
app.exec_()
print " cucu "
print( " cucu ")
main()
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
......@@ -20,14 +20,14 @@ calframe = inspect.getouterframes(curframe, 2)
global version
caller = calframe[-1][1]
if caller[-3:]==".py":
print " caller :" , caller , " // " , os.path.dirname(os.path.dirname(caller))
print( " caller :" , caller , " // " , os.path.dirname(os.path.dirname(caller)))
# imported by Wizard.py to see what are the subtasks
version = os.path.basename(os.path.dirname(os.path.dirname(caller)))[len("XRStools"):]
else:
# called by the XRS_wizard script
caller = os.path.basename(caller)
version = caller[len("XRS_wizard"):]
print " Caller version==", version
print( " Caller version==", version)
XRStools = importlib.import_module( "XRStools"+version )
......@@ -49,8 +49,8 @@ class functor_sigterm_handler:
def __init__(self, p):
self.p = p
def __call__(self, *x):
print x
print " KILLO " , self.p.pid
print( x)
print( " KILLO " , self.p.pid)
os.kill(self.p.pid, signal.SIGKILL)
def swissknife_runner( yamltext, where , ret_dico):
......@@ -142,7 +142,7 @@ class functor_finalise_last_part_of_the_path:
path_items = path.split("/")[-3:]
# res = path + "/" + path_items[0] + "/" + path_items[1] +"/" + "Scan%03d" % num
res = path + "/" + path_items[0] + "/"
print " RITORNO " , res
print( " RITORNO " , res)
return res
class Functor_initialiser:
......@@ -391,3 +391,4 @@ def getMethod(options):
extract_spectra["swissknife_runner"] = swissknife_runner
return metodo
......@@ -21,14 +21,14 @@ calframe = inspect.getouterframes(curframe, 2)
global version
caller = calframe[-1][1]
if caller[-3:]==".py":
print " caller :" , caller , " // " , os.path.dirname(os.path.dirname(caller))
print( " caller :" , caller , " // " , os.path.dirname(os.path.dirname(caller)))
# imported by Wizard.py to see what are the subtasks
version = os.path.basename(os.path.dirname(os.path.dirname(caller)))[len("XRStools"):]
else:
# called by the XRS_wizard script
caller = os.path.basename(caller)
version = caller[len("XRS_wizard"):]
print " Caller version==", version
print( " Caller version==", version)
XRStools = importlib.import_module( "XRStools"+version )
......@@ -50,8 +50,8 @@ class functor_sigterm_handler:
def __init__(self, p):
self.p = p
def __call__(self, *x):
print x
print " KILLO " , self.p.pid
print( x)
print( " KILLO " , self.p.pid)
os.kill(self.p.pid, signal.SIGKILL)
def swissknife_runner( yamltext, where ):
......@@ -284,3 +284,4 @@ def getMethod(options):
extract_spectra["swissknife_runner"] = swissknife_runner
return metodo
......@@ -21,18 +21,18 @@ calframe = inspect.getouterframes(curframe, 2)
global version
caller = calframe[-1][1]
if caller[-3:]==".py":
print " caller :" , caller , " // " , os.path.dirname(os.path.dirname(caller))
print( " caller :" , caller , " // " , os.path.dirname(os.path.dirname(caller)))
# imported by Wizard.py to see what are the subtasks
version = os.path.basename(os.path.dirname(os.path.dirname(caller)))[len("XRStools"):]
else:
# called by the XRS_wizard script
caller = os.path.basename(caller)
version = caller[len("XRS_wizard"):]
print " Caller version==", version
print( " Caller version==", version)
version = caller[len("XRS_wizard"):]
print " Caller version", version
print( " Caller version", version)
XRStools = importlib.import_module( "XRStools"+version )
exec("from XRStools%s.WIZARD.Wizard import *"%version)
......@@ -58,20 +58,20 @@ class functor_sigterm_handler:
def __init__(self, p):
self.p = p
def __call__(self, *x):
print x
print " KILLO " , self.p.pid
print( x)
print( " KILLO " , self.p.pid)
os.kill(self.p.pid, signal.SIGKILL)
def swissknife_runner( yamltext, where, ret_dico ):