Exemple #1
0
    def commandRoach(self,roachNum,state,command):
        """State Machine"""

        #do everything between current state and new state
        for com in range(state+1,command):
            self.roaches[roachNum].pushCommand(com)
            self.colorCommandButtons(roach=[roachNum],command=[com],color='cyan')
            print 'pushed',RoachState.parseState(com)
        self.roaches[roachNum].pushCommand(command)
        self.colorCommandButtons(roach=[roachNum],command=[command],color='cyan')
        print 'pushed',RoachState.parseState(command)
        for com in range(command+1,RoachState.loadThreshold+1):
            self.colorCommandButtons(roach=[roachNum],command=[com],color='red')
Exemple #2
0
 def commandButtonClicked(self):
     source = self.sender()
     print 'Roach: ',source.roach,'Command: ',RoachState.parseState(source.command)
     for i in source.roach:
         if self.roaches[i].hasCommand():
             print 'Roach still working...'
         else: 
             self.commandRoach(i,self.roaches[i].getState(),source.command)
Exemple #3
0
 def catchRoachThreadSignal(self,roachNum):
     #print 'here:',roachNum
     if self.roaches[roachNum].getError() == 0:
             
         self.colorCommandButtons(roach=[roachNum],command=[self.roaches[roachNum].getState()],color='green')
         self.status_text.setText('Roach: '+str(roachNum)+' command: '+ RoachState.parseState(self.roaches[roachNum].getState())+' completed')
         self.roaches[roachNum].setStatus(1)
     else:
         print 'Error on roach',roachNum,':',self.roaches[roachNum].getError()
         self.colorCommandButtons(roach=[roachNum],command=[self.roaches[roachNum].getNextState()],color='error')
         self.roaches[roachNum].emptyCommandQueue()
         self.roaches[roachNum].setStatus(1)
         self.roaches[roachNum].resetError()