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 OnSearch(self, *args): wnd = self.sr.searchbutt.FindParentByName( localization.GetByLabel('UI/Common/GenerateLink')) if not wnd: return editParent = uiutil.FindChild(wnd, 'editField') edit = uiutil.FindChild(editParent, 'edit_txt') val = edit.GetValue().strip().lower() name = self.DoSearch(self.key, val) if name is not None: edit.SetValue(name)
def OnGetQoutes(self, *args): uiutil.FindChild(self, 'reprocessingServiceGetQuotesBtn').Disable() itemKeys = [] for item in self.sr.itemscroll.GetNodes(): if item.checked: itemKeys.append(item.rec.itemID) if len(itemKeys): activeShipID = util.GetActiveShip() self.quotes = sm.GetService( 'reprocessing').GetReprocessingSvc().GetQuotes( itemKeys, activeShipID) self.__LoadQuotes() uiutil.FindChild(self, 'reprocessingServiceReprocessBtn').Enable()
def _Execute(self, title, buttons, icon, suppText, customicon, height, default, modal, okLabel, cancelLabel): if height is None: height = 210 self.MakeUnMinimizable() self.HideHeader() self.SetMinSize([340, height]) self.DefineIcons(icon, customicon) if title is None: title = localization.GetByLabel('UI/Common/Information') self.sr.main = uiutil.FindChild(self, 'main') caption = uicontrols.EveCaptionLarge(text=title, align=uiconst.CENTERLEFT, parent=self.sr.topParent, left=64, width=270) self.SetTopparentHeight(max(56, caption.textheight + 16)) self.DefineButtons(buttons, default=default, okLabel=okLabel, cancelLabel=cancelLabel) if suppText: self.ShowSupp(suppText) if modal: uicore.registry.SetFocus(self)
def IHaveNoIdea(self, column): if settings.user.ui.Get('damageMessages', 1) == 0: for each in ('damageMessagesNoDamage', 'damageMessagesMine', 'damageMessagesEnemy'): cb = uiutil.FindChild(column, each) if cb: cb.state = uiconst.UI_HIDDEN
def ShowSkillPointsNotification(self, number=(0, 0), time=5000, *args): skillPointsNow = self.GetFreeSkillPoints() skillPointsLast = settings.user.ui.Get('freeSkillPoints', -1) if skillPointsLast == skillPointsNow: return if skillPointsNow <= 0: return leftSide, rightSide = uicore.layer.sidePanels.GetSideOffset() data = util.KeyVal() data.headerText = localization.GetByLabel( 'UI/Generic/SkillPointsApplied') data.text1 = localization.GetByLabel( 'UI/SkillQueue/UnallocatedSkillPoints') data.text2 = None data.iconNum = 'ui_94_64_8' data.time = time icon = uiutil.FindChild(uicore.layer.abovemain, 'newmail') if not icon: icon = xtriui.PopupNotification(name='skillpointsapplied', parent=None, align=uiconst.TOPLEFT, pos=(leftSide, 60, 230, 60), idx=0) icon.state = uiconst.UI_NORMAL uicore.layer.abovemain.children.insert(0, icon) icon.Startup() icon.Load(data) settings.user.ui.Set('freeSkillPoints', skillPointsNow) return icon
def PostOnClick(self, obj, *args): import random labels = [ each.raceName for each in sm.GetService('cc').GetRaceData(shuffle=1) if each.raceID in [ const.raceCaldari, const.raceMinmatar, const.raceGallente, const.raceAmarr ] ] if obj in self.ribbonsliders: idx = self.ribbonsliders.index(obj) nidx = idx + 1 colorPreview = uiutil.FindChild(obj.parent, 'colorPreview') if colorPreview: colorPreview.state = uiconst.UI_PICKCHILDREN if len(self.ribbonsliders) <= nidx: return self.ribbonsliders[nidx].parent.state = uiconst.UI_PICKCHILDREN if idx == 0: mtype = getattr(obj, 'mastertype', None) if mtype is not None and self.currentselection != mtype: for slider in self.ribbonsliders[1:]: slider.sr.dad.ClearSprite(slider.sr.dadlayer) data = self.GetRibbonShapeData(mtype) slider.Startup(data) elif obj in self.medalsliders: idx = self.medalsliders.index(obj) nidx = idx + 1 if len(self.medalsliders) <= nidx: return self.medalsliders[nidx].parent.state = uiconst.UI_PICKCHILDREN self.currentselection = getattr(self.ribbonsliders[0], 'mastertype', None)
def OnDeleteContract(self, contractID, *args): def DeleteContractInList(list, contractID): nodes = list.GetNodes() for n in nodes: if n.contractID == contractID: list.RemoveEntries([n]) return list = uiutil.FindChild(self.sr.main, 'mycontractlist') if list: DeleteContractInList(list, contractID)
def ToggleWindowOverlay(self, show): if getattr(self, 'isToggling', 0): return prestate = self.state if not self or self.destroyed: return if prestate != uiconst.UI_HIDDEN: self.state = uiconst.UI_DISABLED setattr(self, 'isToggling', 1) try: mainpar = uiutil.FindChild(self, 'startpage_mainpar') if not mainpar or mainpar.destroyed: return mainpar.state = uiconst.UI_PICKCHILDREN l, t, w, h = mainpar.parent.GetAbsolute() start, ndt = blue.os.GetWallclockTime(), 0.0 time = 750.0 while ndt != 1.0: ndt = max(ndt, min(blue.os.TimeDiffInMs(start, blue.os.GetWallclockTime()) / time, 1.0)) if show: mainpar.top = int(mathUtil.Lerp(-h, 0, ndt)) mainpar.opacity = ndt else: mainpar.top = int(mathUtil.Lerp(0, -h, ndt)) mainpar.opacity = 1.0 - ndt mainpar.height = -mainpar.top blue.pyos.synchro.Yield() finally: if not self.destroyed: self.state = prestate mainpar = uiutil.FindChild(self, 'startpage_mainpar') if mainpar and not mainpar.destroyed: uicore.registry.SetFocus(self.sr.wpCloseBtn) if not self or self.destroyed: return setattr(self, 'isToggling', 0)
def PlaceBidBuyoutCallback(self, chkbox, *args): c = self.contract.contract buyout = c.collateral currentBid = 0 if len(self.contract.bids) > 0: currentBid = self.contract.bids[0].amount minBid = int( max(c.price, min(currentBid + 0.1 * c.price + 0.1, c.collateral))) wnd = chkbox.parent.parent edit = uiutil.FindChild(wnd, 'edit_bid') if chkbox.GetValue(): edit.state = uiconst.UI_DISABLED edit.SetText(buyout) else: edit.state = uiconst.UI_NORMAL edit.SetText(minBid)
def ApplyAttributes(self, attributes): uicontrols.Window.ApplyAttributes(self, attributes) self.SetWndIcon(self.iconNum, size=64) self.MakeUnstackable() self.SetTopparentHeight(72) self.SetSize(WINDOW_WIDTH, WINDOW_HEIGHT) self.SetMinSize((WINDOW_WIDTH, WINDOW_HEIGHT)) self.MakeUnResizeable() self.SetScope('station') self.crimewatchSvc = sm.GetService('crimewatchSvc') self.godmaSvc = sm.GetService('godma') self.walletSvc = sm.GetService('wallet') icon = uiutil.FindChild(self, 'mainicon') icon.left = 16 icon.top = 6 self.currentSecurityStatus = 0 self.targetSecurityStatus = 0 self.ConstructLayout()
def Execute(self, text, title, buttons, icon, suppText, customicon=None, height=None, default=None, modal=True, okLabel=None, cancelLabel=None): if height is None: height = 210 self.MakeUnMinimizable() self.HideHeader() self.SetMinSize([340, height]) self.DefineIcons(icon, customicon) if title is None: title = localization.GetByLabel('UI/Common/Information') self.sr.main = uiutil.FindChild(self, 'main') caption = uicls.EveCaptionLarge(text=title, align=uiconst.CENTERLEFT, parent=self.sr.topParent, left=64, width=270) self.SetTopparentHeight(max(56, caption.textheight + 16)) if text: text = text.replace('\r', '').replace('\n', '') edit = uicls.EditPlainText(parent=self.sr.main, padding=const.defaultPadding, readonly=1) self.edit = edit uthread.new(self.SetText, text) self.DefineButtons(buttons, default=default, okLabel=okLabel, cancelLabel=cancelLabel) if suppText: self.ShowSupp(suppText) if modal: uicore.registry.SetFocus(self)
def ApplyAttributes(self, attributes): uicontrols.Window.ApplyAttributes(self, attributes) isAlliance = attributes.isAlliance bulletin = attributes.bulletin self.scope = 'all' self.bulletin = bulletin self.bulletinID = None self.editDateTime = None self.isAlliance = isAlliance self.SetMinSize([420, 300]) self.SetWndIcon(self.iconNum, mainTop=-10) self.SetCaption(localization.GetByLabel('UI/Corporations/EditCorpBulletin/EditBulletinCaption')) self.SetTopparentHeight(45) main = uiutil.FindChild(self, 'main') main.left = main.top = main.width = main.height = const.defaultPadding uiprimitives.Container(parent=self.sr.topParent, width=4, align=uiconst.TORIGHT, name='push') uiprimitives.Container(parent=self.sr.topParent, width=120, align=uiconst.TOLEFT, name='push') titleInput = uicontrols.SinglelineEdit(name='titleInput', parent=self.sr.topParent, align=uiconst.TOBOTTOM, maxLength=100) titleInput.OnDropData = self.OnDropData self.sr.titleInput = titleInput l = uicontrols.EveLabelSmall(text=localization.GetByLabel('UI/Corporations/EditCorpBulletin/BulletinTitle'), parent=titleInput, width=64, height=12, left=48, top=4, state=uiconst.UI_DISABLED) l.left = -l.textwidth - 6 uiprimitives.Container(parent=main, height=const.defaultPadding, align=uiconst.TOTOP, name='push') self.sr.messageEdit = uicls.EditPlainText(setvalue='', parent=main, maxLength=2000, showattributepanel=1) self.sr.bottom = uiprimitives.Container(name='bottom', parent=self.sr.maincontainer, align=uiconst.TOBOTTOM, height=24, idx=0) uicontrols.ButtonGroup(btns=[[localization.GetByLabel('UI/Common/Buttons/Submit'), self.ClickSend, None, None], [localization.GetByLabel('UI/Common/Buttons/Cancel'), self.OnCancel, None, None]], parent=self.sr.bottom, line=False) if bulletin is not None: self.sr.titleInput.SetValue(bulletin.title) self.sr.messageEdit.SetValue(bulletin.body) self.bulletinID = bulletin.bulletinID self.editDateTime = bulletin.editDateTime
def SetWndIcon(self, iconNum = None, headerIcon = 0, size = 64, fullPath = None, mainTop = -3, hidden = False, **kw): self.iconNum = iconNum or self.GetDefaultWndIcon() if hidden: iconNum = None retmain = None retclipped = None for each in ['mainicon', 'clippedicon', 'clippedicon2']: icon = uiutil.FindChild(self, each) if not icon: continue elif iconNum is None: icon.state = uiconst.UI_HIDDEN continue icon.state = uiconst.UI_DISABLED icon.LoadIcon(iconNum or fullPath, ignoreSize=True) if each in ('clippedicon', 'clippedicon2'): if self.sr.topParent: icon.parent.top = -self.sr.topParent.height if headerIcon: retclipped = None icon.Close() else: retclipped = icon elif each == 'mainicon': retmain = icon icon.top = mainTop if headerIcon and each == 'mainicon': 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 return (retmain, retclipped)
def PrepareData(self): l, t, w, h = self.GetAbsolute() for i in range(self.visiblecount + 2): try: obj, ret = self.data[i - 1] except: obj, ret = (None, None) sys.exc_clear() slimdeco = uiutil.FindChild(self.sr.main, 'cont_%s' % i) if slimdeco is None: slimdeco = uicls.Container(name='cont_%s' % i, parent=self.sr.main, align=uiconst.TOLEFT, left=0, top=0, width=h, state=uiconst.UI_NORMAL) self.SetObject(slimdeco, obj, ret) if i == 0: left = 0 if self.actualcount < self.visiblecount: self.sr.main.children[-1].Close()
def GetSprite(self, id): obj = uiutil.FindChild(self, '%sSprite%s' % (self.lname, id)) if obj: return obj
def GetLayer(self, id): obj = uiutil.FindChild(self, '%sLayer%s' % (self.lname, id)) if obj: return obj
def DefineButtons(self, buttons, okLabel=None, okFunc='default', args='self', cancelLabel=None, cancelFunc='default', okModalResult='default', default=None): if okLabel is None: okLabel = localization.GetByLabel('UI/Common/Buttons/OK') if cancelLabel is None: cancelLabel = localization.GetByLabel('UI/Common/Buttons/Cancel') if getattr(self.sr, 'bottom', None) is None: self.sr.bottom = uiutil.FindChild(self, 'bottom') if not self.sr.bottom: self.sr.bottom = uiprimitives.Container( name='bottom', parent=self.sr.maincontainer, align=uiconst.TOBOTTOM, height=24, idx=0) if self.sr.bottom is None: return self.sr.bottom.Flush() if buttons is None: self.sr.bottom.state = uiconst.UI_HIDDEN return self.sr.bottom.height = 24 if okModalResult == 'default': okModalResult = uiconst.ID_OK if okFunc == 'default': okFunc = self.ConfirmFunction if cancelFunc == 'default': cancelFunc = self.ButtonResult if isinstance(buttons, (types.ListType, types.TupleType)): btns = [] for btn in buttons: if btn.id == uiconst.ID_CANCEL: cancelButton = 1 else: cancelButton = 0 btns.append([ btn.label, self.ButtonResult, None, None, btn.id, 0, cancelButton ]) elif buttons == uiconst.OK: btns = [[okLabel, okFunc, args, None, okModalResult, 1, 0]] elif buttons == uiconst.OKCANCEL: btns = [[okLabel, okFunc, args, None, okModalResult, 1, 0], [ cancelLabel, cancelFunc, args, None, uiconst.ID_CANCEL, 0, 1 ]] elif buttons == uiconst.OKCLOSE: closeLabel = localization.GetByLabel('UI/Common/Buttons/Close') btns = [[okLabel, okFunc, args, None, okModalResult, 1, 0], [ closeLabel, self.CloseByUser, args, None, uiconst.ID_CLOSE, 0, 1 ]] elif buttons == uiconst.YESNO: yesLabel = localization.GetByLabel('UI/Common/Buttons/Yes') noLabel = localization.GetByLabel('UI/Common/Buttons/No') btns = [[ yesLabel, self.ButtonResult, args, None, uiconst.ID_YES, 1, 0 ], [noLabel, self.ButtonResult, args, None, uiconst.ID_NO, 0, 0]] elif buttons == uiconst.YESNOCANCEL: yesLabel = localization.GetByLabel('UI/Common/Buttons/Yes') noLabel = localization.GetByLabel('UI/Common/Buttons/No') btns = [[ yesLabel, self.ButtonResult, args, None, uiconst.ID_YES, 1, 0 ], [noLabel, self.ButtonResult, args, None, uiconst.ID_NO, 0, 0], [ cancelLabel, cancelFunc, args, None, uiconst.ID_CANCEL, 0, 1 ]] elif buttons == uiconst.CLOSE: closeLabel = localization.GetByLabel('UI/Common/Buttons/Close') btns = [[ closeLabel, self.CloseByUser, args, None, uiconst.ID_CANCEL, 0, 1 ]] elif type(okLabel) == types.ListType or type( okLabel) == types.TupleType: btns = [] for index in xrange(len(okLabel)): label = okLabel[index] additionalArguments = { 'Function': okFunc, 'Arguments': args, 'Cancel Label': cancelLabel, 'Cancel Function': cancelFunc, 'Modal Result': okModalResult, 'Default': default } for argName in additionalArguments: if type(additionalArguments[argName]) in ( types.ListType, types.TupleType) and len( additionalArguments[argName]) > index: additionalArguments[argName] = additionalArguments[ argName][index] cancel = additionalArguments[ 'Modal Result'] == uiconst.ID_CANCEL btns.append([ label, additionalArguments['Function'], additionalArguments['Arguments'], None, additionalArguments['Modal Result'], additionalArguments['Default'], cancel ]) else: btns = [[okLabel, okFunc, args, None, okModalResult, 1, 0]] if default is not None: for each in btns: each[5] = each[4] == default buttonGroup = ButtonGroup(btns=btns, parent=self.sr.bottom, unisize=1) self.sr.bottom.height = max(24, buttonGroup.height) self.sr.bottom.state = uiconst.UI_PICKCHILDREN
def LoadWindowOverlayPage(self, force = 0): mainpar = uiutil.FindChild(self, 'startpage_mainpar') if mainpar and not mainpar.destroyed: return if not self or self.destroyed: return kbContent, overlayPage, suppressed = self.CheckForContextHelp() if overlayPage is None or suppressed and not force: return if getattr(self, 'isToggling', 0): return if self.sr.stack: top = 0 else: headerHeight = self.GetCollapsedHeight() top = headerHeight if not force: tutorialWnd = form.TutorialWindow.GetIfOpen() if tutorialWnd: return m = 2 mainpar = uicls.Container(name='startpage', parent=self.sr.maincontainer, left=m, width=m, height=m, idx=0, top=top, clipChildren=True, state=uiconst.UI_NORMAL) par = uicls.Container(name='startpage_mainpar', parent=mainpar, state=uiconst.UI_HIDDEN) uicls.Line(parent=par, align=uiconst.TOLEFT) uicls.Line(parent=par, align=uiconst.TORIGHT) uicls.Line(parent=par, align=uiconst.TOBOTTOM) uicls.Fill(parent=par, color=(0.0, 0.0, 0.0, 0.8)) contentpar = uicls.Container(name='contentpar', parent=par, idx=0) topPar = uicls.Container(name='topPar', parent=contentpar, align=uiconst.TOTOP, height=64) icon = uicls.Icon(icon='ui_74_64_13', parent=contentpar) caption = uicls.CaptionLabel(text=overlayPage.title, parent=topPar, align=uiconst.CENTERLEFT, left=70) topPar.height = max(topPar.height, caption.textheight) bottomPar = uicls.Container(name='bottomPar', parent=contentpar, align=uiconst.TOBOTTOM) uicls.Line(parent=bottomPar, align=uiconst.TOTOP) btn = uicls.Button(parent=bottomPar, label=localization.GetByLabel('UI/Control/EveWindow/CloseWindowOverlay'), func=self.CloseWindowOverlay, idx=0, left=6, align=uiconst.CENTERRIGHT, alwaysLite=True) self.sr.wpCloseBtn = btn checkboxLabel = localization.GetByLabel('UI/Control/EveWindow/DisableThisWindowOverlay') self.sr.wpSuppress = uicls.Checkbox(text=checkboxLabel, parent=bottomPar, configName='suppress', retval=0, checked=suppressed, groupname=None, align=uiconst.TOPLEFT, pos=(6, 0, 200, 0), callback=self.DoSupress) allSuppressed = not settings.char.ui.Get('showWindowOverlays', 0) checkboxLabel = localization.GetByLabel('UI/Control/EveWindow/DisableAllWindowOverlays') self.sr.wpSuppressAll = uicls.Checkbox(text=checkboxLabel, parent=bottomPar, configName='suppressAll', retval=0, checked=allSuppressed, groupname=None, align=uiconst.TOPLEFT, pos=(6, 0, 200, 0), callback=self.DoSuppressAll) self.sr.wpSuppress.top = self.sr.wpSuppressAll.height bottomPar.height = max(self.sr.wpSuppress.height + 2 + self.sr.wpSuppressAll.height, btn.height + 6) if kbContent: uicls.Container(name='push', parent=contentpar, align=uiconst.TOBOTTOM, height=16) mainBottomPar = uicls.Container(name='mainBottomPar', parent=contentpar, align=uiconst.TOBOTTOM, height=32) kbPar = uicls.Container(name='kbPar', parent=mainBottomPar, align=uiconst.TOLEFT, width=128, left=16) uicls.Line(parent=kbPar, align=uiconst.TORIGHT) t = uicls.EveLabelMedium(text=localization.GetByLabel('UI/Control/EveWindow/KnowledgeBase'), parent=kbPar, align=uiconst.TOTOP, state=uiconst.UI_NORMAL) maxWidth = t.textwidth for each in kbContent: if not each.url: continue entryPar = uicls.Container(name='entryPar', parent=kbPar, align=uiconst.TOTOP) l = uicls.EveHeaderSmall(text='<url=%s>%s</url>' % (each.url, each.description or each.url), parent=entryPar, top=1, align=uiconst.CENTERLEFT, state=uiconst.UI_NORMAL) entryPar.height = max(14, l.textheight) maxWidth = max(maxWidth, l.textwidth + 18) icon = uicls.Icon(icon='ui_38_16_125', parent=entryPar, align=uiconst.CENTERRIGHT, idx=0, state=uiconst.UI_NORMAL) icon.OnClick = (self.ClickHelp, each.url) kbPar.width = maxWidth kbHeight = sum([ each.height for each in kbPar.children ]) tutorials = sm.GetService('tutorial').GetTutorials() validTutorials = sm.GetService('tutorial').GetValidTutorials() tutorialsPar = uicls.Container(name='tutorialsPar', parent=mainBottomPar, align=uiconst.TOLEFT, width=128, left=16) uicls.Line(parent=tutorialsPar, align=uiconst.TORIGHT) t = uicls.EveLabelMedium(text=localization.GetByLabel('UI/Control/EveWindow/Tutorials'), parent=tutorialsPar, align=uiconst.TOTOP, state=uiconst.UI_NORMAL) maxWidth = t.textwidth for each in kbContent: if each.tutorialID is None: continue tutorialData = tutorials.get(each.tutorialID, None) if tutorialData and each.tutorialID in validTutorials: entryPar = uicls.Container(name='entryPar', parent=tutorialsPar, align=uiconst.TOTOP) tutorialName = localization.GetByMessageID(tutorialData.tutorialNameID) l = uicls.EveHeaderSmall(text='<url=localsvc:service=tutorial&method=OpenTutorialSequence_Check&tutorialID=%s&force=1&click=1>%s</url>' % (each.tutorialID, tutorialName), parent=entryPar, align=uiconst.CENTERLEFT, top=1, state=uiconst.UI_NORMAL) entryPar.height = max(14, l.textheight) maxWidth = max(maxWidth, l.textwidth + 18) icon = uicls.Icon(icon='ui_38_16_125', parent=entryPar, align=uiconst.CENTERRIGHT, idx=0, state=uiconst.UI_NORMAL) icon.OnClick = (self.ClickTutorial, each.tutorialID) if len(tutorialsPar.children) <= 2: tutorialsPar.Flush() tutorialsPar.width = maxWidth tutorialsHeight = sum([ each.height for each in tutorialsPar.children ]) mainBottomPar.height = max(64, kbHeight, tutorialsHeight) browser = uicls.EditPlainText(parent=contentpar, padLeft=const.defaultPadding, padRight=const.defaultPadding, readonly=1, setvalue=overlayPage.text) browser.HideBackground() browser.RemoveActiveFrame() uthread.new(self.ToggleWindowOverlay, 1)
def CloseWindowOverlay(self, *args): startpage = uiutil.FindChild(self, 'startpage') if startpage: self.ToggleWindowOverlay(0) startpage.Close()
def Execute(self, text, title, buttons, radioOptions, icon, suppText, customicon=None, height=None, width=None, default=None, modal=True): height = height or 230 width = width or 340 self.HideHeader() self.SetMinSize([width, height]) self.width = width self.height = height self.DefineIcons(icon, customicon) if title is None: title = localization.GetByLabel('UI/Common/Information') self.sr.main = uiutil.FindChild(self, 'main') push = uicls.Container(name='push', align=uiconst.TOLEFT, parent=self.sr.topParent, width=64) caption = uicls.CaptionLabel(text=title, align=uiconst.CENTERLEFT, parent=self.sr.topParent, left=64, width=270) self.SetTopparentHeight(max(56, caption.textheight + 16)) self.sr.radioContainer = uicls.Container(name='radioContainer', parent=self.sr.main, align=uiconst.TOBOTTOM, left=6, top=const.defaultPadding, width=const.defaultPadding, height=40) push = uicls.Container(name='push', align=uiconst.TOLEFT, parent=self.sr.radioContainer, width=4) self.sr.radioContainer2 = uicls.Container( name='radioContainer', parent=self.sr.radioContainer, align=uiconst.TOALL, pos=(6, const.defaultPadding, 6, const.defaultPadding)) self.sr.textContainer = uicls.Container( name='textContainer', parent=self.sr.main, align=uiconst.TOALL, pos=(const.defaultPadding, const.defaultPadding, const.defaultPadding, const.defaultPadding)) if text: edit = uicls.EditPlainText(parent=self.sr.textContainer, padding=const.defaultPadding, readonly=1) self.edit = edit uthread.new(self.SetText, text) h = 0 if radioOptions: self.radioboxID = 'radioButtonMessageBox_%s' % repr(title) radioSelection = settings.user.ui.Get(self.radioboxID, 'radioboxOption1Selected') for index, label in enumerate(radioOptions): checkBox = uicls.Checkbox(text=label, parent=self.sr.radioContainer, configName=self.radioboxID, retval='radioboxOption%dSelected' % (index + 1), checked='radioboxOption%dSelected' % (index + 1) == radioSelection, groupname=self.radioboxID, callback=self.OnCheckboxChange) h += checkBox.height self.sr.radioContainer.height = h if suppText: self.ShowSupp(suppText) self.DefineButtons(buttons, default=default) if modal: uicore.registry.SetFocus(self)
def Show(self): if self.wnd and 0: self.wnd.Maximize() return self.wnd = wnd = uicontrols.Window.GetIfOpen(windowID='spaminator') if not wnd: self.wnd = wnd = uicontrols.Window.Open(windowID='spaminator') wnd.DoClose = self.Hide wnd.SetWndIcon(None) wnd.SetTopparentHeight(0) wnd.SetCaption(CAPTION) wnd.SetMinSize([520, 256]) main = uiprimitives.Container(name='main', parent=uiutil.FindChild(wnd, 'main'), left=0, top=0) buttonContainer = uiprimitives.Container(name='bottom', parent=main, align=uiconst.TOBOTTOM, height=30) mainCont = uiprimitives.Container(name='mainCont', parent=main, isClipper=1, top=8, left=8) settingsCont = uiprimitives.Container(name='settingsCont', parent=main, isClipper=1, top=8, left=8) tabs = [['Main', mainCont, self, 'main'], ['Settings', settingsCont, self, 'settings']] self.tabs = uicontrols.TabGroup(name='tabparent', parent=main, idx=1).Startup( tabs, 'monitortabs') leftContainer = uiprimitives.Container(name='left', parent=settingsCont, align=uiconst.TOLEFT, width=250) rightContainer = uiprimitives.Container(name='right', parent=settingsCont, align=uiconst.TOLEFT, width=250) contents = '' tc = uiprimitives.Container(name='titleContLeft', parent=leftContainer, align=uiconst.TOTOP, height=16) uicontrols.Label(text='Automatic detention:', parent=tc, width=160, align=uiconst.TOPLEFT) tc = uiprimitives.Container(name='titleContRight', parent=rightContainer, align=uiconst.TOTOP, height=16) uicontrols.Label(text='Notify:', parent=tc, width=100, align=uiconst.TOPLEFT) self.wnd.sr.detentionWindow = uicls.EditPlainText( setvalue='', parent=leftContainer, align=uiconst.TOALL) self.wnd.sr.notifyWindow = uicls.EditPlainText( setvalue='', parent=rightContainer, align=uiconst.TOALL) self.scrollCont = uiprimitives.Container(name='scrollCont', parent=mainCont, align=uiconst.TOALL) self.scroll = uicontrols.Scroll( name='scroll', parent=self.scrollCont, padding=(const.defaultPadding, const.defaultPadding, const.defaultPadding, const.defaultPadding), align=uiconst.TOALL) self.scroll.Startup() self.scroll.id = 'iskspammerscroll' self.scroll.multiSelect = 0 self.scroll.Load(contentList=[], headers=SCROLL_HEADERS, scrolltotop=1) btns = uicontrols.ButtonGroup( btns=[['Join Channels', self.JoinChannels, (), None], ['Reset', self.Reset, (), None], ['Start/Stop', self.ToggleStartWatching, (), None]], parent=buttonContainer) self.LoadConfig()
def OnPickColor(self, obj, *args): fill = uiutil.FindChild(obj, 'fill') if fill and self.sr.dad is not None: if hasattr(self.sr.dad, 'SetHSV'): self.sr.dad.SetHSV(fill.color.GetHSV())
def CloseAd(self, *args): ad = uiutil.FindChild(self, 'ad') if ad: ad.Close()
def HideAdIfAny(self): ad = uiutil.FindChild(self, 'ad') if ad: ad.state = uiconst.UI_HIDDEN
def ShowAdIfAny(self): ad = uiutil.FindChild(self, 'ad') if ad: ad.state = uiconst.UI_NORMAL
def GetEntry(self, idx): se = uiutil.FindChild(self, 'sliderEntry_%s' % idx) if se: return se
def ApplyAttributes(self, attributes): uicls.Window.ApplyAttributes(self, attributes) self.ResetSelf() format = attributes.format caption = attributes.caption modal = attributes.modal buttons = attributes.buttons location = attributes.location minw = attributes.get('minW', 320) minh = attributes.get('minH', 240) icon = attributes.icon blockconfirm = attributes.get('blockconfirm', False) self.name = caption self.result = {} self.isModal = modal self.blockconfirmonreturn = blockconfirm self.sr.topParent.align = uiconst.TOALL self.sr.topParent.height = 0 iconClipper = uiutil.FindChild(self, 'iconclipper') if iconClipper: iconClipper.top = -1 uicls.Container(name='push', parent=self.sr.topParent, align=uiconst.TORIGHT, width=const.defaultPadding) uicls.Container(name='push', parent=self.sr.topParent, align=uiconst.TOTOP, height=const.defaultPadding) main = uiutil.GetChild(self, 'main') if icon: uicls.Container(name='push', parent=self.sr.topParent, align=uiconst.TOLEFT, width=60) self.DefineIcons(icon) else: uicls.Container(name='push', parent=self.sr.topParent, align=uiconst.TOLEFT, width=const.defaultPadding) self.HideMainIcon() self.HideClippedIcon() self.state = uiconst.UI_HIDDEN self.DefineButtons(buttons) self.MakeUnMinimizable() self.MakeUncollapseable() self.MakeUnpinable() self.SetCaption(caption) self.SetMinSize([minw, minh], 1) self.form, self.retfields, self.reqresult, self.panels, self.errorcheck, refresh = sm.GetService( 'form').GetForm( format, xtriui.FormWnd(name='form', align=uiconst.TOTOP, parent=self.sr.topParent)) self.form.OnChange = self.OnChange for each in self.form.sr.panels.itervalues(): each.OnChange = self.OnChange self.refresh = refresh for each in refresh: for textControl in each[1:]: textControl.OnSizeChanged = self.UpdateTextControlSize self.state = self.form.state = uiconst.UI_NORMAL self.width = self.minsize[0] if self.form.sr.focus: uicore.registry.SetFocus(self.form.sr.focus) else: uicore.registry.SetFocus(self) uthread.new(self.RefreshSize_, 1)
def IsVisible(self): tabs = uiutil.FindChild(self.parent.parent, 'contractsTabs') selectedTab = tabs.GetVisible() return selectedTab.name == 'startPageParent'
def ManageLabel(self, assign=1): labelsChecked = self.FindLabelsChecked() numLabels = len(labelsChecked) scroll = None if numLabels < 1: raise UserError( 'CustomNotify', { 'notify': localization.GetByLabel( 'UI/PeopleAndPlaces/NoLabelsSelected') }) if self.labelType == 'contact': wnd = sm.GetService('addressbook').GetWnd() if wnd: scroll = uiutil.FindChild(wnd, 'rightScroll') else: wnd = sm.GetService('corpui').GetWnd() if wnd: if self.labelType == 'corpcontact': scroll = uiutil.FindChild(wnd, 'corpcontactsform', 'rightScroll') elif self.labelType == 'alliancecontact': scroll = uiutil.FindChild(wnd, 'alliancecontactsform', 'rightScroll') if not wnd: raise UserError( 'CustomNotify', { 'notify': localization.GetByLabel( 'UI/PeopleAndPlaces/NoContactsSelected') }) if scroll is None: selectedContacts = [] else: selectedContacts = scroll.GetSelected() try: contactIDs = [selIDs.charID for selIDs in selectedContacts] except: raise UserError( 'CustomNotify', { 'notify': localization.GetByLabel( 'UI/PeopleAndPlaces/NoContactsSelected') }) sum = 0 for labelID in labelsChecked: sum = sum + labelID numLabels = len(labelsChecked) numContacts = len(contactIDs) if numContacts > 0: if assign: text = localization.GetByLabel( 'UI/PeopleAndPlaces/LabelsAssigned', numLabels=numLabels, numContacts=numContacts) else: text = localization.GetByLabel( 'UI/PeopleAndPlaces/LabelsRemoved', numLabels=numLabels, numContacts=numContacts) eve.Message('CustomNotify', {'notify': text}) else: raise UserError( 'CustomNotify', { 'notify': localization.GetByLabel( 'UI/PeopleAndPlaces/NoContactsSelected') }) if assign == 1: sm.StartService('addressbook').AssignLabelFromWnd(contactIDs, sum, displayNotify=0) else: sm.StartService('addressbook').RemoveLabelFromWnd(contactIDs, sum)