Пример #1
0
	def __init__(self, ctx=None):
		if not ctx:
			import gui
			ctx = gui.ctx()
			assert ctx, "no gui context"
		self.ctx = ctx
		ctx.curSelectedSong_updateEvent.register(self._updateHandler)
Пример #2
0
def setupSongEditWindow():
    from SongEdit import SongEdit
    import gui
    ctx = gui.ctx()
    if not getattr(ctx, "songEdit", None):
        ctx.songEdit = SongEdit(ctx)
    setupWindow(ctx.songEdit, windowName="songEditWindow", title="Song edit")
Пример #3
0
def setupSongEditWindow():
	from SongEdit import SongEdit
	import gui
	ctx = gui.ctx()
	if not getattr(ctx, "songEdit", None):
		ctx.songEdit = SongEdit(ctx)
	setupWindow(ctx.songEdit, windowName="songEditWindow", title="Song edit")	
Пример #4
0
 def __init__(self, ctx=None):
     if not ctx:
         import gui
         ctx = gui.ctx()
         assert ctx, "no gui context"
     self.ctx = ctx
     ctx.curSelectedSong_updateEvent.register(self._updateHandler)
Пример #5
0
            def select(self, index=None):
                self.deselect()
                if index is None:
                    if len(control.guiObjectList) == 0: return
                    index = 0
                self.index = index
                guiObj = control.guiObjectList[index].nativeGuiObject
                guiObj.setBackgroundColor_(
                    NSColor.selectedTextBackgroundColor())

                # special handling for gui.ctx().curSelectedSong
                if control.guiObjectList[
                        index].subjectObject.__class__.__name__ == "Song":
                    import gui
                    gui.ctx().curSelectedSong = control.guiObjectList[
                        index].subjectObject

                def doScrollUpdate():
                    if not guiObj.window():
                        return  # window closed or removed from window in the meantime
                    objFrame = guiObj.frame()
                    visibleFrame = scrollview.contentView(
                    ).documentVisibleRect()
                    if objFrame.origin.y < visibleFrame.origin.y:
                        scrollview.contentView().scrollToPoint_(
                            (0, objFrame.origin.y))
                    elif objFrame.origin.y + objFrame.size.height > visibleFrame.origin.y + visibleFrame.size.height:
                        scrollview.contentView().scrollToPoint_(
                            (0, objFrame.origin.y + objFrame.size.height -
                             scrollview.contentSize().height))
                    scrollview.reflectScrolledClipView_(
                        scrollview.contentView())

                do_in_mainthread(doScrollUpdate, wait=False)
Пример #6
0
    def onMouseDown(ev):
        subjectObj = control.subjectObject
        # special handling for gui.ctx().curSelectedSong
        if subjectObj.__class__.__name__ == "Song":
            import gui

            gui.ctx().curSelectedSong = subjectObj
Пример #7
0
            def select(self, index=None):
                self.deselect()
                if index is None:
                    if len(control.guiObjectList) == 0:
                        return
                    index = 0
                self.index = index
                guiObj = control.guiObjectList[index].nativeGuiObject
                guiObj.setBackgroundColor_(NSColor.selectedTextBackgroundColor())

                # special handling for gui.ctx().curSelectedSong
                if control.guiObjectList[index].subjectObject.__class__.__name__ == "Song":
                    import gui

                    gui.ctx().curSelectedSong = control.guiObjectList[index].subjectObject

                def doScrollUpdate():
                    if not guiObj.window():
                        return  # window closed or removed from window in the meantime
                    objFrame = guiObj.frame()
                    visibleFrame = scrollview.contentView().documentVisibleRect()
                    if objFrame.origin.y < visibleFrame.origin.y:
                        scrollview.contentView().scrollToPoint_((0, objFrame.origin.y))
                    elif objFrame.origin.y + objFrame.size.height > visibleFrame.origin.y + visibleFrame.size.height:
                        scrollview.contentView().scrollToPoint_(
                            (0, objFrame.origin.y + objFrame.size.height - scrollview.contentSize().height)
                        )
                    scrollview.reflectScrolledClipView_(scrollview.contentView())

                do_in_mainthread(doScrollUpdate, wait=False)
Пример #8
0
 def onMouseDown(ev):
     subjectObj = control.subjectObject
     # special handling for gui.ctx().curSelectedSong
     if subjectObj.__class__.__name__ == "Song":
         import gui
         gui.ctx().curSelectedSong = subjectObj