def arrange_area(browser, stattype, startdate, datetype, arrange, interval, next_interval): # 判断next_interval if interval == int(get_option("arrange_area_next_interval")): handle_input(browser, '#roomAreaBegin', 1 if interval == 0 else interval) handle_input(browser, '#roomAreaEnd', '' if next_interval == 0 else next_interval) statdata_by_properties( browser, stattype, startdate, datetype, arrange, interval) # 更新next_interval set_option("arrange_area_next_interval", next_interval)
statdate = datetime.datetime.strptime(get_option("resume_statdate_month"), '%Y-%m-%d') delta = current_datetime - statdate for item in range(1, delta.days - STATDELTA): statdate_item = statdate + datetime.timedelta(days=item) if 1 == int(statdate_item.day): # 月初统计上月月报 enddate = statdate_item - datetime.timedelta(days=1) startdate = datetime.datetime.strptime( '%s-%s-%s' % (enddate.year, enddate.month, 1), '%Y-%m-%d') for stattype in STATTYPES: print("statistic resume month.................") prepare_statdata(browser, stattype, startdate.strftime('%Y-%m-%d'), enddate.strftime('%Y-%m-%d'), 'month') # 更新统计日期 set_option("resume_statdate_month", statdate_item.strftime('%Y-%m-%d')) # 统计resume_statdate_day statdate = datetime.datetime.strptime(get_option("resume_statdate_day"), '%Y-%m-%d') delta = current_datetime - statdate for item in range(1, delta.days - STATDELTA): statdate_item = statdate + datetime.timedelta(days=item) for stattype in STATTYPES[:-1]: # 按天不统计 可售情况 print("statistic resume day.................") prepare_statdata(browser, stattype, statdate_item.strftime('%Y-%m-%d'), statdate_item.strftime('%Y-%m-%d'), 'day') # 更新统计日期 set_option("resume_statdate_day", statdate_item.strftime('%Y-%m-%d')) # 统计arrange_area_statdate statdate = datetime.datetime.strptime(get_option("arrange_area_statdate"),
(x % self.overrect_rocks.width, y % self.overrect_rocks.height) ) # Processed colours should be between 1 and 250 (if it's 0,0,0 it'll be keyed) new_colour.r = max(1, min(new_colour.r + over_lava.r * 2 - over_rock.r / 2, 250)) new_colour.g = max(1, min(new_colour.g - over_lava.r - over_rock.r / 2, 250)) new_colour.b = max(1, min(new_colour.b - over_lava.r - over_rock.r / 2, 250)) """ this draws a ratio*ratio grid in the level, useful for some debugging if x % self.ratio == 0 or y % self.ratio == 0: new_colour = (0,0,255) """ self.set_at((x, y), new_colour) utils.save_image("{0}_processed.png".format(stage_file), self) level_md5 = utils.file_md5("{0}.gif".format(stage_file)) print "MD5 of stage: {0}".format(level_md5) utils.set_option("{0}_hash".format(stage_file), level_md5) def calculate_limits(self): # TODO: cache limits, it takes a while to process them for x in range(self.rect.width - 1): # will store top and bottom limits and append it to self.limits # to control the ship not getting over this x_limits = [-1, -1] for y in range(self.rect.height): # Calculate top and bottom limits if x_limits[0] == -1 and self.level_data.get_at((x, y)) != self.colors["grass"]: x_limits[0] = y if x_limits[0] != -1 and x_limits[1] == -1 and self.level_data.get_at((x, y)) == self.colors["grass"]: x_limits[1] = y """ if y>0 and self.level_data.get_at((x,y)) == self.colors["grass"] and \
if item[0] not in scopes: addition_scopes.append({ "value": item[0], "label": item[0], "center": { "lng": 0, "lng": 0 }, "zoom": 0 }) current_scopes.extend(addition_scopes) sorted_scopes = sorted( current_scopes, key=lambda current_scopes: current_scopes['value']) cts['children'] = sorted_scopes current_cities.append(cts) set_option('cities', json.dumps(current_cities, ensure_ascii=False)) # 更新户型和物业 spiderman_frame = json.loads(get_option("spiderman_frame")) sqli = 'SELECT DISTINCT `property` FROM `dataset_resume`' result = sql_query(sqli) properties = [item[0] for item in result] spiderman_frame['property'].extend( list(set(properties).difference(set(spiderman_frame['property'])))) sqli = 'SELECT DISTINCT `intervals` FROM `dataset_room`' result = sql_query(sqli) arrange_room = [item[0] for item in result] spiderman_frame['arrange']['room'].extend( list( set(arrange_room).difference( set(spiderman_frame['arrange']['room'])))) set_option('spiderman_frame',