class DungeonTracking(service.Service): __guid__ = 'svc.dungeonTracking' __notifyevents__ = ['ProcessSessionChange', 'OnDistributionDungeonEntered', 'OnEscalatingPathDungeonEntered'] def __init__(self): service.Service.__init__(self) self.distributionDungeonsEntered = None self.escalatingPathDungeonsEntered = None def Run(self, memStream = None): service.Service.Run(self, memStream) def ProcessSessionChange(self, isRemote, session, change): if change.has_key('locationid'): self.distributionDungeonsEntered = None self.escalatingPathDungeonsEntered = None def OnDistributionDungeonEntered(self, row): if self.distributionDungeonsEntered is None: self.distributionDungeonsEntered = Rowset(row.header) self.distributionDungeonsEntered.append(row) def OnEscalatingPathDungeonEntered(self, row): if self.escalatingPathDungeonsEntered is None: self.escalatingPathDungeonsEntered = Rowset(row.header) if row.dungeonNameID: row.name = localization.GetByMessageID(row.dungeonNameID) self.escalatingPathDungeonsEntered.append(row) def GetDistributionDungeonsEntered(self): return self.distributionDungeonsEntered def GetEscalatingPathDungeonsEntered(self): return self.escalatingPathDungeonsEntered
def SaveChanges(self, *args): nodesToUpdate = self.GetNodesToUpdate() nCount = len(nodesToUpdate) if nCount == 0: return try: sm.GetService('loading').ProgressWnd(GetByLabel('UI/Common/Updating'), '', 0, nCount) blue.pyos.synchro.Yield() rows = None myRow = None for node in nodesToUpdate: row = self._CreateRowsToUpdate(node) if node.rec.characterID == eve.session.charid: if myRow is None: myRow = Rowset(self.GetRowHeader()) myRow.append(row) else: if rows is None: rows = Rowset(self.GetRowHeader()) rows.append(row) if rows is not None: self.corpSvc.UpdateMembers(rows) sm.ScatterEvent('OnRoleEdit', rows) if myRow is not None: sm.GetService('sessionMgr').PerformSessionChange('corp.UpdateMembers', self.corpSvc.UpdateMembers, myRow) finally: if nCount: for node in nodesToUpdate: self.UpdateOldRolesForNode(node) sm.GetService('loading').ProgressWnd(GetByLabel('UI/Common/Updated'), '', nCount - 1, nCount) blue.pyos.synchro.SleepWallclock(500) sm.GetService('loading').ProgressWnd(GetByLabel('UI/Common/Updated'), '', nCount, nCount) blue.pyos.synchro.Yield()
class DungeonTracking(service.Service): """ Tracks what distribution/escalating path dungeons have been entered since last location session change """ __guid__ = 'svc.dungeonTracking' __notifyevents__ = ['ProcessSessionChange', 'OnDistributionDungeonEntered', 'OnEscalatingPathDungeonEntered'] def __init__(self): service.Service.__init__(self) self.distributionDungeonsEntered = None self.escalatingPathDungeonsEntered = None def Run(self, memStream = None): service.Service.Run(self, memStream) def ProcessSessionChange(self, isRemote, session, change): if change.has_key('locationid'): self.distributionDungeonsEntered = None self.escalatingPathDungeonsEntered = None def OnDistributionDungeonEntered(self, row): if self.distributionDungeonsEntered is None: self.distributionDungeonsEntered = Rowset(row.header) self.distributionDungeonsEntered.append(row) def OnEscalatingPathDungeonEntered(self, row): if self.escalatingPathDungeonsEntered is None: self.escalatingPathDungeonsEntered = Rowset(row.header) if row.dungeonNameID: row.name = localization.GetByMessageID(row.dungeonNameID) self.escalatingPathDungeonsEntered.append(row) def GetDistributionDungeonsEntered(self): return self.distributionDungeonsEntered def GetEscalatingPathDungeonsEntered(self): return self.escalatingPathDungeonsEntered
def SaveChanges(self, *args): nodesToUpdate = [] try: sm.GetService('loading').Cycle('Preparing to update') for node in self.sr.scroll.GetNodes(): if not node or not node or not node.rec: continue changed = 0 if node.rec.titleName != node.rec.oldTitleName: changed = 1 elif node.rec.roles != node.rec.oldRoles: changed = 1 elif node.rec.grantableRoles != node.rec.oldGrantableRoles: changed = 1 elif node.rec.rolesAtHQ != node.rec.oldRolesAtHQ: changed = 1 elif node.rec.grantableRolesAtHQ != node.rec.oldGrantableRolesAtHQ: changed = 1 elif node.rec.rolesAtBase != node.rec.oldRolesAtBase: changed = 1 elif node.rec.grantableRolesAtBase != node.rec.oldGrantableRolesAtBase: changed = 1 elif node.rec.rolesAtOther != node.rec.oldRolesAtOther: changed = 1 elif node.rec.grantableRolesAtOther != node.rec.oldGrantableRolesAtOther: changed = 1 if not changed: continue nodesToUpdate.append(node) finally: sm.GetService('loading').StopCycle() nCount = len(nodesToUpdate) if nCount == 0: if self.sr.debug: self.LogWarn('Nothing to save') sm.GetService('loading').ProgressWnd( localization.GetByLabel('UI/Common/PleaseWait'), '', 0, 1) blue.pyos.synchro.SleepWallclock(500) sm.GetService('loading').ProgressWnd( localization.GetByLabel('UI/Common/PleaseWait'), '', 1, 1) blue.pyos.synchro.Yield() return self.sr.progressCurrent = 0 self.sr.progressTotal = nCount nIndex = 0 try: sm.GetService('loading').ProgressWnd( localization.GetByLabel('UI/Common/Updating'), '', nIndex, nCount) blue.pyos.synchro.Yield() rows = None for node in nodesToUpdate: entry = node.rec src = node.srcRec titleID = src.titleID titleName = entry.titleName roles = entry.roles grantableRoles = entry.grantableRoles rolesAtHQ = entry.rolesAtHQ grantableRolesAtHQ = entry.grantableRolesAtHQ rolesAtBase = entry.rolesAtBase grantableRolesAtBase = entry.grantableRolesAtBase rolesAtOther = entry.rolesAtOther grantableRolesAtOther = entry.grantableRolesAtOther roles &= ~const.corpRoleDirector grantableRoles &= ~const.corpRoleDirector rolesAtHQ &= ~const.corpRoleDirector grantableRolesAtHQ &= ~const.corpRoleDirector rolesAtBase &= ~const.corpRoleDirector grantableRolesAtBase &= ~const.corpRoleDirector rolesAtOther &= ~const.corpRoleDirector grantableRolesAtOther &= ~const.corpRoleDirector if rows is None: rows = Rowset([ 'titleID', 'titleName', 'roles', 'grantableRoles', 'rolesAtHQ', 'grantableRolesAtHQ', 'rolesAtBase', 'grantableRolesAtBase', 'rolesAtOther', 'grantableRolesAtOther' ]) rows.append([ titleID, titleName, roles, grantableRoles, rolesAtHQ, grantableRolesAtHQ, rolesAtBase, grantableRolesAtBase, rolesAtOther, grantableRolesAtOther ]) if rows is not None: sm.GetService('corp').UpdateTitles(rows) finally: if nCount: sm.GetService('loading').ProgressWnd( localization.GetByLabel('UI/Common/Updated'), '', nCount - 1, nCount) blue.pyos.synchro.SleepWallclock(500) sm.GetService('loading').ProgressWnd( localization.GetByLabel('UI/Common/Updated'), '', nCount, nCount) blue.pyos.synchro.Yield() self.PopulateView()
def SaveChanges(self, *args): nodesToUpdate = [] try: sm.GetService('loading').Cycle(localization.GetByLabel('UI/Common/PreparingToUpdate')) for node in self.sr.scroll.GetNodes(): if not node or not node or not node.rec: continue changed = 0 if node.rec.roles != node.rec.oldRoles: changed = 1 elif node.rec.grantableRoles != node.rec.oldGrantableRoles: changed = 1 elif node.rec.rolesAtHQ != node.rec.oldRolesAtHQ: changed = 1 elif node.rec.grantableRolesAtHQ != node.rec.oldGrantableRolesAtHQ: changed = 1 elif node.rec.rolesAtBase != node.rec.oldRolesAtBase: changed = 1 elif node.rec.grantableRolesAtBase != node.rec.oldGrantableRolesAtBase: changed = 1 elif node.rec.rolesAtOther != node.rec.oldRolesAtOther: changed = 1 elif node.rec.grantableRolesAtOther != node.rec.oldGrantableRolesAtOther: changed = 1 elif node.rec.baseID != node.rec.oldBaseID: changed = 1 elif node.rec.titleMask != node.rec.oldTitleMask: changed = 1 if not changed: continue nodesToUpdate.append(node) finally: sm.GetService('loading').StopCycle() nCount = len(nodesToUpdate) if nCount == 0: log.LogWarn('Nothing to save') return self.sr.progressCurrent = 0 self.sr.progressTotal = nCount nIndex = 0 try: sm.GetService('loading').ProgressWnd(localization.GetByLabel('UI/Common/Updating'), '', nIndex, nCount) blue.pyos.synchro.Yield() rows = None myRow = None for node in nodesToUpdate: entry = node.rec src = node.srcRec characterID = entry.characterID title = src.title divisionID = src.divisionID squadronID = src.squadronID roles = entry.roles grantableRoles = entry.grantableRoles rolesAtHQ = entry.rolesAtHQ grantableRolesAtHQ = entry.grantableRolesAtHQ rolesAtBase = entry.rolesAtBase grantableRolesAtBase = entry.grantableRolesAtBase rolesAtOther = entry.rolesAtOther grantableRolesAtOther = entry.grantableRolesAtOther baseID = entry.baseID titleMask = entry.titleMask if entry.titleMask == src.titleMask: titleMask = None if roles & const.corpRoleDirector == const.corpRoleDirector: roles = const.corpRoleDirector grantableRoles = 0 rolesAtHQ = 0 grantableRolesAtHQ = 0 rolesAtBase = 0 grantableRolesAtBase = 0 rolesAtOther = 0 grantableRolesAtOther = 0 if characterID == eve.session.charid: if myRow is None: myRow = Rowset(['characterID', 'title', 'divisionID', 'squadronID', 'roles', 'grantableRoles', 'rolesAtHQ', 'grantableRolesAtHQ', 'rolesAtBase', 'grantableRolesAtBase', 'rolesAtOther', 'grantableRolesAtOther', 'baseID', 'titleMask']) myRow.append([characterID, None, None, None, roles, grantableRoles, rolesAtHQ, grantableRolesAtHQ, rolesAtBase, grantableRolesAtBase, rolesAtOther, grantableRolesAtOther, baseID, titleMask]) else: if rows is None: rows = Rowset(['characterID', 'title', 'divisionID', 'squadronID', 'roles', 'grantableRoles', 'rolesAtHQ', 'grantableRolesAtHQ', 'rolesAtBase', 'grantableRolesAtBase', 'rolesAtOther', 'grantableRolesAtOther', 'baseID', 'titleMask']) rows.append([characterID, None, None, None, roles, grantableRoles, rolesAtHQ, grantableRolesAtHQ, rolesAtBase, grantableRolesAtBase, rolesAtOther, grantableRolesAtOther, baseID, titleMask]) if rows is not None: sm.GetService('corp').UpdateMembers(rows) sm.ScatterEvent('OnRoleEdit', rows) if myRow is not None: sm.GetService('sessionMgr').PerformSessionChange('corp.UpdateMembers', sm.GetService('corp').UpdateMembers, myRow) finally: if nCount: sm.GetService('loading').ProgressWnd(localization.GetByLabel('UI/Common/Updated'), '', nCount - 1, nCount) blue.pyos.synchro.SleepWallclock(500) sm.GetService('loading').ProgressWnd(localization.GetByLabel('UI/Common/Updated'), '', nCount, nCount) blue.pyos.synchro.Yield()
def SaveChanges(self, *args): nodesToUpdate = [] try: sm.GetService('loading').Cycle( localization.GetByLabel('UI/Common/PreparingToUpdate')) for node in self.sr.scroll.GetNodes(): if not node or not node or not node.rec: continue changed = 0 if node.rec.roles != node.rec.oldRoles: changed = 1 elif node.rec.grantableRoles != node.rec.oldGrantableRoles: changed = 1 elif node.rec.rolesAtHQ != node.rec.oldRolesAtHQ: changed = 1 elif node.rec.grantableRolesAtHQ != node.rec.oldGrantableRolesAtHQ: changed = 1 elif node.rec.rolesAtBase != node.rec.oldRolesAtBase: changed = 1 elif node.rec.grantableRolesAtBase != node.rec.oldGrantableRolesAtBase: changed = 1 elif node.rec.rolesAtOther != node.rec.oldRolesAtOther: changed = 1 elif node.rec.grantableRolesAtOther != node.rec.oldGrantableRolesAtOther: changed = 1 elif node.rec.baseID != node.rec.oldBaseID: changed = 1 elif node.rec.titleMask != node.rec.oldTitleMask: changed = 1 if not changed: continue nodesToUpdate.append(node) finally: sm.GetService('loading').StopCycle() nCount = len(nodesToUpdate) if nCount == 0: log.LogWarn('Nothing to save') return self.sr.progressCurrent = 0 self.sr.progressTotal = nCount nIndex = 0 try: sm.GetService('loading').ProgressWnd( localization.GetByLabel('UI/Common/Updating'), '', nIndex, nCount) blue.pyos.synchro.Yield() rows = None myRow = None for node in nodesToUpdate: entry = node.rec src = node.srcRec characterID = entry.characterID title = src.title divisionID = src.divisionID squadronID = src.squadronID roles = entry.roles grantableRoles = entry.grantableRoles rolesAtHQ = entry.rolesAtHQ grantableRolesAtHQ = entry.grantableRolesAtHQ rolesAtBase = entry.rolesAtBase grantableRolesAtBase = entry.grantableRolesAtBase rolesAtOther = entry.rolesAtOther grantableRolesAtOther = entry.grantableRolesAtOther baseID = entry.baseID titleMask = entry.titleMask if entry.titleMask == src.titleMask: titleMask = None if roles & const.corpRoleDirector == const.corpRoleDirector: roles = const.corpRoleDirector grantableRoles = 0 rolesAtHQ = 0 grantableRolesAtHQ = 0 rolesAtBase = 0 grantableRolesAtBase = 0 rolesAtOther = 0 grantableRolesAtOther = 0 if characterID == eve.session.charid: if myRow is None: myRow = Rowset([ 'characterID', 'title', 'divisionID', 'squadronID', 'roles', 'grantableRoles', 'rolesAtHQ', 'grantableRolesAtHQ', 'rolesAtBase', 'grantableRolesAtBase', 'rolesAtOther', 'grantableRolesAtOther', 'baseID', 'titleMask' ]) myRow.append([ characterID, None, None, None, roles, grantableRoles, rolesAtHQ, grantableRolesAtHQ, rolesAtBase, grantableRolesAtBase, rolesAtOther, grantableRolesAtOther, baseID, titleMask ]) else: if rows is None: rows = Rowset([ 'characterID', 'title', 'divisionID', 'squadronID', 'roles', 'grantableRoles', 'rolesAtHQ', 'grantableRolesAtHQ', 'rolesAtBase', 'grantableRolesAtBase', 'rolesAtOther', 'grantableRolesAtOther', 'baseID', 'titleMask' ]) rows.append([ characterID, None, None, None, roles, grantableRoles, rolesAtHQ, grantableRolesAtHQ, rolesAtBase, grantableRolesAtBase, rolesAtOther, grantableRolesAtOther, baseID, titleMask ]) if rows is not None: sm.GetService('corp').UpdateMembers(rows) sm.ScatterEvent('OnRoleEdit', rows) if myRow is not None: sm.GetService('sessionMgr').PerformSessionChange( 'corp.UpdateMembers', sm.GetService('corp').UpdateMembers, myRow) finally: if nCount: sm.GetService('loading').ProgressWnd( localization.GetByLabel('UI/Common/Updated'), '', nCount - 1, nCount) blue.pyos.synchro.SleepWallclock(500) sm.GetService('loading').ProgressWnd( localization.GetByLabel('UI/Common/Updated'), '', nCount, nCount) blue.pyos.synchro.Yield()
def SaveChanges(self, *args): nodesToUpdate = [] try: sm.GetService('loading').Cycle('Preparing to update') for node in self.sr.scroll.GetNodes(): if not node or not node or not node.rec: continue changed = 0 if node.rec.titleName != node.rec.oldTitleName: changed = 1 elif node.rec.roles != node.rec.oldRoles: changed = 1 elif node.rec.grantableRoles != node.rec.oldGrantableRoles: changed = 1 elif node.rec.rolesAtHQ != node.rec.oldRolesAtHQ: changed = 1 elif node.rec.grantableRolesAtHQ != node.rec.oldGrantableRolesAtHQ: changed = 1 elif node.rec.rolesAtBase != node.rec.oldRolesAtBase: changed = 1 elif node.rec.grantableRolesAtBase != node.rec.oldGrantableRolesAtBase: changed = 1 elif node.rec.rolesAtOther != node.rec.oldRolesAtOther: changed = 1 elif node.rec.grantableRolesAtOther != node.rec.oldGrantableRolesAtOther: changed = 1 if not changed: continue nodesToUpdate.append(node) finally: sm.GetService('loading').StopCycle() nCount = len(nodesToUpdate) if nCount == 0: if self.sr.debug: self.LogWarn('Nothing to save') sm.GetService('loading').ProgressWnd(localization.GetByLabel('UI/Common/PleaseWait'), '', 0, 1) blue.pyos.synchro.SleepWallclock(500) sm.GetService('loading').ProgressWnd(localization.GetByLabel('UI/Common/PleaseWait'), '', 1, 1) blue.pyos.synchro.Yield() return self.sr.progressCurrent = 0 self.sr.progressTotal = nCount nIndex = 0 try: sm.GetService('loading').ProgressWnd(localization.GetByLabel('UI/Common/Updating'), '', nIndex, nCount) blue.pyos.synchro.Yield() rows = None for node in nodesToUpdate: entry = node.rec src = node.srcRec titleID = src.titleID titleName = entry.titleName roles = entry.roles grantableRoles = entry.grantableRoles rolesAtHQ = entry.rolesAtHQ grantableRolesAtHQ = entry.grantableRolesAtHQ rolesAtBase = entry.rolesAtBase grantableRolesAtBase = entry.grantableRolesAtBase rolesAtOther = entry.rolesAtOther grantableRolesAtOther = entry.grantableRolesAtOther roles &= ~const.corpRoleDirector grantableRoles &= ~const.corpRoleDirector rolesAtHQ &= ~const.corpRoleDirector grantableRolesAtHQ &= ~const.corpRoleDirector rolesAtBase &= ~const.corpRoleDirector grantableRolesAtBase &= ~const.corpRoleDirector rolesAtOther &= ~const.corpRoleDirector grantableRolesAtOther &= ~const.corpRoleDirector if rows is None: rows = Rowset(['titleID', 'titleName', 'roles', 'grantableRoles', 'rolesAtHQ', 'grantableRolesAtHQ', 'rolesAtBase', 'grantableRolesAtBase', 'rolesAtOther', 'grantableRolesAtOther']) rows.append([titleID, titleName, roles, grantableRoles, rolesAtHQ, grantableRolesAtHQ, rolesAtBase, grantableRolesAtBase, rolesAtOther, grantableRolesAtOther]) if rows is not None: sm.GetService('corp').UpdateTitles(rows) finally: if nCount: sm.GetService('loading').ProgressWnd(localization.GetByLabel('UI/Common/Updated'), '', nCount - 1, nCount) blue.pyos.synchro.SleepWallclock(500) sm.GetService('loading').ProgressWnd(localization.GetByLabel('UI/Common/Updated'), '', nCount, nCount) blue.pyos.synchro.Yield() self.PopulateView()