Beispiel #1
0
    def format_row(self, uuid, task, worker, timestamp, state):
        mx = self.display_width

        # include spacing
        detail_width = mx - 1 - STATE_WIDTH - 1 - TIMESTAMP_WIDTH
        uuid_space = detail_width - 1 - MIN_TASK_WIDTH - 1 - MIN_WORKER_WIDTH

        if uuid_space < UUID_WIDTH:
            uuid_width = uuid_space
        else:
            uuid_width = UUID_WIDTH

        detail_width = detail_width - uuid_width - 1
        task_width = int(ceil(detail_width / 2.0))
        worker_width = detail_width - task_width - 1

        uuid = abbr(uuid, uuid_width).ljust(uuid_width)
        worker = abbr(worker, worker_width).ljust(worker_width)
        task = abbrtask(task, task_width).ljust(task_width)
        state = abbr(state, STATE_WIDTH).ljust(STATE_WIDTH)
        timestamp = timestamp.ljust(TIMESTAMP_WIDTH)

        row = "%s %s %s %s %s " % (uuid, worker, task, timestamp, state)
        if self.screen_width is None:
            self.screen_width = len(row[:mx])
        return row[:mx]
Beispiel #2
0
    def format_row(self, uuid, task, worker, timestamp, state):
        mx = self.display_width

        # include spacing
        detail_width = mx - 1 - STATE_WIDTH - 1 - TIMESTAMP_WIDTH
        uuid_space = detail_width - 1 - MIN_TASK_WIDTH - 1 - MIN_WORKER_WIDTH

        if uuid_space < UUID_WIDTH:
            uuid_width = uuid_space
        else:
            uuid_width = UUID_WIDTH

        detail_width = detail_width - uuid_width - 1
        task_width = int(ceil(detail_width / 2.0))
        worker_width = detail_width - task_width - 1

        uuid = abbr(uuid, uuid_width).ljust(uuid_width)
        worker = abbr(worker, worker_width).ljust(worker_width)
        task = abbrtask(task, task_width).ljust(task_width)
        state = abbr(state, STATE_WIDTH).ljust(STATE_WIDTH)
        timestamp = timestamp.ljust(TIMESTAMP_WIDTH)

        row = "%s %s %s %s %s " % (uuid, worker, task, timestamp, state)
        if self.screen_width is None:
            self.screen_width = len(row[:mx])
        return row[:mx]
Beispiel #3
0
def name(task):
    try:
        short_name = abbrtask(task.name, 16)
        if "alt" in task.name:
            return """<div title="%s"><b>%s</b></div>""" % (escape(
                task.name), escape(short_name))
        else:
            return """<div title="%s">%s</div>""" % (escape(
                task.name), escape(short_name))
    except:
        return task.name
Beispiel #4
0
 def format_row(self, uuid, worker, task, timestamp, state):
     my, mx = self.win.getmaxyx()
     mx = mx - 3
     uuid_max = 36
     if mx < 88:
         uuid_max = mx - 52 - 2
     uuid = abbr(uuid, uuid_max).ljust(uuid_max)
     worker = abbr(worker, 16).ljust(16)
     task = abbrtask(task, 16).ljust(16)
     state = abbr(state, 8).ljust(8)
     timestamp = timestamp.ljust(8)
     row = "%s %s %s %s %s " % (uuid, worker, task, timestamp, state)
     if self.screen_width is None:
         self.screen_width = len(row[:mx])
     return row[:mx]
 def format_row(self, uuid, worker, task, timestamp, state):
     my, mx = self.win.getmaxyx()
     mx = mx - 3
     uuid_max = 36
     if mx < 88:
         uuid_max = mx - 52 - 2
     uuid = abbr(uuid, uuid_max).ljust(uuid_max)
     worker = abbr(worker, 16).ljust(16)
     task = abbrtask(task, 16).ljust(16)
     state = abbr(state, 8).ljust(8)
     timestamp = timestamp.ljust(8)
     row = "%s %s %s %s %s " % (uuid, worker, task, timestamp, state)
     if self.screen_width is None:
         self.screen_width = len(row[:mx])
     return row[:mx]
Beispiel #6
0
def name(task):
    short_name = abbrtask(task.name, 16)
    return """<div title="%s"><b>%s</b></div>""" % (escape(task.name),
                                                    escape(short_name))
Beispiel #7
0
def name(task):
    short_name = abbrtask(task.name, 16)
    return """<div title="%s"><b>%s</b></div>""" % (escape(
        task.name), escape(short_name))
Beispiel #8
0
 def test_abbrtask(self):
     self.assertEqual(utils.abbrtask(None, 3), "???")
     self.assertEqual(utils.abbrtask("feeds.tasks.refresh", 10),
                                     "[.]refresh")
     self.assertEqual(utils.abbrtask("feeds.tasks.refresh", 30),
                                     "feeds.tasks.refresh")
Beispiel #9
0
 def test_abbrtask(self):
     self.assertEqual(utils.abbrtask(None, 3), "???")
     self.assertEqual(utils.abbrtask("feeds.tasks.refresh", 10),
                      "[.]refresh")
     self.assertEqual(utils.abbrtask("feeds.tasks.refresh", 30),
                      "feeds.tasks.refresh")
Beispiel #10
0
def name(task):
    return """<b>%s</b>""" % (escape(abbrtask(task.name, 16)), )