(self, text = None, width = 55)
| 229 | |
| 230 | # Header drawing method |
| 231 | def head(self, text = None, width = 55): |
| 232 | if not self.interactive: |
| 233 | sys.stderr.write(str(text)+"\n") |
| 234 | sys.stderr.flush() |
| 235 | return |
| 236 | if text is None: |
| 237 | text = self.name |
| 238 | self.cls() |
| 239 | print(" {}".format("#"*width)) |
| 240 | mid_len = int(round(width/2-len(text)/2)-2) |
| 241 | middle = " #{}{}{}#".format(" "*mid_len, text, " "*((width - mid_len - len(text))-2)) |
| 242 | if len(middle) > width+1: |
| 243 | # Get the difference |
| 244 | di = len(middle) - width |
| 245 | # Add the padding for the ...# |
| 246 | di += 3 |
| 247 | # Trim the string |
| 248 | middle = middle[:-di] + "...#" |
| 249 | print(middle) |
| 250 | print("#"*width) |
| 251 | print("") |
| 252 | |
| 253 | def info(self, text): |
| 254 | if self.interactive: |
no test coverage detected