Merge branch 'master' into test-3
Conflicts: eos/gamedata.py eos/saveddata/booster.py eos/saveddata/character.py gui/builtinAdditionPanes/commandView.py gui/builtinContextMenus/commandFits.py gui/builtinMarketBrowser/itemView.py gui/builtinMarketBrowser/marketTree.py gui/builtinPreferenceViews/pyfaGeneralPreferences.py gui/builtinShipBrowser/categoryItem.py gui/builtinShipBrowser/fitItem.py gui/builtinShipBrowser/navigationPanel.py gui/builtinShipBrowser/raceSelector.py gui/builtinShipBrowser/shipItem.py gui/builtinStatsViews/priceViewFull.py gui/builtinViews/fittingView.py gui/characterEditor.py gui/characterSelection.py gui/chromeTabs.py gui/crestFittings.py gui/itemStats.py gui/mainFrame.py scripts/itemDiff.py service/price.py
This commit is contained in:
@@ -22,6 +22,7 @@ import wx
|
||||
import wx.dataview
|
||||
import wx.lib.agw.hyperlink
|
||||
|
||||
from utils.floatspin import FloatSpin
|
||||
# noinspection PyPackageRequirements
|
||||
import wx.lib.newevent
|
||||
# noinspection PyPackageRequirements
|
||||
@@ -39,6 +40,9 @@ from logbook import Logger
|
||||
|
||||
from wx.lib.agw.floatspin import FloatSpin
|
||||
|
||||
|
||||
from gui.utils.clipboard import toClipboard, fromClipboard
|
||||
|
||||
pyfalog = Logger(__name__)
|
||||
|
||||
|
||||
@@ -154,7 +158,7 @@ class CharacterEditor(wx.Frame):
|
||||
self.viewsNBContainer = wx.Notebook(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, 0)
|
||||
|
||||
self.sview = SkillTreeView(self.viewsNBContainer)
|
||||
self.iview = ImplantEditorView(self.viewsNBContainer)
|
||||
self.iview = ImplantEditorView(self.viewsNBContainer, self)
|
||||
self.aview = APIView(self.viewsNBContainer)
|
||||
|
||||
self.viewsNBContainer.AddPage(self.sview, "Skills")
|
||||
@@ -203,6 +207,7 @@ class CharacterEditor(wx.Frame):
|
||||
self.btnSaveChar.Enable(not char.ro and char.isDirty)
|
||||
self.btnSaveAs.Enable(char.isDirty)
|
||||
self.btnRevert.Enable(char.isDirty)
|
||||
self.sview.importBtn.Enable(not char.ro)
|
||||
|
||||
def refreshCharacterList(self, event=None):
|
||||
"""This is only called when we save a modified character"""
|
||||
@@ -340,6 +345,26 @@ class SkillTreeView(wx.Panel):
|
||||
bSizerButtons = wx.BoxSizer(wx.HORIZONTAL)
|
||||
|
||||
bSizerButtons.Add(self.btnSecStatus, 0, wx.ALL, 5)
|
||||
|
||||
bSizerButtons.AddSpacer((0, 0), 1, wx.EXPAND, 5)
|
||||
|
||||
importExport = (("Import", wx.ART_FILE_OPEN, "from"),
|
||||
("Export", wx.ART_FILE_SAVE_AS, "to"))
|
||||
|
||||
for name, art, direction in importExport:
|
||||
bitmap = wx.ArtProvider.GetBitmap(art, wx.ART_BUTTON)
|
||||
btn = wx.BitmapButton(self, wx.ID_ANY, bitmap)
|
||||
|
||||
btn.SetMinSize(btn.GetSize())
|
||||
btn.SetMaxSize(btn.GetSize())
|
||||
|
||||
btn.Layout()
|
||||
setattr(self, "{}Btn".format(name.lower()), btn)
|
||||
btn.Enable(True)
|
||||
btn.SetToolTipString("%s skills %s clipboard" % (name, direction))
|
||||
bSizerButtons.Add(btn, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_RIGHT | wx.ALL, 5)
|
||||
btn.Bind(wx.EVT_BUTTON, getattr(self, "{}Skills".format(name.lower())))
|
||||
|
||||
pmainSizer.Add(bSizerButtons, 0, wx.EXPAND, 5)
|
||||
|
||||
# bind the Character selection event
|
||||
@@ -375,6 +400,48 @@ class SkillTreeView(wx.Panel):
|
||||
|
||||
self.Layout()
|
||||
|
||||
def importSkills(self, evt):
|
||||
|
||||
dlg = wx.MessageDialog(self, "Importing skills into this character will set the skill levels as pending. " +
|
||||
"To save the skills permanently, please click the Save button at the bottom of the window after importing"
|
||||
, "Import Skills", wx.OK)
|
||||
dlg.ShowModal()
|
||||
dlg.Destroy()
|
||||
|
||||
text = fromClipboard().strip()
|
||||
if text:
|
||||
char = self.charEditor.entityEditor.getActiveEntity()
|
||||
try:
|
||||
lines = text.splitlines()
|
||||
|
||||
for l in lines:
|
||||
skill, level = l.strip()[:-1].strip(), int(l.strip()[-1])
|
||||
skill = char.getSkill(skill)
|
||||
if skill:
|
||||
skill.setLevel(level, ignoreRestrict=True)
|
||||
|
||||
except Exception as e:
|
||||
dlg = wx.MessageDialog(self, "There was an error importing skills, please see log file", "Error", wx.ICON_ERROR)
|
||||
dlg.ShowModal()
|
||||
dlg.Destroy()
|
||||
pyfalog.error(e)
|
||||
|
||||
finally:
|
||||
self.charEditor.btnRestrict()
|
||||
self.populateSkillTree()
|
||||
self.charEditor.entityEditor.refreshEntityList(char)
|
||||
|
||||
def exportSkills(self, evt):
|
||||
char = self.charEditor.entityEditor.getActiveEntity()
|
||||
|
||||
skills = sorted(char.__class__.getSkillNameMap().keys())
|
||||
list = ""
|
||||
for s in skills:
|
||||
skill = char.getSkill(s)
|
||||
list += "{} {}\n".format(skill.item.name, skill.level)
|
||||
|
||||
toClipboard(list)
|
||||
|
||||
def onSecStatus(self, event):
|
||||
sChar = Character.getInstance()
|
||||
char = self.charEditor.entityEditor.getActiveEntity()
|
||||
@@ -561,10 +628,11 @@ class SkillTreeView(wx.Panel):
|
||||
|
||||
|
||||
class ImplantEditorView(BaseImplantEditorView):
|
||||
def __init__(self, parent):
|
||||
def __init__(self, parent, charEditor):
|
||||
BaseImplantEditorView.__init__(self, parent)
|
||||
|
||||
self.determineEnabled()
|
||||
charEditor.Bind(GE.CHAR_CHANGED, self.contextChanged)
|
||||
|
||||
if "__WXGTK__" in wx.PlatformInfo:
|
||||
self.pluggedImplantsTree.Bind(wx.EVT_RIGHT_UP, self.scheduleMenu)
|
||||
@@ -605,7 +673,11 @@ class ImplantEditorView(BaseImplantEditorView):
|
||||
# fuck good coding practices, passing a pointer to the character editor here for [reasons] =D
|
||||
# (see implantSets context class for info)
|
||||
menu = ContextMenu.getMenu((self.Parent.Parent,), *context)
|
||||
self.PopupMenu(menu)
|
||||
|
||||
if menu:
|
||||
self.PopupMenu(menu)
|
||||
else:
|
||||
pyfalog.debug("ContextMenu.getMenu returned false do not attempt PopupMenu")
|
||||
|
||||
def determineEnabled(self):
|
||||
char = self.Parent.Parent.entityEditor.getActiveEntity()
|
||||
|
||||
Reference in New Issue
Block a user