letzte Hilfeseiten.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import logging
|
||||
import FileReader
|
||||
from os.path import exists
|
||||
|
||||
class HilfeModul():
|
||||
|
||||
@@ -12,8 +13,9 @@ class HilfeModul():
|
||||
|
||||
self.world = world
|
||||
|
||||
def readTxt(self, datei):
|
||||
self.check()
|
||||
|
||||
def readTxt(self, datei):
|
||||
logging.debug(f'öffne Hilfedatei {datei}')
|
||||
reader = FileReader.FileReader(datei)
|
||||
|
||||
@@ -23,6 +25,18 @@ class HilfeModul():
|
||||
|
||||
return lines
|
||||
|
||||
def check(self):
|
||||
|
||||
for id in self.world.befehle:
|
||||
befehl = self.world.befehle[id]
|
||||
|
||||
helptxt = self.baueHilfedatei(befehl.key)
|
||||
|
||||
logging.debug(f'suche Hilfedatei {helptxt}')
|
||||
if not exists(helptxt):
|
||||
logging.warn(f'Hilfedatei {helptxt} existiert nicht')
|
||||
|
||||
|
||||
def hilfe(self, command):
|
||||
generalHelp = True
|
||||
if not self.isBlank(command):
|
||||
@@ -42,6 +56,8 @@ class HilfeModul():
|
||||
else:
|
||||
self.world.printText('hilfe')
|
||||
|
||||
def baueHilfedatei(self, key):
|
||||
return f'ascii/hilfe/cmd-{key}.txt'
|
||||
def findHilfetext(self, command):
|
||||
|
||||
logging.debug(f'suche Hilfetext zu {command}')
|
||||
@@ -52,10 +68,10 @@ class HilfeModul():
|
||||
|
||||
logging.debug(f'cmdid= {cmdid}')
|
||||
|
||||
# logging.debug(f'vergleiche {befehl.name.lower()} mit {command.lower()}')
|
||||
logging.debug(f'vergleiche {befehl.name.lower()} mit {command.lower()}')
|
||||
|
||||
if befehl.name.lower() == command.lower():
|
||||
logging.debug(f'gefundener Befehl: {befehl.name}')
|
||||
return f'ascii/hilfe/cmd-{befehl.key}.txt'
|
||||
return self.baueHilfedatei(befehl.key)
|
||||
|
||||
return None
|
Reference in New Issue
Block a user