Author: esr
Date: Mon Oct 13 19:09:20 2008
New Revision: 30126
URL: http://svn.gna.org/viewcvs/wesnoth?rev=30126&view=rev
Log:
Implement separate save and write buttons.
Modified:
trunk/data/tools/trackplacer
Modified: trunk/data/tools/trackplacer
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/data/tools/trackplacer?rev=30126&r1=30125&r2=30126&view=diff
==============================================================================
--- trunk/data/tools/trackplacer (original)
+++ trunk/data/tools/trackplacer Mon Oct 13 19:09:20 2008
@@ -39,7 +39,9 @@
The radio buttons near the top left corner control which icon is placed by a
left click, except that the when the trashcan is selected a left click deletes
already-placed icons.
-The Save button pops up a file selector asking you to supply a filename to
which the track should be saved. If you specify a file with a .trk extension
the data will be saved in track format, which trackplacer can reload or edit.
Any other file extension will raise an error.
+The Save button pops up a file selector asking you to supply a filename to
which the track should be saved in .trk format, which trackplacer can reload or
edit. Any other extension than .trk on the filenae will raise an error.
+
+The Write button pops up a file selector asking you to supply a filename to
which the track should be saved in .cfg format, as a series of macros suitable
for inclusion in WML. Any other extension than .cfg on the filename will raise
an error.
The Quit button will ask for confirmation if you have unsaved changes.
@@ -339,7 +341,17 @@
# A save button
button = gtk.Button("Save")
buttonbox.pack_end(button, expand=False, fill=False, padding=10)
- button.connect_object("clicked", self.save_handler, window)
+ button.connect_object("clicked",
+ lambda w: self.save_handler(".trk", w),
+ window)
+ button.show()
+
+ # A write-cfg button
+ button = gtk.Button("Write")
+ buttonbox.pack_end(button, expand=False, fill=False, padding=10)
+ button.connect_object("clicked",
+ lambda w: self.save_handler(".cfg", w),
+ window)
button.show()
# A help button
@@ -521,9 +533,9 @@
w.run()
w.destroy()
- def save_handler(self, w):
+ def save_handler(self, ext, w):
"Save track data,"
- if not self.journey.has_unsaved_changes():
+ if ext == ".trk" and not self.journey.has_unsaved_changes():
w = gtk.MessageDialog(type=gtk.MESSAGE_INFO,
flags=gtk.DIALOG_DESTROY_WITH_PARENT,
buttons=gtk.BUTTONS_OK)
@@ -532,8 +544,8 @@
w.destroy()
else:
w = ModalFileSelector(default=self.last_read, legend="Save track
to file")
- if not w.path.endswith(".trk") and not w.path.endswith(".cfg"):
- raise IOException("File must have a .trk or .cfg extension.",
w.path)
+ if not w.path.endswith(ext):
+ raise IOException("File must have a %s extension."%ext, w.path)
if w.path != self.last_read and os.path.exists(w.path):
self.save_check = gtk.Dialog(title="Really overwrite?",
parent=None,
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits