aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pycrctrl.py69
1 files changed, 67 insertions, 2 deletions
diff --git a/pycrctrl.py b/pycrctrl.py
index 4b87516..01b9b90 100644
--- a/pycrctrl.py
+++ b/pycrctrl.py
@@ -256,6 +256,7 @@ class PyCRCtrl(object):
self.loadCapabilities()
self.loadScenarioList()
self.codec = QTextCodec.codecForName(self.config.get("encoding"))
+
self.queue = queue.Queue(5)
if self.config.get("engine") == "openclonk-server":
self.updater = Updater(self)
@@ -308,8 +309,69 @@ class PyCRCtrl(object):
if self.path == None:
return False
- self.config = json.load(open(os.path.join(self.path, config),"r"))
- return True
+ config = os.path.join(self.path, config)
+
+ if os.path.isdir(config):
+ return False
+
+ elif os.path.isfile(config):
+ self.config = json.load(open(os.path.join(self.path, config),"r"))
+ return True
+
+ elif not os.path.exists(config):
+ c = {
+ "General" : {
+ "Directories" : {
+ "plugins" : []
+ },
+ "useLogfile" : True,
+ },
+
+ "Clonk" : {
+ "engine" : "clonk",
+ "commandline" : ["fullscreen", ["lobby",300], ["config","config.txt"], "record", "faircrew"],
+ "commandlinePrefix" : "/",
+ "prefix" : "@",
+
+ "Channels" : {
+ "parent" : "",
+ "ingame" : ""
+ },
+
+ "RegExps" : {
+ "lobbyStartExp" : "",
+ "startExp" : "",
+ "joinExp" : "",
+ "leaveExp" : "",
+ "shutdownExp" : ""
+ }
+
+ "autohost" : False,
+ "IRC" : {
+ "ingamechat" : True
+ },
+
+ "Rights" : {
+ "admin" : True,
+ "moderator" : True
+ }
+ },
+
+ "Updater" : {
+ "enabled" : False,
+ "Addresses" : {
+ "snapshotList" : "",
+ "snapshotDownload" : "",
+ "autobuildList" : "",
+ "autobuildAddress" : ""
+ }
+ }
+ }
+ }
+
+ json.dump(c, open(config, "w"))
+ return c
+
def decodeRegExp(self, regexp):
return self.codec.toUnicode(base64.b64decode(regexp))
@@ -635,6 +697,9 @@ class PyCRCtrl(object):
except KeyError:
return False
+
+ def registerHook(self, hook, function, replace=False):
+ pass
#
#