def Refresh(self, update=0): if update: uiutil.Update(self, 'Browser::Refresh') for each in self.children: if hasattr(each, 'RefreshSize'): each.RefreshSize() if hasattr(each, 'RefreshOverlays'): each.RefreshOverlays()
def Expand(self): self.expanding = 1 if sm.GetService('connection').IsConnected(): eve.Message('ComboExpand') log.LogInfo('Combo', self.name, 'expanding') colorpar = uicls.Container(name='colors', align=uiconst.TOPLEFT, width=130, height=133) uicore.layer.menu.children.insert(0, colorpar) colorscroll = uicls.Scroll(parent=colorpar) colors = [((1.0, 1.0, 1.0, 1.0), 'white'), ((0.7, 0.7, 0.7, 1.0), 'grey 70%'), ((0.3, 0.3, 0.3, 1.0), 'grey 30%'), ((0.0, 0.0, 0.0, 1.0), 'black'), ((1.0, 1.0, 0.0, 1.0), 'yellow'), ((0.0, 1.0, 0.0, 1.0), 'green'), ((1.0, 0.0, 0.0, 1.0), 'red'), ((0.0, 0.0, 1.0, 1.0), 'blue'), ((0.5, 0.5, 0.0, 1.0), 'dark yellow'), ((0.0, 0.5, 0.0, 1.0), 'dark green'), ((0.5, 0.0, 0.0, 1.0), 'dark red'), ((0.0, 0.0, 0.5, 1.0), 'dark blue'), ((0.5, 0.0, 0.5, 1.0), 'dark mangenta'), ((0.0, 1.0, 1.0, 1.0), 'cyan'), ((1.0, 0.0, 1.0, 1.0), 'mangenta'), ((0.0, 0.5, 1.0, 1.0), 'dark blue'), ((1.0, 0.5, 0.0, 1.0), 'dark blue')] x = y = 0 scrolllist = [] icons = [] for each in colors: color, labelstr = each icons.append((None, color, color, self.PickCol)) x += 1 if x == 4: scrolllist.append(listentry.Get('Icons', {'icons': icons})) icons = [] y += 1 x = 0 colorscroll.Load(32, contentList=scrolllist) uiutil.Update(colorpar) colorpar.left, colorpar.top = self.sr.color.absoluteLeft, [ self.sr.color.absoluteTop + self.sr.color.height, self.sr.color.absoluteTop - colorpar.height ][self.sr.color.absoluteTop + self.sr.color.height + colorpar.height > uicore.desktop.height] colorpar.state = uiconst.UI_NORMAL self.sr.colorpar = _weakref.ref(colorscroll) uicore.event.RegisterForTriuiEvents(uiconst.UI_MOUSEUP, self.OnGlobalClick) self.expanding = 0 self.expanded = 1 log.LogInfo('Colors', self.name, 'expanded')
def SlideTo(self, value, update = 1): if update: uiutil.Update(self, 'Slider::SlideTo') l, t, w, h = self.parent.GetAbsolute() maxX = w - self.width left = max(0, int(maxX * value)) if self.increments: steps = [ int(incproportion * maxX) for incproportion in self.increments[1] ] left = self.FindClosest(left, steps) self.left = int(left) self.state = uiconst.UI_NORMAL
def UpdateMyLocation(self): if not uiutil.IsUnder(self, uicore.desktop): return bp = sm.GetService('michelle').GetBallpark() if bp is None or self is None or self.destroyed: self.updatemylocationtimer = None return myball = bp.GetBall(eve.session.shipid) if myball is None: self.updatemylocationtimer = None return size = max(1, self.absoluteRight - self.absoluteLeft) if size == 1: uiutil.Update(self, 'Map2D::UpdateMyLocation') size = max(1, self.absoluteRight - self.absoluteLeft) x = y = None if self.allowAbstract and settings.user.ui.Get('solarsystemmapabstract', 0): if not len(self.orbs): return x, y = self.GetAbstractPosition(trinity.TriVector(myball.x, 0.0, myball.z), 1) elif self.sr.sizefactor is not None and self.sr.sizefactorsize is not None: maxdist = self.GetMaxDist() sizefactor = size / 2 / maxdist * self.fillSize x = FLIPMAP * myball.x * sizefactor / float(size) + 0.5 y = -(myball.z * sizefactor) / float(size) + 0.5 if x is not None and y is not None: self.imhere.sr.x = x self.imhere.sr.y = y self.imhere.state = uiconst.UI_DISABLED camera = sm.GetService('sceneManager').GetRegisteredCamera('default') if camera is None: return rot = geo2.QuaternionRotationGetYawPitchRoll(camera.rotationAroundParent) look = geo2.QuaternionRotationGetYawPitchRoll(camera.rotationOfInterest) if not self.fov: self.fov = Fov(parent=self.imhere) self.fov.SetRotation(rot[0] + look[0] - pi) actualfov = camera.fieldOfView * (uicore.desktop.width / float(uicore.desktop.height)) degfov = actualfov - pi / 2 self.fov.SetFovAngle(actualfov) if self.showingtempangle: if not self.tempAngleFov: self.tempAngleFov = Fov(parent=self.imhere, state=uiconst.UI_DISABLED, blendMode=trinity.TR2_SBM_ADDX2) self.tempAngleFov.SetColor((0.0, 0.3, 0.0, 1.0)) self.tempAngleFov.display = True self.tempAngleFov.SetRotation(rot[0] + look[0] - pi) angle = self.showingtempangle self.tempAngleFov.SetFovAngle(angle) elif self.tempAngleFov: self.tempAngleFov.display = False self.RefreshOverlays()
def SetViewport(self, update=0): uiutil.Update(self, 'MapBrowser::SetViewport') viewwidth = self.sr.mainmapparent.absoluteRight - self.sr.mainmapparent.absoluteLeft viewheight = self.sr.mainmapparent.absoluteBottom - self.sr.mainmapparent.absoluteTop self.sr.viewport.width = int( viewwidth * (float(VIEWWIDTH) / self.sr.mapcontainer.width)) self.sr.viewport.height = int(self.sr.viewport.width * (float(viewheight) / viewwidth)) self.sr.viewport.left = -int( self.sr.mapcontainer.left * (float(VIEWWIDTH) / self.sr.mapcontainer.width)) self.sr.viewport.top = -int( self.sr.mapcontainer.top * (float(VIEWWIDTH) / self.sr.mapcontainer.width))
def _SetMarks(self, marks): if not uiutil.IsUnder(self, uicore.desktop): return for i in xrange(0, len(marks), 4): id = marks[i] hint = marks[i + 1] uiutil.Update(self, 'Map2D::_SetMarks') size = max(1, self.absoluteRight - self.absoluteLeft) x, y = self.GetCordsByKeyAsPortion(id, size) if x is None or y is None: return if self.sr.marks is None: self.sr.marks = uicls.Container(name='marks', parent=self, align=uiconst.TOALL, pos=(0, 0, 0, 0), idx=0, state=uiconst.UI_DISABLED) mark = uicls.Sprite(parent=self.sr.marks, name='area', left=x - mark.width / 2, top=y - mark.height / 2 + 1, width=128, height=128, state=uiconst.UI_PICKCHILDREN, texturePath='res:/UI/Texture/circle_full.png', color=(1.0, 1.0, 1.0, 0.21)) if hint: uicls.EveLabelMedium(text=hint, parent=self.sr.marks, left=mark.left + mark.width, top=mark.top + 2, width=min(128, max(64, size - mark.left - mark.width)), state=uiconst.UI_NORMAL)
def RefreshOverlays(self, update = 0): if not uiutil.IsUnder(self, uicore.desktop): return if self is None or self.destroyed or not uicore.uilib: return if update: uiutil.Update(self, 'Map2D::RefreshOverlays') size = self.absoluteRight - self.absoluteLeft for each in self.sr.areas.children: if not hasattr(each, 'sr') or getattr(each.sr, 'x', None) is None and getattr(each.sr, 'y', None) is None: continue each.width = each.height = int(each.sr.rad * size * 2) each.left = int(getattr(each.sr, 'x', 0) * size) - each.width / 2 + 1 each.top = int(getattr(each.sr, 'y', 0) * size) - each.height / 2 + 1 for each in self.overlays.children: if not hasattr(each, 'sr') or getattr(each.sr, 'x', None) is None and getattr(each.sr, 'y', None) is None: continue each.left = int(getattr(each.sr, 'x', 0) * size) - each.width / 2 + 1 each.top = int(getattr(each.sr, 'y', 0) * size) - each.height / 2 + 1
def Expand(self, *args): self.expanding = 1 if sm.GetService('connection').IsConnected(): eve.Message('ComboExpand') log.LogInfo('ColorPreview', self.name, 'expanding') colorpar = uicls.Container(name='colors', align=uiconst.TOPLEFT, width=112, height=62) uicore.layer.menu.children.insert(0, colorpar) colorSwatch = xtriui.ColorSwatch(name='colorSwatch', align=uiconst.TOALL, parent=colorpar) colorSwatch.Startup() colorSwatch.sr.dad = self self.sr.wndUnderlay = uicls.WindowUnderlay(parent=colorpar) self.sr.wndUnderlay.padding = -6 uiutil.Update(colorpar) l, t, w, h = self.sr.preview.GetAbsolute() colorpar.left = [l + w, l - colorpar.width][l + w + colorpar.width > uicore.desktop.width] colorpar.top = [t + h, t - colorpar.height][t + h + colorpar.height > uicore.desktop.height] colorpar.state = uiconst.UI_NORMAL self.colorpar = colorpar self.sr.cookie = uicore.event.RegisterForTriuiEvents(uiconst.UI_MOUSEUP, self.OnGlobalClick) self.expanding = 0 self.expanded = 1 log.LogInfo('ColorPreview', self.name, 'expanded')
def GetSize(self): abswidth, absheight = self.absoluteRight - self.absoluteLeft, self.absoluteBottom - self.absoluteTop if not abswidth or not absheight: uiutil.Update(self, 'PriceHistory::GetSize') abswidth, absheight = self.absoluteRight - self.absoluteLeft, self.absoluteBottom - self.absoluteTop return (abswidth, absheight - self.sr.options.height)