Pyfa icon indicating copy to clipboard operation
Pyfa copied to clipboard

Add button to search contracts for abyssal modules

Open NicolasKion opened this issue 1 year ago • 0 comments

It would be nice if Pyfa had a button that would open up a search for a specific abyssal module.

It could look similar to this:

Bildschirmfoto 2024-06-08 um 18 01 53

The required change for that should also be pretty straight forward:

# ItemMutator.py

# ...
import webbrowser


class ItemMutatorPanel():
    def __init__(self, parent):
        # ...
         self.searchContractsBtn = wx.Button(self, label="Search contracts")
        self.searchContractsBtn.Bind(wx.EVT_BUTTON, self.OnSearchContracts)
        footerSizer.Add(self.searchContractsBtn, 0, wx.ALIGN_CENTER_VERTICAL | wx.LEFT, 5)
        # ...

    def OnSearchContracts(self, event):
        baseUrl = "https://mutamarket.com/modules/"
        typeString = f"type/{self.stuff.item.name.replace(' ', '-')}/"
        attributeString = "attributes/"
        for attribute in self.mutaList.stuff.mutators.values():
            attributeString += f"{attribute.attribute.name}/{attribute.value}/"
        attributeString = attributeString[:-1]
        url = baseUrl + typeString + attributeString
        webbrowser.open(url)

I'm happy to discuss other option too!

NicolasKion avatar Jun 08 '24 16:06 NicolasKion