예제 #1
0
파일: image.py 프로젝트: imagect/imagect
    def fun():

        vm = vmm.get()
        v = vm.currentView()
        dataset = vm.currentDataSet()
        index = dataset.currentStackIndex
        stack = vm.currentStack().copy()

        def proc_data(p):
            def comp():
                d = proc(stack, p)

                def cb():
                    dataset.updateStack(index, d)
                    mainwin.get().showMessage("Complete")

                app.get().asyncio_loop().call_soon_threadsafe(cb)

            if config.RUN_THREAD:
                app.get().asyncio_loop().run_in_executor(
                    app.get().threadpool(), comp)
            else:
                comp()

        class IntHandler(Controller):

            _changed = False

            def setattr(self, info, object, name, value):
                Handler.setattr(self, info, object, name, value)
                self.apply(object)

            def object__updated_changed(self, info):
                if info.initialized:
                    info.ui.title += "*"
                    self.apply(info.object)

            def apply(self, o):
                # self._changed = True
                proc_data(o)

            def closed(self, info, is_ok):
                if is_ok:
                    proc_data(info.object)
                else:
                    if self._changed:
                        dataset.updateStack(index, stack)

        mainwin.get().showMessage("Running")
        intpara = ParaKlass()
        intpara.configure_traits(handler=IntHandler)
예제 #2
0
파일: image.py 프로젝트: imagect/imagect
    def fun():

        ret = False

        # 如果有参数模板
        if ParaKlass:
            p = ParaKlass()
            ret = p.configure_traits(kind="modal")

            # 给定参数模板,但被用户放弃
            if not ret:
                return

        vm = vmm.get()
        v = vm.currentView()
        dataset = vm.currentDataSet()
        stack = vm.currentStack().copy()

        mainwin.get().showMessage("Running")

        def comp():
            if not ParaKlass:
                d = proc(stack)
            else:
                d = proc(stack, p)

            # update ui
            def cb():
                dataset.updateCurrentStack(d)
                mainwin.get().showMessage("Complete")

            app.get().asyncio_loop().call_soon_threadsafe(cb)

        if config.RUN_THREAD:
            app.get().asyncio_loop().run_in_executor(app.get().threadpool(),
                                                     comp)
        else:
            comp()
예제 #3
0
파일: image.py 프로젝트: imagect/imagect
 def cb():
     dataset.updateStack(index, d)
     mainwin.get().showMessage("Complete")
예제 #4
0
파일: image.py 프로젝트: imagect/imagect
 def cb():
     dataset.updateCurrentStack(d)
     mainwin.get().showMessage("Complete")
예제 #5
0
파일: image.py 프로젝트: imagect/imagect
def log(msg):
    app.get().asyncio_loop().call_soon_threadsafe(mainwin.get().showMessage,
                                                  msg)