Hmm, I just tried this option of deleting the dataLocation and it
definitely caused a problem in my circumstance, i.e. when the dataSource
still existed, because when it got around to loading the NMR data the
loader did not like the one-way link from the dataSource to a (now)
non-existant dataLocation and threw an exception. So although it would
work perfectly well if there was indeed no dataSource using the
dataLocation, I think this is probably a bit too dangerous an option to
put in, people could accidentally end up with invalid projects. Instead
I'm going to just mark the dataLocation as "not to be worried about" using
application specific data, and the next time around it won't bother you
with the question about where the file exists.
Wayne
On Fri, 10 Jun 2005, Wayne Boucher wrote:
> One more thing. I noticed that the code that asks for a new dataLocation
> path only does so if the dataLocation.url path exists. But presumably
> that still does in your case. (For those who are not familiar with the
> data model details, the full (actual) path for the dataLocation is
> dataLocation.url.path + '/' + dataLocation.path. The idea is that lots
> of dataLocations can share the same url, so if that url changes you only
> have to modify one path instead of many.)
>
> I've decided I might as well also add an option, when reading a project,
> to delete the dataLocation (if the path does not exist) and if you do
> decide to delete it then it doesn't bother asking you for a new path, of
> course.
>
> Wayne
>
> On Fri, 10 Jun 2005, Wayne Boucher wrote:
>
> > Hello,
> >
> > Ah, yes, this does bring up a problem. Just looking at it now, the code
> > that reads the project XML files checks all dataLocations, not just used
> > ones. And in fact the way the data model works it's actually
> > (intentionally) not easy to find out which dataLocations are used. (I
> > think we've thought about re-jigging this part of the data model in the
> > past, but nothing has come of it yet.) The point is that (currently)
> > dataLocations live in the memops.Implementation package, and that doesn't
> > know anything about the ccp.Nmr package, so the link from dataSource to
> > dataLocation is one-way. Indeed, the way things are set up, a program
> > (e.g. a molecular viewing package) might not even load the ccp.Nmr XML
> > file so would have no way of knowing that certain dataLocations were (or
> > were not) used.
> >
> > Note that there is a "delete" option for dataLocations in the Other -->
> > General Editor dialog. Hardly anyone uses this General Editor since it is
> > similar to a general XML editor, so rather weak on semantics. So this
> > hardly ever gets tested so is one of those bits of code that probably
> > doesn't work perfectly. But I just tried it and it allowed me to delete a
> > dataLocation. (It was a dataLocation which was being used, but it looks
> > like the way Analysis is set up it doesn't care because it sets up the
> > hooks to the data file on start-up. Of course if I saved this project and
> > started again it would care. Basically, don't delete required
> > dataLocations!)
> >
> > Another thing I could do is add a "delete" option to the dataLocation
> > table in the "Save As" dialog, but perhaps that's no more obvious a place
> > to look than the General Editor.
> >
> > Another option, if you don't mind typing a bit of Python, is at the Python
> > shell prompt to do something like:
> >
> > >>> project = top.project
> > >>> for serial in myListOfSerialsOfDataLocationsToDelete:
> > ... dataLocation = project.findFirstDataLocation(serial=serial)
> > ... dataLocation.delete()
> > ...
> > >>>
> >
> > and that should remove the undesired ones. Just make sure you delete the
> > right ones!
> >
> > Wayne
> >
> > On Fri, 10 Jun 2005, Magnus Helgstrand wrote:
> >
> > > Hi!
> > >
> > > I have an Analysis project, which I have used for a while. I have
> > > checked some spectra in it but later removed them. The spectra was on
> > > a separate drive which no longer is connected to the computer. Now
> > > when I start Analysis the program complains about the paths to the
> > > removed spectra not being "valid" (which they of course are not since
> > > the drive was removed).
> > >
> > > I used the Save As command and checked the URLs, it seems that every
> > > spectra I have looked on using the specific project still has a "Data
> > > location" entry and therfore a URL. Why are not the no longer used
> > > "Data locations" removed and the URLs belonging to those? Can I
> > > mauallyh remove them in any way?
> > >
> > > It is no fun to have Analysis complaining about a lot of unused URLs
> > > every time I load the project...
> > >
> > > Magnus
> > >
> >
>
|