import Tkinter import editobj, editobj.editor as editor, editobj.custom as custom import song, globdef, tablature, drum, staff, view, songbook custom.TRANSLATOR = _ custom.register_children_attr("partitions", clazz = song.Song) custom.register_children_attr("playlist_items", clazz = song.Playlist) custom.register_children_attr("songs", "on_add_song", "on_del_song", clazz = songbook.Songbook) def edit_songref(songref, window): import main s = songref.get_song() main.App(edit_song = s) custom.register_on_edit(edit_songref, songbook.SongRef) def edit_song(song, window): if getattr(song, "app", None): if not window.hierarchyedited is song: song.app.tkraise() else: import main main.App(edit_song = song) custom.register_on_edit(edit_song, song.Song) def _partition_children(self): if self.view.__class__.__name__ in ("Tablature", "DrumView"): return self.view.strings return None song.Partition.children = property(_partition_children)
def edit_world(self, window): if not self.parent: if not soya.inited: soya.init("Soya Editor") ed = soya.editor.world.WorldEditor(self, window) def on_activate(event = None): global CURRENT if CURRENT: CURRENT.deactivate() ed.activate() CURRENT = ed window.bind("<FocusIn>" , on_activate) custom.register_on_edit(edit_material, soya.Material) custom.register_on_edit(edit_world, soya.World) def _subedit(self, window): if hasattr(CURRENT, "select_handles_for"): CURRENT.select_handles_for(self) def _subedit_face(self, window): if hasattr(CURRENT, "select_handles_for"): for vertex in self: CURRENT.select_handles_for(vertex) def _editchildren(self, visible): if hasattr(CURRENT, "children_edited"): CURRENT.children_edited(self, visible) custom.register_on_edit (_subedit, soya.CoordSyst) custom.register_on_edit (_subedit, soya.Vertex)