if mesures: return song.PlaylistItem(parent, min(mesures), max(mesures)) else: return song.PlaylistItem(parent, (parent.playlist_items and (parent.playlist_items[-1].to_mesure)) or 0, len(parent.song.mesures) - 1) custom.EVAL_ENV["NewPlaylistItem"] = NewPlaylistItem custom.register_available_children("NewPlaylistItem(parent)", song.Playlist) def AddSong(songbook): import tkFileDialog filename = tkFileDialog.askopenfilename(filetypes = ((_("Songwrite files"), "*.sw.xml"),)) if not filename: return if isinstance(filename, unicode): filename = filename.encode("latin") return filename custom.EVAL_ENV["AddSong"] = AddSong custom.register_available_children("AddSong(parent)", songbook.Songbook) custom.register_method("preview_print", songbook.Songbook) def preview_print(song): song.app.on_preview_print() custom.register_method(preview_print, song.Song) def redefine(p): parent = p.playlist mesures = {} for partition in parent.song.partitions: for graphic_note in partition.view.selected_notes(): mesure = parent.song.mesure_at(graphic_note.note.time) mesures[mesure] = 1 mesures = map(lambda mesure: parent.song.mesures.index(mesure), mesures.keys()) if mesures:
# along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA import Tkinter, dircache, os, os.path, sets import editobj, editobj.main, editobj.editor as editor, editobj.custom as custom import soya, soya.editor.material, soya.editor.world import soya.laser as laser import soya.ray as ray import soya.facecutter as facecutter import soya.widget # # Config and hacks for EditObj. # custom.register_method("rotate_y", soya.CoordSyst, editor.FloatEditor) custom.register_method("rotate_x", soya.CoordSyst, editor.FloatEditor) custom.register_method("rotate_z", soya.CoordSyst, editor.FloatEditor) custom.register_children_attr("children" , "add", "__delitem__", clazz = soya.World) custom.register_children_attr("vertices" , clazz = soya.Face) custom.register_children_attr("generators", clazz = soya.Particles) soya.Particles.generators = property(lambda self: [self.generator], None) # Register properties' editors class XTextureCoordEditor(editor.Editor, Tkinter.Frame): require_right_menu = 0 def __init__(self, master, obj, attr):