コード例 #1
0
ファイル: filter.py プロジェクト: courins/imagepy
 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'
コード例 #2
0
ファイル: free.py プロジェクト: shuxin/imagepy
 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)
コード例 #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)
         '''
コード例 #4
0
    def __init__(self, title='ImagePy TexLog'):
        wx.Frame.__init__(self, IPy.curapp, title=title, size=(500, 300))
        self.title = title
        TextLogManager.add(title, self)
        self.file = ''

        ### Create menus (name:event) k-v pairs
        menus = [
            ## File
            ('File(&F)', [('Open', self.OnOpen), ('Save', self.OnSave),
                          ('Save as', self.OnSaveAs), ('-'),
                          ('Exit', self.OnClose)]),
            ## Edit
            ('Edit(&E)', [('Undo', self.OnUndo), ('Redo', self.OnRedo), ('-'),
                          ('Cut', self.OnCut), ('Copy', self.OnCopy),
                          ('Paste', self.OnPaste), ('-'),
                          ('All', self.OnSelectAll)]),
            ## Help
            ('Help(&H)', [('About', self.OnAbout)])
        ]

        ### Bind menus with the corresponding events
        self.menuBar = wx.MenuBar()
        for menu in menus:
            m = wx.Menu()
            for item in menu[1]:
                if item[0] == '-':
                    m.AppendSeparator()
                else:
                    i = m.Append(-1, item[0])
                    self.Bind(wx.EVT_MENU, item[1], i)
            self.menuBar.Append(m, menu[0])
        self.SetMenuBar(self.menuBar)
        self.Bind(wx.EVT_CLOSE, self.OnClosing)

        sizer = wx.BoxSizer(wx.VERTICAL)
        self.text = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString,
                                wx.DefaultPosition, wx.DefaultSize,
                                wx.TE_MULTILINE)
        sizer.Add(self.text, 1, wx.ALL | wx.EXPAND, 1)
        self.SetSizer(sizer)

        self.Bind(wx.EVT_RIGHT_DOWN, self.OnRClick)
コード例 #5
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()
コード例 #6
0
ファイル: filter.py プロジェクト: bison31205/imagepy
    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'
コード例 #7
0
ファイル: simple.py プロジェクト: bison31205/imagepy
 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()
コード例 #8
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()
     '''
コード例 #9
0
 def OnClosing(self, event):
     TextLogManager.close(self.title)
     event.Skip()
コード例 #10
0
 def run(self, para=None):
     MacrosEditor(TextLogManager.name('Macros Editor')).Show()
コード例 #11
0
 def run(self, para=None):
     if TextLogManager.get('Recorder') == None:
         MacrosEditor('Recorder').Show()
コード例 #12
0
ファイル: macros.py プロジェクト: shuxin/imagepy
 def start(self, para=None):
     win = TextLogManager.get('Recorder')
     if win != None: win.append('%s>None' % (self.title))
     self.run()
コード例 #13
0
ファイル: recorder_plg.py プロジェクト: perterest/imagepy
 def run(self, para=None):
     f = lambda: MacrosEditor(TextLogManager.name('Macros Editor')).Show()
     wx.CallAfter(f)
コード例 #14
0
ファイル: recorder_plg.py プロジェクト: perterest/imagepy
 def run(self, para=None):
     if TextLogManager.get('Recorder') == None:
         f = lambda: MacrosEditor('Recorder').Show()
         wx.CallAfter(f)
コード例 #15
0
 def run(self, para=None):
     if para['name'] == 'All':
         for i in TextLogManager.get_titles():
             TextLogManager.close(i)
     else:
         TextLogManager.close(para['name'])
コード例 #16
0
 def load(self):
     TextKiller.para = {'name': 'All'}
     titles = ['All'] + TextLogManager.get_titles()
     TextKiller.view = [(list, titles, str, 'Name', 'name', 'selected')]
     return True