def draw_stages(self, win, height): text_color = theme.getPair(238, -1) line_color = theme.getPair(234, -1) stages = [ " Setup ", " Compile ", " Lint ", " Test ", " Package ", " Deploy " ] stage_width = int(self.width - 2) / (len(stages) + 1) for i, t in enumerate(stages): win.attron(line_color) win.vline(2, int(stage_width + stage_width * i), curses.ACS_VLINE, height) win.attroff(line_color) win.attron(text_color) win.hline(2, int(stage_width + stage_width * i - len(t) / 2), curses.ACS_HLINE, len(t)) win.addch(2, int(stage_width + i * stage_width), curses.ACS_TTEE) win.attron(curses.A_REVERSE | curses.A_BOLD) win.addstr(1, int(stage_width + stage_width * i - len(t) / 2), t) win.attroff(text_color) win.attroff(curses.A_REVERSE | curses.A_BOLD)
def draw_steps(self, win): done_color = theme.getPair(28, -1) fail_color = theme.getPair(160, -1) current_color = theme.getPair(226, -1) self.draw_step_block(win, 10, 5, done_color) self.draw_step_block(win, 20, 9, fail_color) self.draw_step_block(win, 10, 13, current_color) self.draw_dependency(win, 11, 7, 20, 10)
def draw_steps(self, win): done_color = theme.getPair( 28, -1) fail_color = theme.getPair(160, -1) current_color = theme.getPair(226, -1) self.draw_step_block(win, 10, 5 , done_color) self.draw_step_block(win, 20, 9 , fail_color) self.draw_step_block(win, 10, 13, current_color) self.draw_dependency(win, 11, 7, 20, 10)
def get_color(win, seq): fields = [] cur = "" idx = 0 for char in seq: if char == "[": pass elif char == ";": fields.append(cur) cur = "" else: assert(int(char) < 10) cur += char fields.append(cur) if len(fields) < 1: return # 256 color mode if fields[0] == "38": fields[0] = "-1" # reset if fields[0] == "39" or fields[0] == "49" : return colors = [] for f in fields: c = int(f) assert(c >= -1 and c < 256) colors.append(c) if len(fields) == 3: col = theme.getPair(colors[2], colors[0]) if colors[1] == 5: col |= curses.A_BOLD return col elif len(fields) == 4: col = theme.getPair(colors[2], colors[0]) if colors[1] == 5: col |= curses.A_BOLD return col elif len(fields) == 2: col = theme.getPair(colors[1], colors[0]) return col elif len(fields) == 1: col = theme.getPair(-1, colors[0]) return col return
def get_color(win, seq): fields = [] cur = "" idx = 0 for char in seq: if char == "[": pass elif char == ";": fields.append(cur) cur = "" else: assert (int(char) < 10) cur += char fields.append(cur) if len(fields) < 1: return # 256 color mode if fields[0] == "38": fields[0] = "-1" # reset if fields[0] == "39" or fields[0] == "49": return colors = [] for f in fields: c = int(f) assert (c >= -1 and c < 256) colors.append(c) if len(fields) == 3: col = theme.getPair(colors[2], colors[0]) if colors[1] == 5: col |= curses.A_BOLD return col elif len(fields) == 4: col = theme.getPair(colors[2], colors[0]) if colors[1] == 5: col |= curses.A_BOLD return col elif len(fields) == 2: col = theme.getPair(colors[1], colors[0]) return col elif len(fields) == 1: col = theme.getPair(-1, colors[0]) return col return
def repaint(self, clear=False): if self.win == None: return if clear: self.win.clear() #self.mode_color2 = { #'E': { #'fg': create_color(curses.COLOR_BLUE, -1), #'bg': create_color(curses.COLOR_BLACK, curses.COLOR_BLUE), #}, #'S': { #'fg': create_color(curses.COLOR_CYAN, -1), #'bg': create_color(curses.COLOR_WHITE, curses.COLOR_CYAN), #}, #'O': { #'fg': create_color(curses.COLOR_RED, -1), #'bg': create_color(curses.COLOR_BLACK, curses.COLOR_RED), #}, #'F': { #'fg': create_color(curses.COLOR_YELLOW, -1), #'bg': create_color(curses.COLOR_BLACK, curses.COLOR_YELLOW), #}, #' ': { #'fg': create_color(-1, -1), #'bg': create_color(curses.COLOR_WHITE, curses.COLOR_GREEN), #} #} offset = self.draw_word("E", "Edit", theme.getPair(122, -1), 1, 0) offset = self.draw_word( "F", "Fixup", theme.getPair(curses.COLOR_BLACK, curses.COLOR_YELLOW), offset, 0) offset = self.draw_word( "O", "Omit", theme.getPair(curses.COLOR_BLACK, curses.COLOR_RED), offset, 0) offset = self.draw_word( "S", "Squash", theme.getPair(curses.COLOR_WHITE, curses.COLOR_CYAN), offset, 0) #offset = self.draw_word("/", "Search" , 26 , offset, 0 ) offset = self.draw_word("K", "Move Up", 2, offset, curses.A_BOLD) offset = self.draw_word("J", "Move Down", 2, offset, curses.A_BOLD) offset = self.draw_word("Q", "Quit", 2, offset, curses.A_BOLD) self.win.refresh()
def getAttributes(self, selected): attr = theme.normal if self.background or self.foreground: attr = theme.getPair(self.foreground, self.background) if selected: attr = theme.selected return attr
def repaint(self, clear = False): if self.win == None: return if clear: self.win.clear() #self.mode_color2 = { #'E': { #'fg': create_color(curses.COLOR_BLUE, -1), #'bg': create_color(curses.COLOR_BLACK, curses.COLOR_BLUE), #}, #'S': { #'fg': create_color(curses.COLOR_CYAN, -1), #'bg': create_color(curses.COLOR_WHITE, curses.COLOR_CYAN), #}, #'O': { #'fg': create_color(curses.COLOR_RED, -1), #'bg': create_color(curses.COLOR_BLACK, curses.COLOR_RED), #}, #'F': { #'fg': create_color(curses.COLOR_YELLOW, -1), #'bg': create_color(curses.COLOR_BLACK, curses.COLOR_YELLOW), #}, #' ': { #'fg': create_color(-1, -1), #'bg': create_color(curses.COLOR_WHITE, curses.COLOR_GREEN), #} #} offset = self.draw_word("E", "Edit" , theme.getPair(122, -1) , 1 , 0 ) offset = self.draw_word("F", "Fixup" , theme.getPair(curses.COLOR_BLACK, curses.COLOR_YELLOW) , offset, 0 ) offset = self.draw_word("O", "Omit" , theme.getPair(curses.COLOR_BLACK, curses.COLOR_RED) , offset, 0 ) offset = self.draw_word("S", "Squash" , theme.getPair(curses.COLOR_WHITE, curses.COLOR_CYAN) , offset, 0 ) #offset = self.draw_word("/", "Search" , 26 , offset, 0 ) offset = self.draw_word("K", "Move Up" , 2 , offset, curses.A_BOLD) offset = self.draw_word("J", "Move Down", 2 , offset, curses.A_BOLD) offset = self.draw_word("Q", "Quit" , 2 , offset, curses.A_BOLD) self.win.refresh()
def draw_stages(self, win, height): text_color = theme.getPair(238, -1) line_color = theme.getPair(234, -1) stages = [" Setup ", " Compile ", " Lint ", " Test ", " Package ", " Deploy "] stage_width = int(self.width-2)/(len(stages)+1) for i, t in enumerate(stages): win.attron(line_color) win.vline(2, int(stage_width + stage_width*i), curses.ACS_VLINE, height) win.attroff(line_color) win.attron(text_color) win.hline(2, int(stage_width + stage_width*i - len(t)/2), curses.ACS_HLINE, len(t)) win.addch(2, int(stage_width + i*stage_width), curses.ACS_TTEE) win.attron(curses.A_REVERSE|curses.A_BOLD) win.addstr(1, int(stage_width + stage_width*i - len(t)/2), t) win.attroff(text_color) win.attroff(curses.A_REVERSE|curses.A_BOLD)
def repaint(self, clear=False): if self.win == None: return self.win.erase() # Draw the sides self.win.vline(0, 0, curses.ACS_VLINE, self.height) self.win.vline(0, self.width - 1, curses.ACS_VLINE, self.height) if not self._entry: self.win.refresh() return # Draw the static box self.win.hline(1, 1, curses.ACS_HLINE, self.width - 2) self.win.hline(3, 1, curses.ACS_HLINE, self.width - 2) self.win.addch(1, 0, curses.ACS_LTEE) self.win.addch(3, 0, curses.ACS_LTEE) self.win.addch(1, self.width - 1, curses.ACS_RTEE) self.win.addch(3, self.width - 1, curses.ACS_RTEE) # Draw the dynamic parts of the box line_len = len(str(self._entry["line"])) + 9 self.win.addch(1, line_len, curses.ACS_TTEE) self.win.addch(2, line_len, curses.ACS_VLINE) self.win.addch(3, line_len, curses.ACS_BTEE) col_len = len(str(self._entry["columns"])) + 8 self.win.addch(1, line_len + col_len, curses.ACS_TTEE) self.win.addch(2, line_len + col_len, curses.ACS_VLINE) self.win.addch(3, line_len + col_len, curses.ACS_BTEE) warn_len = len(str(self._entry["warn"])) + 4 self.win.addch(1, self.width - warn_len, curses.ACS_TTEE) self.win.addch(2, self.width - warn_len, curses.ACS_VLINE) self.win.addch(3, self.width - warn_len, curses.ACS_BTEE) message_len = len(self._entry["message"]) + 12 message_lines = int( math.ceil(float(message_len) / float(self.width - 12))) yoffset = 4 + message_lines if self.height > yoffset: self.win.hline(yoffset, 1, curses.ACS_HLINE, self.width - 2) self.win.addch(yoffset, 0, curses.ACS_LTEE) self.win.addch(yoffset, self.width - 1, curses.ACS_RTEE) # Draw the text self.win.attron(curses.A_BOLD) self.win.addstr(0, 2, "FILE:") self.win.addstr(2, 2, "LINE:") self.win.addstr(2, line_len + 2, "COL:") self.win.addstr(4, 2, "MESSAGE:") self.win.attroff(curses.A_BOLD) self.win.addstr(2, 8, self._entry["line"]) self.win.addstr(2, line_len + 7, self._entry["columns"]) filecol = theme.getPair(curses.COLOR_BLUE, -1) self.win.addstr(0, 8, self._entry["filename"], filecol) warncol = theme.getPair(curses.COLOR_RED, -1) self.win.addstr(2, self.width - warn_len + 2, self._entry["warn"].upper(), warncol | curses.A_BOLD) mess = theme.getPair(208, -1) for l in range(0, message_lines): start = l * (self.width - 12) end = start + self.width - 12 self.win.addstr(4 + l, 11, self._entry["message"][start:end], mess) self.win.refresh()
def repaint(self, clear = False): if self.win == None: return self.win.erase() # Draw the sides self.win.vline(0, 0, curses.ACS_VLINE, self.height) self.win.vline(0, self.width-1, curses.ACS_VLINE, self.height) if not self._entry: self.win.refresh() return # Draw the static box self.win.hline(1, 1, curses.ACS_HLINE, self.width-2) self.win.hline(3, 1, curses.ACS_HLINE, self.width-2) self.win.addch(1, 0, curses.ACS_LTEE) self.win.addch(3, 0, curses.ACS_LTEE) self.win.addch(1, self.width-1, curses.ACS_RTEE) self.win.addch(3, self.width-1, curses.ACS_RTEE) # Draw the dynamic parts of the box line_len = len(str(self._entry["line"]))+9 self.win.addch(1, line_len, curses.ACS_TTEE ) self.win.addch(2, line_len, curses.ACS_VLINE) self.win.addch(3, line_len, curses.ACS_BTEE ) col_len = len(str(self._entry["columns"]))+8 self.win.addch(1, line_len+col_len, curses.ACS_TTEE ) self.win.addch(2, line_len+col_len, curses.ACS_VLINE) self.win.addch(3, line_len+col_len, curses.ACS_BTEE ) warn_len = len(str(self._entry["warn"]))+4 self.win.addch(1, self.width-warn_len, curses.ACS_TTEE ) self.win.addch(2, self.width-warn_len, curses.ACS_VLINE) self.win.addch(3, self.width-warn_len, curses.ACS_BTEE ) message_len = len(self._entry["message"]) + 12 message_lines = int(math.ceil(float(message_len)/float(self.width-12))) yoffset = 4 + message_lines if self.height > yoffset: self.win.hline(yoffset, 1, curses.ACS_HLINE, self.width-2) self.win.addch(yoffset, 0, curses.ACS_LTEE) self.win.addch(yoffset, self.width-1, curses.ACS_RTEE) # Draw the text self.win.attron(curses.A_BOLD) self.win.addstr(0, 2, "FILE:") self.win.addstr(2, 2, "LINE:") self.win.addstr(2, line_len+2 , "COL:") self.win.addstr(4, 2, "MESSAGE:") self.win.attroff(curses.A_BOLD) self.win.addstr(2, 8, self._entry["line"]) self.win.addstr(2, line_len + 7, self._entry["columns"]) filecol = theme.getPair(curses.COLOR_BLUE, -1) self.win.addstr(0, 8, self._entry["filename"], filecol) warncol = theme.getPair(curses.COLOR_RED, -1) self.win.addstr(2, self.width-warn_len+2, self._entry["warn"].upper(), warncol|curses.A_BOLD) mess = theme.getPair(208, -1) for l in range(0, message_lines): start = l*(self.width-12) end = start + self.width-12 self.win.addstr(4+l, 11, self._entry["message"][start:end], mess) self.win.refresh()