private inventory is now persistent
This commit is contained in:
parent
70041822bb
commit
169ce1c44a
37
gameview.py
37
gameview.py
@ -1559,8 +1559,12 @@ class gui(QtGui.QWidget):
|
||||
del self.privateevidence[self.selectedevi]
|
||||
self.privatedropdown.removeItem(self.selectedevi)
|
||||
|
||||
def onExportEvidence(self):
|
||||
path = str(QtGui.QFileDialog.getSaveFileName(self, "Save evidence", AOpath, "Evidence (*.ini)"))
|
||||
def onExportEvidence(self, is_autosave=False):
|
||||
if not exists("evidence"):
|
||||
os.mkdir("evidence")
|
||||
|
||||
path = unicode(QtGui.QFileDialog.getSaveFileName(self, "Save evidence", "evidence", "Evidence (*.ini)")) if not is_autosave else "evidence/inventory.ini"
|
||||
|
||||
if path:
|
||||
evidence = self.evidence if not self.privateinv else self.privateevidence
|
||||
inifile = ConfigParser()
|
||||
@ -1579,15 +1583,19 @@ class gui(QtGui.QWidget):
|
||||
|
||||
inifile.write(open(path, "wb"))
|
||||
|
||||
def onImportEvidence(self):
|
||||
if not self.privateinv:
|
||||
if QtGui.QMessageBox.warning(self, "Import evidence", 'This will OVERWRITE the global evidence server-side.\n\nContinue?', QtGui.QMessageBox.Yes | QtGui.QMessageBox.No, QtGui.QMessageBox.No) == QtGui.QMessageBox.No:
|
||||
return
|
||||
else:
|
||||
if QtGui.QMessageBox.warning(self, "Import evidence", 'This will OVERWRITE your private evidence.\n\nContinue?', QtGui.QMessageBox.Yes | QtGui.QMessageBox.No, QtGui.QMessageBox.No) == QtGui.QMessageBox.No:
|
||||
return
|
||||
def onImportEvidence(self, is_autoload=False):
|
||||
if not is_autoload:
|
||||
if not self.privateinv:
|
||||
if QtGui.QMessageBox.warning(self, "Import evidence", 'This will OVERWRITE the global evidence server-side.\n\nContinue?', QtGui.QMessageBox.Yes | QtGui.QMessageBox.No, QtGui.QMessageBox.No) == QtGui.QMessageBox.No:
|
||||
return
|
||||
else:
|
||||
if QtGui.QMessageBox.warning(self, "Import evidence", 'This will OVERWRITE your private evidence.\n\nContinue?', QtGui.QMessageBox.Yes | QtGui.QMessageBox.No, QtGui.QMessageBox.No) == QtGui.QMessageBox.No:
|
||||
return
|
||||
|
||||
if not exists("evidence"):
|
||||
os.mkdir("evidence")
|
||||
|
||||
path = str(QtGui.QFileDialog.getOpenFileName(self, "Load evidence", AOpath, "Evidence (*.ini)"))
|
||||
path = unicode(QtGui.QFileDialog.getOpenFileName(self, "Load evidence", "evidence", "Evidence (*.ini)")) if not is_autoload else "evidence/inventory.ini"
|
||||
if path and exists(path):
|
||||
evidence = []
|
||||
inifile = ConfigParser()
|
||||
@ -1598,7 +1606,7 @@ class gui(QtGui.QWidget):
|
||||
image = ini.read_ini(inifile, section, "image", "empty.png")
|
||||
evidence.append([name, description, image])
|
||||
|
||||
if self.privateinv:
|
||||
if self.privateinv or is_autoload:
|
||||
dropdown = self.privatedropdown
|
||||
self.privateevidence = evidence
|
||||
if dropdown.count() > 0:
|
||||
@ -1608,6 +1616,9 @@ class gui(QtGui.QWidget):
|
||||
for evi in evidence:
|
||||
dropdown.addItem(evi[0])
|
||||
dropdown.setCurrentIndex(self.selectedevi)
|
||||
|
||||
if not is_autoload:
|
||||
self.onExportEvidence(True)
|
||||
elif evidence:
|
||||
if self.evidence:
|
||||
for i in range(len(self.evidence)):
|
||||
@ -3029,7 +3040,6 @@ class gui(QtGui.QWidget):
|
||||
|
||||
for area in areas[0]:
|
||||
areaitem = QtGui.QListWidgetItem()
|
||||
areaitem.setText("Area\n aaa\n aaa")
|
||||
self.areaitems.addItem(areaitem)
|
||||
|
||||
for pid in playerlist:
|
||||
@ -3040,6 +3050,8 @@ class gui(QtGui.QWidget):
|
||||
self.musicslider.setValue(ini.read_ini_int("AO2XP.ini", "Audio", "Music volume", 100))
|
||||
self.soundslider.setValue(ini.read_ini_int("AO2XP.ini", "Audio", "Sound volume", 100))
|
||||
self.blipslider.setValue(ini.read_ini_int("AO2XP.ini", "Audio", "Blip volume", 100))
|
||||
|
||||
self.onImportEvidence(True)
|
||||
|
||||
#thread.start_new_thread(self.tcp_thread, ())
|
||||
self.tcpthread = TCP_Thread(self)
|
||||
@ -3207,6 +3219,7 @@ class EditEvidenceDialog(QtGui.QDialog):
|
||||
else:
|
||||
self.gamegui.privateevidence.append([name, desc, self.filename])
|
||||
self.gamegui.privatedropdown.addItem(name)
|
||||
self.onExportEvidence(True)
|
||||
|
||||
self.eviname.setText('')
|
||||
self.evidesc.setText('')
|
||||
|
Loading…
Reference in New Issue
Block a user