trackplacer: fix a bug in the deletion logic.
This commit is contained in:
parent
0b542118a8
commit
72bb6dc0d8
1 changed files with 12 additions and 4 deletions
|
@ -298,10 +298,14 @@ class JourneyTracks:
|
|||
if found:
|
||||
# Prefer to delete the most recent feature
|
||||
track = self.selected_track()
|
||||
track = track[:found[-1]] + track[found[-1]+1:]
|
||||
self.tracks[self.selected_id] = track[:found[-1]] + track[found[-1]+1:]
|
||||
self.modified += 1
|
||||
def __str__(self):
|
||||
return self.mapfile + ": " + `self.tracks`
|
||||
rep = self.mapfile + ":n"
|
||||
for name in self.track_order:
|
||||
track = self.tracks[name]
|
||||
rep += name + ": " + `track` + "\n"
|
||||
return rep
|
||||
|
||||
class TrackEditorIcon:
|
||||
def __init__(self, action, path):
|
||||
|
@ -979,7 +983,7 @@ class TracksEditor:
|
|||
self.redraw(self.drawing_area, 0.5)
|
||||
|
||||
def log(self, msg):
|
||||
"Notify user of error and die."
|
||||
"Debugging report."
|
||||
if self.verbose:
|
||||
print >>sys.stderr, "trackplacer:", msg
|
||||
|
||||
|
@ -1011,7 +1015,11 @@ if __name__ == "__main__":
|
|||
wesnoth.wmltools.pop_to_top("trackplacer")
|
||||
if arguments:
|
||||
try:
|
||||
TracksEditor(path=os.path.join(here, arguments[0]), verbose=verbose)
|
||||
filename = os.path.join(here, arguments[0])
|
||||
# Relativize file path to current directory
|
||||
if filename.startswith(os.getcwd()):
|
||||
filename = filename[len(os.getcwd())+1:]
|
||||
TracksEditor(path=filename, verbose=verbose)
|
||||
except IOException, e:
|
||||
if e.lineno:
|
||||
sys.stderr.write(('"%s", line %d: ' % (e.path, e.lineno)) + e.message + "\n")
|
||||
|
|
Loading…
Add table
Reference in a new issue