コード例 #1
0
ファイル: Wave.py プロジェクト: fbarre96/PollenisatorGUI
 def isLaunchableNow(self):
     """Returns True if the tool matches criteria to be launched 
     (current time matches one of interval object assigned to this wave)
     Returns:
         bool
     """
     intervals = Interval.fetchObjects({"wave": self.wave})
     for intervalModel in intervals:
         if Utils.fitNowTime(intervalModel.dated, intervalModel.datef):
             return True
     return False
コード例 #2
0
def getWaveTimeLimit(waveName):
    """
    Return the latest time limit in which this tool fits. The tool should timeout after that limit

    Returns:
        Return the latest time limit in which this tool fits.
    """
    intervals = Interval.fetchObjects({"wave": waveName})
    furthestTimeLimit = datetime.now()
    for intervalModel in intervals:
        if Utils.fitNowTime(intervalModel.dated, intervalModel.datef):
            endingDate = intervalModel.getEndingDate()
            if endingDate is not None:
                if endingDate > furthestTimeLimit:
                    furthestTimeLimit = endingDate
    return furthestTimeLimit