def UpdateFileList(self, mode): SearchName = str(self.PickSearchItemEditLine.GetText()) SelectedIndex = self.PickfileListBox.GetSelectedItem() self.__RefreshFileList() try: lines = open(app.GetLocalePath() + "/item_list.txt", "r").readlines() except IOError: OpenLog.DebugPrint( "Load Itemlist Error, you have so set the IDs manually") self.Close() for line in lines: tokens = str(line).split("\t") Index = str(tokens[0]) try: Itemname = item.GetItemName(item.SelectItem(int(Index))) except Exception: continue if mode == 1: if Index and str(Itemname) != "": self.PickfileListBox.AppendItem( OpenLib.Item(Index + " " + Itemname)) elif mode == 2: if str(Itemname).find(str(SearchName)) != -1: self.PickfileListBox.AppendItem( OpenLib.Item(Index + " " + Itemname)) elif mode == 3: if str(Itemname) == str( SelectedIndex.GetText().split(" ")[1]): ItemValue = Index.split(" ")[0] self.CreateItemDialog.UpdateItem(int(ItemValue)) self.Close() break
def UpdatePickFilterList(self): searchValue = self.PickSearchItemEditLine.GetText() self.PickfileListBox.RemoveAllItems() for filterItem in sorted(self.pickFilter): item.SelectItem(filterItem) name = item.GetItemName() if searchValue in name: self.PickfileListBox.AppendItem( OpenLib.Item(str(filterItem) + " " + name))
def UpdateFileList(self): self.ListBoxItems.RemoveAllItems() for i in xrange(100): ItemIndex = player.GetItemIndex(i) if ItemIndex != 0: ItemName = item.GetItemName(item.SelectItem(int(ItemIndex))) self.ListBoxItems.AppendItem( OpenLib.Item( str(i) + ' ' + str(player.GetItemIndex(i)) + ' ' + ItemName))
def UpdateLocationList(self): self.fileListBox.RemoveAllItems() for loc in sorted(self.locations, key=lambda x: x.level): self.fileListBox.AppendItem(OpenLib.Item(str(loc)))
def UpdateSellFilterList(self): for filterItem in sorted(self.sellItems): item.SelectItem(filterItem) name = item.GetItemName() self.ShopFileListBox.AppendItem( OpenLib.Item(str(filterItem) + " " + name))