# label: Replace File...
# title: Replace File URIs
# documentation: """
# Goal is to replace all the files in the DOM with another file.
# """
ds= dom.dataSourceFilters[0].controller.dataSet
from javax.swing import JOptionPane
if ( dom.dataSourceFilters[0].uri==None ):
JOptionPane.showMessageDialog( None, "Nothing plotted" )
else:
from org.virbo.datasource import URISplit
split= URISplit.parse(dom.dataSourceFilters[0].uri)
oldf= split.file
from javax.swing import JOptionPane
newf= JOptionPane.showInputDialog( None,
"Current file is
"+oldf+"
Enter New Filename: ",
oldf )
print newf
if ( newf!=None ):
dom.options.setAutoranging(False)
for i in dom.dataSourceFilters:
oldf1= i.uri
newf1= oldf1.replace( oldf, newf )
i.uri= newf1
dom.controller.waitUntilIdle()
dom.options.setAutoranging(True)
# label: Replace File...
ds= dom.dataSourceFilters[0].controller.dataSet
from org.virbo.dataset import SemanticOps
from org.das2.datum import DatumRangeUtil
ext= SemanticOps.bounds(ds)
xbounds= ext.slice(0)
xunits= SemanticOps.getUnits( xbounds )
xdr= DatumRange( xbounds.value(0), xbounds.value(1), xunits )
if ( not xdr.intersects( dom.plots[0].xaxis.range ) ):
dom.plots[0].xaxis.range= xdr