Merge branch 'master' into ammo_graph

This commit is contained in:
DarkPhoenix
2019-10-10 12:41:30 +03:00
49 changed files with 155 additions and 225 deletions

View File

@@ -88,12 +88,12 @@ class BoosterView(d.Display):
def kbEvent(self, event):
keycode = event.GetKeyCode()
mstate = wx.GetMouseState()
if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE:
modifiers = event.GetModifiers()
if keycode == wx.WXK_ESCAPE and modifiers == wx.MOD_NONE:
self.unselectAll()
elif keycode == 65 and mstate.GetModifiers() == wx.MOD_CONTROL:
elif keycode == 65 and modifiers == wx.MOD_CONTROL:
self.selectAll()
elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE) and mstate.GetModifiers() == wx.MOD_NONE:
elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE) and modifiers == wx.MOD_NONE:
boosters = self.getSelectedBoosters()
self.removeBoosters(boosters)
event.Skip()

View File

@@ -104,12 +104,12 @@ class CargoView(d.Display):
def kbEvent(self, event):
keycode = event.GetKeyCode()
mstate = wx.GetMouseState()
if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE:
modifiers = event.GetModifiers()
if keycode == wx.WXK_ESCAPE and modifiers == wx.MOD_NONE:
self.unselectAll()
elif keycode == 65 and mstate.GetModifiers() == wx.MOD_CONTROL:
elif keycode == 65 and modifiers == wx.MOD_CONTROL:
self.selectAll()
elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE) and mstate.GetModifiers() == wx.MOD_NONE:
elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE) and modifiers == wx.MOD_NONE:
cargos = self.getSelectedCargos()
self.removeCargos(cargos)
event.Skip()

View File

@@ -102,12 +102,12 @@ class CommandView(d.Display):
def kbEvent(self, event):
keycode = event.GetKeyCode()
mstate = wx.GetMouseState()
if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE:
modifiers = event.GetModifiers()
if keycode == wx.WXK_ESCAPE and modifiers == wx.MOD_NONE:
self.unselectAll()
elif keycode == 65 and mstate.GetModifiers() == wx.MOD_CONTROL:
elif keycode == 65 and modifiers == wx.MOD_CONTROL:
self.selectAll()
elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE) and mstate.GetModifiers() == wx.MOD_NONE:
elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE) and modifiers == wx.MOD_NONE:
commandFits = self.getSelectedCommandFits()
self.removeCommandFits(commandFits)
event.Skip()

View File

@@ -120,12 +120,12 @@ class DroneView(Display):
def kbEvent(self, event):
keycode = event.GetKeyCode()
mstate = wx.GetMouseState()
if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE:
modifiers = event.GetModifiers()
if keycode == wx.WXK_ESCAPE and modifiers == wx.MOD_NONE:
self.unselectAll()
elif keycode == 65 and mstate.GetModifiers() == wx.MOD_CONTROL:
elif keycode == 65 and modifiers == wx.MOD_CONTROL:
self.selectAll()
elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE) and mstate.GetModifiers() == wx.MOD_NONE:
elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE) and modifiers == wx.MOD_NONE:
drones = self.getSelectedDrones()
self.removeDroneStacks(drones)
event.Skip()
@@ -260,7 +260,7 @@ class DroneView(Display):
drone = self.drones[row]
except IndexError:
return
if wx.GetMouseState().GetModifiers() == wx.MOD_ALT:
if event.GetModifiers() == wx.MOD_ALT:
self.removeDroneStacks([drone])
else:
self.removeDrone(drone)

View File

@@ -205,12 +205,12 @@ class FighterDisplay(d.Display):
def kbEvent(self, event):
keycode = event.GetKeyCode()
mstate = wx.GetMouseState()
if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE:
modifiers = event.GetModifiers()
if keycode == wx.WXK_ESCAPE and modifiers == wx.MOD_NONE:
self.unselectAll()
elif keycode == 65 and mstate.GetModifiers() == wx.MOD_CONTROL:
elif keycode == 65 and modifiers == wx.MOD_CONTROL:
self.selectAll()
elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE) and mstate.GetModifiers() == wx.MOD_NONE:
elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE) and modifiers == wx.MOD_NONE:
fighters = self.getSelectedFighters()
self.removeFighters(fighters)
event.Skip()
@@ -315,12 +315,11 @@ class FighterDisplay(d.Display):
if row != -1:
col = self.getColumn(event.Position)
if col != self.getColIndex(State):
mstate = wx.GetMouseState()
try:
fighter = self.fighters[row]
except IndexError:
return
if mstate.GetModifiers() == wx.MOD_ALT:
if event.GetModifiers() == wx.MOD_ALT:
fighters = getSimilarFighters(self.original, fighter)
else:
fighters = [fighter]

View File

@@ -162,12 +162,12 @@ class ImplantDisplay(d.Display):
def kbEvent(self, event):
keycode = event.GetKeyCode()
mstate = wx.GetMouseState()
if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE:
modifiers = event.GetModifiers()
if keycode == wx.WXK_ESCAPE and modifiers == wx.MOD_NONE:
self.unselectAll()
elif keycode == 65 and mstate.GetModifiers() == wx.MOD_CONTROL:
elif keycode == 65 and modifiers == wx.MOD_CONTROL:
self.selectAll()
elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE) and mstate.GetModifiers() == wx.MOD_NONE:
elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE) and modifiers == wx.MOD_NONE:
implants = self.getSelectedImplants()
self.removeImplants(implants)
event.Skip()

View File

@@ -129,12 +129,12 @@ class ProjectedView(d.Display):
def kbEvent(self, event):
keycode = event.GetKeyCode()
mstate = wx.GetMouseState()
if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE:
modifiers = event.GetModifiers()
if keycode == wx.WXK_ESCAPE and modifiers == wx.MOD_NONE:
self.unselectAll()
elif keycode == 65 and mstate.GetModifiers() == wx.MOD_CONTROL:
elif keycode == 65 and modifiers == wx.MOD_CONTROL:
self.selectAll()
elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE) and mstate.GetModifiers() == wx.MOD_NONE:
elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE) and modifiers == wx.MOD_NONE:
self.mainFrame.command.Submit(cmd.GuiRemoveProjectedItemsCommand(
fitID=self.mainFrame.getActiveFit(),
items=self.getSelectedProjectors(),
@@ -267,7 +267,7 @@ class ProjectedView(d.Display):
selection = self.getSelectedProjectors()
if mainItem not in selection:
selection = [mainItem]
modPressed = wx.GetMouseState().GetModifiers() == wx.MOD_ALT
modPressed = event.GetModifiers() == wx.MOD_ALT
fitID = self.mainFrame.getActiveFit()
if isinstance(mainItem, EosModule) and modPressed:
fit = Fit.getInstance().getFit(fitID)
@@ -342,7 +342,7 @@ class ProjectedView(d.Display):
if mainItem is None:
return
fitID = self.mainFrame.getActiveFit()
modPressed = wx.GetMouseState().GetModifiers() == wx.MOD_ALT
modPressed = event.GetModifiers() == wx.MOD_ALT
if isinstance(mainItem, EosFit):
self.mainFrame.command.Submit(cmd.GuiRemoveProjectedItemsCommand(
fitID=fitID, items=[mainItem], amount=math.inf if modPressed else 1))

View File

@@ -1,7 +1,6 @@
# noinspection PyPackageRequirements
import wx
import gui.fitCommands as cmd
import gui.mainFrame
from gui.builtinViews.emptyView import BlankPage
from gui.contextMenu import ContextMenuUnconditional

View File

@@ -52,19 +52,18 @@ class ChangeItemProjectionRange(ContextMenuCombined):
newRange = cleanInputFloat * 1000
else:
newRange = None
fitID = self.mainFrame.getActiveFit()
items = selection
if wx.GetMouseState().GetModifiers() in (wx.MOD_ALT, wx.MOD_CONTROL):
if isinstance(mainItem, EosModule):
fit = Fit.getInstance().getFit(fitID)
positions = getSimilarModPositions(fit.projectedModules, mainItem)
items = [fit.projectedModules[p] for p in positions]
elif isinstance(mainItem, EosFighter):
fit = Fit.getInstance().getFit(fitID)
items = getSimilarFighters(fit.projectedFighters, mainItem)
self.mainFrame.command.Submit(cmd.GuiChangeProjectedItemsProjectionRangeCommand(
fitID=fitID, items=items, projectionRange=newRange))
fitID = self.mainFrame.getActiveFit()
items = selection
if wx.GetMouseState().GetModifiers() in (wx.MOD_ALT, wx.MOD_CONTROL):
if isinstance(mainItem, EosModule):
fit = Fit.getInstance().getFit(fitID)
positions = getSimilarModPositions(fit.projectedModules, mainItem)
items = [fit.projectedModules[p] for p in positions]
elif isinstance(mainItem, EosFighter):
fit = Fit.getInstance().getFit(fitID)
items = getSimilarFighters(fit.projectedFighters, mainItem)
self.mainFrame.command.Submit(cmd.GuiChangeProjectedItemsProjectionRangeCommand(
fitID=fitID, items=items, projectionRange=newRange))
ChangeItemProjectionRange.register()

View File

@@ -48,10 +48,9 @@ class ItemStats(ContextMenuSingle):
if srcContext == "fittingModule" and stuff.isEmpty:
return
mstate = wx.GetMouseState()
reuse = False
if mstate.GetModifiers() == wx.MOD_SHIFT:
if wx.GetMouseState().GetModifiers() == wx.MOD_SHIFT:
reuse = True
if self.mainFrame.GetActiveStatsWindow() is None and reuse:

View File

@@ -56,9 +56,7 @@ class ChangeItemToVariation(ContextMenuCombined):
fit = sFit.getFit(self.mainFrame.getActiveFit())
def get_metalevel(x):
if 'metaLevel' not in x.attributes:
return 0
return x.attributes['metaLevel'].value
return x.metaLevel or 0
def get_metagroup(x):
# We want deadspace before officer mods

View File

@@ -226,9 +226,8 @@ class ChangeModuleAmmo(ContextMenuCombined):
fitID = self.mainFrame.getActiveFit()
sFit = Fit.getInstance()
fit = sFit.getFit(fitID)
mstate = wx.GetMouseState()
# Switch in selection or all modules, depending on modifier key state and settings
switchAll = sFit.serviceFittingOptions['ammoChangeAll'] is not (mstate.GetModifiers() in (wx.MOD_ALT, wx.MOD_CONTROL))
switchAll = sFit.serviceFittingOptions['ammoChangeAll'] is not (wx.GetMouseState().GetModifiers() in (wx.MOD_ALT, wx.MOD_CONTROL))
if switchAll:
if self.srcContext == 'fittingModule':
command = cmd.GuiChangeLocalModuleChargesCommand

View File

@@ -9,7 +9,7 @@ from gui.utils.numberFormatter import formatAmount
def defaultSort(item):
return (item.attributes['metaLevel'].value if 'metaLevel' in item.attributes else 0, item.name)
return (item.metaLevel or 0, item.name)
class ItemCompare(wx.Panel):

View File

@@ -215,7 +215,7 @@ class ItemView(Display):
# Get position of market group
metagrpid = sMkt.getMetaGroupIdByItem(item)
metatab = self.metaMap.get(metagrpid)
metalvl = self.metalvls.get(item.ID, 0)
metalvl = item.metaLevel or 0
return catname, mktgrpid, parentname, metatab, metalvl, item.name
@@ -237,11 +237,6 @@ class ItemView(Display):
def populate(self, items):
if len(items) > 0:
# Get dictionary with meta level attribute
sAttr = Attribute.getInstance()
attrs = sAttr.getAttributeInfo("metaLevel")
sMkt = self.sMkt
self.metalvls = sMkt.directAttrRequest(items, attrs)
# Clear selection
self.unselectAll()
# Perform sorting, using item's meta levels besides other stuff
@@ -254,11 +249,6 @@ class ItemView(Display):
def refresh(self, items):
if len(items) > 1:
# Get dictionary with meta level attribute
sAttr = Attribute.getInstance()
attrs = sAttr.getAttributeInfo("metaLevel")
sMkt = self.sMkt
self.metalvls = sMkt.directAttrRequest(items, attrs)
# Re-sort stuff
if self.marketBrowser.mode != 'recent':
items.sort(key=self.itemSort)

View File

@@ -283,9 +283,7 @@ class FitItem(SFItem.SFBrowserItem):
event.Skip()
def editCheckEsc(self, event):
keycode = event.GetKeyCode()
mstate = wx.GetMouseState()
if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE:
if event.GetKeyCode() == wx.WXK_ESCAPE and event.GetModifiers() == wx.MOD_NONE:
self.RestoreEditButton()
else:
event.Skip()

View File

@@ -109,10 +109,10 @@ class NavigationPanel(SFItem.SFBrowserItem):
def OnBrowserSearchBoxKeyPress(self, event):
keycode = event.GetKeyCode()
mstate = wx.GetMouseState()
if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE:
modifiers = event.GetModifiers()
if keycode == wx.WXK_ESCAPE and modifiers == wx.MOD_NONE:
self.BrowserSearchBox.Show(False)
elif event.RawControlDown() and event.GetKeyCode() == wx.WXK_BACK:
elif keycode == wx.WXK_BACK and modifiers == wx.MOD_CONTROL:
HandleCtrlBackspace(self.BrowserSearchBox)
else:
event.Skip()

View File

@@ -176,9 +176,7 @@ class ShipItem(SFItem.SFBrowserItem):
self.Refresh()
def editCheckEsc(self, event):
keycode = event.GetKeyCode()
mstate = wx.GetMouseState()
if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE:
if event.GetKeyCode() == wx.WXK_ESCAPE and event.GetModifiers() == wx.MOD_NONE:
self.tcFitName.Show(False)
else:
event.Skip()

View File

@@ -689,9 +689,8 @@ class Miscellanea(ViewColumn):
baseRange = stuff.getModifiedChargeAttr("baseScanRange")
if not scanStr or not baseRange:
return "", None
strTwoAu = scanStr / (2.0 / baseRange)
text = "{0}".format(formatAmount(strTwoAu, 3, 0, 3))
tooltip = "Scan strength with 2 AU scan range"
text = "{}".format(formatAmount(scanStr, 4, 0, 3))
tooltip = "Scan strength at {} AU scan range".format(formatAmount(baseRange, 3, 0, 0))
return text, tooltip
else:
return "", None

View File

@@ -280,12 +280,12 @@ class FittingView(d.Display):
def kbEvent(self, event):
keycode = event.GetKeyCode()
mstate = wx.GetMouseState()
if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE:
modifiers = event.GetModifiers()
if keycode == wx.WXK_ESCAPE and modifiers == wx.MOD_NONE:
self.unselectAll()
elif keycode == 65 and mstate.GetModifiers() == wx.MOD_CONTROL:
elif keycode == 65 and modifiers == wx.MOD_CONTROL:
self.selectAll()
elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE) and mstate.GetModifiers() == wx.MOD_NONE:
elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE) and modifiers == wx.MOD_NONE:
modules = [m for m in self.getSelectedMods() if not m.isEmpty]
self.removeModule(modules)
event.Skip()

View File

@@ -258,9 +258,7 @@ class CharacterEditor(AuxiliaryFrame):
wx.PostEvent(self, GE.CharListUpdated())
def kbEvent(self, event):
keycode = event.GetKeyCode()
mstate = wx.GetMouseState()
if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE:
if event.GetKeyCode() == wx.WXK_ESCAPE and event.GetModifiers() == wx.MOD_NONE:
self.Close()
return
event.Skip()

View File

@@ -92,9 +92,7 @@ class EveFittings(AuxiliaryFrame):
self.charChoice.SetSelection(0)
def kbEvent(self, event):
keycode = event.GetKeyCode()
mstate = wx.GetMouseState()
if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE:
if event.GetKeyCode() == wx.WXK_ESCAPE and event.GetModifiers() == wx.MOD_NONE:
self.Close()
return
event.Skip()
@@ -248,9 +246,7 @@ class ExportToEve(AuxiliaryFrame):
self.charChoice.SetSelection(0)
def kbEvent(self, event):
keycode = event.GetKeyCode()
mstate = wx.GetMouseState()
if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE:
if event.GetKeyCode() == wx.WXK_ESCAPE and event.GetModifiers() == wx.MOD_NONE:
self.Close()
return
event.Skip()
@@ -358,9 +354,7 @@ class SsoCharacterMgmt(AuxiliaryFrame):
event.Skip()
def kbEvent(self, event):
keycode = event.GetKeyCode()
mstate = wx.GetMouseState()
if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE:
if event.GetKeyCode() == wx.WXK_ESCAPE and event.GetModifiers() == wx.MOD_NONE:
self.Close()
return
event.Skip()

View File

@@ -133,9 +133,7 @@ class ItemStatsFrame(AuxiliaryFrame):
self.parentWnd.SetActiveStatsWindow(self)
def kbEvent(self, event):
keycode = event.GetKeyCode()
mstate = wx.GetMouseState()
if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE:
if event.GetKeyCode() == wx.WXK_ESCAPE and event.GetModifiers() == wx.MOD_NONE:
self.Close()
return
event.Skip()

View File

@@ -281,9 +281,7 @@ class DmgPatternEditor(AuxiliaryFrame):
self.stNotice.SetLabel("Patterns exported to clipboard")
def kbEvent(self, event):
keycode = event.GetKeyCode()
mstate = wx.GetMouseState()
if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE:
if event.GetKeyCode() == wx.WXK_ESCAPE and event.GetModifiers() == wx.MOD_NONE:
self.Close()
return
event.Skip()

View File

@@ -81,9 +81,7 @@ class PreferenceDialog(wx.Dialog):
self.Close()
def kbEvent(self, event):
keycode = event.GetKeyCode()
mstate = wx.GetMouseState()
if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE:
if event.GetKeyCode() == wx.WXK_ESCAPE and event.GetModifiers() == wx.MOD_NONE:
self.Close()
return
event.Skip()

View File

@@ -89,9 +89,7 @@ class AttributeEditor(AuxiliaryFrame):
self.Bind(wx.EVT_CHAR_HOOK, self.kbEvent)
def kbEvent(self, event):
keycode = event.GetKeyCode()
mstate = wx.GetMouseState()
if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE:
if event.GetKeyCode() == wx.WXK_ESCAPE and event.GetModifiers() == wx.MOD_NONE:
self.Close()
return
event.Skip()

View File

@@ -185,9 +185,7 @@ class ImplantSetEditor(AuxiliaryFrame):
return
def kbEvent(self, event):
keycode = event.GetKeyCode()
mstate = wx.GetMouseState()
if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE:
if event.GetKeyCode() == wx.WXK_ESCAPE and event.GetModifiers() == wx.MOD_NONE:
self.Close()
return
event.Skip()

View File

@@ -369,9 +369,7 @@ class TargetProfileEditor(AuxiliaryFrame):
self.stNotice.SetLabel("Profiles exported to clipboard")
def kbEvent(self, event):
keycode = event.GetKeyCode()
mstate = wx.GetMouseState()
if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE:
if event.GetKeyCode() == wx.WXK_ESCAPE and event.GetModifiers() == wx.MOD_NONE:
self.Close()
return
event.Skip()