def scroll_text(s, y, speed): #not sure if this is the best way to do this... cen_pos = get_center(s) end_pos = (cen_pos * 2) - (MARGIN * 2) - 64 for x in range(WIDTH, end_pos, -1): add_string(s, x, y) wmdocklib.redraw() time.sleep(speed)
def mainLoop(self): self.updateMonitoredPaths() while 1: self._checkEvents() if self._actMonEnabled: self.updateHdActivity() wmdocklib.redraw() time.sleep(0.1)
def mainLoop(self): counter = -1 while 1: counter += 1 self._checkForEvents() if counter % self._cpuUpdateDelay == 0: self.updateCPUInfo() if counter % self._memUpdateDelay == 0: self.updateMemInfo() if counter == 999999: counter = -1 wmdocklib.redraw() time.sleep(0.1)
def mainLoop(self): counter = -1 while 1: counter += 1 self._checkForEvents() if counter % 2 == 0: [e.tick1() for e in self._entrys if not e is None] if counter % 20 == 0: [e.tick2() for e in self._entrys if not e is None] if counter == 999999: counter = -1 wmdocklib.redraw() time.sleep(0.5)
def mainLoop(self): counter = -1 self._startStopEnabled = 1 while 1: counter += 1 self._checkForEvents() if counter % 10 == 0: self.updateRunning() if counter % 100 == 0: self.updateProgress() self.updateNumResults() self.updateTime() if counter == 999999: counter = -1 wmdocklib.redraw() time.sleep(0.1)
def main_loop(server, port, update_interval): dif = datetime.timedelta(seconds=update_interval) last_updated = datetime.datetime.now() just_started = True while 1: check_for_events() now = datetime.datetime.now() if now > (last_updated + dif) or just_started == True: data = query_server(server, port) if not data: add_string('Server', get_center('Server'), get_spacing(1)) add_string('Not', get_center('Not'), get_spacing(2)) add_string('Found', get_center('Found'), get_spacing(3)) just_started = False else: mapname = get_map(data) num_allies = get_num_allies(data) num_axis = get_num_axis(data) num_specs = get_num_spectators(data) last_updated = datetime.datetime.now() just_started = False if data: add_string(('Allies:%s' % str(num_allies)), MARGIN, get_spacing(2) + 5) add_string(('Axis:%s' % str(num_axis)), MARGIN, get_spacing(3) + 5) add_string(('Spec:%s' % str(num_specs)), MARGIN, get_spacing(4) + 5) #mapname last in case it has to scroll if get_center(mapname) < MARGIN: scroll_text(mapname, get_spacing(1), 0.04) else: add_string(mapname, get_center(mapname), get_spacing(1)) wmdocklib.redraw() time.sleep(0.1)
def mainLoop(): while 1: checkForEvents() wmdocklib.redraw() time.sleep(0.5)