Esempio n. 1
0
 def ConstructLayout(self):
     self.leftCont = uicls.Container(name='leftCont',
                                     parent=self.sr.main,
                                     align=uiconst.TOLEFT,
                                     width=SEARCH_WIDTH,
                                     clipChildren=True)
     self.rightCont = uicls.Container(name='rightCont',
                                      parent=self.sr.main,
                                      align=uiconst.TOALL)
     topCont = uicls.Container(name='topCont',
                               parent=self.rightCont,
                               align=uiconst.TOTOP,
                               height=90)
     uicls.EveLabelMedium(
         text=localization.GetByLabel('UI/AgentFinder/AgentLevel'),
         parent=topCont,
         align=uiconst.CENTERTOP,
         top=4)
     self.sliderCont = uicls.Container(name='sliderCont',
                                       parent=topCont,
                                       align=uiconst.TOTOP,
                                       pos=(0, 28, 0, 20),
                                       padding=(SLIDER_PADDING, 0,
                                                SLIDER_PADDING, 0))
     self.sliderAdjusterCont = uicls.Container(name='sliderAdjusterCont',
                                               parent=topCont,
                                               align=uiconst.TOTOP,
                                               pos=(0, 0, 0,
                                                    ADJUSTER_WIDTH),
                                               padding=(SLIDER_PADDING, 0,
                                                        SLIDER_PADDING, 0))
     browseCont = uicls.Container(name='browseCont',
                                  parent=self.rightCont,
                                  align=uiconst.TOBOTTOM,
                                  height=22,
                                  padding=(const.defaultPadding, 0,
                                           const.defaultPadding, 0),
                                  state=uiconst.UI_NORMAL)
     self.prevBtn = uicls.BrowseButton(parent=browseCont,
                                       prev=True,
                                       state=uiconst.UI_NORMAL,
                                       func=self.BrowseAgents)
     self.nextBtn = uicls.BrowseButton(parent=browseCont,
                                       prev=False,
                                       state=uiconst.UI_NORMAL,
                                       align=uiconst.TOPRIGHT,
                                       func=self.BrowseAgents)
     self.pageNumText = uicls.EveLabelMedium(text='',
                                             parent=browseCont,
                                             align=uiconst.CENTERTOP,
                                             state=uiconst.UI_HIDDEN)
     self.noAgentsCont = uicls.Container(
         name='noAgentsCont',
         parent=self.rightCont,
         align=uiconst.TOALL,
         padding=(const.defaultPadding * 3, const.defaultPadding,
                  const.defaultPadding * 3, const.defaultPadding),
         state=uiconst.UI_HIDDEN)
     self.noAgentsOrLoadingText = uicls.EveCaptionMedium(
         text='',
         parent=self.noAgentsCont,
         align=uiconst.TOTOP,
         width=self.noAgentsCont.width)
     self.noAgentsOrLoadingText.SetAlpha(0.5)
     self.mainCont = uicls.GridContainer(
         name='mainCont',
         parent=self.rightCont,
         align=uiconst.TOALL,
         padding=(const.defaultPadding, const.defaultPadding,
                  const.defaultPadding, const.defaultPadding))
     self.mainCont.lines = AGENT_LINES
     self.mainCont.columns = AGENT_COLUMNS
     self.expanderCont = uicls.Container(parent=topCont,
                                         align=uiconst.BOTTOMLEFT,
                                         height=16,
                                         width=60,
                                         top=8,
                                         state=uiconst.UI_NORMAL,
                                         left=6)
     self.expanderIcon = uicls.Icon(parent=self.expanderCont,
                                    idx=0,
                                    size=16,
                                    state=uiconst.UI_DISABLED,
                                    icon='ui_1_16_100')
     l = uicls.EveLabelMedium(
         text=localization.GetByLabel('UI/AgentFinder/FilterOptions'),
         parent=self.expanderCont,
         left=16)
     self.expanderCont.SetOpacity(NORMAL_ALPHA)
     self.expanderCont.width = l.width + 16
     self.expanderCont.OnClick = self.OnChangeSize
     self.expanderCont.OnMouseEnter = (self.OnContMouseEnter,
                                       self.expanderCont)
     self.expanderCont.OnMouseExit = (self.OnContMouseExit,
                                      self.expanderCont)
     self.GetStandings()
     self.GetAllAgentInfo()
     self.ConstructSearchUI()
     self.agentLevel = settings.user.ui.Get('agentFinderLevel',
                                            self.bestCorpStanding)
     self.ConstructSlider()
     expanded = settings.user.ui.Get('agentFinderExpanded', None)
     if expanded is None:
         settings.user.ui.Set('agentFinderExpanded', False)
     if expanded:
         self.ExpandSearch()
     else:
         self.CollapseSearch()
     self.GetAgents()
 def Load(self, args):
     if not self.sr.Get('inited', 0):
         self.ourWarsScroll = None
         self.allWarsScroll = None
         self.killReportsScroll = None
         self.sr.inited = 1
         self.maxWarID = const.maxInt
         self.warbatches = []
         self.ourWarsCont = uiprimitives.Container(name='ourWarsCont',
                                                   parent=self,
                                                   align=uiconst.TOALL)
         toolbarContainer = uiprimitives.Container(name='toolbarContainer',
                                                   align=uiconst.TOBOTTOM,
                                                   parent=self.ourWarsCont,
                                                   height=22)
         declareButton = uicontrols.ButtonGroup(btns=[[
             localization.GetByLabel(
                 'UI/Corporations/CorporationWindow/Alliances/Rankings/DeclareWar'
             ), self.DeclareWar, None, None
         ]],
                                                parent=toolbarContainer)
         self.ourWarsScroll = uicontrols.Scroll(
             parent=self.ourWarsCont, padding=const.defaultPadding)
         self.allWarsCont = uiprimitives.Container(name='allWarsCont',
                                                   parent=self,
                                                   align=uiconst.TOALL)
         allWarsSettingsCont = uiprimitives.Container(
             name='allWarsSettingsCont',
             parent=self.allWarsCont,
             align=uiconst.TOTOP,
             height=18,
             top=2)
         browseCont = uiprimitives.Container(
             name='browseCont',
             parent=self.allWarsCont,
             align=uiconst.TOBOTTOM,
             height=22,
             padding=(const.defaultPadding, 0, const.defaultPadding, 0),
             state=uiconst.UI_NORMAL)
         self.prevBtn = uicls.BrowseButton(parent=browseCont,
                                           prev=True,
                                           state=uiconst.UI_NORMAL,
                                           func=self.BrowseAllWars)
         self.nextBtn = uicls.BrowseButton(parent=browseCont,
                                           prev=False,
                                           state=uiconst.UI_NORMAL,
                                           align=uiconst.TOPRIGHT,
                                           func=self.BrowseAllWars)
         self.showCryForHelpCb = uicontrols.Checkbox(
             parent=allWarsSettingsCont,
             align=uiconst.TOPLEFT,
             left=const.defaultPadding,
             height=14,
             width=300,
             configName='allwars_showcryforhelp',
             text=localization.GetByLabel(
                 'UI/Corporations/Wars/ShowCryForHelp'),
             checked=settings.user.ui.Get('allwars_showcryforhelp', 0),
             callback=self.CheckBoxChange)
         self.showCryForHelpCb.hint = localization.GetByLabel(
             'UI/Corporations/Wars/NotFilterWhenSearching')
         self.searchButton = uicontrols.Button(
             parent=allWarsSettingsCont,
             label=localization.GetByLabel(
                 'UI/Corporations/CorporationWindow/Standings/Search'),
             align=uiconst.TOPRIGHT,
             pos=(const.defaultPadding, 2, 0, 0),
             func=self.Search,
             btn_default=1)
         self.searchEdit = uicontrols.SinglelineEdit(
             name='edit',
             parent=allWarsSettingsCont,
             left=self.searchButton.width + const.defaultPadding * 2,
             width=150,
             align=uiconst.TOPRIGHT,
             maxLength=32)
         self.searchEdit.OnReturn = self.Search
         self.allWarsScroll = uicontrols.Scroll(
             parent=self.allWarsCont, padding=const.defaultPadding)
         self.killReportsCont = uiprimitives.Container(
             name='killReportsCont', parent=self, align=uiconst.TOALL)
         killSettingsContainer = uiprimitives.Container(
             name='killSettingsContainer',
             parent=self.killReportsCont,
             align=uiconst.TOTOP,
             height=20)
         self.killReportQuickFilter = uicls.QuickFilterEdit(
             parent=killSettingsContainer,
             left=const.defaultPadding,
             align=uiconst.CENTERRIGHT,
             width=150)
         self.killReportQuickFilter.ReloadFunction = self.ReloadKillReports
         combatValues = ((localization.GetByLabel(
             'UI/Corporations/Wars/Killmails/ShowKills'), 0),
                         (localization.GetByLabel(
                             'UI/Corporations/Wars/Killmails/ShowLosses'),
                          1))
         selectedCombatType = settings.user.ui.Get('CorpCombatLogCombo', 0)
         self.combatCombo = uicontrols.Combo(parent=killSettingsContainer,
                                             name='combo',
                                             select=selectedCombatType,
                                             align=uiconst.TOPLEFT,
                                             callback=self.OnCombatChange,
                                             options=combatValues,
                                             idx=0,
                                             adjustWidth=True,
                                             top=const.defaultPadding,
                                             left=const.defaultPadding)
         self.killReportsScroll = uicontrols.Scroll(
             parent=self.killReportsCont, padding=const.defaultPadding)
         warTabs = [
             [
                 localization.GetByLabel(
                     'UI/Corporations/CorporationWindow/Wars/OurWars'),
                 self.ourWarsCont, self, 'our'
             ],
             [
                 localization.GetByLabel('UI/Corporations/Wars/AllWars'),
                 self.allWarsCont, self, 'all'
             ],
             [
                 localization.GetByLabel(
                     'UI/Corporations/Wars/Killmails/KillReports'),
                 self.killReportsCont, self, 'killreports'
             ]
         ]
         btnContainer = uiprimitives.Container(
             name='pageBtnContainer',
             parent=self,
             align=uiconst.TOBOTTOM,
             idx=0,
             padBottom=const.defaultPadding)
         btn = uix.GetBigButton(size=22,
                                where=btnContainer,
                                left=4,
                                top=0,
                                align=uiconst.TORIGHT)
         btn.hint = localization.GetByLabel('UI/Common/ViewMore')
         btn.state = uiconst.UI_HIDDEN
         btn.sr.icon.LoadIcon('ui_23_64_2')
         btn = uix.GetBigButton(size=22,
                                where=btnContainer,
                                left=4,
                                top=0,
                                align=uiconst.TOLEFT)
         btn.hint = localization.GetByLabel('UI/Common/Previous')
         btn.state = uiconst.UI_HIDDEN
         btn.sr.icon.LoadIcon('ui_23_64_1')
         btnContainer.height = max(
             [c.height for c in btnContainer.children])
         self.btnContainer = btnContainer
         btnContainer.state = uiconst.UI_HIDDEN
         tabs = uicontrols.TabGroup(name='tabparent', parent=self, idx=0)
         tabs.Startup(warTabs, 'corporationwars')
         self.tabs = tabs
         self.killentries = 25
     sm.GetService('corpui').LoadTop(
         'res:/ui/Texture/WindowIcons/wars.png',
         localization.GetByLabel(
             'UI/Corporations/CorporationWindow/Wars/WarsTitle'))
     self.myWars = 1
     if not hasattr(self, 'viewingOwnerID'):
         self.viewingOwnerID = eve.session.allianceid or eve.session.corpid
     if not hasattr(self, 'searchOwnerID'):
         self.searchOwnerID = None
     extrahint = ''
     if args != 'wars':
         self._HideNextPrevBtns()
     if args == 'all':
         self.ourWarsCont.display = False
         self.allWarsCont.display = True
         self.killReportsCont.display = False
         self.ShowAllWars()
     elif args == 'our':
         self.ourWarsCont.display = True
         self.allWarsCont.display = False
         self.killReportsCont.display = False
         self.ShowWars()
     elif args == 'killreports':
         self.ourWarsCont.display = False
         self.allWarsCont.display = False
         self.killReportsCont.display = True
         self.prevIDs = []
         self.combatPageNum = 0
         selectedCombatType = settings.user.ui.Get('CorpCombatLogCombo', 0)
         if selectedCombatType == 0:
             self.ShowCombatKills()
         else:
             self.ShowCombatLosses()
         extrahint = localization.GetByLabel(
             'UI/Corporations/CorporationWindow/Wars/DelayedKillboardDetails'
         )
     sm.GetService('corpui').LoadTop(
         'res:/ui/Texture/WindowIcons/wars.png',
         localization.GetByLabel(
             'UI/Corporations/CorporationWindow/Wars/WarsTitle'), extrahint)