mirror of
https://github.com/erkin/ponysay.git
synced 2024-11-26 14:18:00 +01:00
documenting methods
This commit is contained in:
parent
e52153af6e
commit
8ba734cf9c
1 changed files with 25 additions and 0 deletions
25
ponysay
25
ponysay
|
@ -414,6 +414,9 @@ class Ponysay():
|
||||||
'''
|
'''
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def isUsingKMS():
|
def isUsingKMS():
|
||||||
|
if not linuxvt:
|
||||||
|
return False
|
||||||
|
|
||||||
env_kms = os.environ['PONYSAY_KMS_PALETTE'] if 'PONYSAY_KMS_PALETTE' in os.environ else None
|
env_kms = os.environ['PONYSAY_KMS_PALETTE'] if 'PONYSAY_KMS_PALETTE' in os.environ else None
|
||||||
if env_kms is None: env_kms = ''
|
if env_kms is None: env_kms = ''
|
||||||
|
|
||||||
|
@ -447,6 +450,7 @@ class Ponysay():
|
||||||
|
|
||||||
palette = env_kms
|
palette = env_kms
|
||||||
palettefile = env_kms.replace('\033]P', '')
|
palettefile = env_kms.replace('\033]P', '')
|
||||||
|
print(palettefile)
|
||||||
|
|
||||||
kmsponies = '/var/cache/ponysay/kmsponies/' + palettefile
|
kmsponies = '/var/cache/ponysay/kmsponies/' + palettefile
|
||||||
kmspony = (kmsponies + pony).replace('//', '/')
|
kmspony = (kmsponies + pony).replace('//', '/')
|
||||||
|
@ -727,6 +731,9 @@ class Backend():
|
||||||
self.__truncate()
|
self.__truncate()
|
||||||
|
|
||||||
|
|
||||||
|
'''
|
||||||
|
Converts all tabs in the message to spaces by expanding
|
||||||
|
'''
|
||||||
def __expandMessage(self):
|
def __expandMessage(self):
|
||||||
lines = self.message.split('\n')
|
lines = self.message.split('\n')
|
||||||
buf = ''
|
buf = ''
|
||||||
|
@ -750,6 +757,9 @@ class Backend():
|
||||||
self.message = buf[:-1]
|
self.message = buf[:-1]
|
||||||
|
|
||||||
|
|
||||||
|
'''
|
||||||
|
Loads the pony file
|
||||||
|
'''
|
||||||
def __loadFile(self):
|
def __loadFile(self):
|
||||||
ponystream = None
|
ponystream = None
|
||||||
try:
|
try:
|
||||||
|
@ -760,6 +770,9 @@ class Backend():
|
||||||
ponystream.close()
|
ponystream.close()
|
||||||
|
|
||||||
|
|
||||||
|
'''
|
||||||
|
Truncate output to the width of the screen
|
||||||
|
'''
|
||||||
def __truncate(self):
|
def __truncate(self):
|
||||||
if self.width is None:
|
if self.width is None:
|
||||||
return
|
return
|
||||||
|
@ -782,6 +795,9 @@ class Backend():
|
||||||
self.output = self.output[:-1]
|
self.output = self.output[:-1]
|
||||||
|
|
||||||
|
|
||||||
|
'''
|
||||||
|
Process the pony file and generate output to self.output
|
||||||
|
'''
|
||||||
def __processPony(self):
|
def __processPony(self):
|
||||||
self.output = ''
|
self.output = ''
|
||||||
|
|
||||||
|
@ -857,6 +873,9 @@ class Backend():
|
||||||
indent += 1
|
indent += 1
|
||||||
|
|
||||||
|
|
||||||
|
'''
|
||||||
|
Gets colour code att the currect offest in a buffer
|
||||||
|
'''
|
||||||
def __getcolour(self, input, offset):
|
def __getcolour(self, input, offset):
|
||||||
(i, n) = (offset, len(input))
|
(i, n) = (offset, len(input))
|
||||||
rc = input[i]
|
rc = input[i]
|
||||||
|
@ -889,6 +908,9 @@ class Backend():
|
||||||
return rc
|
return rc
|
||||||
|
|
||||||
|
|
||||||
|
'''
|
||||||
|
Generates a balloon with the message
|
||||||
|
'''
|
||||||
def __getballoon(self, width, height, left):
|
def __getballoon(self, width, height, left):
|
||||||
wrap = None
|
wrap = None
|
||||||
if self.wrapcolumn is not None:
|
if self.wrapcolumn is not None:
|
||||||
|
@ -913,6 +935,9 @@ class Backend():
|
||||||
return rc
|
return rc
|
||||||
|
|
||||||
|
|
||||||
|
'''
|
||||||
|
Wraps the message
|
||||||
|
'''
|
||||||
def __wrapMessage(self, message, wrap):
|
def __wrapMessage(self, message, wrap):
|
||||||
lines = message.split('\n')
|
lines = message.split('\n')
|
||||||
buf = ''
|
buf = ''
|
||||||
|
|
Loading…
Reference in a new issue