def LoadHistory(self, historyLength): uiutil.FlushList(self.sr.bitParent.children[1:]) litBit = None for i in xrange(historyLength): bit = uicls.Container(parent=self.sr.bitParent, name='bit_%s' % i, align=uiconst.TOPLEFT, pos=(i * (self.BITWIDTH + self.BITGAP), 0, self.BITWIDTH + self.BITGAP, self.SIZE), state=uiconst.UI_NORMAL) uicls.Fill(parent=bit, color=(1.0, 1.0, 1.0, 0.75), padding=(self.BITGAP, 4, 0, 4)) bit.OnClick = (self.OnClickBit, bit) bit.idx = i if i == self._lastLoadIndex: litBit = bit self._lastLoadIndex = None self.UpdateContentWidth() if litBit is None: self.ScrollTo(1.0, initing=True) else: self._lastLit = litBit self.SettleScrollHandle(initing=True) self.UpdateBitsState()
def Render(self, typeRecord): if self.rendering: return self.typerecord = typeRecord if not self.optionsinited: self.InitOptions() uiutil.FlushList(self.children[1:]) if settings.user.ui.Get('pricehistorytype', 0): self.RenderTable() return graphWidth, graphHeight = self.GetSize() graphWidth = int(graphWidth * uicore.desktop.dpiScaling) graphHeight = int(graphHeight * uicore.desktop.dpiScaling) if graphWidth < 2 or graphHeight < 2: return self.rendering = 1 try: days = settings.user.ui.Get('pricehistorytime', 90) buf = self.GetChart(self.typerecord.typeID, days) hostBitmap = trinity.Tr2HostBitmap( graphWidth, graphHeight, 1, trinity.PIXEL_FORMAT.B8G8R8A8_UNORM) hostBitmap.LoadFromPngInMemory(buf) linegr = uiprimitives.Sprite(align=uiconst.TOALL) linegr.texture.atlasTexture = uicore.uilib.CreateTexture( graphWidth, graphHeight) linegr.texture.atlasTexture.CopyFromHostBitmap(hostBitmap) self.children.append(linegr) linegr.GetMenu = self.GetGraphMenu finally: self.rendering = 0
def ChangeZoomLevel(self, btn, level, *args): for each in btn.parent.children: uiutil.FlushList(each.children[5:]) uicls.Fill(parent=btn, padding=(1, 1, 1, 1)) settings.user.ui.Set('mapbrowserzoomlevel', level) self.ResetMapContainerSize() if self.sr.mainmap: self.sr.mainmap.RefreshOverlays(1)
def LoadTop(self, icon, caption, subcaption=None): uiutil.FlushList(self.toparea.children[1:]) if icon is None and caption is None: self.toparea.state = uiconst.UI_HIDDEN else: self.toparea.state = uiconst.UI_DISABLED self.toparea.children[0].top = -4 if icon is not None: self.toparea.children[0].LoadIcon(icon) uicls.WndCaptionLabel(text=caption, subcaption=subcaption, parent=self.toparea, align=uiconst.RELATIVE) return self.toparea
def GetMap(self, ids, idlevel, drawlevel, selected = None): if getattr(self, 'loadingMap', 0): return self.loadingMap = 1 uiutil.FlushList(self.children[idlevel:]) self.ids[idlevel] = ids cfg.evelocations.Prime(ids) l, t, absWidth, absHeight = self.GetAbsolute() pilmap = xtriui.Map2D(name='map', align=uiconst.TOTOP, state=uiconst.UI_NORMAL, height=absWidth) pilmap.OnSelectItem = self.OnMapSelection pilmap.GetParentMenu = self.GetMenu pilmapList = [] basesize = self.absoluteRight - self.absoluteLeft if drawlevel == DRAWLVLSYS: pilmap.width = pilmap.height = basesize pilmap.left = pilmap.top = (pilmap.width - basesize) / 2 pilmap.align = uiconst.RELATIVE pilmap.dragAllowed = 1 mapparent = uiprimitives.Container(name='mapparent', align=uiconst.TOTOP, lockAspect=1, parent=self, clipChildren=1, height=absWidth) LineThemeColored(parent=mapparent, align=uiconst.TOBOTTOM) pilmapList = mapparent.children self.SetLoadExternalPointer(mapparent, self.ids[idlevel][0]) addstuff = mapparent else: LineThemeColored(parent=pilmap.overlays, align=uiconst.TOBOTTOM) pilmapList = self.children self.SetLoadExternalPointer(pilmap, self.ids[idlevel][0]) addstuff = pilmap.overlays pilmap.Draw(ids, idlevel, drawlevel, basesize) uicore.animations.FadeIn(pilmap, duration=0.3) pilmapList.append(pilmap) listicon = xtriui.ListSurroundingsBtn(parent=addstuff, align=uiconst.TOPLEFT, state=uiconst.UI_NORMAL, pos=(0, 3, 16, 16), idx=0, showIcon=True) locConsts = {0: {const.typeUniverse: ''}, 1: {const.typeRegion: localization.GetByLabel('UI/Common/LocationTypes/Region')}, 2: {const.typeConstellation: localization.GetByLabel('UI/Common/LocationTypes/Constellation')}, 3: {const.typeSolarSystem: localization.GetByLabel('UI/Common/LocationTypes/SolarSystem')}} levelName = locConsts.get(idlevel, '').values()[0] levelID = locConsts.get(idlevel, '').keys()[0] for id in ids: if levelID != const.typeUniverse: locName = cfg.evelocations.Get(id).name hintStr = '' buttonStr = '' if levelID == const.typeUniverse: buttonStr = localization.GetByLabel('UI/Common/LocationTypes/Universe') hintStr = localization.GetByLabel('UI/Map/MapBrowser/ListRegions') elif levelID == const.typeRegion: buttonStr = localization.GetByLabel('UI/Map/MapBrowser/NameRegion', name=locName) hintStr = localization.GetByLabel('UI/Map/MapBrowser/ListConstellations', name=locName) elif levelID == const.typeConstellation: buttonStr = localization.GetByLabel('UI/Map/MapBrowser/NameConstellation', name=locName) hintStr = localization.GetByLabel('UI/Map/MapBrowser/ListSolarSystems', name=locName) elif levelID == const.typeSolarSystem: buttonStr = localization.GetByLabel('UI/Map/MapBrowser/NameSolarSystem', name=locName) hintStr = localization.GetByLabel('UI/Map/MapBrowser/ListCelestials', name=locName) listbtn = uicontrols.EveLabelMedium(text=buttonStr, parent=addstuff, left=listicon.left + listicon.width + 4, top=5, color=(1.0, 1.0, 1.0, 0.75), idx=0, state=uiconst.UI_NORMAL) listbtn.expandOnLeft = True listbtn.GetMenu = listicon.GetMenu for id in ids: if id != const.typeUniverse: listicon.sr.typeID = listbtn.sr.typeID = levelID listicon.sr.itemID = listbtn.sr.itemID = id listbtn.sr.hint = hintStr if self.destroyed: return if drawlevel == DRAWLVLSYS: listbtn.sr.groupByType = listicon.sr.groupByType = 1 listbtn.sr.mapitems = listicon.sr.mapitems = pilmap.mapitems elif drawlevel in (DRAWLVLCON, DRAWLVLSOL): listbtn.sr.mapitems = listicon.sr.mapitems = pilmap.mapitems[1:] else: listbtn.sr.mapitems = listicon.sr.mapitems = pilmap.mapitems listbtn.solarsystemid = listicon.solarsystemid = ids[0] if selected: pilmap.SetSelected([selected]) self.Refresh() self.loadingMap = 0
def SetInfoMode(self): self.updatemylocationtimer = None uiutil.FlushList(self.imhere.children[1:]) for each in self.children: if each.name == 'frame': each.Close()