add demo recording setting
This commit is contained in:
parent
81e71bccb8
commit
529ba583b7
2
demo.py
2
demo.py
@ -150,6 +150,7 @@ class DemoRecorder():
|
|||||||
if packet[0][0] in ["FM", "ARUP", "CharsCheck"]:
|
if packet[0][0] in ["FM", "ARUP", "CharsCheck"]:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
#print packet[0][0]
|
||||||
with open(self.demofile, "a") as demofile:
|
with open(self.demofile, "a") as demofile:
|
||||||
currtime = time.time() * 1000
|
currtime = time.time() * 1000
|
||||||
diff = currtime - self.lasttime
|
diff = currtime - self.lasttime
|
||||||
@ -157,7 +158,6 @@ class DemoRecorder():
|
|||||||
demofile.write(("wait#%d#%%" % diff) + "\n")
|
demofile.write(("wait#%d#%%" % diff) + "\n")
|
||||||
|
|
||||||
line = "#".join(packet[0]) + "#%\n"
|
line = "#".join(packet[0]) + "#%\n"
|
||||||
print packet[0][0]
|
|
||||||
if encode:
|
if encode:
|
||||||
line = line.encode('utf-8')
|
line = line.encode('utf-8')
|
||||||
demofile.write(line)
|
demofile.write(line)
|
||||||
|
@ -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])
|
self.logfile = "logs/%d-%02d-%02d %02d.%02d.%02d.log" % (currtime[0], currtime[1], currtime[2], currtime[3], currtime[4], currtime[5])
|
||||||
else:
|
else:
|
||||||
if self.type == 0:
|
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:
|
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:
|
else:
|
||||||
self.logfile = None
|
self.logfile = None
|
||||||
|
|
||||||
|
19
options.py
19
options.py
@ -81,6 +81,12 @@ class Settings(QtGui.QDialog):
|
|||||||
savetolog_layout.addWidget(self.savetolog)
|
savetolog_layout.addWidget(self.savetolog)
|
||||||
savetolog_layout.addWidget(self.savetolog_combine)
|
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_layout = QtGui.QHBoxLayout()
|
||||||
textstaytime_label = QtGui.QLabel("Text stay time (milliseconds)")
|
textstaytime_label = QtGui.QLabel("Text stay time (milliseconds)")
|
||||||
self.textstaytime = QtGui.QSpinBox()
|
self.textstaytime = QtGui.QSpinBox()
|
||||||
@ -156,6 +162,7 @@ class Settings(QtGui.QDialog):
|
|||||||
|
|
||||||
general_layout.addLayout(defaultoocname_layout)
|
general_layout.addLayout(defaultoocname_layout)
|
||||||
general_layout.addLayout(savetolog_layout)
|
general_layout.addLayout(savetolog_layout)
|
||||||
|
general_layout.addLayout(savedemos_layout)
|
||||||
general_layout.addWidget(separators[0])
|
general_layout.addWidget(separators[0])
|
||||||
general_layout.addLayout(textstaytime_layout)
|
general_layout.addLayout(textstaytime_layout)
|
||||||
general_layout.addLayout(slide_layout)
|
general_layout.addLayout(slide_layout)
|
||||||
@ -230,8 +237,9 @@ class Settings(QtGui.QDialog):
|
|||||||
def showSettings(self):
|
def showSettings(self):
|
||||||
if exists("AO2XP.ini"):
|
if exists("AO2XP.ini"):
|
||||||
self.inifile.read("AO2XP.ini")
|
self.inifile.read("AO2XP.ini")
|
||||||
self.savetolog.setChecked(ini.read_ini_bool(self.inifile, "General", "save 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"))
|
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:
|
try:
|
||||||
self.defaultoocname.setText(ini.read_ini(self.inifile, "General", "OOC name").decode("utf-8"))
|
self.defaultoocname.setText(ini.read_ini(self.inifile, "General", "OOC name").decode("utf-8"))
|
||||||
except:
|
except:
|
||||||
@ -260,6 +268,7 @@ class Settings(QtGui.QDialog):
|
|||||||
else:
|
else:
|
||||||
self.savetolog.setChecked(False)
|
self.savetolog.setChecked(False)
|
||||||
self.savetolog_combine.setChecked(False)
|
self.savetolog_combine.setChecked(False)
|
||||||
|
self.savedemos.setChecked(False)
|
||||||
self.defaultoocname.setText("")
|
self.defaultoocname.setText("")
|
||||||
self.defaultshowname.setText("")
|
self.defaultshowname.setText("")
|
||||||
self.enableslide.setChecked(False)
|
self.enableslide.setChecked(False)
|
||||||
@ -297,6 +306,7 @@ class Settings(QtGui.QDialog):
|
|||||||
if not self.inifile.has_section("Audio"): self.inifile.add_section("Audio")
|
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", "save logs", self.savetolog.isChecked())
|
||||||
self.inifile.set("General", "combined logs", self.savetolog_combine.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", "OOC name", self.defaultoocname.text().toUtf8())
|
||||||
self.inifile.set("General", "showname", self.defaultshowname.text().toUtf8())
|
self.inifile.set("General", "showname", self.defaultshowname.text().toUtf8())
|
||||||
self.inifile.set("General", "text stay time", self.textstaytime.value())
|
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.icLog.set_logfiles(self.gamewindow.gamewidget.ooclog.logfile)
|
||||||
self.gamewindow.gamewidget.slide_enabled = self.enableslide.isChecked()
|
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()
|
self.hide()
|
||||||
|
|
||||||
def onCancelClicked(self):
|
def onCancelClicked(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user