Skip to content

Commit

Permalink
Configuration file
Browse files Browse the repository at this point in the history
  • Loading branch information
svk committed Mar 22, 2010
1 parent b52570d commit 0c25a01
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 4 deletions.
3 changes: 2 additions & 1 deletion gamewidget.py
Expand Up @@ -421,6 +421,7 @@ def keyboard(self, key):
}[key]
except KeyError:
pass
from harmless7drl import DebugMode
if standardAction:
self.clearlog()
standardAction()
Expand All @@ -442,7 +443,7 @@ def keyboard(self, key):
from plot import displayHelp
displayHelp( self.main )
# elif False:
elif key == '!':
elif DebugMode and key == '!':
if self.main.query( SelectionMenuWidget, choices = [
(False, "No"),
(True, "Yes"),
Expand Down
12 changes: 12 additions & 0 deletions harmless7drl.cfg
@@ -0,0 +1,12 @@
[general]
debug=yes

[colours]
# Some terminals have trouble displaying bold black on black.
# If the bomber beetles seem invisible, you are suffering from
# this. If so, set blackOnBlack to something other than "black".
# You may need to start a new game to see the effect of a new
# setting.
# "blue" is suggested; just uncomment the following line.
blackOnBlack=blue

18 changes: 15 additions & 3 deletions harmless7drl.py
@@ -1,12 +1,24 @@
import copy

Signature = "Harmless7DRL"
Version = "Version 1.0 (7DRL)"
Version = "Version 1.1"
Author = "kaw"
Date = "March 14 2010"
Date = "?"
Email = "kaw.dev@gmail.com"

ForegroundBlack = "blue" # set to e.g. blue if bold black on black is hard to see
from ConfigParser import RawConfigParser, NoOptionError
Cfg = RawConfigParser()
Cfg.read( "harmless7drl.cfg" )

def getCfg( section, setting, default = None ):
try:
return Cfg.get( section, setting )
except NoOptionError:
return default

ForegroundBlack = getCfg( "colours", "blackOnBlack", "black" )
DebugMode = getCfg( "general", "debug", "no" ) == "yes"


class Widget:
def __init__(self, main = None, ui = None):
Expand Down

0 comments on commit 0c25a01

Please sign in to comment.