def display_jobs(**kwargs): q = build_job_query(**kwargs) header = "%-40s %16s %16s %4s [%2s %2s %2s] [%4s ] %8s %-20s %s" format = "%-40s %16s %16s %04d [%03d %03d %03d] [%04dMB] %8s %-20s %s" print header % ( "Job", "State", "User", "Pend", "Run", "Min", "Max", "RAM", "Duration", "Start Time", "End Time" ) print "-" * 160 for job in plow.client.get_jobs(**q): print format % ( util.clipText(job.name, 40), constants.JOB_STATES[job.state], job.username, job.totals.waiting + job.totals.depend, job.runCores, job.minCores, job.maxCores, job.stats.highRam, util.formatDuration(job.startTime, job.stopTime), util.formatDateTime(job.startTime), util.formatDateTime(job.stopTime) )
def onAnalyzerTick(self, analyzer): enrageTime = config.get("customEnrageTime") if not enrageTime: self.bar.SetValue(0) self.bar.SetLabel("") return enrageTime = float(enrageTime) self.bar.SetValue(1.0 - util.div(analyzer.combatDuration, enrageTime)) self.bar.SetLabel(util.formatDuration(enrageTime - analyzer.combatDuration))
def onAnalyzerTick(self, analyzer): enrageTime = config.get("customEnrageTime") if not enrageTime: self.bar.SetValue(0) self.bar.SetLabel("") return enrageTime = float(enrageTime) self.bar.SetValue(1.0 - util.div(analyzer.combatDuration, enrageTime)) self.bar.SetLabel( util.formatDuration(enrageTime - analyzer.combatDuration))
def display_jobs(**kwargs): q = build_job_query(**kwargs) header = "%-40s %16s %16s %4s [%2s %2s %2s] [%4s ] %8s %-20s %s" format = "%-40s %16s %16s %04d [%03d %03d %03d] [%04dMB] %8s %-20s %s" print header % ("Job", "State", "User", "Pend", "Run", "Min", "Max", "RAM", "Duration", "Start Time", "End Time") print "-" * 160 for job in plow.client.get_jobs(**q): print format % (util.clipText( job.name, 40), constants.JOB_STATES[job.state], job.username, job.totals.waiting + job.totals.depend, job.runCores, job.minCores, job.maxCores, job.stats.highRam, util.formatDuration(job.startTime, job.stopTime), util.formatDateTime( job.startTime), util.formatDateTime(job.stopTime))
def createOverviewView(self, parent, panelParent): self.overviewGrid = wx.GridSizer(3, 3, 20, 20) self.overviewUpdaters = [] def createDetailBlock(name, getter): detailBlock = wx.BoxSizer(wx.VERTICAL) header = wx.StaticText(panelParent, -1, name) header.SetFont(wx.Font(14, wx.DEFAULT, wx.NORMAL, wx.NORMAL)) header.SetSize(header.GetBestSize()) detailBlock.Add(header, 0, wx.ALL & ~wx.BOTTOM, 10) text = wx.StaticText(panelParent, -1, "N/A") text.SetFont(wx.Font(24, wx.DEFAULT, wx.NORMAL, wx.NORMAL)) text.SetSize(text.GetBestSize()) detailBlock.Add(text, 0, wx.ALL & ~wx.TOP, 10) self.overviewGrid.Add(detailBlock) self.overviewUpdaters.append((lambda t,x: lambda a: t.SetLabel(getter(a)))(text, getter)) createDetailBlock("Damage Dealt", lambda a: locale.format("%d", a.totalDamage, grouping=True)) createDetailBlock("Damage Taken", lambda a: locale.format("%d", a.totalDamageTaken, grouping=True)) createDetailBlock("DPS", lambda a: locale.format("%.2f", a.avgDps, grouping=True)) createDetailBlock("Healing Done", lambda a: locale.format("%d", a.totalHealing, grouping=True)) createDetailBlock("Healing Received", lambda a: locale.format("%d", a.totalHealingReceived, grouping=True)) createDetailBlock("HPS", lambda a: locale.format("%.2f", a.avgHps, grouping=True)) createDetailBlock("Combat Duration", lambda a: util.formatDuration(a.combatDurationLinear)) createDetailBlock("Rolling DPS", lambda a: locale.format("%.2f", a.dps, grouping=True)) createDetailBlock("Rolling HPS", lambda a: locale.format("%.2f", a.hps, grouping=True)) # Create user label self.overviewUsername = wx.StaticText(panelParent, -1, "INITIALIZING...") self.overviewUsername.SetFont(wx.Font(18, wx.DEFAULT, wx.NORMAL, wx.NORMAL)) self.overviewUsername.SetSize(self.overviewUsername.GetBestSize()) parent.AddSpacer(10) parent.Add(self.overviewUsername, 0, wx.LEFT | wx.RIGHT, 20) parent.Add(wx.StaticLine(panelParent), 0, wx.EXPAND | wx.ALL & ~wx.BOTTOM, 10) parent.Add(self.overviewGrid, 0, wx.EXPAND | wx.ALL, 10)
def createReportView(self, parent, panelParent): self.reportView = ListBox(panelParent, ["Name", "Value"], [200, 200], style=wx.LC_REPORT | wx.NO_BORDER) self.reportView.SortListItems(0) self.reportUpdaters = {} def addDetailItem(name, getter): self.reportUpdaters[name] = getter addDetailItem("My Damage Dealt", lambda a: locale.format("%d", a.totalDamage, grouping=True)) addDetailItem("My Damage Taken", lambda a: locale.format("%d", a.totalDamageTaken, grouping=True)) addDetailItem("My Average DPS", lambda a: locale.format("%.2f", a.avgDps, grouping=True)) addDetailItem("My Healing Done", lambda a: locale.format("%d", a.totalHealing, grouping=True)) addDetailItem("My Healing Received", lambda a: locale.format("%d", a.totalHealingReceived, grouping=True)) addDetailItem("My Average HPS", lambda a: locale.format("%.2f", a.avgHps, grouping=True)) addDetailItem("My Threat", lambda a: locale.format("%d", a.totalThreat, grouping=True)) addDetailItem("Combat Duration", lambda a: util.formatDuration(a.combatDurationLinear)) addDetailItem("Combat Duration (seconds)", lambda a: locale.format("%.2f", a.combatDurationLinear, grouping=True)) addDetailItem("Combat Enter Time", lambda a: time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(a.combatStartTime))) addDetailItem("Combat Exit Time", lambda a: time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(a.combatEndTime))) parent.Add(self.reportView, 1, wx.EXPAND, 0)
def onAnalyzerTick(self, analyzer): self.timer.SetLabel(util.formatDuration(analyzer.combatDurationLinear))