示例#1
0
 def AskLink(self, label='', lines=[], width=280):
     icon = uiconst.QUESTION
     format = [{
         'type': 'btline'
     }, {
         'type': 'text',
         'text': label,
         'frame': 1
     }] + lines + [{
         'type': 'bbline'
     }]
     btns = uiconst.OKCANCEL
     retval = uix.HybridWnd(
         format,
         localization.GetByLabel('UI/Common/GenerateLink'),
         1,
         None,
         uiconst.OKCANCEL,
         minW=width,
         minH=110,
         icon=icon)
     if retval:
         return retval
     else:
         return
示例#2
0
    def ConfigureLocationInfo(self):
        label = localization.GetByLabel('UI/Neocom/ConfigureWoldInfoText')
        setting = 'neocomLocationInfo_3'
        valid = ['nearest', 'sovereignty']
        current = sm.GetService('infoPanel').GetLocationInfoSettings()
        itemMapping = [util.KeyVal(name='nearest', label='%s / %s' % (localization.GetByLabel('UI/Neocom/Nearest'), localization.GetByLabel('UI/Neocom/DockedIn'))), util.KeyVal(name='sovereignty', label=localization.GetByLabel('UI/Neocom/Sovereignty'))]
        format = [{'type': 'text',
          'text': label}, {'type': 'push'}]
        for info in itemMapping:
            if info.name not in valid:
                continue
            format.append({'type': 'checkbox',
             'setvalue': bool(info.name in current),
             'key': info.name,
             'label': '_hide',
             'required': 1,
             'text': info.label,
             'onchange': self.ConfigCheckboxChange})

        format += [{'type': 'push'}]
        caption = localization.GetByLabel('UI/Neocom/UpdateLocationSettings')
        retval = uix.HybridWnd(format, caption, 1, buttons=uiconst.OK, minW=240, minH=100, icon='ui_2_64_16', unresizeAble=1)
        if retval:
            newsettings = []
            for k, v in retval.iteritems():
                if v == 1:
                    newsettings.append(k)

            settings.char.windows.Set(setting, newsettings)
    def DeclareSupportForm(self, *args):
        format = []
        stati = {}
        pledgeLabel = localization.GetByLabel(
            'UI/Corporations/CorporationWindow/Alliances/Members/PledgeSupportTo'
        )
        format.append({'type': 'header', 'text': pledgeLabel, 'frame': 1})
        format.append({'type': 'push'})
        format.append({'type': 'btline'})
        members = sm.GetService('alliance').GetMembers()
        myCorp = members[eve.session.corpid]
        for member in members.itervalues():
            text = cfg.eveowners.Get(member.corporationID).ownerName
            format.append({
                'type': 'checkbox',
                'setvalue': member.corporationID == myCorp.chosenExecutorID,
                'key': member.corporationID,
                'text': text,
                'frame': 1,
                'group': 'members'
            })

        format.append({'type': 'btline'})
        left = uicore.desktop.width / 2 - 500 / 2
        top = uicore.desktop.height / 2 - 400 / 2
        declareLabel = localization.GetByLabel(
            'UI/Corporations/CorporationWindow/Alliances/Members/DeclarationExecutorSupport'
        )
        retval = uix.HybridWnd(format, declareLabel, 1, None, uiconst.OKCANCEL,
                               [left, top], 500)
        if retval is not None:
            corpID = retval['members']
            sm.GetService('alliance').DeclareExecutorSupport(corpID)
示例#4
0
 def MemDo(self, mem, command):
     if self.sr.inpt.GetValue() == '':
         self.SetInpt('0')
     if command == 'Set':
         value = self.sr.inpt.GetValue()
         pointValue = self.sr.inpt.PrepareFloatString(value)
         setattr(mem, 'mem', float(pointValue))
         mem.sr.memHilite.state = uiconst.UI_DISABLED
     elif command == 'Add':
         value = self.sr.inpt.GetValue()
         pointValue = self.sr.inpt.PrepareFloatString(value)
         setattr(mem, 'mem', getattr(mem, 'mem', 0.0) + float(value))
     elif command == 'Sub':
         value = self.sr.inpt.GetValue()
         pointValue = self.sr.inpt.PrepareFloatString(value)
         setattr(mem, 'mem', getattr(mem, 'mem', 0.0) - float(value))
     elif command == 'Clear':
         setattr(mem, 'mem', None)
         mem.sr.memHilite.state = uiconst.UI_HIDDEN
     elif command == 'Name':
         format = [{
             'type':
             'edit',
             'setvalue':
             getattr(mem, 'label', '') or '',
             'labelwidth':
             48,
             'label':
             localization.GetByLabel('UI/Accessories/Calculator/Name'),
             'key':
             'name',
             'maxlength':
             16,
             'setfocus':
             1
         }]
         retval = uix.HybridWnd(
             format,
             localization.GetByLabel('UI/Accessories/Calculator/Annotate'),
             icon=uiconst.QUESTION,
             minW=300,
             minH=100)
         if retval:
             mem.label = retval['name']
             settings.public.ui.Set('CalculatorMem%sName' % mem.nr,
                                    mem.label)
     if getattr(mem, 'mem', None) is not None:
         mem.hint = '%s<br>%.14G' % (mem.label, getattr(mem, 'mem', 0.0))
     else:
         mem.hint = localization.GetByLabel(
             'UI/Accessories/Calculator/EmptyBank',
             label=mem.label,
             empty=localization.GetByLabel(
                 'UI/Accessories/Calculator/Empty'))
     settings.public.ui.Set('CalculatorMem%s' % mem.nr,
                            getattr(mem, 'mem', None))
 def OverrideFleetID(self, teamIdx, *args):
     format = [{'type': 'edit',
       'key': 'fleetid',
       'setfocus': True,
       'label': u'New FleetID'}]
     retVal = uix.HybridWnd(format, u'Specify new fleetID', minW=250, minH=100)
     if retVal:
         newFleetID = int(retVal['fleetid'])
         if newFleetID:
             self.matchMoniker.OverrideFleetID(self.matchDetails[0], teamIdx, newFleetID)
 def AddPlayer(self, whichTeam):
     format = [{'type': 'edit',
       'key': 'charid',
       'setfocus': True,
       'label': u'Char ID to add'}]
     retVal = uix.HybridWnd(format, u'Gimme a dude', minW=250, minH=100)
     if retVal:
         newCharID = int(retVal['charid'])
         if newCharID:
             self.matchMoniker.AddPlayer(self.matchDetails[0], whichTeam, newCharID)
 def __init__(self, caption=None, labeltop=None, labelbtm=None):
     if caption is None:
         caption = u'Type in name'
     if labeltop is None:
         labeltop = u'Type in name'
     if labelbtm is None:
         labelbtm = u'Type in name'
     format = [{
         'type': 'btline'
     }, {
         'type': 'labeltext',
         'label': labeltop,
         'text': '',
         'frame': 1,
         'labelwidth': 180
     }, {
         'type': 'edit',
         'setvalue': '',
         'key': 'name',
         'label': '_hide',
         'required': 1,
         'frame': 1,
         'setfocus': 1,
         'selectall': 1
     }, {
         'type': 'labeltext',
         'label': labelbtm,
         'text': '',
         'frame': 1,
         'labelwidth': 180
     }, {
         'type': 'edit',
         'setvalue': '',
         'key': 'value',
         'label': '_hide',
         'required': 1,
         'frame': 1,
         'setfocus': 1,
         'selectall': 1
     }, {
         'type': 'bbline'
     }]
     OKCANCEL = 1
     self.popup = uix.HybridWnd(format,
                                caption,
                                1,
                                None,
                                OKCANCEL,
                                None,
                                minW=240,
                                minH=80)
示例#8
0
 def GMInstallProgram(self, pinID):
     colony = self.GetColonyByPinID(pinID)
     if colony is None:
         raise RuntimeError('Unable to find colony for pinID')
     pin = colony.GetPin(pinID)
     resourceInfo = self.remoteHandler.GetPlanetResourceInfo()
     typeOptions = [ (cfg.invtypes.Get(typeID).name, typeID) for typeID in resourceInfo.keys() ]
     format = [{'type': 'combo',
       'key': 'typeID',
       'label': 'Type',
       'options': typeOptions,
       'frame': 0,
       'labelwidth': 80},
      {'type': 'edit',
       'key': 'qtyPerCycle',
       'label': 'Output per cycle',
       'setvalue': '100',
       'frame': 0,
       'labelwidth': 140,
       'required': True},
      {'type': 'btline'},
      {'type': 'edit',
       'key': 'cycleTime',
       'label': 'Cycle time (seconds)',
       'setvalue': '60',
       'frame': 0,
       'labelwidth': 140,
       'required': True},
      {'type': 'edit',
       'key': 'lifetime',
       'label': 'Lifetime (hours)',
       'setvalue': '24',
       'frame': 0,
       'labelwidth': 140,
       'required': True}]
     icon = 'ui_35_64_11'
     retval = uix.HybridWnd(format, 'Deposit designer: %s' % planetCommon.GetGenericPinName(pin.typeID, pin.id), 1, None, uiconst.OKCANCEL, minW=300, minH=132, icon=icon)
     if retval is None:
         return
     typeID, qtyPerCycle, cycleTime, lifetimeHours = (retval['typeID'],
      retval['qtyPerCycle'],
      retval['cycleTime'],
      retval['lifetime'])
     typeID = int(typeID)
     qtyPerCycle = int(qtyPerCycle)
     cycleTime = long(cycleTime) * const.SEC
     lifetimeHours = int(lifetimeHours)
     headRadius = 1.0
     if typeID not in resourceInfo or qtyPerCycle < 0 or cycleTime < 10 * const.SEC or lifetimeHours < 1 or headRadius <= 0.0:
         return
     self.remoteHandler.GMForceInstallProgram(pinID, typeID, cycleTime, lifetimeHours, qtyPerCycle, headRadius)
示例#9
0
    def DivisionsForm(self, *args):
        if not sm.GetService('corp').UserIsCEO():
            eve.Message('CorpAccessOnlyCEOEditDivisionNames')
            return
        divisions = sm.GetService('corp').GetDivisionNames()
        format = [{'type': 'btline'},
         {'type': 'push',
          'frame': 1},
         {'type': 'text',
          'frame': 1,
          'text': localization.GetByLabel('UI/Corporations/CorpUIHome/AssignNames')},
         {'type': 'push',
          'frame': 1}]
        labelWidth = 160
        for i in xrange(1, 8):
            key = 'division%s' % i
            format.append({'type': 'edit',
             'setvalue': divisions[i],
             'label': localization.GetByLabel('UI/Corporations/CorpUIHome/DivisionName', index=i),
             'key': key,
             'frame': 1,
             'labelwidth': labelWidth,
             'maxlength': 50})

        format.append({'type': 'labeltext',
         'label': localization.GetByLabel('UI/Corporations/CorpUIHome/WalletDivisionName', index=1),
         'text': localization.GetByLabel('UI/Corporations/Common/CorporateDivisionMasterWallet'),
         'frame': 1,
         'labelwidth': labelWidth})
        for i in xrange(9, 15):
            key = 'division%s' % i
            format.append({'type': 'edit',
             'setvalue': divisions[i],
             'label': localization.GetByLabel('UI/Corporations/CorpUIHome/WalletDivisionName', index=i - 7),
             'key': key,
             'frame': 1,
             'labelwidth': labelWidth,
             'maxlength': 50})

        format.append({'type': 'push',
         'frame': 1})
        format.append({'type': 'btline'})
        format.append({'type': 'errorcheck',
         'errorcheck': self.ApplyDivisionNames})
        wnd = uix.HybridWnd(format, localization.GetByLabel('UI/Corporations/CorpUIHome/DivisionNamesCaption'), 0, minW=450, ignoreCurrent=0)
        if wnd:
            wnd.Maximize()
示例#10
0
def RetrievePasswordALSC(itemID, invCacheSvc):
    container = invCacheSvc.GetInventoryFromId(itemID)
    formFormat = []
    formFormat.append({
        'type':
        'header',
        'text':
        localization.GetByLabel('UI/Menusvc/RetrieveWhichPassword'),
        'frame':
        1
    })
    formFormat.append({'type': 'push'})
    formFormat.append({'type': 'btline'})
    configSettings = [
        [
            const.SCCPasswordTypeGeneral,
            localization.GetByLabel('UI/Menusvc/GeneralPassword')
        ],
        [
            const.SCCPasswordTypeConfig,
            localization.GetByLabel('UI/Menusvc/RetrievePasswordConfiguration')
        ]
    ]
    for value, settingName in configSettings:
        formFormat.append({
            'type': 'checkbox',
            'setvalue': value & const.SCCPasswordTypeGeneral == value,
            'key': value,
            'label': '',
            'text': settingName,
            'frame': 1,
            'group': 'which_password'
        })

    formFormat.append({'type': 'btline'})
    retval = uix.HybridWnd(
        formFormat, localization.GetByLabel('UI/Commands/RetrievePassword'), 1,
        None, uiconst.OKCANCEL)
    if retval is None:
        return
    container.RetrievePassword(retval['which_password'])
示例#11
0
    def __init__(self, caption=None, defaults=None):
        values = ['typeID', 'qty', 'x', 'y', 'z', 'text']
        if caption is None:
            caption = u'Type in name'
        if defaults is None:
            valuedict = {}
            for entry in values:
                valuedict[entry] = ''

        else:
            valuedict = defaults.copy()
        format = [{'type': 'btline'}]
        for each in values:
            v = '%s' % valuedict[each]
            l = '%s:' % each
            reqd = 1
            if each == 'text':
                reqd = 0
            format += [{
                'type': 'edit',
                'setvalue': v,
                'key': each,
                'label': l,
                'required': reqd,
                'frame': 1,
                'setfocus': 1,
                'selectall': 0
            }]

        format += [{'type': 'bbline'}]
        OKCANCEL = 1
        self.popup = uix.HybridWnd(format,
                                   caption,
                                   1,
                                   None,
                                   OKCANCEL,
                                   None,
                                   minW=240,
                                   minH=80)
示例#12
0
    def __init__(self, caption = None, width = ASPECT_X, height = ASPECT_Y):
        aspectPairs = [['width', width], ['height', height]]
        focus = 'width'
        if caption is None:
            caption = u'Type in name'
        format = [{'type': 'btline'}]
        for each in aspectPairs:
            key, val = each
            if key == focus:
                hasFocus = 1
            else:
                hasFocus = 0
            format += [{'type': 'edit',
              'setvalue': '%s' % val,
              'key': '%s' % key,
              'label': '%s' % key,
              'required': 1,
              'frame': 1,
              'setfocus': hasFocus,
              'selectall': hasFocus}]

        format += [{'type': 'bbline'}]
        OKCANCEL = 1
        self.popup = uix.HybridWnd(format, caption, 1, None, OKCANCEL, None, minW=240, minH=80)
 def EnterShipPassword(self):
     format = [{
         'type':
         'text',
         'refreshheight':
         1,
         'text':
         localization.GetByLabel('UI/Inflight/POS/EnterHarmonicPassword'),
         'frame':
         0
     }, {
         'type': 'edit',
         'setvalue': '',
         'label': '_hide',
         'key': 'name',
         'maxLength': 50,
         'passwordChar': '*',
         'setfocus': 1,
         'frame': 0
     }]
     retval = uix.HybridWnd(
         format,
         localization.GetByLabel('UI/Inflight/POS/ShipShieldHarmonic'),
         1,
         None,
         uiconst.OKCANCEL,
         icon=uiconst.OKCANCEL,
         minW=240,
         minH=120,
         unresizeAble=True)
     if retval is not None:
         if session.stationid:
             eve.Message('CannotSetShieldHarmonicPassword')
         else:
             ship = moniker.GetShipAccess()
             ship.SetShipPassword(retval['name'])
示例#14
0
 def __init__(self, default = None, caption = None, label = None):
     if default is None:
         default = '0'
     if caption is None:
         caption = u'Type in name'
     if label is None:
         label = u'Type in name'
     format = [{'type': 'btline'},
      {'type': 'labeltext',
       'label': label,
       'text': '',
       'frame': 1,
       'labelwidth': 180},
      {'type': 'edit',
       'setvalue': '%s' % default,
       'key': 'qty',
       'label': '_hide',
       'required': 1,
       'frame': 1,
       'setfocus': 1,
       'selectall': 1},
      {'type': 'bbline'}]
     OKCANCEL = 1
     self.popup = uix.HybridWnd(format, caption, 1, None, OKCANCEL, None, minW=240, minH=80)
示例#15
0
    def Insure(self, item, *args):
        if item is None or not len(item):
            item = self.GetSelected()
            if not item:
                eve.Message('SelectShipToInsure')
                return
            item = item[0]
        isCorpItem = 0
        if item.ownerID == eve.session.corpid:
            isCorpItem = 1
        if item.ownerID == eve.session.corpid:
            msg = 'InsAskAcceptTermsCorp'
        else:
            msg = 'InsAskAcceptTerms'
        if eve.Message(msg, {}, uiconst.YESNO) != uiconst.ID_YES:
            return
        quotes = self.GetQuoteForShip(item)
        format = []
        stati = {}
        format.append({
            'type':
            'header',
            'text':
            localization.GetByLabel(
                'UI/Insurance/QuoteWindow/SelectInsuranceLevel')
        })
        format.append({'type': 'push'})
        insurancePrice = sm.GetService('insurance').GetInsurancePrice(
            item.typeID)
        for quote in quotes:
            text = localization.GetByLabel(
                'UI/Insurance/QuoteWindow/Line',
                name=self.GetInsuranceName(quote.fraction),
                cost=localization.GetByLabel('UI/Common/Cost'),
                amount=util.FmtISK(quote.amount),
                payout=localization.GetByLabel(
                    'UI/Insurance/QuoteWindow/EstimatedPayout'),
                price=util.FmtISK(quote.fraction * insurancePrice))
            format.append({
                'type': 'checkbox',
                'setvalue': quote.fraction == 0.5,
                'key': str(quote.fraction),
                'text': text,
                'group': 'quotes'
            })
            format.append({'type': 'push', 'height': 12})

        left = uicore.desktop.width / 2 - 500 / 2
        top = uicore.desktop.height / 2 - 400 / 2
        retval = uix.HybridWnd(
            format, localization.GetByLabel('UI/Insurance/QuoteWindow/Title'),
            1, None, uiconst.OKCANCEL, [left, top], 500)
        if retval is not None:
            try:
                sm.GetService('loading').ProgressWnd(
                    localization.GetByLabel(
                        'UI/Insurance/ProgressWindow/Insuring'), '', 0, 2)
                blue.pyos.synchro.Yield()
                fraction = float(retval['quotes'])
                for quote in quotes:
                    if str(quote.fraction) != str(fraction):
                        continue
                    try:
                        sm.GetService(
                            'insurance').GetInsuranceMgr().InsureShip(
                                item.itemID, quote.amount, isCorpItem)
                    except UserError as e:
                        if e.msg == 'InsureShipFailedSingleContract':
                            ownerName = e.args[1]['ownerName']
                            if eve.Message('InsureShipAlreadyInsured',
                                           {'ownerName': ownerName},
                                           uiconst.YESNO) == uiconst.ID_YES:
                                sm.GetService(
                                    'insurance').GetInsuranceMgr().InsureShip(
                                        item.itemID,
                                        quote.amount,
                                        isCorpItem,
                                        voidOld=True)
                                self.ShowInsuranceInfo()
                                return
                            else:
                                return
                        if e.msg != 'InsureShipFailed':
                            raise
                        self.ShowInsuranceInfo()
                        raise

                    self.ShowInsuranceInfo()
                    return

            finally:
                sm.GetService('loading').ProgressWnd(
                    localization.GetByLabel(
                        'UI/Insurance/ProgressWindow/Insuring'), '', 1, 2)
                blue.pyos.synchro.SleepWallclock(500)
                sm.GetService('loading').ProgressWnd(
                    localization.GetByLabel(
                        'UI/Insurance/ProgressWindow/Insuring'), '', 2, 2)
                blue.pyos.synchro.Yield()
示例#16
0
    def AllianceViewApplication(self, entry, *args):
        corporationID = entry.sr.node.application.corporationID
        allianceID = eve.session.allianceid
        if const.corpRoleDirector & eve.session.corprole != const.corpRoleDirector:
            return
        application = entry.sr.node.application
        canEditStatus = 0
        canAppendNote = 0
        stati = {}
        status = self.__GetStatusStr(application.state)
        format = []
        if application.state == const.allianceApplicationNew:
            canEditStatus = 1
            canAppendNote = 1
            rejectLabel = localization.GetByLabel(
                'UI/Corporations/CorporationWindow/Alliances/Applications/Reject'
            )
            acceptLabel = localization.GetByLabel(
                'UI/Corporations/CorporationWindow/Alliances/Applications/Accept'
            )
            stati[const.allianceApplicationRejected] = (rejectLabel, 0)
            stati[const.allianceApplicationAccepted] = (acceptLabel, 1)
        elif application.state == const.allianceApplicationAccepted:
            canEditStatus = 0
            canAppendNote = 0
        elif application.state == const.allianceApplicationEffective:
            canEditStatus = 0
            canAppendNote = 0
        elif application.state == const.allianceApplicationRejected:
            canEditStatus = 0
            canAppendNote = 0
        statusLabel = localization.GetByLabel(
            'UI/Corporations/CorporationWindow/Alliances/Applications/Status')
        fromLabel = localization.GetByLabel(
            'UI/Corporations/CorporationWindow/Alliances/Applications/From')
        termsAndConditionsLabel = localization.GetByLabel(
            'UI/Corporations/CorporationWindow/Alliances/Applications/TermsAndConditions'
        )
        format.append({'type': 'header', 'text': fromLabel, 'frame': 1})
        format.append({
            'type': 'text',
            'text': cfg.eveowners.Get(application.corporationID).ownerName,
            'frame': 1
        })
        format.append({'type': 'push', 'frame': 1})
        format.append({'type': 'header', 'text': statusLabel, 'frame': 1})
        format.append({'type': 'text', 'text': status, 'frame': 1})
        format.append({'type': 'push', 'frame': 1})
        format.append({
            'type': 'header',
            'text': termsAndConditionsLabel,
            'frame': 1
        })
        if canEditStatus == 0:
            format.append({
                'type': 'labeltext',
                'label': statusLabel,
                'text': status,
                'frame': 1
            })
            format.append({'type': 'bbline'})
        else:
            i = 1
            for key in stati:
                if i == 1:
                    lbl = 'Status'
                else:
                    lbl = ''
                text, selected = stati[key]
                format.append({
                    'type': 'checkbox',
                    'setvalue': selected,
                    'key': key,
                    'label': lbl,
                    'text': text,
                    'frame': 1,
                    'group': 'stati'
                })
                i = 0

            format.append({'type': 'bbline'})
        if canAppendNote == 1:
            allianceApplicationTextLabel = localization.GetByLabel(
                'UI/Corporations/CorporationWindow/Alliances/Applications/AllianceApplicationText'
            )
            format.append({'type': 'push', 'frame': 1})
            format.append({
                'type': 'textedit',
                'setvalue': application.applicationText + ' --- ',
                'key': 'appltext',
                'label': allianceApplicationTextLabel,
                'required': 0,
                'frame': 1,
                'height': 96,
                'maxLength': 1000
            })
            format.append({
                'type': 'errorcheck',
                'errorcheck': self.CheckApplication
            })
            format.append({'type': 'push', 'frame': 1})
            format.append({'type': 'bbline'})
        else:
            format.append({'type': 'push', 'frame': 1})
            format.append({
                'type': 'textedit',
                'setvalue': application.applicationText,
                'readonly': 1,
                'frame': 1,
                'height': 96,
                'maxLength': 1000
            })
            format.append({'type': 'push', 'frame': 1})
            format.append({'type': 'bbline'})
        if canEditStatus == 1 and canAppendNote == 1:
            btn = uiconst.OKCANCEL
        else:
            btn = uiconst.OK
        viewApplicationDetailsLabel = localization.GetByLabel(
            'UI/Corporations/CorporationWindow/Alliances/Applications/ViewApplicationDetails'
        )
        left = uicore.desktop.width / 2 - 400 / 2
        top = uicore.desktop.height / 2 - 400 / 2
        if application.state == const.allianceApplicationEffective:
            return uix.HybridWnd(format,
                                 viewApplicationDetailsLabel,
                                 0,
                                 None,
                                 btn, [left, top],
                                 400,
                                 unresizeAble=1)
        retval = uix.HybridWnd(format,
                               viewApplicationDetailsLabel,
                               1,
                               None,
                               btn, [left, top],
                               400,
                               unresizeAble=1)
        if retval is not None and canEditStatus == 1 and canAppendNote == 1:
            applicationText = retval['appltext']
            status = retval['stati']
            if status == const.allianceApplicationAccepted:
                wars = sm.GetService('war').GetWars(corporationID, 1)
                if len(wars):
                    warningLabel = localization.GetByLabel(
                        'UI/Corporations/CorporationWindow/Alliances/Applications/Warning'
                    )
                    warsWillBeAdoptedLabel = localization.GetByLabel(
                        'UI/Corporations/CorporationWindow/Alliances/Applications/WarsWillBeAdopted'
                    )
                    format = []
                    format.append({
                        'type': 'header',
                        'text': warningLabel,
                        'frame': 1
                    })
                    format.append({
                        'type': 'text',
                        'text': warsWillBeAdoptedLabel,
                        'frame': 1
                    })
                    format.append({'type': 'push'})
                    declaredIDs = []
                    againstIDs = []
                    for war in wars.itervalues():
                        if war.declaredByID != corporationID:
                            declaredIDs.append(war.declaredByID)
                        if war.againstID != corporationID:
                            againstIDs.append(war.againstID)

                    if len(declaredIDs):
                        declaredByLabel = (localization.GetByLabel(
                            'UI/Corporations/CorporationWindow/Alliances/Applications/DeclaredBy'
                        ), )
                        format.append({
                            'type': 'header',
                            'text': declaredByLabel,
                            'frame': 1
                        })
                        for ownerID in declaredIDs:
                            format.append({
                                'type': 'text',
                                'text': cfg.eveowners.Get(ownerID).ownerName,
                                'frame': 0
                            })

                    if len(againstIDs):
                        againstLabel = (localization.GetByLabel(
                            'UI/Corporations/CorporationWindow/Alliances/Applications/Against'
                        ), )
                        format.append({
                            'type': 'header',
                            'text': againstLabel,
                            'frame': 1
                        })
                        for ownerID in againstIDs:
                            format.append({
                                'type': 'text',
                                'text': cfg.eveowners.Get(ownerID).ownerName,
                                'frame': 0
                            })

                    format.append({'type': 'push', 'frame': 1})
                    format.append({'type': 'bbline'})
                    confirmAcceptLabel = localization.GetByLabel(
                        'UI/Corporations/CorporationWindow/Alliances/Applications/ConfirmAccept'
                    )
                    format.append({
                        'type': 'text',
                        'text': confirmAcceptLabel,
                        'frame': 0
                    })
                    adoptWarsLabel = localization.GetByLabel(
                        'UI/Corporations/CorporationWindow/Alliances/Applications/AdoptWars'
                    )
                    retval = uix.HybridWnd(format,
                                           adoptWarsLabel,
                                           1,
                                           None,
                                           uiconst.OKCANCEL, [left, top],
                                           400,
                                           unresizeAble=1)
                    if retval is None:
                        return
            sm.GetService('alliance').UpdateApplication(
                corporationID, applicationText, status)
            if status == const.allianceApplicationAccepted:
                raise UserError(
                    'AcceptedApplicationsTake24HoursToBecomeEffective')
示例#17
0
    def PlaceBid(self, contractID, force=None):
        uthread.ReentrantLock(self)
        try:
            isContractMgr = eve.session.corprole & const.corpRoleContractManager == const.corpRoleContractManager
            contract = self.GetContract(contractID, force=force)
            self.contract = contract
            c = contract.contract
            if not self.CheckEndpointAccess(c.startStationID):
                return
            currentBid = 0
            numBids = 0
            maxBid = MAX_AMOUNT
            if len(contract.bids) > 0:
                currentBid = contract.bids[0].amount
                numBids = len(contract.bids)
            b = currentBid + max(int(0.1 * c.price), 1000)
            if c.collateral > 0:
                b = min(b, c.collateral)
                maxBid = c.collateral
            minBid = int(max(c.price, b))
            if c.collateral > 0:
                collateral = FmtISKWithDescription(c.collateral)
            else:
                collateral = localization.GetByLabel(
                    'UI/Contracts/ContractEntry/NoBuyoutPrice')
            biddingOnLabel = localization.GetByLabel(
                'UI/Contracts/ContractsService/BiddingOnName',
                contractName=GetContractTitle(c, contract.items))
            startingBidLabel = localization.GetByLabel(
                'UI/Contracts/ContractsWindow/StartingBid')
            buyoutLabel = localization.GetByLabel(
                'UI/Contracts/ContractsWindow/BuyoutPrice')
            currentLabel = localization.GetByLabel(
                'UI/Contracts/ContractsWindow/CurrentBid')
            yourBidLabel = localization.GetByLabel(
                'UI/Contracts/ContractsWindow/YourBid')
            format = [{
                'type': 'text',
                'text': biddingOnLabel,
                'labelwidth': 100
            }, {
                'type': 'labeltext',
                'label': startingBidLabel,
                'text': FmtISKWithDescription(c.price),
                'labelwidth': 100
            }, {
                'type': 'labeltext',
                'label': buyoutLabel,
                'text': collateral,
                'labelwidth': 100
            }, {
                'type': 'labeltext',
                'label': currentLabel,
                'text': FmtISKWithDescription(currentBid),
                'labelwidth': 100
            }, {
                'type': 'edit',
                'setvalue': '0.1',
                'floatonly': [0, maxBid],
                'setvalue': minBid,
                'key': 'bid',
                'labelwidth': 100,
                'label': yourBidLabel,
                'required': 1,
                'setfocus': 1
            }]
            if isContractMgr and not (c.forCorp and c.issuerCorpID
                                      == eve.session.corpid):
                format.append({
                    'type':
                    'checkbox',
                    'required':
                    1,
                    'height':
                    16,
                    'setvalue':
                    0,
                    'key':
                    'forCorp',
                    'label':
                    '',
                    'text':
                    localization.GetByLabel(
                        'UI/Contracts/ContractsWindow/PlaceBidForCorp')
                })
            if c.collateral > 0:
                format.append({
                    'type':
                    'checkbox',
                    'required':
                    1,
                    'height':
                    16,
                    'setvalue':
                    0,
                    'key':
                    'buyout',
                    'label':
                    '',
                    'text':
                    localization.GetByLabel(
                        'UI/Contracts/ContractsWindow/Buyout'),
                    'onchange':
                    self.PlaceBidBuyoutCallback
                })
            format.append({'type': 'push'})
            retval = uix.HybridWnd(
                format,
                localization.GetByLabel(
                    'UI/Contracts/ContractsWindow/BiddingOnContract'),
                1,
                buttons=uiconst.OKCANCEL,
                minW=340,
                minH=100,
                icon='res:/ui/Texture/WindowIcons/wallet.png')
            if retval:
                forCorp = not not retval.get('forCorp', False)
                buyout = not not retval.get('buyout', False)
                bid = int(retval['bid'])
                if buyout:
                    if c.collateral < c.price:
                        raise RuntimeError(
                            'Buyout is lower than starting bid!')
                    bid = c.collateral
                try:
                    retval = self.DoPlaceBid(contractID, bid, forCorp)
                except UserError as e:
                    if e.args[0] == 'ConBidTooLow':
                        eve.Message(e.args[0], e.args[1])
                        self.PlaceBid(contractID, force=True)
                    else:
                        raise

            return not not retval
        finally:
            uthread.UnLock(self)
            self.ClearCache()
示例#18
0
def AskNewContainerPassword(invCacheSvc,
                            id_,
                            desc,
                            which=1,
                            setnew='',
                            setold=''):
    container = invCacheSvc.GetInventoryFromId(id_)
    wndFormat = []
    if container.HasExistingPasswordSet(which):
        wndFormat.append({
            'type':
            'edit',
            'setvalue':
            setold or '',
            'labelwidth':
            48,
            'label':
            localization.GetByLabel('UI/Menusvc/OldPassword'),
            'key':
            'oldpassword',
            'maxlength':
            16,
            'setfocus':
            1,
            'passwordChar':
            '*'
        })
    wndFormat.append({
        'type': 'edit',
        'setvalue': setnew or '',
        'labelwidth': 48,
        'label': localization.GetByLabel('UI/Menusvc/NewPassword'),
        'key': 'newpassword',
        'maxlength': 16,
        'passwordChar': '*'
    })
    wndFormat.append({
        'type':
        'edit',
        'setvalue':
        '',
        'labelwidth':
        48,
        'label':
        localization.GetByLabel('UI/Menusvc/ConfirmPassword'),
        'key':
        'conpassword',
        'maxlength':
        16,
        'passwordChar':
        '*'
    })
    retval = uix.HybridWnd(wndFormat,
                           desc,
                           icon=uiconst.QUESTION,
                           minW=300,
                           minH=75)
    if retval:
        old = retval['oldpassword'] or None if 'oldpassword' in retval else None
        new = retval['newpassword'] or None
        con = retval['conpassword'] or None
        if new is None or len(new) < 3:
            eve.Message('MinThreeLetters')
            return AskNewContainerPassword(id_, desc, which, new, old)
        if new != con:
            eve.Message('NewPasswordMismatch')
            return AskNewContainerPassword(id_, desc, which, new, old)
        container.SetPassword(which, old, new)
示例#19
0
def ConfigureALSC(itemID, invCacheSvc):
    container = invCacheSvc.GetInventoryFromId(itemID)
    config = container.ALSCConfigGet()
    defaultLock = bool(config & const.ALSCLockAddedItems)
    containerOwnerID = container.GetItem().ownerID
    if util.IsCorporation(containerOwnerID):
        if charsession.corprole & const.corpRoleEquipmentConfig == 0:
            raise UserError('PermissionDeniedNeedEquipRole',
                            {'corp': (const.UE_OWNERID, containerOwnerID)})
    else:
        userDefaultLock = settings.user.ui.Get(
            'defaultContainerLock_%s' % itemID, None)
        if userDefaultLock:
            defaultLock = True if userDefaultLock == const.flagLocked else False
    configSettings = [
        (const.ALSCPasswordNeededToOpen,
         localization.GetByLabel('UI/Menusvc/ContainerPasswordForOpening')),
        (const.ALSCPasswordNeededToLock,
         localization.GetByLabel('UI/Menusvc/ContainerPasswordForLocking')),
        (const.ALSCPasswordNeededToUnlock,
         localization.GetByLabel('UI/Menusvc/ContainerPasswordForUnlocking')),
        (const.ALSCPasswordNeededToViewAuditLog,
         localization.GetByLabel('UI/Menusvc/ContainerPasswordForViewingLog'))
    ]
    formFormat = []
    formFormat.append({
        'type':
        'header',
        'text':
        localization.GetByLabel('UI/Menusvc/ContainerDefaultLocked'),
        'frame':
        1
    })
    formFormat.append({
        'type': 'checkbox',
        'setvalue': defaultLock,
        'key': const.ALSCLockAddedItems,
        'label': '',
        'text': localization.GetByLabel('UI/Menusvc/ALSCLocked'),
        'frame': 1
    })
    formFormat.append({'type': 'btline'})
    formFormat.append({'type': 'push'})
    formFormat.append({
        'type':
        'header',
        'text':
        localization.GetByLabel('UI/Menusvc/ContainerPasswordRequiredFor'),
        'frame':
        1
    })
    for value, settingName in configSettings:
        formFormat.append({
            'type': 'checkbox',
            'setvalue': value & config == value,
            'key': value,
            'label': '',
            'text': settingName,
            'frame': 1
        })

    formFormat.append({'type': 'btline'})
    formFormat.append({'type': 'push'})
    retval = uix.HybridWnd(
        formFormat,
        localization.GetByLabel('UI/Menusvc/ContainerConfigurationHeader'),
        1,
        None,
        uiconst.OKCANCEL,
        unresizeAble=1,
        minW=300)
    if retval is None:
        return
    settings.user.ui.Delete('defaultContainerLock_%s' % itemID)
    newconfig = 0
    for k, v in retval.iteritems():
        newconfig |= k * v

    if config != newconfig:
        container.ALSCConfigSet(newconfig)
示例#20
0
 def PayoutDividendForm(self, *args):
     if getattr(self, 'openingDividendForm', False):
         return
     self.openingDividendForm = True
     try:
         if not sm.GetService('corp').UserIsCEO():
             eve.Message('OnlyCEOCanPayoutDividends')
             return
         maxAmount = sm.RemoteSvc('account').GetCashBalance(1, 1000)
         if maxAmount < 1:
             eve.Message('CorpHasNoMoneyToPayoutDividends')
             return
         payShareholders = 0
         format = [{'type': 'btline'},
          {'type': 'push',
           'frame': 1},
          {'type': 'text',
           'text': localization.GetByLabel('UI/Corporations/CorpUIHome/HintSelectDividend'),
           'frame': 1},
          {'type': 'push',
           'frame': 1},
          {'type': 'btline'},
          {'type': 'push',
           'frame': 1}]
         payShareholders = 0
         payMembers = 1
         format.append({'type': 'text',
          'text': localization.GetByLabel('UI/Corporations/CorpUIHome/PayDividendTo'),
          'frame': 1})
         format.append({'type': 'checkbox',
          'required': 1,
          'group': 'OdividendType',
          'height': 16,
          'setvalue': 1,
          'key': payShareholders,
          'label': '',
          'text': localization.GetByLabel('UI/Corporations/CorpUIHome/Shareholders'),
          'frame': 1})
         format.append({'type': 'checkbox',
          'required': 1,
          'group': 'OdividendType',
          'height': 16,
          'setvalue': 0,
          'key': payMembers,
          'label': '',
          'text': localization.GetByLabel('UI/Corporations/CorpUIHome/Members'),
          'frame': 1})
         format.append({'type': 'push',
          'frame': 1})
         format.append({'type': 'btline'})
         format.append({'type': 'push',
          'frame': 1})
         format.append({'type': 'text',
          'text': localization.GetByLabel('UI/Corporations/CorpUIHome/EnterTotalAmount'),
          'frame': 1})
         format.append({'type': 'text',
          'text': localization.GetByLabel('UI/Corporations/CorpUIHome/AmountWillBeDivided'),
          'frame': 1})
         format.append({'type': 'edit',
          'key': 'payoutAmount',
          'setvalue': 1,
          'label': localization.GetByLabel('UI/Corporations/CorpUIHome/Amount'),
          'frame': 1,
          'floatonly': [1, maxAmount]})
         format.append({'type': 'push',
          'frame': 1})
         format.append({'type': 'bbline'})
         retval = uix.HybridWnd(format, localization.GetByLabel('UI/Corporations/CorpUIHome/PayDividend'), 1, None, None, None, 340, 256, ignoreCurrent=0)
         if retval is not None:
             payShareholders = [1, 0][retval['OdividendType']]
             payoutAmount = retval['payoutAmount']
             sm.GetService('corp').PayoutDividend(payShareholders, payoutAmount)
     finally:
         self.openingDividendForm = False