Add a checkbox for drones instead of + & -, group drones by 5 by default (will be able to be changed via rightclick, later)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
__all__ = ["moduleState", "moduleNameOrSlot", "attributeDisplay", "maxRange",
|
||||
"name", "droneDps", "droneNameAmount", "checkbox"]
|
||||
"name", "droneDps", "droneNameAmount", "droneCheckbox"]
|
||||
|
||||
columns = {}
|
||||
def registerColumn(column):
|
||||
|
||||
@@ -22,14 +22,12 @@ from gui.viewColumn import ViewColumn
|
||||
import gui.mainFrame
|
||||
import wx
|
||||
|
||||
class Checkbox(ViewColumn):
|
||||
name = "Checkbox"
|
||||
class DroneCheckbox(ViewColumn):
|
||||
name = "Drone Checkbox"
|
||||
def __init__(self, fittingView, params):
|
||||
ViewColumn.__init__(self, fittingView)
|
||||
self.resizable = False
|
||||
self.size = 16
|
||||
self.checked = False
|
||||
|
||||
for name, state in (("checked", wx.CONTROL_CHECKED), ("unchecked", 0)):
|
||||
bitmap = wx.EmptyBitmap(16, 16)
|
||||
dc = wx.MemoryDC()
|
||||
@@ -42,10 +40,10 @@ class Checkbox(ViewColumn):
|
||||
def getText(self, mod):
|
||||
return ""
|
||||
|
||||
def getImageId(self, mod):
|
||||
if self.checked:
|
||||
def getImageId(self, drone):
|
||||
if drone.amountActive > 0:
|
||||
return self.checkedId
|
||||
else:
|
||||
return self.uncheckedId
|
||||
|
||||
builtinViewColumns.registerColumn(Checkbox)
|
||||
builtinViewColumns.registerColumn(DroneCheckbox)
|
||||
@@ -29,7 +29,7 @@ class DroneNameAmount(ViewColumn):
|
||||
self.columnText = "Name"
|
||||
|
||||
def getText(self, drone):
|
||||
return "%dx %s (%d Active)" % (drone.amount, drone.item.name, drone.amountActive)
|
||||
return "%dx %s" % (drone.amount, drone.item.name)
|
||||
|
||||
def getImageId(self, mod):
|
||||
return -1
|
||||
|
||||
@@ -23,11 +23,10 @@ import controller
|
||||
import gui.fittingView as fv
|
||||
import gui.marketBrowser as mb
|
||||
import gui.builtinViewColumns.display as d
|
||||
from gui.builtinViewColumns.checkbox import Checkbox
|
||||
|
||||
from gui.builtinViewColumns.droneCheckbox import DroneCheckbox
|
||||
|
||||
class DroneView(d.Display):
|
||||
DEFAULT_COLS = ["Checkbox",
|
||||
DEFAULT_COLS = ["Drone Checkbox",
|
||||
"Drone Name/Amount",
|
||||
"Drone DPS",
|
||||
"Max range",
|
||||
@@ -58,7 +57,7 @@ class DroneView(d.Display):
|
||||
row, _ = self.HitTest(event.Position)
|
||||
if row != -1:
|
||||
col = self.getColumn(event.Position)
|
||||
if col != self.getColIndex(Checkbox):
|
||||
if col != self.getColIndex(DroneCheckbox):
|
||||
fitID = self.mainFrame.getActiveFit()
|
||||
cFit = controller.Fit.getInstance()
|
||||
cFit.removeDrone(fitID, self.GetItemData(row))
|
||||
@@ -68,5 +67,8 @@ class DroneView(d.Display):
|
||||
row, _ = self.HitTest(event.Position)
|
||||
if row != -1:
|
||||
col = self.getColumn(event.Position)
|
||||
if col == self.getColIndex(Checkbox):
|
||||
pass
|
||||
if col == self.getColIndex(DroneCheckbox):
|
||||
fitID = self.mainFrame.getActiveFit()
|
||||
cFit = controller.Fit.getInstance()
|
||||
cFit.toggleDrone(fitID, row)
|
||||
wx.PostEvent(self.mainFrame, fv.FitChanged(fitID=fitID))
|
||||
|
||||
Reference in New Issue
Block a user