diff --git a/demo.py b/demo.py index 1b5ef87..04bdc0f 100644 --- a/demo.py +++ b/demo.py @@ -149,7 +149,8 @@ class DemoRecorder(): def record(self, packet, encode=False): if packet[0][0] in ["FM", "ARUP", "CharsCheck"]: return - + + #print packet[0][0] with open(self.demofile, "a") as demofile: currtime = time.time() * 1000 diff = currtime - self.lasttime @@ -157,7 +158,6 @@ class DemoRecorder(): demofile.write(("wait#%d#%%" % diff) + "\n") line = "#".join(packet[0]) + "#%\n" - print packet[0][0] if encode: line = line.encode('utf-8') demofile.write(line) diff --git a/gameview.py b/gameview.py index e7976d4..89064a8 100644 --- a/gameview.py +++ b/gameview.py @@ -213,9 +213,9 @@ class ChatLogs(QtGui.QTextEdit): self.logfile = "logs/%d-%02d-%02d %02d.%02d.%02d.log" % (currtime[0], currtime[1], currtime[2], currtime[3], currtime[4], currtime[5]) else: if self.type == 0: - self.logfile = "logs/IC_%d-%02d-%02d %02d.%02d.%02d.log" % (currtime[0], currtime[1], currtime[2], currtime[3], currtime[4], currtime[5]) + self.logfile = "logs/%d-%02d-%02d %02d.%02d.%02d [IC].log" % (currtime[0], currtime[1], currtime[2], currtime[3], currtime[4], currtime[5]) else: - self.logfile = "logs/OOC_%d-%02d-%02d %02d.%02d.%02d.log" % (currtime[0], currtime[1], currtime[2], currtime[3], currtime[4], currtime[5]) + self.logfile = "logs/%d-%02d-%02d %02d.%02d.%02d [OOC].log" % (currtime[0], currtime[1], currtime[2], currtime[3], currtime[4], currtime[5]) else: self.logfile = None diff --git a/options.py b/options.py index 73f996f..0d6df67 100644 --- a/options.py +++ b/options.py @@ -80,6 +80,12 @@ class Settings(QtGui.QDialog): self.savetolog_combine.setChecked(False) savetolog_layout.addWidget(self.savetolog) savetolog_layout.addWidget(self.savetolog_combine) + + savedemos_layout = QtGui.QHBoxLayout() + self.savedemos = QtGui.QCheckBox() + self.savedemos.setText("Record demo files") + self.savedemos.setChecked(False) + savedemos_layout.addWidget(self.savedemos) textstaytime_layout = QtGui.QHBoxLayout() textstaytime_label = QtGui.QLabel("Text stay time (milliseconds)") @@ -156,6 +162,7 @@ class Settings(QtGui.QDialog): general_layout.addLayout(defaultoocname_layout) general_layout.addLayout(savetolog_layout) + general_layout.addLayout(savedemos_layout) general_layout.addWidget(separators[0]) general_layout.addLayout(textstaytime_layout) general_layout.addLayout(slide_layout) @@ -230,8 +237,9 @@ class Settings(QtGui.QDialog): def showSettings(self): if exists("AO2XP.ini"): self.inifile.read("AO2XP.ini") - self.savetolog.setChecked(ini.read_ini_bool(self.inifile, "General", "save logs")) - self.savetolog_combine.setChecked(ini.read_ini_bool(self.inifile, "General", "combined logs")) + self.savetolog.setChecked(ini.read_ini_bool(self.inifile, "General", "save logs", False)) + self.savetolog_combine.setChecked(ini.read_ini_bool(self.inifile, "General", "combined logs", False)) + self.savedemos.setChecked(ini.read_ini_bool(self.inifile, "General", "record demos", False)) try: self.defaultoocname.setText(ini.read_ini(self.inifile, "General", "OOC name").decode("utf-8")) except: @@ -260,6 +268,7 @@ class Settings(QtGui.QDialog): else: self.savetolog.setChecked(False) self.savetolog_combine.setChecked(False) + self.savedemos.setChecked(False) self.defaultoocname.setText("") self.defaultshowname.setText("") self.enableslide.setChecked(False) @@ -297,6 +306,7 @@ class Settings(QtGui.QDialog): if not self.inifile.has_section("Audio"): self.inifile.add_section("Audio") self.inifile.set("General", "save logs", self.savetolog.isChecked()) self.inifile.set("General", "combined logs", self.savetolog_combine.isChecked()) + self.inifile.set("General", "record demos", self.savedemos.isChecked()) self.inifile.set("General", "OOC name", self.defaultoocname.text().toUtf8()) self.inifile.set("General", "showname", self.defaultshowname.text().toUtf8()) self.inifile.set("General", "text stay time", self.textstaytime.value()) @@ -327,6 +337,11 @@ class Settings(QtGui.QDialog): self.gamewindow.gamewidget.icLog.set_logfiles(self.gamewindow.gamewidget.ooclog.logfile) self.gamewindow.gamewidget.slide_enabled = self.enableslide.isChecked() + if self.savedemos.isChecked(): + self.gamewindow.gamewidget.start_demo_recorder() + else: + self.gamewindow.gamewidget.demo_recorder = None + self.hide() def onCancelClicked(self):