Fix some fucking shit with importing wx
This commit is contained in:
@@ -23,8 +23,6 @@ import threading
|
||||
from collections import OrderedDict
|
||||
from itertools import chain
|
||||
|
||||
# noinspection PyPackageRequirements
|
||||
import wx
|
||||
from logbook import Logger
|
||||
from sqlalchemy.sql import or_
|
||||
|
||||
@@ -38,7 +36,12 @@ from service.settings import SettingsProvider
|
||||
from utils.cjk import isStringCjk
|
||||
|
||||
pyfalog = Logger(__name__)
|
||||
_t = wx.GetTranslation
|
||||
|
||||
|
||||
def _t(s):
|
||||
import wx
|
||||
return wx.GetTranslation(s)
|
||||
|
||||
|
||||
# Event which tells threads dependent on Market that it's initialized
|
||||
mktRdy = threading.Event()
|
||||
@@ -77,6 +80,7 @@ class ShipBrowserWorkerThread(threading.Thread):
|
||||
set_ = sMkt.getShipList(id_)
|
||||
cache[id_] = set_
|
||||
|
||||
import wx
|
||||
wx.CallAfter(callback, (id_, set_))
|
||||
except (KeyboardInterrupt, SystemExit):
|
||||
raise
|
||||
@@ -170,6 +174,7 @@ class SearchWorkerThread(threading.Thread):
|
||||
for item in all_results:
|
||||
if sMkt.getPublicityByItem(item):
|
||||
item_IDs.add(item.ID)
|
||||
import wx
|
||||
wx.CallAfter(callback, sorted(item_IDs))
|
||||
|
||||
def scheduleSearch(self, text, callback, filterName=None):
|
||||
@@ -268,7 +273,7 @@ class Market:
|
||||
self.les_grp = types_Group()
|
||||
self.les_grp.ID = -1
|
||||
self.les_grp.name = "Limited Issue Ships"
|
||||
self.les_grp.displayName = _t("Limited Issue Ships")
|
||||
self.les_grp.displayName = "Limited Issue Ships"
|
||||
self.les_grp.published = True
|
||||
ships = self.getCategory("Ship")
|
||||
self.les_grp.category = ships
|
||||
|
||||
12
service/port/active_state.py
Normal file
12
service/port/active_state.py
Normal file
@@ -0,0 +1,12 @@
|
||||
# Module-state logic shared by port (EFT import) and gui (fit commands).
|
||||
# Uses gamedata (item type + attributes), no hardcoded effect names.
|
||||
|
||||
from eos.const import FittingModuleState
|
||||
from service.market import Market
|
||||
|
||||
|
||||
def activeStateLimit(itemIdentity):
|
||||
item = Market.getInstance().getItem(itemIdentity)
|
||||
if not item.isType("active") or item.getAttribute("activationBlocked", 0) > 0:
|
||||
return FittingModuleState.ONLINE
|
||||
return FittingModuleState.ACTIVE
|
||||
@@ -47,6 +47,8 @@ SLOT_ORDER = (FittingSlot.LOW, FittingSlot.MED, FittingSlot.HIGH, FittingSlot.RI
|
||||
OFFLINE_SUFFIX = '/offline'
|
||||
NAME_CHARS = r'[^,/\[\]]' # Characters which are allowed to be used in name
|
||||
|
||||
from service.port.active_state import activeStateLimit
|
||||
|
||||
|
||||
class MutationExportData:
|
||||
|
||||
@@ -240,7 +242,6 @@ def exportCargo(cargos):
|
||||
|
||||
|
||||
def importEft(lines):
|
||||
from gui.fitCommands.helpers import activeStateLimit
|
||||
lines = _importPrepare(lines)
|
||||
try:
|
||||
fit = _importCreateFit(lines)
|
||||
@@ -877,7 +878,6 @@ class AbstractFit:
|
||||
self.getContainerBySlot(m.slot).append(m)
|
||||
|
||||
def __makeModule(self, itemSpec):
|
||||
from gui.fitCommands.helpers import activeStateLimit
|
||||
# Mutate item if needed
|
||||
m = None
|
||||
if itemSpec.mutationIdx in self.mutations:
|
||||
|
||||
@@ -24,7 +24,6 @@ import timeit
|
||||
from itertools import chain
|
||||
|
||||
import math
|
||||
import wx
|
||||
from logbook import Logger
|
||||
|
||||
from eos import db
|
||||
@@ -51,6 +50,8 @@ class Price:
|
||||
sources = {}
|
||||
|
||||
def __init__(self):
|
||||
# Import market sources so they register; avoid at module level so server path never loads them
|
||||
from service.marketSources import evemarketdata, fuzzwork, cevemarket, evetycoon # noqa: F401
|
||||
# Start price fetcher
|
||||
self.priceWorkerThread = PriceWorkerThread()
|
||||
self.priceWorkerThread.daemon = True
|
||||
@@ -253,6 +254,7 @@ class PriceWorkerThread(threading.Thread):
|
||||
if len(requests) > 0:
|
||||
Price.fetchPrices(requests, fetchTimeout, validityOverride)
|
||||
|
||||
import wx
|
||||
wx.CallAfter(callback)
|
||||
queue.task_done()
|
||||
|
||||
@@ -273,7 +275,3 @@ class PriceWorkerThread(threading.Thread):
|
||||
|
||||
def stop(self):
|
||||
self.running = False
|
||||
|
||||
|
||||
# Import market sources only to initialize price source modules, they register on their own
|
||||
from service.marketSources import evemarketdata, fuzzwork, cevemarket, evetycoon # noqa: E402
|
||||
|
||||
Reference in New Issue
Block a user