Save last export setting

This commit is contained in:
blitzmann
2018-08-25 19:01:49 -04:00
parent ebe0efac81
commit c530660132
3 changed files with 18 additions and 5 deletions

View File

@@ -21,6 +21,7 @@
# noinspection PyPackageRequirements
import wx
from service.eftPort import EFT_OPTIONS
from service.settings import SettingsProvider
class CopySelectDialog(wx.Dialog):
@@ -36,6 +37,8 @@ class CopySelectDialog(wx.Dialog):
style=wx.DEFAULT_DIALOG_STYLE)
mainSizer = wx.BoxSizer(wx.VERTICAL)
self.settings = SettingsProvider.getInstance().getSettings("pyfaExport", {"format": 0, "options": 0})
self.copyFormats = {
"EFT": CopySelectDialog.copyFormatEft,
"XML": CopySelectDialog.copyFormatXml,
@@ -51,10 +54,11 @@ class CopySelectDialog(wx.Dialog):
else:
rdo = wx.RadioButton(self, wx.ID_ANY, format)
rdo.Bind(wx.EVT_RADIOBUTTON, self.Selected)
if self.settings['format'] == self.copyFormats[format]:
rdo.SetValue(True)
self.copyFormat = self.copyFormats[format]
mainSizer.Add(rdo, 0, wx.EXPAND | wx.ALL, 5)
self.copyFormat = CopySelectDialog.copyFormatEft
# some sizer magic to deal with https://github.com/wxWidgets/Phoenix/issues/974
self.box1 = wx.StaticBox(self, -1, "EFT Options")
self.bsizer1 = wx.BoxSizer(wx.VERTICAL)
@@ -68,6 +72,8 @@ class CopySelectDialog(wx.Dialog):
for x, v in EFT_OPTIONS.items():
ch = wx.CheckBox(self.box1, -1, v['name'])
self.options[x] = ch
if self.settings['options'] & x:
ch.SetValue(True)
self.bsizer2.Add(ch, 1, wx.EXPAND)
self.box1.SetSizer(self.bsizer1)
@@ -77,6 +83,8 @@ class CopySelectDialog(wx.Dialog):
if buttonSizer:
mainSizer.Add(buttonSizer, 0, wx.EXPAND | wx.ALL, 5)
self.box1.Show(self.GetSelected() == CopySelectDialog.copyFormatEft)
self.SetSizer(mainSizer)
self.Fit()
self.Center()
@@ -95,6 +103,6 @@ class CopySelectDialog(wx.Dialog):
i = 0
for x, v in self.options.items():
if v.IsChecked():
i = i ^ x.value
i = i ^ x
return i

View File

@@ -752,6 +752,11 @@ class MainFrame(wx.Frame):
dlg.ShowModal()
selected = dlg.GetSelected()
options = dlg.GetOptions()
settings = SettingsProvider.getInstance().getSettings("pyfaExport")
settings["format"] = selected
settings["options"] = options
CopySelectDict[selected](options)
try:

View File

@@ -51,11 +51,11 @@ SLOT_ORDER = (Slot.LOW, Slot.MED, Slot.HIGH, Slot.RIG, Slot.SUBSYSTEM, Slot.SERV
OFFLINE_SUFFIX = ' /OFFLINE'
EFT_OPTIONS = {
Options.IMPLANTS: {
Options.IMPLANTS.value: {
"name": "Implants",
"description": "Exports implants"
},
Options.MUTATIONS: {
Options.MUTATIONS.value: {
"name": "Abyssal",
"description": "Exports Abyssal stats"
}