MCPcopy
hub / github.com/corpnewt/GenSMBIOS / head

Method head

Scripts/utils.py:218–233  ·  view source on GitHub ↗
(self, text = None, width = 55)

Source from the content-addressed store, hash-verified

216
217 # Header drawing method
218 def head(self, text = None, width = 55):
219 if text == None:
220 text = self.name
221 self.cls()
222 print(" {}".format("#"*width))
223 mid_len = int(round(width/2-len(text)/2)-2)
224 middle = " #{}{}{}#".format(" "*mid_len, text, " "*((width - mid_len - len(text))-2))
225 if len(middle) > width+1:
226 # Get the difference
227 di = len(middle) - width
228 # Add the padding for the ...#
229 di += 3
230 # Trim the string
231 middle = middle[:-di] + "...#"
232 print(middle)
233 print("#"*width)
234
235 def resize(self, width, height):
236 print('\033[8;{};{}t'.format(height, width))

Callers 8

custom_quitMethod · 0.95
_get_macserialMethod · 0.80
_get_remote_versionMethod · 0.80
_get_plistMethod · 0.80
_generate_smbiosMethod · 0.80
_list_currentMethod · 0.80
get_additional_argsMethod · 0.80
mainMethod · 0.80

Calls 1

clsMethod · 0.95

Tested by

no test coverage detected