pyfa-org / Pyfa

Python fitting assistant, cross-platform fitting tool for EVE Online
GNU General Public License v3.0
1.59k stars 403 forks source link

Add button to search contracts for abyssal modules #2617

Open NicolasKion opened 4 weeks ago

NicolasKion commented 4 weeks ago

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!