def DisplayPhoto(self): self.picture = uiutil.GetChild(self, 'mainicon') self.picture.left = const.defaultPadding self.picture.top = const.defaultPadding self.picture.state = uiconst.UI_DISABLED uiutil.GetChild(self, 'clippedicon').Close() sm.GetService('photo').GetPortrait(self.charID, 128, self.picture)
def Setup(self, moduleinfo): targetContainer = uiprimitives.Container(name='targetCont', align=uiconst.TOPLEFT, parent=self, top=0, height=64, width=64) slot = DefenceModuleButton(parent=targetContainer, idx=0) self.sr.targetIcon = uiutil.GetChild(targetContainer, 'iconSprite') self.sr.targetContainer = targetContainer self.sr.targetContainer.state = uiconst.UI_DISABLED sourceContainer = uiprimitives.Container(name='sourceCont', align=uiconst.TOPLEFT, parent=self, top=targetContainer.height + 22, height=64, width=64) slot = DefenceModuleButton(parent=sourceContainer, idx=0) self.sr.sourceIcon = uiutil.GetChild(sourceContainer, 'iconSprite') self.sr.sourceIcon.state = uiconst.UI_DISABLED self.sr.glow = uiutil.GetChild(sourceContainer, 'glow') self.sr.busy = uiutil.GetChild(sourceContainer, 'busy') self.sr.quantityParent = uiutil.GetChild(sourceContainer, 'quantityParent') self.sr.quantityParent.left = 8 self.sr.quantityParent.width = 28 idx = self.parent.children.index(self) fill = uiprimitives.Fill(parent=self, color=(1.0, 1.0, 1.0, 0.125), state=uiconst.UI_HIDDEN, idx=idx) self.sr.hilite = fill self.sr.sourceContainer = sourceContainer self.sr.sourceContainer.state = uiconst.UI_DISABLED chargeIcon = uicontrols.Icon(parent=sourceContainer, align=uiconst.RELATIVE, top=32, left=6, size=24, idx=0, state=uiconst.UI_HIDDEN, ignoreSize=True) self.sr.chargeIcon = chargeIcon if not len(self.__cgattrs__): self.__cgattrs__.extend([ a.attributeID for a in cfg.dgmattribs if cgre.match(a.attributeName) is not None ]) self.sr.typeID = moduleinfo.typeID self.moduleinfo = moduleinfo self.locationFlag = moduleinfo.flagID self.sr.sourceID = moduleinfo.itemID self.id = moduleinfo.itemID self.sr.glow.z = 0 self.sr.qtylabel = uicontrols.Label(text='', parent=self.sr.quantityParent, width=30, state=uiconst.UI_DISABLED, idx=0, fontsize=9) self.sr.distancelabel = uicontrols.EveHeaderSmall(text='', parent=self.sr.targetContainer, left=12, top=-16, width=70, state=uiconst.UI_DISABLED, idx=0) if cfg.IsChargeCompatible(moduleinfo): self.invCookie = sm.GetService('inv').Register(self) self.SetCharge(None) for key in moduleinfo.effects.iterkeys(): effect = moduleinfo.effects[key] if self.IsEffectActivatible(effect): self.def_effect = effect if effect.isActive: self.SetActive() if effect.effectName == 'online': if effect.isActive: self.ShowOnline() else: self.ShowOffline() self.state = uiconst.UI_NORMAL currentTarget = self.GetCurrentTarget() if currentTarget is not None: uthread.pool('DefenceMobuleButton::OnTargetAdded::', self.OnTargetAdded, currentTarget) self.sr.sourceUpdateTimer = base.AutoTimer(random.randint(750, 1000), self.UpdateData, 'source') self.UpdateData('source') self.sr.targetUpdateTimer = base.AutoTimer(random.randint(750, 1000), self.UpdateData, 'target') self.UpdateData('target') self.UpdateDistance() self.sr.distanceUpdateTimer = base.AutoTimer(random.randint(5000, 6000), self.UpdateDistance) self.EnableDrag() uthread.new(self.BlinkIcon)
def StartBot(self, *args): autoMoveBotSvc = sm.GetService('automovebot') autoMoveBotSvc.StartBot() main = uiutil.GetChild(self.sr.main, 'main') autoMoveBotSvc.channelName = uiutil.GetChild(main, 'channelInput').GetValue() autoMoveBotSvc.movePhrase = uiutil.GetChild(main, 'phraseInput').GetValue() autoMoveBotSvc.destinationID = uiutil.GetChild(main, 'destInput').GetValue() self.SetRunning(True)
def UpdateCheckBox(self, checkbox, config, width, height, left): cfgname, retval, desc, default = config checkbox.left = left checkbox.width = width checkbox.height = height checkbox.data['config'] = cfgname checkbox.data['value'] = retval label = uiutil.GetChild(checkbox, 'text') diode = uiutil.GetChild(checkbox, 'diode') label.width = width - diode.width label.text = desc checkbox.OnChange = None checkbox.SetChecked(default) checkbox.OnChange = self.CheckBoxChange
def StartBot(self, *args): """ Event-handler for the Start button. Starts the bot and changes the button states. Params: *args -- Extra arguments from the UI. """ autoMoveBotSvc = sm.GetService('automovebot') autoMoveBotSvc.StartBot() main = uiutil.GetChild(self.sr.main, 'main') autoMoveBotSvc.channelName = uiutil.GetChild(main, 'channelInput').GetValue() autoMoveBotSvc.movePhrase = uiutil.GetChild(main, 'phraseInput').GetValue() autoMoveBotSvc.destinationID = uiutil.GetChild(main, 'destInput').GetValue() self.SetRunning(True)
def Show(self): if self.wnd: self.wnd.Maximize() return self.wnd = wnd = uicontrols.Window.Open(windowID='Cap Simulator') wnd._OnClose = self.Hide wnd.SetWndIcon(None) wnd.SetTopparentHeight(0) wnd.SetCaption('Capacitor Simulator') wnd.SetMinSize([256, 384]) main = uiprimitives.Container( name='main', parent=uiutil.GetChild(wnd, 'main'), pos=(const.defaultPadding, const.defaultPadding, const.defaultPadding, const.defaultPadding)) bottom = uiprimitives.Container(name='bottom', parent=main, align=uiconst.TOBOTTOM, height=60) wnd.sr.text = uicontrols.Label(text='<br><br><br><br>', parent=bottom, align=uiconst.TOALL, left=const.defaultPadding, state=uiconst.UI_NORMAL) wnd.sr.scroll = uicontrols.Scroll(name='attributescroll', parent=main) wnd.sr.scroll.sr.id = 'capsim_modulescroll' wnd.sr.scroll.hiliteSorted = 0 btns = uicontrols.ButtonGroup( btns=[['Run Simulation', self.Simulate, (), None]], parent=main, idx=0, unisize=0) self.Load() wnd.Maximize(1)
def ApplyAttributes(self, attributes): Window.ApplyAttributes(self, attributes) self.itemID = attributes.itemID self.typeID = attributes.typeID self.nameFilter = None self.stateManager = sm.GetService('godma').GetStateManager() self.SetCaption('Attribute Inspector') self.SetWndIcon(None) self.SetTopparentHeight(0) main = Container(name='main', parent=uiutil.GetChild(self, 'main'), pos=(const.defaultPadding, const.defaultPadding, const.defaultPadding, const.defaultPadding)) top = Container(name='top', parent=main, height=20, align=uiconst.TOTOP) Button(parent=top, label='Refresh', align=uiconst.TORIGHT, func=self.Refresh) self.input = SinglelineEdit(name='itemID', parent=top, width=-1, height=-1, align=uiconst.TOALL) self.input.readonly = not eve.session.role & ROLE_GMH self.input.OnReturn = self.Refresh self.input.SetValue(str(self.itemID)) Container(name='div', parent=main, height=5, align=uiconst.TOTOP) self.scroll = Scroll(parent=main) self.Refresh()
def ApplyAttributes(self, attributes): uicontrols.Window.ApplyAttributes(self, attributes) self.scope = 'station_inflight' self.SetCaption('Add snippet to detention list') self.SetMinSize([256, 256], 1) self.MakeUnResizeable() self.SetWndIcon() self.SetTopparentHeight(0) self.sr.main = uiutil.GetChild(self, 'main') textparent = uiprimitives.Container(name='push', align=uiconst.TOTOP, height=48, parent=self.sr.main) uicontrols.Label( text= 'Remove everything from the message below except\nfor the snippet that you want to add to the automatic \ndetention list', parent=textparent, left=6, top=3, fontsize=12, width=250, align=uiconst.TOPLEFT) self.sr.reason = uicls.EditPlainText(setvalue='', parent=self.sr.main, align=uiconst.TOPLEFT, width=248, height=150, top=50) mainbtns = uicontrols.ButtonGroup( btns=[['Add snippet', self.Confirm, ( ), 81], ['Cancel', self.Cancel, (), 81]]) self.sr.main.children.insert(0, mainbtns)
def OnLinkTypeChange(self, chkbox, *args): if chkbox.GetValue(): self.itemID = self.typeID = 0 self.key = chkbox.data['key'] text = uiutil.GetChild(chkbox, 'text') wnd = chkbox.FindParentByName( localization.GetByLabel('UI/Common/GenerateLink')) if not wnd: return editParent = uiutil.FindChild(wnd, 'editField') if editParent is not None: label = uiutil.FindChild(editParent, 'label') label.text = text.text edit = uiutil.FindChild(editParent, 'edit_txt') edit.SetValue('') self.sr.searchbutt = uiutil.FindChild(editParent, 'button') if self.key in ('char', 'corp', 'type', 'solarsystem', 'station'): if self.sr.searchbutt == None: from eve.client.script.ui.control.buttons import Button self.sr.searchbutt = Button( parent=editParent, label=localization.GetByLabel( 'UI/Common/SearchForItemType'), func=self.OnSearch, btn_default=0, align=uiconst.TOPRIGHT) else: self.sr.searchbutt.state = uiconst.UI_NORMAL edit.width = 55 elif self.sr.searchbutt != None: self.sr.searchbutt.state = uiconst.UI_HIDDEN edit.width = 0
def __init__(self, key_or_template, name=None, buttons=True, store=True): import dna if isinstance(key_or_template, dna.Ship): self.t = key_or_template else: self.t = Ship().ImportFromDNA(key_or_template, name) _wndname = '%s_%s' % (Popup.__wndname__, blue.os.GetWallclockTime()) wnd = uicontrols.Window.Open(windowID=_wndname) wnd.SetWndIcon(None) wnd.SetTopparentHeight(0) wnd.SetCaption('Ship Setup Information') wnd.sr.main = uiutil.GetChild(wnd, 'main') wnd.SetMinSize((320, 256)) main = uiprimitives.Container( name='main', parent=wnd.sr.main, pos=(const.defaultPadding, const.defaultPadding, const.defaultPadding, const.defaultPadding), align=uiconst.TOALL) info = InfoPanel(name='info', parent=main, pos=(0, 0, 0, 0)) info.Setup(self.t) if buttons: buttons = [['Close', self.Close, None, 81]] wnd.sr.main.children.insert(0, uicontrols.ButtonGroup(btns=buttons))
def Dump(self, *args): """ Dumps the contents of the scroll window to a file for later review """ if eve.Message( 'CustomQuestion', { 'header': 'Save current data?', 'question': 'This will save the current data entered in the window.<br><br>Are you sure that you want to save this?' }, uiconst.YESNO) == uiconst.ID_YES: filename = '%s.%s' % (self.GetTimestamp(), FILE_DESTROYABLES) wnd = DestroyableItemsWindow.GetIfOpen() if wnd: scroll = uiutil.GetChild(wnd, 'scroll') f = blue.classes.CreateInstance('blue.ResFile') TARGET = os.path.join(self.GetInsiderDir(), filename) if not f.Open(TARGET, 0): f.Create(TARGET) scroll.SelectAll() data = scroll.GetSelected() scroll.DeselectAll() headers = scroll.GetColumns() for header in headers: f.Write('%s\t' % header) f.Write('\r\n') for entry in data: f.Write('%s' % entry.label.replace('<t>', '\t').encode('utf8')) f.Write('\r\n') f.Close()
def DumpPOSer(self, *args): """ Dumps the contents of the scroll window to a file for later review """ if eve.Message( 'CustomQuestion', { 'header': 'Save current data?', 'question': 'This will save the current data entered in the window.<br><br>Are you sure that you want to save this?' }, uiconst.YESNO) == uiconst.ID_YES: filename = '%s.%s' % (self.GetTimestamp(), FILE_POS_EXT) wnd = DestroyableItemsWindow.GetIfOpen() if wnd: scroll = uiutil.GetChild(wnd, 'scroll') f = blue.classes.CreateInstance('blue.ResFile') TARGET = os.path.join(self.GetInsiderDir(), filename) if not f.Open(TARGET, 0): f.Create(TARGET) scroll.SelectAll() data = scroll.GetSelected() scroll.DeselectAll() for entry in data: if sm.GetService('michelle').GetBallpark().GetInvItem( entry.itemID ).categoryID == const.categoryStructure: f.Write('% 6d % 6d % 6d = %s' % (entry.x, entry.y, entry.z, entry.typeID)) f.Write('\r\n') f.Close()
def ApplyAttributes(self, attributes): uicontrols.Window.ApplyAttributes(self, attributes) self.specialGroups = util.GetNPCGroups() self.filterID = None self.scope = 'inflight' self.SetCaption(localization.GetByLabel('UI/Inflight/Scanner/ScannerFilterEditor')) self.SetMinSize([300, 250]) self.SetWndIcon() self.SetTopparentHeight(0) self.sr.main = uiutil.GetChild(self, 'main') topParent = uiprimitives.Container(name='topParent', parent=self.sr.main, height=64, align=uiconst.TOTOP) topParent.padRight = 6 topParent.padLeft = 6 uicontrols.EveHeaderSmall(text=localization.GetByLabel('UI/Inflight/Scanner/FilterName'), parent=topParent, state=uiconst.UI_DISABLED, idx=0, top=2) nameEdit = uicontrols.SinglelineEdit(name='name', parent=topParent, setvalue=None, align=uiconst.TOTOP, maxLength=64) nameEdit.top = 16 self.sr.nameEdit = nameEdit hint = uicontrols.EveLabelMedium(text=localization.GetByLabel('UI/Inflight/Scanner/SelectGroupsToFilter'), parent=topParent, align=uiconst.TOTOP) hint.top = 4 self.sr.topParent = topParent self.sr.scroll = uicontrols.Scroll(parent=self.sr.main, padding=(const.defaultPadding, const.defaultPadding, const.defaultPadding, const.defaultPadding)) self.sr.scroll.multiSelect = 0 self.DefineButtons(uiconst.OKCANCEL, okLabel=localization.GetByLabel('UI/Common/Buttons/Save'), okFunc=self.SaveChanges, cancelFunc=self.Close) self.scanGroupsNames = {const.probeScanGroupSignatures: localization.GetByLabel('UI/Inflight/Scanner/CosmicSignature'), const.probeScanGroupShips: localization.GetByLabel('UI/Inflight/Scanner/Ship'), const.probeScanGroupStructures: localization.GetByLabel('UI/Inflight/Scanner/Structure'), const.probeScanGroupDronesAndProbes: evetypes.GetCategoryNameByCategory(const.categoryDrone)} self.Maximize() self.OnResizeUpdate()
def SetWndIcon(self, iconNum=None, headerIcon=0, size=64, fullPath=None, mainTop=-3, mainLeft=0, hidden=False, **kw): self.iconNum = iconNum or self.GetDefaultWndIcon() if hidden: return icon = self.sr.mainIcon if not icon: return if iconNum is None: icon.state = uiconst.UI_HIDDEN return icon.state = uiconst.UI_DISABLED icon.LoadIcon(iconNum or fullPath, ignoreSize=True) icon.top = mainTop icon.left = mainLeft if headerIcon: icon.width = icon.height = 16 icon.left = 4 icon.top = 0 uiutil.Transplant(icon, uiutil.GetChild(self, 'captionParent')) if self.sr.caption: self.sr.caption.left = 24 self.sr.headerIcon = icon
def ApplyAttributes(self, attributes): uicls.Window.ApplyAttributes(self, attributes) self.scope = 'station_inflight' self.soldict = {} self.sr.main = uiutil.GetChild(self, 'main') self.SetWndIcon('ui_53_64_11', mainTop=-8) self.SetMinSize([350, 200]) self.SetCaption( localization.GetByLabel( 'UI/CapitalNavigation/CapitalNavigationWindow/CapitalNavigationLabel' )) uicls.WndCaptionLabel( text=localization.GetByLabel( 'UI/CapitalNavigation/CapitalNavigationWindow/CapitalNavigationLabel' ), subcaption=localization.GetByLabel( 'UI/CapitalNavigation/CapitalNavigationWindow/OnlinedStarbaseMessage' ), parent=self.sr.topParent, align=uiconst.RELATIVE) self.sr.scroll = uicls.Scroll( name='scroll', parent=self.sr.main, padding=(const.defaultPadding, const.defaultPadding, const.defaultPadding, const.defaultPadding)) self.sr.settingsParent = uicls.Container( name='settingsParent', parent=self.sr.main, align=uiconst.TOALL, state=uiconst.UI_HIDDEN, idx=1, pos=(const.defaultPadding, const.defaultPadding, const.defaultPadding, const.defaultPadding), clipChildren=1) maintabs = [ [ localization.GetByLabel( 'UI/CapitalNavigation/CapitalNavigationWindow/JumpTo'), self.sr.scroll, self, 'jumpto', self.sr.scroll ], [ localization.GetByLabel( 'UI/CapitalNavigation/CapitalNavigationWindow/WithinRange' ), self.sr.scroll, self, 'inrange', self.sr.scroll ] ] shipID = util.GetActiveShip() if shipID and sm.GetService('clientDogmaIM').GetDogmaLocation( ).GetItem(shipID).groupID == const.groupTitan: maintabs.insert(1, [ localization.GetByLabel( 'UI/CapitalNavigation/CapitalNavigationWindow/BridgeTo'), self.sr.scroll, self, 'bridgeto', self.sr.scroll ]) self.sr.maintabs = uicls.TabGroup(name='tabparent', parent=self.sr.main, idx=0, tabs=maintabs, groupID='capitaljumprangepanel')
def Show(self): if self.wnd: self.wnd.Maximize() return def MakeButton1(where, x, y, map, size, function, label, hint=None): button = uix.GetBigButton(size, where, left=x, top=y) button.cursor = 1 button.name = label if map != '': button.sr.icon.LoadIcon(map) button.OnClick = function if hint: button.hint = hint return button self.wnd = wnd = uicontrols.Window.Open(windowID=SERVICENAME) wnd._OnClose = self.Hide wnd.SetWndIcon(None) wnd.SetTopparentHeight(0) wnd.sr.main = uiutil.GetChild(wnd, 'main') wnd.SetCaption('Grid Utilities') x = const.defaultPadding y = const.defaultPadding size = 32 labelwidth = 128 for icon, label, func in [ ['56_4', 'Attract Jetcans', self.Attract], ['58_15', 'Loot Jetcans', lambda *x: self.CombineLoot(True)], [ '26_11', 'Combine Containers', lambda *x: self.CombineLoot(False) ], ['54_9', 'Scoop Containers', self.Scoop], ['56_2', 'Nuke Structures', self.NukeStructures], ['56_1', 'Nuke Shuttles', self.NukeShuttles], ['11_16', 'Nuke Cans/Drones', self.NukeGarbage] ]: MakeButton1(wnd.sr.main, x, y, icon, size, func, label, label) if ORIENTATION == 0: uicontrols.Label(text=label, parent=wnd.sr.main, width=200, left=x + size + 6, top=y + size / 2 - 6, color=None, state=uiconst.UI_DISABLED) y += size else: x += size if ORIENTATION == 0: wnd.fixedWidth = wnd.width = const.defaultPadding + size - 1 + labelwidth + const.defaultPadding wnd.fixedHeight = wnd.height = 20 + const.defaultPadding + y + const.defaultPadding else: wnd.fixedWidth = wnd.width = const.defaultPadding + x - 1 + const.defaultPadding wnd.fixedHeight = wnd.height = 20 + const.defaultPadding + size + const.defaultPadding wnd.MakeUnResizeable() wnd.Maximize(1)
def SetHint(self, hint): hp = uiutil.GetChild(self, 'hintparent') hp.Flush() if hint: t = uicontrols.EveLabelMedium(text=hint, parent=hp, top=-3, width=self.minsize[0] - 32, state=uiconst.UI_DISABLED, align=uiconst.CENTER) hp.state = uiconst.UI_PICKCHILDREN hp.height = t.height + 8 else: hp.state = uiconst.UI_HIDDEN
def Error(self, error): ep = uiutil.GetChild(self, 'errorParent') ep.Flush() if error: t = uicontrols.EveLabelMedium(text=localization.GetByLabel('UI/Control/ListWindow/DisplayError', errorMessage=error), top=-3, parent=ep, width=self.minsize[0] - 32, state=uiconst.UI_DISABLED, color=(1.0, 0.0, 0.0, 1.0), align=uiconst.CENTER) ep.state = uiconst.UI_DISABLED ep.height = t.height + 8 else: ep.state = uiconst.UI_HIDDEN
def Show(self): self.wnd = wnd = uicontrols.Window.GetIfOpen(windowID='typedb') if wnd: self.wnd.Maximize() return self.wnd = wnd = uicontrols.Window.Open(windowID='typedb') wnd.SetWndIcon(None) wnd.SetMinSize([350, 270]) wnd.SetTopparentHeight(0) wnd.SetCaption('Type Browser') mainpar = uiutil.GetChild(wnd, 'main') wnd.sr.tabs = uicontrols.TabGroup(name='tabsparent', parent=mainpar) main = uiprimitives.Container( name='main', parent=mainpar, padding=(const.defaultPadding, const.defaultPadding, const.defaultPadding, const.defaultPadding)) body = uiprimitives.Container(name='body', parent=main, align=uiconst.TOALL, pos=(0, 0, 0, 0)) wnd.sr.browser = uicontrols.Scroll(name='scroll', parent=body, pos=(0, 0, 0, 0)) wnd.sr.browser.multiSelect = False wnd.sr.browser.Startup() searchParent = uiprimitives.Container(name='search', parent=body, align=uiconst.TOALL, pos=(0, 0, 0, 0)) searchTop = uiprimitives.Container(name='search', parent=searchParent, height=25, align=uiconst.TOTOP) btn = uicontrols.Button(parent=searchTop, label='Search', func=self.Search, align=uiconst.TORIGHT) wnd.sr.input = uicontrols.SinglelineEdit(name='Search', parent=searchTop, width=-1, left=1, align=uiconst.TOALL) uiprimitives.Container(name='div', parent=searchParent, height=5, align=uiconst.TOTOP) wnd.sr.input.OnReturn = self.Search wnd.sr.scroll = uicontrols.Scroll(parent=searchParent) wnd.sr.scroll.multiSelect = False wnd.sr.tabs.Startup([['Browse', wnd.sr.browser, self, 0], ['Search', searchParent, self, 1]], 'typebrowsertabs') self.Search() stuff = self.GetContent(None, False) wnd.sr.browser.Load(contentList=stuff, headers=['Name', 'typeID']) wnd.sr.browser.Sort('Name')
def ApplyAttributes(self, attributes): uicls.Window.ApplyAttributes(self, attributes) tabIdx = attributes.tabIdx self.isFlat = settings.user.ui.Get('flatFleetView', False) self.scope = 'all' self.broadcastMenuItems = [] self.SetCaption(localization.GetByLabel('UI/Fleet/Fleet')) self.SetTopparentHeight(0) self.SetWndIcon('94_9') self.SetHeaderIcon() hicon = self.sr.headerIcon hicon.GetMenu = self.GetFleetMenuTop hicon.expandOnLeft = 1 hicon.hint = localization.GetByLabel('UI/Fleet/FleetWindow/FleetMenuHint') currentryActiveColumn = settings.user.ui.Get('activeSortColumns', {}) self.sr.main = uiutil.GetChild(self, 'main') self.InitBroadcastBottom() myFleetParent = uicls.Container(name='myfleet', parent=self.sr.main, align=uiconst.TOALL, pos=(0, 0, 0, 0)) uicls.Container(name='push', parent=myFleetParent, width=const.defaultPadding, align=uiconst.TOLEFT) uicls.Container(name='push', parent=myFleetParent, width=const.defaultPadding, align=uiconst.TORIGHT) self.sr.myFleetContent = form.FleetView(parent=myFleetParent, name='fleetfinderpar', pos=(0, 0, 0, 0)) broadcastsParent = uicls.Container(name='broadcasts', parent=self.sr.main, align=uiconst.TOALL, pos=(0, 0, 0, 0)) self.broadcastsContent = form.FleetBroadcastView(parent=broadcastsParent, name='fleetfinderpar', pos=(0, 0, 0, 0)) fleetFinderParent = uicls.Container(name='fleetfinder', parent=self.sr.main, align=uiconst.TOALL, pos=(0, 0, 0, 0)) self.fleetFinderContent = form.FleetFinderWindow(parent=fleetFinderParent, name='fleetfinderpar', pos=(0, 0, 0, 0)) settingsParent = uicls.Container(name='settings', parent=self.sr.main, align=uiconst.TOALL, pos=(0, 0, 0, 0)) self.startPage = uicls.Container(name='startpage', parent=self.sr.main, align=uiconst.TOALL, state=uiconst.UI_HIDDEN) myFleetParent.children.append(self.startPage) self.sr.tabs = uicls.TabGroup(name='fleettabs', parent=self.sr.main, idx=0) tabs = [] inFleetTabs = [[localization.GetByLabel('UI/Fleet/FleetWindow/MyFleet'), myFleetParent, self, 'myfleet'], [localization.GetByLabel('UI/Fleet/FleetWindow/FleetHistory'), broadcastsParent, self, 'broadcasts']] fleetFinderTabs = [[localization.GetByLabel('UI/Fleet/FleetWindow/FleetFinder'), fleetFinderParent, self, 'fleetfinder']] if session.fleetid is not None: tabs.extend(inFleetTabs) tabs.extend(fleetFinderTabs) self.sr.tabs.Startup(tabs, 'fleettabs', autoselecttab=1) if session.fleetid is not None: myFleetTab = self.sr.tabs.GetTabs()[0] myFleetTab.OnTabDropData = self.OnDropInMyFleet if session.fleetid: tabToOpen = localization.GetByLabel('UI/Fleet/FleetWindow/MyFleet') else: tabToOpen = localization.GetByLabel('UI/Fleet/FleetWindow/FleetFinder') uthread.new(self.sr.tabs.ShowPanelByName, tabToOpen) if settings.user.ui.Get('fleetFinderBroadcastsVisible', False) and session.fleetid: self.ToggleBroadcasts()
def TestGammaSlider(): winID = 'TestGammaSlider_windID' uicontrols.Window.CloseIfOpen(windowID=winID) wnd = uicontrols.Window.Open(windowID=winID) wnd.SetTopparentHeight(0) wnd.SetMinSize([300, 50]) wnd.SetCaption('Gamma slider PROTOTYPE') mainCont = uiprimitives.Container(name='mainCont', parent=uiutil.GetChild(wnd, 'main'), align=uiconst.CENTER, state=uiconst.UI_NORMAL, width=200, height=10) gammaSlider = Slider(name='gammaSlider', parent=mainCont, minValue=0.5, maxValue=1.5, startValue=1.0, onsetvaluefunc=OnMySliderMoved, endsliderfunc=OnMySliderReleased) currentVal = trinity.settings.GetValue('eveSpaceSceneGammaBrightness') gammaSlider.SetValue(currentVal, True)
def ApplyAttributes(self, attributes): uicontrols.Window.ApplyAttributes(self, attributes) hubID = attributes.hubID self.SetCaption(localization.GetByLabel('UI/InfrastructureHub/HubSettings')) self.SetMinSize([230, 70]) self.SetWndIcon() self.SetTopparentHeight(0) self.sr.main = uiutil.GetChild(self, 'main') self.hubID = hubID self.corpID = eve.session.corpid self.ConstructLayout()
def SetRunning(self, state): """ Set the state of the Start and Stop buttons of the Automovebot UI. Params: state -- The state (bool) to set the buttons to. """ main = uiutil.GetChild(self.sr.main, 'main') channelInput = uiutil.GetChild(main, 'channelInput') phraseInput = uiutil.GetChild(main, 'phraseInput') destInput = uiutil.GetChild(main, 'destInput') startBtn = uiutil.GetChild(self.btns, 'Start_Btn') stopBtn = uiutil.GetChild(self.btns, 'Stop_Btn') if state is True: startBtn.Disable() stopBtn.Enable() channelInput.Disable() phraseInput.Disable() destInput.Disable() else: startBtn.Enable() stopBtn.Disable() channelInput.Enable() phraseInput.Enable() destInput.Enable()
def Show(self): if self.wnd and not self.wnd.destroyed: self.wnd.Maximize() return def MakeButton1(where, x, y, map, size, function, label, hint = None): button = uix.GetBigButton(size, where, left=x, top=y) button.cursor = 1 button.name = label if map != '': button.sr.icon.LoadIcon(map) button.OnClick = function if hint: button.hint = hint return button self.wnd = wnd = uicontrols.Window.Open(windowID=SERVICENAME) wnd._OnClose = self.Hide wnd.SetWndIcon(None) wnd.SetTopparentHeight(0) wnd.sr.main = uiutil.GetChild(wnd, 'main') wnd.SetCaption('Poser') x = const.defaultPadding y = const.defaultPadding size = 32 labelwidth = 128 for icon, label, func in [['41_2', 'Assemble Starbase', self.Assemble], ['57_14', 'Store Starbase', self.Store], ['24_5', 'Fuel Tower - Cycles', self.Fuel], ['24_5', 'Fuel Tower - Full', lambda : sm.GetService('slash').SlashCmd('/pos fuel')], ['56_2', 'Nuke Structures', lambda : sm.GetService('gridutils').NukeStructures()], ['58_2', 'Anchor All', lambda : sm.GetService('slash').SlashCmd('/pos anchor all')], ['58_15', 'Unanchor All', lambda : sm.GetService('slash').SlashCmd('/pos unanchor all')], ['41_10', 'Online All', lambda : sm.GetService('slash').SlashCmd('/pos online all')], ['41_11', 'Offline All', lambda : sm.GetService('slash').SlashCmd('/pos offline all')], ['23_3', 'Reinforce', lambda : sm.GetService('slash').SlashCmd('/pos reinforce all')], ['56_10', 'Interrupt', lambda : sm.GetService('slash').SlashCmd('/pos interrupt all')]]: MakeButton1(wnd.sr.main, x, y, icon, size, func, label, label) if ORIENTATION == 0: uicontrols.Label(text=label, parent=wnd.sr.main, width=200, left=x + size + 6, top=y + size / 2 - 6, color=None, state=uiconst.UI_DISABLED) y += size else: x += size if ORIENTATION == 0: wnd.SetFixedWidth(const.defaultPadding + size - 1 + labelwidth + const.defaultPadding) wnd.SetFixedHeight(20 + const.defaultPadding + y + const.defaultPadding) else: wnd.SetFixedWidth(const.defaultPadding + x - 1 + const.defaultPadding) wnd.SetFixedHeight(20 + const.defaultPadding + size + const.defaultPadding) wnd.MakeUnResizeable() wnd.Maximize(1)
def GetWnd(self, haveto=0, panelName=None, subPanelName=None): wnd = form.Corporation.GetIfOpen() if not wnd and haveto: wnd = form.Corporation.Open() wnd.sr.main = uiutil.GetChild(wnd, 'main') wnd.sr.main.left = wnd.sr.main.top = 0 wnd.sr.main.clipChildren = 1 wnd.OnScale_ = self.OnWndScale wnd.RefreshSize = self.RefreshSize wnd._OnClose = self.OnCloseWnd wnd.SetTopparentHeight(0) self.Initialize(wnd, panelName, subPanelName) return wnd
def ApplyAttributes(self, attributes): uicontrols.Window.ApplyAttributes(self, attributes) node = attributes.node caption = attributes.caption or 'List window' self.SetScope('station_inflight') self.SetMinSize((200, 200)) self.SetTopparentHeight(0) self.sr.data = node.copy() main = uiutil.GetChild(self, 'main') main.Flush() icon = getattr(self.sr.data, 'showicon', '') if icon == 'hide': self.SetCaption(caption) self.SetWndIcon('ui_9_64_14') elif icon and icon[0] == '_': self.SetWndIcon(icon[1:], 1, size=32) self.SetCaption(caption) else: self.SetCaption(caption) self.SetWndIcon('res:/ui/Texture/WindowIcons/smallfolder.png', 1, size=32) if icon: mainicon = uiutil.GetChild(self, 'mainicon') mainicon.LoadIcon(icon, ignoreSize=True) mainicon.SetSize(32, 32) mainicon.state = uiconst.UI_DISABLED else: self.SetWndIcon('res:/ui/Texture/WindowIcons/smallfolder.png', 1, size=32) self.sr.scroll = uicontrols.Scroll(name='scroll', parent=main, padding=(const.defaultPadding, const.defaultPadding, const.defaultPadding, const.defaultPadding), align=uiconst.TOALL) self.sr.scroll.sr.iconMargin = getattr(self.sr.data, 'iconMargin', 0) ignoreTabTrimming = util.GetAttrs(node, 'scroll', 'sr', 'ignoreTabTrimming') or 0 self.sr.scroll.sr.ignoreTabTrimming = ignoreTabTrimming minColumnWidth = util.GetAttrs(node, 'scroll', 'sr', 'minColumnWidth') or {} self.sr.scroll.sr.minColumnWidth = minColumnWidth self.sr.scroll.sr.content.OnDropData = self.OnDropData
def ApplyAttributes(self, attributes): uicontrols.Window.ApplyAttributes(self, attributes) self.prefs = prefs self.SetCaption('Settings Manager') self.SetMinSize([320, 300]) self.SetWndIcon(None) self.SetTopparentHeight(0) margin = const.defaultPadding main = uiprimitives.Container(name='main', parent=uiutil.GetChild(self, 'main'), pos=(margin, margin, margin, margin)) uicontrols.Frame(parent=main, color=(1.0, 1.0, 1.0, 0.2), idx=0) bottom = uiprimitives.Container(name='btm', parent=main, height=45, align=uiconst.TOBOTTOM) btns = [['Refresh', self.Refresh, None, 81], ['Add', self.AddEntry, None, 81], ['Modify', self.EditAttribute, None, 81], ['Delete', self.DeleteKey, None, 81], ['Open', self.OpenPrefs, True, 81]] btn = uicontrols.ButtonGroup(btns=btns, parent=bottom) push = uiprimitives.Container(parent=bottom, align=uiconst.TOLEFT, width=2) push = uiprimitives.Container(parent=bottom, align=uiconst.TOTOP, height=margin) locstr = '\xe2\x80\xa2 Current file location...' text = uicontrols.Label(text=locstr, parent=bottom, align=uiconst.TOTOP, height=18, fontsize=10, letterspace=1, linespace=9, uppercase=1, state=uiconst.UI_NORMAL) text.OnClick = (self.OpenPrefs, False) text.GetMenu = self.TextMenu text.hint = 'The current location for the prefs.ini is:<br><br>%s<br><br><b>Click</b> to open.' % self.prefs.ini.filename uiprimitives.Container(name='div', parent=main, height=0, align=uiconst.TOTOP) self.scroll = uicontrols.Scroll(parent=main) self.scroll.sr.id = 'PrefsScroll' self.Refresh()
def ShowMessage(self, header, text, icon): self.sr.header.text = header if icon: try: icon = util.IconFile(int(icon.split(' ', 1)[0])) self.SetWndIcon(icon, mainTop=-3) if icon.startswith('c_'): uiutil.GetChild(self, 'clippedicon').state = uiconst.UI_HIDDEN except: self.SetWndIcon('ui_40_64_14', mainTop=-3) log.LogWarn('Failed adding ', icon, ' as icon in transmission window') sys.exc_clear() else: self.SetWndIcon('ui_40_64_14', mainTop=-6) self.sr.messageArea.SetValue(text)
def MakeMenu(self, list = None, anchor = None): if list is None: return if anchor is None: return mv = menu.CreateMenuView(menu.CreateMenuFromList(list), None, None) anchorwindow = self x = max(uiutil.GetChild(anchorwindow, anchor).GetAbsolute()[0], 0) y = anchorwindow.top + anchorwindow.height if anchorwindow.top + anchorwindow.height + mv.height > uicore.desktop.height: mv.top = min(form.InsiderWnd.GetIfOpen().top - mv.height, y) else: mv.top = min(uicore.desktop.width - mv.height, y) mv.left = min(uicore.desktop.width - mv.width, x) uicontrols.Frame(parent=mv, color=(1.0, 1.0, 1.0, 0.2)) uicore.layer.menu.children.insert(0, mv)
def ApplyAttributes(self, attributes): import uicls import uiutil import uiconst import sys sys.stdout = self uicls.Window.ApplyAttributes(self, attributes) scroll = uicls.Scroll(parent=uiutil.GetChild(self, 'main'), padding=2) self.sr.scroll = scroll self.edit = uicls.SinglelineEdit(name="", readonly=False, parent=self.sr.maincontainer, align=uiconst.RELATIVE, pos=(2, 2, 150, 25), padding=(0, 0, 0, 0)) self.edit.OnReturn = self.EnterPressed