def __init__(self,waffe=None):
super().__init__()
if Wolke.Debug:
print("Initializing WaffenPicker...")
self.waffe = None
if waffe is not None and waffe in Wolke.DB.waffen:
self.current = waffe
else:
self.current = ""
self.Form = QtWidgets.QDialog()
self.ui = CharakterWaffen.Ui_Dialog()
self.ui.setupUi(self.Form)
self.Form.setWindowFlags(
QtCore.Qt.Window |
QtCore.Qt.CustomizeWindowHint |
QtCore.Qt.WindowTitleHint |
QtCore.Qt.WindowCloseButtonHint)
if Wolke.Debug:
print("Ui is Setup...")
currSet = self.current != ""
for kind in Definitionen.Kampftalente:
parent = QtWidgets.QTreeWidgetItem(self.ui.treeWeapons)
parent.setText(0,kind)
parent.setText(1,"")
parent.setExpanded(True)
wafs = []
for waf in Wolke.DB.waffen:
if Wolke.DB.waffen[waf].fertigkeit == kind:
wafs.append(waf)
wafs.sort()
for el in wafs:
if not currSet:
self.current = el
currSet = True
child = QtWidgets.QTreeWidgetItem(parent)
child.setText(0,el)
child.setText(1,Wolke.DB.waffen[el].talent)
self.ui.treeWeapons.sortItems(1,QtCore.Qt.AscendingOrder)
if Wolke.Debug:
print("Tree Filled...")
self.ui.treeWeapons.itemSelectionChanged.connect(self.changeHandler)
self.ui.treeWeapons.header().setSectionResizeMode(0,1)
self.updateInfo()
if Wolke.Debug:
print("Info Updated...")
self.Form.setWindowModality(QtCore.Qt.ApplicationModal)
self.Form.show()
self.ret = self.Form.exec_()
if self.ret == QtWidgets.QDialog.Accepted and self.current != '':
self.waffe = Wolke.DB.waffen[self.current]
else:
self.waffe = None
评论列表
文章目录