Ejemplo n.º 1
0
 def ok(self, ips, para=None):
     if para == None:
         para = self.para
         if not 'not_slice' in self.note and ips.get_nslices() > 1:
             if para == None: para = {}
         if para != None and para.has_key('stack'): del para['stack']
     win = TextLogManager.get('Recorder')
     if ips.get_nslices() == 1 or 'not_slice' in self.note:
         process_one(self, ips, ips.snap, ips.get_img(), para)
         if win != None: win.append('%s>%s' % (self.title, para))
     elif ips.get_nslices() > 1:
         has, rst = para.has_key('stack'), None
         if not has:
             rst = IPy.yes_no('run every slice in current stacks?')
         if 'auto_snap' in self.note: ips.swap()
         if has and para['stack'] or rst == 'yes':
             para['stack'] = True
             process_stack(self, ips, ips.snap, ips.imgs, para)
             if win != None: win.append('%s>%s' % (self.title, para))
         elif has and not para['stack'] or rst == 'no':
             para['stack'] = False
             process_one(self, ips, ips.snap, ips.get_img(), para)
             if win != None: win.append('%s>%s' % (self.title, para))
         elif rst == 'cancel': pass
     ips.update = 'pix'
Ejemplo n.º 2
0
 def start(self, para=None):
     if not self.load(): return
     if para != None or self.show() == wx.ID_OK:
         if para == None: para = self.para
         win = TextLogManager.get('Recorder')
         if win != None: win.append('%s>%s' % (self.title, para))
         self.run(para)
Ejemplo n.º 3
0
 def start(self, para=None, thd=True):
     if not self.load(): return
     if para != None or self.show() == wx.ID_OK:
         if para == None: para = self.para
         win = TextLogManager.get('Recorder')
         if win != None:
             wx.CallAfter(win.append, '{}>{}'.format(self.title, para))
         self.run(para)
         '''
Ejemplo n.º 4
0
 def start(self, para=None):
     #print self.title, para
     if not self.check(self.ips):return
     if not self.load(self.ips):return
     if para!=None or self.show() == wx.ID_OK:
         if para == None:para = self.para
         win = TextLogManager.get('Recorder')
         if win!=None: win.append('%s>%s'%(self.title, para))
         self.run(self.ips, self.ips.imgs, para)
         self.ips.update = 'pix'
     if self.dialog!=None:self.dialog.Destroy()
Ejemplo n.º 5
0
    def ok(self, ips, para=None, thd=True):
        if para == None:
            para = self.para
            if not 'not_slice' in self.note and ips.get_nslices() > 1:
                if para == None: para = {}
            if para != None and 'stack' in para: del para['stack']
        win = TextLogManager.get('Recorder')
        if ips.get_nslices() == 1 or 'not_slice' in self.note:
            process_one(self, ips, ips.snap, ips.get_img(), para)
            '''
            run = lambda p=para:process_one(self, ips, ips.snap, ips.get_img(), p, True)

            thread = threading.Thread(None, run, ())
            thread.start()
            if not thd:thread.join()
            '''
            if win != None: win.append('{}>{}'.format(self.title, para))
        elif ips.get_nslices() > 1:
            has, rst = 'stack' in para, None
            if not has:
                rst = IPy.yes_no('run every slice in current stacks?')
            if 'auto_snap' in self.note and self.modal: ips.swap()
            if has and para['stack'] or rst == 'yes':
                para['stack'] = True
                process_stack(self, ips, ips.snap, ips.imgs, para)
                '''
                run = lambda p=para:process_stack(self, ips, ips.snap, ips.imgs, p)
                
                print( 'new thread')
                thread = threading.Thread(None, run, ())
                thread.start()
                if not thd:thread.join()
                '''

                if win != None: win.append('{}>{}'.format(self.title, para))
            elif has and not para['stack'] or rst == 'no':
                para['stack'] = False
                process_one(self, ips, ips.snap, ips.get_img(), para)
                ''' multithread
                run = lambda p=para:process_one(self, ips, ips.snap, ips.get_img(), p, True)
                
                thread = threading.Thread(None, run, ())
                thread.start()
                if thd:thread.join()
                '''
                if win != None: win.append('{}>{}'.format(self.title, para))
            elif rst == 'cancel': pass
        ips.update = 'pix'
Ejemplo n.º 6
0
 def start(self, para=None, thd=True):
     #print self.title, para
     if not self.check(self.ips): return
     if not self.load(self.ips): return
     if para != None or self.show() == wx.ID_OK:
         if para == None: para = self.para
         win = TextLogManager.get('Recorder')
         if win != None: win.append('{}>{}'.format(self.title, para))
         self.run(self.ips, self.ips.imgs, para)
         self.ips.update = 'pix'
         '''
         def run(ips, imgs, p):
             self.run(ips, imgs, p)
             ips.update = 'pix'
         f = lambda ips=self.ips, imgs=self.ips.imgs, p=para:run(ips, imgs, p)
         thread = threading.Thread(None, f)
         thread.start()
         if not thd:thread.join()
         '''
     if self.dialog != None: self.dialog.Destroy()
Ejemplo n.º 7
0
 def start(self, thd=False):
     win = TextLogManager.get('Recorder')
     if win != None and self.title != None:
         win.append('%s>None' % (self.title))
     self.run()
     '''
Ejemplo n.º 8
0
 def run(self, para=None):
     if TextLogManager.get('Recorder') == None:
         MacrosEditor('Recorder').Show()
Ejemplo n.º 9
0
 def start(self, para=None):
     win = TextLogManager.get('Recorder')
     if win != None: win.append('%s>None' % (self.title))
     self.run()
Ejemplo n.º 10
0
 def run(self, para=None):
     if TextLogManager.get('Recorder') == None:
         f = lambda: MacrosEditor('Recorder').Show()
         wx.CallAfter(f)