def __init__(self, itemd=None, parent=None, **kwargs): QtWidgets.QWidget.__init__(self, parent, **kwargs) self.parent = parent if (itemd == None): self.itemd = item_format.base_item('') else: self.itemd = itemd VBox = QtWidgets.QVBoxLayout(self) self.nameLineEdit = QtWidgets.QLineEdit(self) self.nameLineEdit.setMaxLength(22) self.radioEquipable = QtWidgets.QRadioButton('equipable', self) self.radioUsable = QtWidgets.QRadioButton('usable', self) self.radioNone = QtWidgets.QRadioButton('none', self) self.checkboxUnique = QtWidgets.QCheckBox('unique', self) self.checkboxReusable = QtWidgets.QCheckBox('reusable', self) self.descriptionLineEdit = QtWidgets.QLineEdit(self) self.comboboxCategory = QtWidgets.QComboBox(self) self.statModWidget = StatModWidget(self) self.effectWidget = EffectWidget(self) self.actionWidget = actions_wdgt.tinyActionsWdgt( parent=self, ssettings=current_project.settings, nothis=True, isitem=True) self.actionWidget.setEnabled(False) self.statModWidget.setEnabled(False) self.effectWidget.setEnabled(False) self.checkboxReusable.setEnabled(False) self.radioUsable.toggled.connect(self.radioUsableChanged) self.radioEquipable.toggled.connect(self.radioEquipableChanged) for i in range(len(item_format.item_categories)): category = item_format.item_categories[i] self.comboboxCategory.insertItem(i, category) self.loadItem() VBox.addWidget(QtWidgets.QLabel('Item name:')) VBox.addWidget(self.nameLineEdit) VBox.addWidget(QtWidgets.QLabel('Item properties:')) VBox.addWidget(self.radioEquipable) VBox.addWidget(self.radioUsable) VBox.addWidget(self.radioNone) VBox.addWidget(self.checkboxUnique) VBox.addWidget(self.checkboxReusable) VBox.addWidget(QtWidgets.QLabel('Item description:')) VBox.addWidget(self.descriptionLineEdit) VBox.addWidget(QtWidgets.QLabel('Item category:')) VBox.addWidget(self.comboboxCategory) VBox.addWidget(self.statModWidget) VBox.addWidget(self.effectWidget) VBox.addWidget(self.actionWidget)
def __init__(self, itemd=None, parent=None, **kwargs): QtWidgets.QWidget.__init__(self, parent, **kwargs) self.parent = parent if(itemd==None): self.itemd = item_format.base_item('') else: self.itemd = itemd VBox = QtWidgets.QVBoxLayout(self) self.nameLineEdit = QtWidgets.QLineEdit(self) self.nameLineEdit.setMaxLength(22) self.radioEquipable = QtWidgets.QRadioButton('equipable',self) self.radioUsable = QtWidgets.QRadioButton('usable', self) self.radioNone = QtWidgets.QRadioButton('none', self) self.checkboxUnique = QtWidgets.QCheckBox('unique', self) self.checkboxReusable = QtWidgets.QCheckBox('reusable', self) self.descriptionLineEdit = QtWidgets.QLineEdit(self) self.comboboxCategory = QtWidgets.QComboBox(self) self.statModWidget = StatModWidget(self) self.effectWidget = EffectWidget(self) self.actionWidget = actions_wdgt.tinyActionsWdgt(parent=self, ssettings=current_project.settings, nothis=True, isitem=True) self.actionWidget.setEnabled(False) self.statModWidget.setEnabled(False) self.effectWidget.setEnabled(False) self.checkboxReusable.setEnabled(False) self.radioUsable.toggled.connect(self.radioUsableChanged) self.radioEquipable.toggled.connect(self.radioEquipableChanged) for i in range(len(item_format.item_categories)): category = item_format.item_categories[i] self.comboboxCategory.insertItem(i,category) self.loadItem() VBox.addWidget(QtWidgets.QLabel('Item name:')) VBox.addWidget(self.nameLineEdit) VBox.addWidget(QtWidgets.QLabel('Item properties:')) VBox.addWidget(self.radioEquipable) VBox.addWidget(self.radioUsable) VBox.addWidget(self.radioNone) VBox.addWidget(self.checkboxUnique) VBox.addWidget(self.checkboxReusable) VBox.addWidget(QtWidgets.QLabel('Item description:')) VBox.addWidget(self.descriptionLineEdit) VBox.addWidget(QtWidgets.QLabel('Item category:')) VBox.addWidget(self.comboboxCategory) VBox.addWidget(self.statModWidget) VBox.addWidget(self.effectWidget) VBox.addWidget(self.actionWidget)
def newItem(self): item = item_format.base_item('newItem') needsrefresh = self.itemf.additem(item) if(needsrefresh): self.load() items = self.itemf.getitemsname() for i in range(len(items)): itemname = items[i] if(itemname=='newItem'): self.itemsList.setCurrentRow(i) return
def currentChanged(self,current,previous): if(current == previous): return previousname = '' if(previous != None): previousname = previous.text() if(current != None): itemname = current.text() itemjson = self.itemf.getitem(itemname) item = item_format.base_item(itemname,jsonTree=itemjson) self.currentItemChanged.emit(item,previousname)
def getCurrentItemDescriptor(self): itemname = self.currentItem() if(itemname!=None): itemjson = self.itemf.getitem(itemname) item = item_format.base_item(itemname,jsonTree=itemjson) return item
def newItem(self): self.itemd = item_format.base_item('') self.loadItem()