def __setClanData(self): profile = self.webCtrl.getAccountProfile() isInClan = profile.isInClan() clanDossier = profile.getClanDossier() isClanFeaturesEnabled = self.lobbyContext.getServerSettings().clanProfile.isEnabled() if isClanFeaturesEnabled: btnLabel = makeString(MENU.HEADER_ACCOUNT_POPOVER_CLAN_ENABLED_BTNLABEL) else: btnLabel = makeString(MENU.HEADER_ACCOUNT_POPOVER_CLAN_NOT_ENABLED_BTNLABEL) if isInClan: permissions = ClanMemberPermissions(g_clanCache.clanRole) requestInviteBtnVisible = isClanFeaturesEnabled and permissions.canHandleClanInvites() appsCount = clanDossier.getAppsCount() or 0 clanBtnsParams = self._getClanBtnsParams(appsCount) self.requestClanEmblem32x32(profile.getClanDbID()) if appsCount == 0: envelopeIcon = RES_ICONS.MAPS_ICONS_BUTTONS_ENVELOPEOPENED else: envelopeIcon = RES_ICONS.MAPS_ICONS_BUTTONS_ENVELOPE self.__clanData = {'formation': makeString(MENU.HEADER_ACCOUNT_POPOVER_CLAN_HEADER), 'formationName': profile.getClanFullName(), 'position': profile.getRoleUserString(), 'btnLabel': btnLabel, 'requestInviteBtnIcon': envelopeIcon, 'clanResearchIcon': RES_ICONS.MAPS_ICONS_BUTTONS_SEARCH, 'clanResearchTFText': MENU.HEADER_ACCOUNT_POPOVER_CLAN_SEARCHCLAN2} self.__clanData.update(clanBtnsParams) else: requestInviteBtnVisible = False clanBtnsParams = self._getClanBtnsParams(clans_fmts.formatDataToString(None)) clanProfile = self.webCtrl.getAccountProfile() invitesCount = 0 if not clanProfile.isInClan(): invitesCount = clanProfile.getInvitesCount() or 0 if invitesCount == 0: envelopeIcon = RES_ICONS.MAPS_ICONS_BUTTONS_ENVELOPEOPENED else: envelopeIcon = RES_ICONS.MAPS_ICONS_BUTTONS_ENVELOPE self.__clanData = {'formation': makeString(MENU.HEADER_ACCOUNT_POPOVER_CLAN_HEADER), 'clanResearchIcon': RES_ICONS.MAPS_ICONS_BUTTONS_SEARCH, 'clanResearchTFText': MENU.HEADER_ACCOUNT_POPOVER_CLAN_SEARCHCLAN1, 'searchClanTooltip': clanBtnsParams['searchClanTooltip'], 'isSearchClanBtnEnabled': clanBtnsParams['isSearchClanBtnEnabled'], 'inviteBtnIcon': envelopeIcon} self.__clanData.update(self._getMyInvitesBtnParams()) self.as_setClanEmblemS(getNoClanEmblem32x32()) self.__clanData.update({'isInClan': isInClan, 'isClanFeaturesEnabled': isClanFeaturesEnabled, 'isDoActionBtnVisible': isInClan, 'requestInviteBtnVisible': requestInviteBtnVisible, 'isSearchClanBtnVisible': isClanFeaturesEnabled, 'isTextFieldNameVisible': isInClan, 'clansResearchBtnYposition': 119 if isInClan else 72}) self.as_setClanDataS(self.__clanData) return
def __setClanData(self): profile = self.clansCtrl.getAccountProfile() isInClan = profile.isInClan() clanDossier = profile.getClanDossier() isClanFeaturesEnabled = self.clansCtrl.isEnabled() if isClanFeaturesEnabled: btnLabel = makeString(MENU.HEADER_ACCOUNT_POPOVER_CLAN_ENABLED_BTNLABEL) else: btnLabel = makeString(MENU.HEADER_ACCOUNT_POPOVER_CLAN_NOT_ENABLED_BTNLABEL) if isInClan: permissions = ClanMemberPermissions(g_clanCache.clanRole) isOpenInviteBtnVisible = isClanFeaturesEnabled and permissions.canHandleClanInvites() appsCount = clanDossier.getAppsCount() or 0 clanBtnsParams = self._getClanBtnsParams(appsCount) self.requestClanEmblem32x32(profile.getClanDbID()) if appsCount == 0: envelopeIcon = RES_ICONS.MAPS_ICONS_BUTTONS_ENVELOPEOPENED else: envelopeIcon = RES_ICONS.MAPS_ICONS_BUTTONS_ENVELOPE self.__clanData = {'formation': makeString(MENU.HEADER_ACCOUNT_POPOVER_CLAN_HEADER), 'formationName': profile.getClanFullName(), 'position': profile.getRoleUserString(), 'btnLabel': btnLabel, 'inviteBtnIcon': envelopeIcon, 'clanResearchIcon': RES_ICONS.MAPS_ICONS_BUTTONS_SEARCH, 'clanResearchTFText': MENU.HEADER_ACCOUNT_POPOVER_CLAN_SEARCHCLAN2} self.__clanData.update(clanBtnsParams) else: isOpenInviteBtnVisible = False clanBtnsParams = self._getClanBtnsParams(clans_fmts.formatDataToString(None)) self.__clanData = {'formation': makeString(MENU.HEADER_ACCOUNT_POPOVER_CLAN_HEADER), 'position': MENU.HEADER_ACCOUNT_POPOVER_CLAN_NOTINCLAN, 'clanResearchIcon': RES_ICONS.MAPS_ICONS_BUTTONS_SEARCH, 'clanResearchTFText': MENU.HEADER_ACCOUNT_POPOVER_CLAN_SEARCHCLAN1, 'searchClanTooltip': clanBtnsParams['searchClanTooltip'], 'isSearchClanBtnEnabled': clanBtnsParams['isSearchClanBtnEnabled']} self.as_setClanEmblemS(getNoClanEmblem32x32()) self.__clanData.update({'isInClan': isInClan, 'isClanFeaturesEnabled': isClanFeaturesEnabled, 'isDoActionBtnVisible': isInClan, 'isOpenInviteBtnVisible': isOpenInviteBtnVisible, 'isSearchClanBtnVisible': isClanFeaturesEnabled, 'isTextFieldNameVisible': isInClan, 'clansResearchBtnYposition': 119 if isInClan else 72, 'textFieldPositionYposition': 57 if isInClan else 42}) self.as_setClanDataS(self.__clanData) return
def getPermissions(self, clanDossier): return ClanMemberPermissions( self.getRole()) if clanDossier and clanDossier.getDbID( ) == self._clanDbID else DefaultClanMemberPermissions()