add music item from gui + option to edit music.ini with default editor
This commit is contained in:
parent
9bb049f7d1
commit
b3fd870981
22
gameview.py
22
gameview.py
@ -1930,14 +1930,23 @@ class GUI(QtGui.QWidget):
|
|||||||
QtGui.QApplication.clipboard().setText(self.musicItems.currentItem().text())
|
QtGui.QApplication.clipboard().setText(self.musicItems.currentItem().text())
|
||||||
|
|
||||||
def onActMusicAddTriggered(self):
|
def onActMusicAddTriggered(self):
|
||||||
title, ok = QtGui.QInputDialog.getText(self, "Add new song", "Please enter a title for the song.")
|
title, ok = QtGui.QInputDialog.getText(self, "Add new song", "Please enter a title for the song. Leave this empty to add a separator that acts as music stop.")
|
||||||
if title and ok:
|
url = QtCore.QString("")
|
||||||
title.replace("=", "")
|
if ok:
|
||||||
url, ok = QtGui.QInputDialog.getText(self, "Add new song", "Please enter an URL for the song.")
|
ok = False
|
||||||
if url and ok:
|
if not title:
|
||||||
|
title = QtCore.QString("--------------------------")
|
||||||
|
ok = True
|
||||||
|
if not ok:
|
||||||
|
url, ok = QtGui.QInputDialog.getText(self, "Add new song", "Please enter an URL for the song.")
|
||||||
|
if ok:
|
||||||
|
title.replace("=", "-")
|
||||||
|
if ok:
|
||||||
|
if not url:
|
||||||
|
url = "~stop.mp3"
|
||||||
with open(AO2XPpath + "music.ini", "ab") as f:
|
with open(AO2XPpath + "music.ini", "ab") as f:
|
||||||
f.write(("\n" + title + " = " + url).toUtf8())
|
f.write(("\n" + title + " = " + url).toUtf8())
|
||||||
self.onActMusicRefreshTriggered()
|
self.onActMusicRefreshTriggered()
|
||||||
|
|
||||||
def onActMusicEditTriggered(self):
|
def onActMusicEditTriggered(self):
|
||||||
pass
|
pass
|
||||||
@ -1958,7 +1967,6 @@ class GUI(QtGui.QWidget):
|
|||||||
if not init:
|
if not init:
|
||||||
self.musicItems.clear()
|
self.musicItems.clear()
|
||||||
self.loadAllMusic()
|
self.loadAllMusic()
|
||||||
print self.musicListPrivate
|
|
||||||
|
|
||||||
def onActMusicSwitchTriggered(self):
|
def onActMusicSwitchTriggered(self):
|
||||||
self.privateMusicSelected = not self.privateMusicSelected
|
self.privateMusicSelected = not self.privateMusicSelected
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user