示例#1
0
    def drawBoard(self, root):
        self.world = [-1, -1, 1, 1]
        self.bgcolor = "#F5E7C4"
        self.root = root
        self.pad = 25
        self._ALL = 'all'
        WIDTH, HEIGHT = 400, 400

        root.bind_all("<Escape>", lambda _: root.destroy())
        root.bind_all('<Key>', self.key)
        root.bind_all('<Button-1>', self.mouseClick)

        self.canvas = Canvas(
            root,
            width=WIDTH,
            height=HEIGHT,
            bg=self.bgcolor,
            bd=10,
        )

        # start the countdown clock
        self.clock = Countdown(10, self.canvas)
        self.root.title('Boggle')

        # draw the board
        self.paintgraphics()
        self.canvas.pack(fill=BOTH, expand=YES)
        self.refresh()
def Init():
    global ScriptSettings
    ScriptSettings = Settings(SettingsFile)
    ScriptSettings.Save(SettingsFile)

    global BanWordReward
    BanWordReward = BanWord.BanWord(ScriptName, Parent,
                                    ScriptSettings.EnableDebug)

    global CountdownReward
    CountdownReward = Countdown.Countdown(ScriptName, Parent,
                                          ScriptSettings.EnableDebug)

    global AlertReward
    AlertReward = Alert.Alert(ScriptName, Parent, ScriptSettings.EnableDebug)

    return
    while mode == "ready2":
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                sys.exit()

        mode = "countdown"
        # pygame.time.delay(500)
        voiceCount.play(1)
        voiceCount.fadeout(3300)

        dirty = all.draw(screen)
        pygame.display.update(dirty)
        pygame.display.flip()
        clock.tick(60)

    cd = Countdown()
    print "counting down"
    while mode == "countdown":
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                sys.exit()
        all.update()
        if cd.done:
            mode = "secret"
        dirty = all.draw(screen)
        pygame.display.update(dirty)
        pygame.display.flip()
        clock.tick(60)

    bg.kill()
    bg = Background("Screen Display/Background/images/space.png")
示例#4
0
 def Countdown(self):
     return countdown.Countdown(self.contract)
示例#5
0
def main():
    print "Reading argument list:"

    usage = "python " + sys.argv[
        0] + """ directory1 directory2 ... OR you can use the -m option to provide a multicrab file; furthermore -r allows resubmission and -t kills the initial timeout"""

    parser = OptionParser(usage=usage, version="%prog 0.1")
    parser.add_option("-r",
                      "--resubmit",
                      action="store_true",
                      dest="doresubmit",
                      default=False,
                      help="If activated, resubmits failed and aborted jobs")
    parser.add_option(
        "-t",
        "--notimeout",
        action="store_true",
        dest="notimeout",
        default=False,
        help="Eliminates, if activated, the initial timeout of 2 min")
    parser.add_option("-m",
                      "--multicrab",
                      action="store_true",
                      dest="multicrab",
                      default=False,
                      help="Read entries from multicrab.cfg file")
    (options, args) = parser.parse_args()

    global DoResubmit
    DoResubmit += options.doresubmit
    print "Overview of running options: "
    print "    Allow to resubmit?   " + str(
        int(DoResubmit)) + "    (option r = resubmit)"
    print "    Disable timeout ?    " + str(int(
        options.notimeout)) + "    (option t = no timeout)"
    print "    Read from multicrab? " + str(int(
        options.multicrab)) + "    (option m = read from multicrab file) \n"

    for arg in args:
        if os.path.isdir(arg) and os.path.isfile(
                arg + "/share/default.tgz"
        ):  # making sure that the directory exists and that it is a crab job
            JobDatabase[arg] = {}
            TaskDatabase[arg] = {}
        else:
            print "The supplied argument " + arg + " is not a valid task; it will not be considered. \n"

    if options.multicrab:
        ReadFromMulticrab()

    if len(TaskDatabase) < 1:
        print "No valid tasks have been found. Try again."
        sys.exit(-1)

    print "The following tasks are going to get checked:"
    taskCounter = 0
    for task in TaskDatabase:
        taskCounter += 1
        print str(taskCounter) + " ) " + task

    if not options.notimeout == True:
        print "\n"
        Countdown(120)

    for i in range(0, 3 * 24 * 60 / CheckInterval):  #check for up to 3 days
        print "\n"
        print " \033[1m ***************************************************************************** \033[0m "
        d = datetime.now()
        print
        print "                          Check #" + str(
            i + 1) + "   (at " + str(d.hour) + ":" + str(d.minute) + ":" + str(
                d.second) + "  on  " + str(d.month) + " / " + str(
                    d.day) + " / " + str(d.year) + "\n\n"

        for task in TaskDatabase:
            process_job(task)
        print "\n\n\n"
        print "     Check summary: "
        for task in TaskDatabase:
            if "nJobs" in TaskDatabase[
                    task] and TaskDatabase[task]["nJobs"] > 0:
                print "        " + task + " : " + str(
                    100 * TaskDatabase[task]["NJobsPleasingCRAB"] /
                    float(TaskDatabase[task]["nJobs"])) + " % done"
            else:
                print "        " + task + " : experienced problems while retrieving information"
        print "\n\n\n"
        Countdown(CheckInterval * 60)