Added "Open in Ship Browser" to fitting context menu, and modified a bit of the history logic in shipBrowser.
This commit is contained in:
@@ -1,2 +1,2 @@
|
||||
__all__ = ["moduleAmmoPicker", "itemStats", "damagePattern", "marketJump", "droneSplit", "itemRemove",
|
||||
"droneRemoveStack", "ammoPattern", "project", "factorReload", "whProjector", "cargo"]
|
||||
"droneRemoveStack", "ammoPattern", "project", "factorReload", "whProjector", "cargo", "shipJump"]
|
||||
|
||||
29
gui/builtinContextMenus/shipJump.py
Normal file
29
gui/builtinContextMenus/shipJump.py
Normal file
@@ -0,0 +1,29 @@
|
||||
import wx
|
||||
from gui.contextMenu import ContextMenu
|
||||
import gui.mainFrame
|
||||
import service
|
||||
from gui.shipBrowser import Stage3Selected
|
||||
|
||||
class ShipJump(ContextMenu):
|
||||
def __init__(self):
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
|
||||
def display(self, srcContext, selection):
|
||||
validContexts = ("fittingShip")
|
||||
if not srcContext in validContexts:
|
||||
return False
|
||||
return True
|
||||
|
||||
def getText(self, itmContext, selection):
|
||||
return "Open in Ship Browser"
|
||||
|
||||
def activate(self, fullContext, selection, i):
|
||||
fitID = self.mainFrame.getActiveFit()
|
||||
sFit = service.Fit.getInstance()
|
||||
stuff = sFit.getFit(fitID).ship
|
||||
groupID = stuff.item.group.ID
|
||||
|
||||
self.mainFrame.notebookBrowsers.SetSelection(1)
|
||||
wx.PostEvent(self.mainFrame.shipBrowser,Stage3Selected(shipID=stuff.item.ID, back=groupID))
|
||||
|
||||
ShipJump.register()
|
||||
@@ -454,7 +454,7 @@ class NavigationPanel(SFItem.SFBrowserItem):
|
||||
def OnHistoryReset(self):
|
||||
if self.shipBrowser.browseHist:
|
||||
self.shipBrowser.browseHist = []
|
||||
self.gotoStage(1,0)
|
||||
self.gotoStage(1,0)
|
||||
|
||||
def OnHistoryBack(self):
|
||||
if len(self.shipBrowser.browseHist) > 0:
|
||||
@@ -671,6 +671,7 @@ class ShipBrowser(wx.Panel):
|
||||
self._lastStage = self._activeStage
|
||||
self._activeStage = 1
|
||||
self.lastdata = 0
|
||||
self.browseHist = [(1,0)]
|
||||
|
||||
self.navpanel.ShowNewFitButton(False)
|
||||
self.navpanel.ShowSwitchEmptyGroupsButton(False)
|
||||
@@ -774,8 +775,8 @@ class ShipBrowser(wx.Panel):
|
||||
def stage2(self, event):
|
||||
back = event.back
|
||||
|
||||
if not back:
|
||||
self.browseHist.append( (1,0) )
|
||||
#if not back:
|
||||
# self.browseHist.append( (1,0) )
|
||||
|
||||
self._lastStage = self._activeStage
|
||||
self._activeStage = 2
|
||||
@@ -807,6 +808,8 @@ class ShipBrowser(wx.Panel):
|
||||
elif event.back == -1:
|
||||
if len(self.navpanel.recentSearches)>0:
|
||||
self.browseHist.append((4, self.navpanel.lastSearch))
|
||||
elif event.back > 0:
|
||||
self.browseHist.append( (2,event.back) )
|
||||
|
||||
shipID = event.shipID
|
||||
self.lastdata = shipID
|
||||
|
||||
Reference in New Issue
Block a user