1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
   |  
    def run(self,):
        '''
        Run selected actions using action own 'run' method
        '''       
        import locale
        import datetime
 
        #locale.setlocale(locale.LC_ALL, 'fr_FR')
        now = datetime.datetime.now()
        now = now.strftime("%A %d %B %Y, %H:%M:%S")
 
        # Je vide la fenêtre Detail qui est un Tkinter.Text
        self.clearDetail()
        # J'écris dans Detail
        self.argList.insert(Tkinter.END,self.process.name+'\n','PROCESS')
        # J'écris dans la Log
        self.logText.insert(Tkinter.END,self.process.name+' ('+now+')\n','PROCESS')
 
        # Pour chaque action sélectionnée
        for but,lcheckb in self.boutons.items():
            sname = but.cget('text')
            for sect in self.process.sections:
                if sname == sect.name:                            
                    lact = []
                    for c in lcheckb:
                        if (c.var.get() == 1):
                            lact.append(c.cget('text'))
                    if len(lact) != 0:
                        self.argList.insert(Tkinter.END,sname+'\n','SECTION')
                        self.logText.insert(Tkinter.END,sname+'\n','SECTION')
                        for a in lact:
                            self.current_process = None
                            self.running_threads.append(a)
                            for act in sect.actions:
                                if a == act.name:                            
                                    self.argList.insert(Tkinter.END,a+' ('+act.path+')\n','ACTION')
                                    i=0
                                    for arg in act.args:
                                        i=i+1
                                        self.argList.insert(Tkinter.END,'      argument '+str(i)+' : ' +arg+'\n','ARG')
                                    self.argList.insert(Tkinter.END,'\n')
 
                                    self.logText.insert(Tkinter.END,a+' ('+act.path+')\n','ACTION')
                                    self.logText.focus_force()
 
                                    # Je lance mon thread
                                    self.current_process = threading.Thread(target = self.runOneAction(act),name=act.name)
                                    self.current_process.start() | 
Partager