def on_system_paint(self, ev): bitmap = self.bitmap painter = Painter(self.bitmap) border = self.border_width() width = self.window_width() height = self.window_height() caption_color = SteelBlue if self.active() else LightSteelBlue border_color = 0xaaffffff & caption_color if self.attr() & WND_TRANSPARENT: painter.clear() else: painter.fill_rect(self.margin_left(), self.margin_top(), self.width(), self.height(), White) if self.attr() & WND_FRAME: rc = Rect(0, 0, self.window_width() - 1, self.window_height() - 1) max_alpha = 40 if self.active() else 20 dalpha = max_alpha / DEFAULT_BORDER_WIDTH for i in xrange(DEFAULT_BORDER_WIDTH - 1): painter.set_pen_color(i * dalpha << 24) painter.draw_rect(rc) rc.adjust(1, 1, -1, -1) painter.set_pen_color(caption_color) painter.draw_rect(rc) if self.attr() & WND_CAPTION: # fill caption caption_color &= 0xddffffff caption_rc = Rect(border, border, width - 2 * border, self.caption_height()) painter.fill_rect(rc, caption_color) # draw title painter.set_pen_color(White) rc = caption_rc.translated(10, 0) painter.draw_text(rc, Painter.AlignLeft | Painter.AlignVCenter, self.title_) # draw close/maximize/minimize painter.save() painter.set_pen_color(DarkWhite) painter.set_render_hint(Painter.Antialiasing) # close painter.set_pen_width(2) rc = Rect(self.close_rect()) painter.draw_line(rc.top_left(), rc.bottom_right()) painter.draw_line(rc.top_right(), rc.bottom_left()) # maximize painter.draw_rect(Rect(self.maximize_rect())) # minimize rc = Rect(self.minimize_rect()) painter.draw_line(rc.bottom_left(), rc.bottom_right()) painter.restore()
if(not n.name=='CAVE'): draw.rectangle(n.get_list(), fill=defaultResurce[n.name][0]) else: draw.polygon(createPolygonFromRect(n,5), fill=defaultResurce[n.name][0]) #STAMPA CINTA MURARIA draw.line(perim,width=2,fill='#1A1A1A'); #STAMPA EDIFICI for place in buildings: color=DEFAULT_COLOR; if(not place.name=='HOUSE'): info=getDefaultPlace(place.name) color=info[3] draw.rectangle(place.get_list(), outline=DEFAULT_COLOR, fill=color ) draw.text((place.top_left().x+5,place.top_left().y),place.name[0:1],fill="red",font=font) else: draw.rectangle(place.get_list(), outline=color) #STAMPA LEGENDA draw.rectangle((CITY_SIZE_X_TRUE-maxsize*WIDTH_LEGEND-5,5,CITY_SIZE_X_TRUE-5,CITY_SIZE_Y-5), fill='white' ) draw.rectangle((CITY_SIZE_X_TRUE-maxsize*WIDTH_LEGEND-5,5,CITY_SIZE_X_TRUE-5,CITY_SIZE_Y-5), outline='black' ) LEFT=WIDTH_LEGEND TOP=0 for i in range(0,len(LIGHT_PLACES)): if((TOP*(FONT_SIZE+1)+10)>CITY_SIZE_Y): TOP=0 LEFT=LEFT-1
draw.rectangle(n.get_list(), fill=defaultResurce[n.name][0]) else: draw.polygon(createPolygonFromRect(n, 5), fill=defaultResurce[n.name][0]) #STAMPA CINTA MURARIA draw.line(perim, width=2, fill='#1A1A1A') #STAMPA EDIFICI for place in buildings: color = DEFAULT_COLOR if (not place.name == 'HOUSE'): info = getDefaultPlace(place.name) color = info[3] draw.rectangle(place.get_list(), outline=DEFAULT_COLOR, fill=color) draw.text((place.top_left().x + 5, place.top_left().y), place.name[0:1], fill="red", font=font) else: draw.rectangle(place.get_list(), outline=color) #STAMPA LEGENDA draw.rectangle((CITY_SIZE_X_TRUE - maxsize * WIDTH_LEGEND - 5, 5, CITY_SIZE_X_TRUE - 5, CITY_SIZE_Y - 5), fill='white') draw.rectangle((CITY_SIZE_X_TRUE - maxsize * WIDTH_LEGEND - 5, 5, CITY_SIZE_X_TRUE - 5, CITY_SIZE_Y - 5), outline='black') LEFT = WIDTH_LEGEND