Exemplo n.º 1
0
def Sort(iterable, cmp=None, key=lambda x: x, reverse=False, languageID=None):
    import localization
    if cmp:
        raise ValueError(
            "Passing a compare function into Sort defeats the purpose of using a language-aware sort.  You probably want to use the 'key' parameter instead."
        )
    cmpFunc = GetSortFunc(languageID)
    if all([isinstance(key(each), (int, type(None))) for each in iterable]):

        def getPronunciation(messageID):
            if not messageID:
                return ''
            ret = ''
            try:
                ret = localization.GetMetaData(messageID,
                                               'pronounciation',
                                               languageID=languageID)
            except KeyError:
                ret = localization.GetByMessageID(messageID, languageID)

            return ret

        return sorted(iterable,
                      cmp=cmpFunc,
                      key=lambda x: StripTags(getPronunciation(key(x))),
                      reverse=reverse)
    return sorted(iterable,
                  cmp=cmpFunc,
                  key=lambda x: StripTags(key(x)),
                  reverse=reverse)
Exemplo n.º 2
0
 def CleanImportantMarkup(self, textString):
     if self.UseImportantTooltip():
         textString = StripTags(textString, stripOnly=['localized'])
     if self.HighlightImportant(
     ) and len(textString) > 1 and textString[-1] == '*':
         textString = textString.replace(
             locconst.HIGHLIGHT_IMPORTANT_MARKER, '')
     return textString
Exemplo n.º 3
0
 def GetColumnSortValues(controller, structureServicesChecked):
     baseColumns = (controller.GetNumJumps(), controller.GetSecurity(),
                    controller.GetOwnerName().lower(),
                    '%s %s' % (controller.GetSystemName(),
                               StripTags(controller.GetName()).lower()),
                    len(controller.GetServices()))
     return baseColumns
Exemplo n.º 4
0
 def GetColWidths(node, idx=None):
     controller = node.controller
     widths = []
     if idx is None or idx == 0:
         jumpText = unicode(controller.GetNumJumps())
         widths.append(
             uicore.font.MeasureTabstops([(jumpText, ) + LABEL_PARAMS])[0])
     if idx is None or idx == 1:
         securityText = unicode(controller.GetSecurity())
         widths.append(
             uicore.font.MeasureTabstops([(securityText, ) + LABEL_PARAMS
                                          ])[0])
     if idx is None or idx == 2:
         widths.append(
             uicore.font.MeasureTabstops([
                 (controller.GetOwnerName(), ) + LABEL_PARAMS
             ])[0])
     if idx is None or idx == 3:
         nameToUse = max(StripTags(controller.GetName(),
                                   ignoredTags=('br', )).split('<br>'),
                         key=len)
         widths.append(
             uicore.font.MeasureTabstops([(nameToUse, ) +
                                          LABEL_PARAMS])[0] + HEIGHT - 4)
     return widths
Exemplo n.º 5
0
 def GetColumnSortValues(controller, slimProfileController):
     return (controller.GetState(), controller.GetNumJumps(),
             controller.GetSecurity(),
             '%s %s ' % (controller.GetSystemName(),
                         StripTags(controller.GetName()).lower()),
             len(controller.GetServices()),
             (controller.GetCurrentSchedule(),
              controller.GetNextWeekSchedule()), '')
Exemplo n.º 6
0
 def PrepareDrag(cls, dragContainer, dragSource, *args):
     from eve.client.script.ui.control.eveLabel import Label
     dragData = dragContainer.dragData[0]
     displayText = TruncateStringTo(dragData.displayText, 24, '...')
     label = Label(parent=dragContainer, text=StripTags(displayText), align=uiconst.TOPLEFT, bold=True)
     Fill(parent=dragContainer, color=(0, 0, 0, 0.3), padding=(-10, -2, -10, -2))
     dragContainer.width = label.textwidth
     dragContainer.height = label.textheight
     return (2, label.textheight)
Exemplo n.º 7
0
 def GetDragData(self, *args):
     displayText = self.GetDragText()
     if self.itemID and self.typeID and displayText:
         url = 'showinfo:%d//%d' % (self.typeID, self.itemID)
         entry = Bunch()
         entry.__guid__ = 'TextLink'
         entry.url = url
         entry.displayText = StripTags(displayText)
         return [entry]
Exemplo n.º 8
0
    def LoadFitting(self, fitting, getFailedDict = False):
        self.CheckBusyFittingAndRaiseIfNeeded()
        self._CheckValidFittingLocation(fitting)
        shipInv = self.invCache.GetInventoryFromId(util.GetActiveShip())
        if shipInv.item.typeID != fitting.shipTypeID:
            raise UserError('ShipTypeInFittingNotSameAsShip')
        chargesByType, dronesByType, fightersByTypeID, iceByType, itemTypes, modulesByFlag, rigsToFit, subsystems = self.GetTypesToFit(fitting, shipInv)
        fitRigs = False
        cargoItemsByType = defaultdict(int)
        if rigsToFit:
            if self.HasRigFitted():
                eve.Message('CustomNotify', {'notify': localization.GetByLabel('UI/Fitting/ShipHasRigsAlready')})
            elif eve.Message('FitRigs', {}, uiconst.YESNO) == uiconst.ID_YES:
                fitRigs = True
            else:
                for flagID, typeID in modulesByFlag.iteritems():
                    if flagID in const.rigSlotFlags:
                        cargoItemsByType[typeID] += 1

        cargoItemsByType = dict(cargoItemsByType)
        itemsToFit = defaultdict(set)
        for item in self.invCache.GetInventory(const.containerHangar).List(const.flagHangar):
            if item.typeID in itemTypes:
                qtyNeeded = itemTypes[item.typeID]
                if qtyNeeded == 0:
                    continue
                quantityToTake = min(item.stacksize, qtyNeeded)
                itemsToFit[item.typeID].add(item.itemID)
                itemTypes[item.typeID] -= quantityToTake

        if subsystems:
            shipType = shipInv.GetItem().typeID
            for flag, module in modulesByFlag.iteritems():
                if const.flagSubSystemSlot0 <= flag <= const.flagSubSystemSlot7:
                    moduleFitsShipType = int(sm.GetService('clientDogmaStaticSvc').GetTypeAttribute(module, const.attributeFitsToShipType))
                    if shipType != moduleFitsShipType:
                        raise UserError('CannotFitSubSystemNotShip', {'subSystemName': (const.UE_TYPEID, module),
                         'validShipName': (const.UE_TYPEID, moduleFitsShipType),
                         'shipName': (const.UE_TYPEID, shipType)})
                    if module in itemTypes and itemTypes[module] > 0:
                        raise UserError('CantUnfitSubSystems')

        self.CheckBusyFittingAndRaiseIfNeeded()
        self.busyFitting = True
        try:
            failedToLoad = shipInv.FitFitting(util.GetActiveShip(), itemsToFit, session.stationid2 or session.structureid, modulesByFlag, dronesByType, fightersByTypeID, chargesByType, iceByType, cargoItemsByType, fitRigs)
        finally:
            self.busyFitting = False

        if settings.user.ui.Get('useFittingNameForShips', 0):
            fittingName = StripTags(fitting.get('name'))
            fittingName = fittingName[:20]
            self.invCache.GetInventoryMgr().SetLabel(util.GetActiveShip(), fittingName)
        if getFailedDict:
            return failedToLoad
        self.ShowFailedToLoadMsg(failedToLoad)
Exemplo n.º 9
0
 def GetDragData(self, *args):
     dragDisplayText, url = cfg.evelocations.Get(
         self.markerID).name, 'showinfo:%d//%d' % (const.typeRegion,
                                                   self.markerID)
     entry = Bunch()
     entry.__guid__ = 'TextLink'
     entry.url = url
     entry.dragDisplayText = dragDisplayText
     entry.displayText = StripTags(dragDisplayText)
     return [entry]
Exemplo n.º 10
0
 def AutoSaveBio(self):
     newbio = self.edit.GetValue()
     defaultBioString = GetByLabel(
         'UI/CharacterSheet/CharacterSheetWindow/BioEdit/HereYouCanTypeBio')
     newbio = newbio.replace(defaultBioString, '')
     if not len(StripTags(newbio)):
         newbio = ''
     self.bioClient = newbio
     if newbio.strip() != self.bioServer:
         uthread.new(self._AutoSaveBio, newbio)
         self.bioServer = newbio
Exemplo n.º 11
0
 def SetText(self, text, format = 0):
     if not isinstance(text, basestring):
         if self.integermode:
             text = repr(int(text))
         elif self.floatmode:
             text = '%.*f' % (self.floatmode[2], float(text))
         else:
             text = str(text)
     text = StripTags(text, stripOnly=['localized'])
     if self.passwordchar is not None:
         displayText = self.passwordchar * len(text.replace('<br>', ''))
     elif format:
         displayText = self.EncodeOutput(text) + self.suffix
     elif self.floatmode:
         displayText = text.replace(self.DECIMAL, self.GetLocalizedDecimal())
     else:
         displayText = text
     displayText = StripTags(displayText, stripOnly=['localized'])
     self.sr.text.text = displayText.replace('<', '&lt;').replace('>', '&gt;')
     self.text = text
Exemplo n.º 12
0
    def GetDragData(self):
        nodesSelected = self.sr.node.scroll.GetSelectedNodes(self.sr.node)
        data = []
        for eachNode in nodesSelected:
            k = KeyVal(__guid__='xtriui.ListSurroundingsBtn',
                       itemID=eachNode.controller.GetItemID(),
                       typeID=eachNode.controller.GetTypeID(),
                       label=StripTags(eachNode.controller.GetName().replace(
                           '<br>', '-')),
                       isMyCorpStructureEntry=True)
            data.append(k)

        return data
Exemplo n.º 13
0
 def SetValue(self, text, add = 0, keepSelection = 0, updateIndex = 1, docallback = 1):
     text = text or ''
     isString = isinstance(text, basestring)
     if isString:
         text = StripTags(text, stripOnly=['localized'])
     if self.floatmode:
         if isString:
             text = self.PrepareFloatString(text)
         text = self.CheckBounds(text, 0, bool(self.hinttext))
     elif self.integermode:
         text = self.CheckBounds(text, 0, bool(self.hinttext))
     else:
         text = text.replace('&lt;', '<').replace('&gt;', '>')
         if self.maxletters:
             text = text[:self.maxletters]
     if updateIndex:
         self.SetText(text, 0)
         self.caretIndex = self.GetCursorFromIndex(-1)
     self.SetText(text, 1)
     self.selFrom = self.selTo = None
     self.RefreshSelectionDisplay()
     self.OnTextChange(docallback)
Exemplo n.º 14
0
 def SetValue(self, text, add = 0, keepSelection = 0, updateIndex = 1, docallback = 1):
     self.draggedValue = None
     text = text or ''
     isString = isinstance(text, basestring)
     if isString:
         text = StripTags(text, stripOnly=['localized'])
     if self.floatmode:
         if isString:
             text = self.PrepareFloatString(text)
         text = self.CheckBounds(text, 0, bool(self.hinttext))
     elif self.integermode:
         text = self.CheckBounds(text, 0, bool(self.hinttext))
     else:
         text = text.replace('&lt;', '<').replace('&gt;', '>')
         if self.maxletters:
             text = text[:self.maxletters]
     if updateIndex:
         self.SetText(text, 0)
         self.caretIndex = self.GetCursorFromIndex(-1)
     self.SetText(text, 1)
     self.selFrom = self.selTo = None
     self.RefreshSelectionDisplay()
     self.OnTextChange(docallback)
Exemplo n.º 15
0
    def GetRolesSortValue(self, node, columnID, sortDirection, idx = None):
        self.SetNameAndBaseSorting(node)
        if node.Get('sort_%s' % columnID, None) is None:
            roles = getattr(node.member, node.roleGroup.appliesTo)
            grantableRoles = getattr(node.member, node.roleGroup.appliesToGrantable)
            if self.CheckIfDirectorOrCEO(node, roles):
                roles |= node.roleGroup.roleMask
                grantableRoles |= node.roleGroup.roleMask
            for columnName, subColumns in node.roleGroup.columns:
                for subColumnName, role in subColumns:
                    if columnName.replace(' ', '') == StripTags(columnID).replace(' ', ''):
                        checkValue = GetCheckStateForRole(roles, grantableRoles, role)
                        node.Set('sort_%s' % columnID, (0, checkValue))

        return self.GetSortValue(node, columnID, sortDirection, idx=None)
Exemplo n.º 16
0
 def GetValue(self, condition, item):
     if condition == ITEM_CATEGORY:
         return item.categoryID
     if condition == ITEM_GROUP:
         return item.groupID
     if condition == ITEM_VOLUME:
         return GetItemVolume(item)
     if condition == ITEM_PRICE:
         price = util.GetAveragePrice(item)
         if price is not None:
             price = util.RoundISK(price)
         return price
     if condition == ITEM_STACKSIZE:
         return item.stacksize
     if condition == ITEM_ASSEMBLED:
         return item.singleton
     if condition == ITEM_SLOT:
         effects = cfg.dgmtypeeffects.get(item.typeID, [])
         return [effect.effectID for effect in effects]
     if condition == ITEM_NAME:
         name = uix.GetItemName(item)
         return StripTags(name)
     if condition == ITEM_METAGROUP:
         ret = int(
             sm.GetService('godma').GetTypeAttribute(
                 item.typeID, const.attributeMetaGroupID, 0))
         if not ret:
             ret = int(
                 sm.GetService('godma').GetTypeAttribute(
                     item.typeID, const.attributeTechLevel, 1))
             if ret == 3:
                 ret = 14
         return ret
     if condition == ITEM_METALEVEL:
         return int(
             sm.GetService('godma').GetTypeAttribute(
                 item.typeID, const.attributeMetaLevel, 0))
     if condition == ITEM_POWER:
         return int(
             sm.GetService('godma').GetTypeAttribute(
                 item.typeID, const.attributePower, 0))
     if condition == ITEM_CPU:
         return int(
             sm.GetService('godma').GetTypeAttribute(
                 item.typeID, const.attributeCpu, 0))
     if condition == ITEM_BLUEPRINT_COPY:
         return item.singleton == const.singletonBlueprintCopy
Exemplo n.º 17
0
 def DoFitManyShips(self, chargesByType, dronesByType, fightersByTypeID, fitRigs, fitting, iceByType, cargoItemsByType, maxAvailableFitting, modulesByFlag, fittingName = None):
     shipAccess = sm.StartService('gameui').GetShipAccess()
     try:
         failedInfo = None
         if fittingName is None or fittingName.strip() == '':
             fittingName = fitting.name or evetypes.GetName(fitting.shipTypeID)
             fittingName = StripTags(fittingName)
         self.busyFitting = True
         sm.GetService('inv').ChangeTreeUpdatingState(isUpdateEnabled=False)
         failedInfo = shipAccess.FitShips(shipTypeID=fitting.shipTypeID, modulesByFlag=modulesByFlag, itemLocationID=session.stationid2 or session.structureid, dronesByType=dronesByType, fightersByTypeID=fightersByTypeID, chargesByType=chargesByType, iceByType=iceByType, cargoItemsByType=cargoItemsByType, fitRigs=fitRigs, name=fittingName, numToFit=maxAvailableFitting)
     finally:
         self.busyFitting = False
         sm.GetService('inv').ChangeTreeUpdatingState(isUpdateEnabled=True)
         if failedInfo:
             failedToLoad, failedShipID = failedInfo
             if failedShipID:
                 self._RenameShip(failedShipID)
             if failedToLoad:
                 self.ShowFailedToLoadMsg(failedToLoad)
Exemplo n.º 18
0
 def ApplyAttributes(self, attributes):
     Window.ApplyAttributes(self, attributes)
     name = attributes.bookmarkName
     url = attributes.url
     self.SetCaption(localization.GetByLabel('UI/Browser/EditBookmarks/Caption'))
     self.SetButtons(uiconst.OKCLOSE, okLabel=localization.GetByLabel('UI/Browser/EditBookmarks/Remove', selectedItems=0), okFunc=self.Remove, okModalResult=uiconst.ID_NONE)
     self.SetMinSize((256, 256))
     main = self.GetMainArea()
     main.clipChildren = 0
     Container(name='errorParent', parent=main, align=uiconst.TOBOTTOM, height=16, state=uiconst.UI_HIDDEN)
     toppar = Container(name='toppar', align=uiconst.TOTOP, height=66, parent=main, idx=0, padding=(const.defaultPadding,
      const.defaultPadding,
      const.defaultPadding,
      const.defaultPadding))
     c = Container(name='namecont', parent=toppar, align=uiconst.TOTOP, height=20, padBottom=5)
     label = Label(text=localization.GetByLabel('UI/Browser/EditBookmarks/Name'), fontsize=9, letterspace=2, state=uiconst.UI_DISABLED, parent=c, align=uiconst.CENTERLEFT, left=4)
     edit = SinglelineEdit(name='nameEdit', parent=c, align=uiconst.CENTERLEFT, width=150)
     edit.OnReturn = self.OnEnter
     self.nameEdit = edit
     c = Container(name='urlcont', parent=toppar, align=uiconst.TOTOP, height=20, padBottom=5)
     label2 = Label(text=localization.GetByLabel('UI/Browser/EditBookmarks/URL'), fontsize=9, letterspace=2, state=uiconst.UI_DISABLED, parent=c, align=uiconst.CENTERLEFT, left=4, uppercase=True)
     edit = SinglelineEdit(name='urlEdit', parent=c, align=uiconst.CENTERLEFT, width=150)
     edit.OnReturn = self.OnEnter
     self.urlEdit = edit
     self.nameEdit.left = self.urlEdit.left = max(35, label.textwidth + 6, label2.textwidth + 6)
     b = Button(parent=toppar, label=localization.GetByLabel('UI/Browser/EditBookmarks/Add'), func=self.OnEnter, align=uiconst.BOTTOMRIGHT)
     editBtn = Button(parent=toppar, label=localization.GetByLabel('UI/Browser/EditBookmarks/Edit'), pos=(b.width + const.defaultPadding,
      0,
      0,
      0), func=self.OnEdit, align=uiconst.BOTTOMRIGHT)
     editBtn.state = uiconst.UI_HIDDEN
     self.editBtn = editBtn
     name = StripTags(name).strip()
     if name:
         self.nameEdit.SetValue(name)
     if url:
         self.urlEdit.SetValue(url)
     self.scroll = Scroll(parent=main, padding=(const.defaultPadding,
      const.defaultPadding,
      const.defaultPadding,
      const.defaultPadding))
     sm.GetService('sites')
     self.RefreshSites()
Exemplo n.º 19
0
 def GetTextWidth(self,
                  strng,
                  fontsize=12,
                  letterspace=0,
                  uppercase=0,
                  font=None,
                  fontPath=None,
                  fontStyle=None,
                  fontFamily=None):
     if not strng:
         return 0
     font = font
     fontsize = fontsize or fontConst.DEFAULT_FONTSIZE
     letterspace = letterspace or fontConst.DEFAULT_LETTERSPACE
     uppercase = uppercase or fontConst.DEFAULT_UPPERCASE
     cacheKey = (strng, fontsize, letterspace, uppercase, font,
                 uicore.fontSizeFactor)
     if cacheKey in self.textMeasureCache:
         return self.textMeasureCache[cacheKey]
     if '<br>' in strng:
         val = max([
             self.GetTextWidth(line, fontsize, letterspace, uppercase, font)
             for line in strng.split('<br>')
         ])
     else:
         if self.defaultLabelClass is None:
             from carbonui.control.label import LabelCore
             self.defaultLabelClass = LabelCore
         textmeasurer = self.defaultLabelClass(text=StripTags(
             strng, ignoredTags=['b']),
                                               parent=None,
                                               align=uiconst.TOPLEFT,
                                               fontsize=fontsize,
                                               letterspace=letterspace,
                                               uppercase=uppercase,
                                               measuringText=True,
                                               fontPath=fontPath,
                                               fontStyle=fontStyle,
                                               fontFamily=fontFamily)
         val = textmeasurer.textwidth
     self.textMeasureCache[cacheKey] = val
     return val
Exemplo n.º 20
0
    def GetAccessSortValue(self, node, columnID, sortDirection, idx = None):
        self.SetNameAndBaseSorting(node)
        if node.Get('sort_%s' % columnID, None) is None:
            roleGrouping = self.roleGroupings
            totalValue = 0
            for divisionID in xrange(4, 10):
                roleGroup = roleGrouping[divisionID]
                rolesAppliesTo = getattr(node.member, roleGroup.appliesTo)
                grantableRolesAppliesTo = getattr(node.member, roleGroup.appliesToGrantable)
                if self.CheckIfDirectorOrCEO(node, node.member.roles):
                    rolesAppliesTo |= roleGroup.roleMask
                    grantableRolesAppliesTo |= roleGroup.roleMask
                for columnName, subColumns in roleGroup.columns:
                    if columnName.replace(' ', '') != StripTags(columnID).replace(' ', ''):
                        continue
                    for _, role in subColumns:
                        checkValue = GetCheckStateForRole(rolesAppliesTo, grantableRolesAppliesTo, role)
                        totalValue += checkValue

            node.Set('sort_%s' % columnID, (0, totalValue))
        return self.GetSortValue(node, columnID, sortDirection, idx=None)
Exemplo n.º 21
0
 def SetText(self, text, format = 0):
     if not isinstance(text, basestring):
         if self.integermode:
             text = repr(int(text))
         elif self.floatmode:
             text = '%.*f' % (self.floatmode[2], float(text))
         else:
             text = str(text)
     text = StripTags(text, stripOnly=['localized'])
     if self.passwordchar is not None:
         displayText = self.passwordchar * len(text.replace('<br>', ''))
     elif format:
         displayText = self.EncodeOutput(text) + self.suffix
     elif self.floatmode:
         displayText = text.replace(self.DECIMAL, self.GetLocalizedDecimal())
     else:
         displayText = text
     displayText = StripTags(displayText, stripOnly=['localized'])
     self.sr.text.text = displayText.replace('<', '&lt;').replace('>', '&gt;')
     self.text = text
Exemplo n.º 22
0
 def Load(self):
     self.isLoaded = True
     if self.measurer is None:
         measurer = trinity.Tr2FontMeasurer()
         measurer.limit = 0
         measurer.font = self.fontPath
         measurer.fontSize = ScaleDpi(self.fontSize)
         measurer.letterSpace = ScaleDpi(self.letterSpace)
         measurer.AddText(StripTags(self.GetLabelText()))
         measurer.CommitText(0, measurer.ascender)
         self.measurer = measurer
     textSprite = trinity.Tr2Sprite2dTextObject()
     textSprite.fontMeasurer = self.measurer
     textSprite.color = self.fontColor
     textSprite.blendMode = trinity.TR2_SBM_ADD
     self.markerContainer.renderObject.children.append(textSprite)
     self.textSprite = textSprite
     height = self.measurer.ascender - self.measurer.descender
     width = self.measurer.cursorX
     self.textSprite.textWidth = width
     self.textSprite.textHeight = height
     self.markerContainer.pos = (0, 0, ReverseScaleDpi(width),
                                 ReverseScaleDpi(height))
Exemplo n.º 23
0
 def ClickGameLinks(self, parent, URL):
     """
         Game specific options
         returns True if the link was used
     """
     import form
     if URL.startswith('eve:/'):
         self.GetFromCluster(parent, URL)
         return True
     if URL.startswith('showinfo:'):
         self.ShowInfo(URL[9:])
         return True
     if URL.startswith('showrouteto:'):
         self.ShowRouteTo(URL[12:])
         return True
     if URL.startswith('showinmap:'):
         self.ShowInMap(URL[10:])
         return True
     if URL.startswith('cmd:/'):
         sm.GetService('slash').SlashCmd(URL[4:])
         return True
     if URL.startswith('evebrowser:'):
         uicore.cmd.OpenBrowser(URL[11:])
         return True
     if URL.startswith('evemail:'):
         self.EveMail(URL[8:])
         return True
     if URL.startswith('evemailto:'):
         self.EveMail(URL[10:])
         return True
     if URL.startswith('note:'):
         self.Note(URL[5:])
         return True
     if URL.startswith('fleetmission:'):
         self.FleetMission(URL[13:])
         return True
     if URL.startswith('contract:'):
         self.Contract(URL[9:])
         return True
     if URL.startswith('fleet:'):
         self.AskJoinFleet(URL[6:])
         return True
     if URL.startswith('CertEntry:'):
         myArgs = URL[10:]
         certID, level = myArgs.split('//')
         abstractinfo = KeyVal(certificateID=int(certID), level=int(level))
         sm.StartService('info').ShowInfo(const.typeCertificate,
                                          abstractinfo=abstractinfo)
         return True
     if URL.startswith('fleetmenu:'):
         self.FleetMenu(URL[len('fleetmenu:'):])
         return True
     if URL.startswith('celestialmenu:'):
         self.CelestialMenu(URL[len('celestialmenu:'):])
         return True
     if URL.startswith('fitting:'):
         sm.StartService('fittingSvc').DisplayFittingFromString(
             URL[len('fitting:'):])
         return True
     if URL.startswith('preview:'):
         sm.GetService('preview').PreviewType(URL[len('preview:'):])
         return True
     if URL.startswith('warNegotiation:'):
         warNegotiationID = int(URL.split(':')[1])
         form.WarSurrenderWnd.Open(warNegotiationID=warNegotiationID,
                                   isRequest=False)
         return True
     if URL.startswith('killReport:'):
         killID, hashValue = URL.split(':')[1:]
         killID = int(killID)
         kill = sm.RemoteSvc('warStatisticMgr').GetKillMail(
             killID, hashValue)
         if kill is not None:
             from eve.client.script.ui.shared.killReportUtil import OpenKillReport
             OpenKillReport(kill)
         return True
     if URL.startswith('warReport:'):
         warID = URL[10:]
         form.WarReportWnd.CloseIfOpen()
         form.WarReportWnd.Open(create=1, warID=int(warID))
         return True
     if URL.startswith('tutorial:'):
         tutorialID = URL[len('tutorial:'):]
         sm.GetService('tutorial').OpenTutorialFromOutside(
             int(tutorialID), ask=True, ignoreSettings=True)
         return True
     if URL.startswith('recruitmentAd:'):
         myArgs = URL[14:]
         corpID, adID = myArgs.split('//')
         sm.GetService('corp').OpenCorpAdInNewWindow(int(corpID), int(adID))
         return True
     if URL.startswith('scannerAction:'):
         action = URL[14:]
         sm.GetService('scanSvc').ClickLink(action)
         return True
     if URL.startswith('podGuideLink:'):
         podGuideID = int(URL[len('podGuideLink:'):])
         OpenPodGuide(podGuideID)
         return True
     if URL.startswith('overviewPreset:'):
         if isinstance(parent, LabelCore):
             overviewName, url = getattr(parent, '_dragLinkData',
                                         ('', None))
             overviewName = StripTags(overviewName)
         else:
             overviewName = getattr(parent, 'linkText', '')
         overviewName = StripTags(overviewName)
         presetString = URL[len('overviewPreset:'):]
         parts = presetString.split('//')
         presetKey = (parts[0], int(parts[1]))
         sm.GetService('overviewPresetSvc').LoadSettings(
             presetKey, overviewName)
         return True
     if URL.startswith('joinChannel:'):
         channelID = URL[12:]
         corpID = None
         adID = None
         if '//' in channelID:
             channelID, corpID, adID = channelID.split('//')
         channelID = int(channelID)
         if channelID and not sm.GetService('LSC').IsJoined(channelID):
             sm.GetService('LSC').JoinOrLeaveChannel(channelID)
             if adID is not None:
                 sm.GetService('corp').LogCorpRecruitmentEvent(
                     [
                         'corporationID', 'allianceID', 'channelID',
                         'applyingCorporationID', 'adID'
                     ], 'JoinRecruitingChannel', session.corpid,
                     session.allianceid, channelID, corpID, adID)
         return True
     return False
Exemplo n.º 24
0
 def GetTextParts(editField):
     text = editField.GetValue()
     text = StripTags(text)
     textParts = text.strip(SPLITTER).split(SPLITTER)
     textParts = filter(None, (word.strip() for word in textParts))
     return textParts
Exemplo n.º 25
0
 def GetTextParts(editField):
     text = editField.GetValue()
     text = StripTags(text)
     textParts = text.strip(SPLITTER).split(SPLITTER)
     textParts = filter(None, (word.strip() for word in textParts))
     return textParts
Exemplo n.º 26
0
 def SetCaption(self, caption):
     captionString = localization.uiutil.PrepareLocalizationSafeString(
         StripTags(caption)[:50])
     Window.SetCaption(self, captionString)