Added copy-format selection dialog.

This commit is contained in:
Lucas Thode
2010-10-28 09:40:56 -05:00
parent 8b34a9c666
commit 92457a8006
2 changed files with 65 additions and 0 deletions

59
gui/copySelectDialog.py Normal file
View File

@@ -0,0 +1,59 @@
#===============================================================================
# Copyright (C) 2010 Lucas Thode
#
# This file is part of pyfa.
#
# pyfa is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# pyfa is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with pyfa. If not, see <http://www.gnu.org/licenses/>.
#===============================================================================
import wx
class CopySelectDialog(wx.Dialog):
copyFormatEft = 0
copyFormatXml = 1
copyFormatDna = 2
def __init__(self, parent):
wx.Dialog.__init__(self, parent, id = wx.ID_ANY, title = u"Select a format", size = wx.Size(200, 125), style = wx.DEFAULT_DIALOG_STYLE)
mainSizer = wx.BoxSizer(wx.VERTICAL)
copyFormats = [u"EFT", u"XML", u"DNA"]
copyFormatTooltips = {CopySelectDialog.copyFormatEft: u"Eve Fitting Tool text format",
CopySelectDialog.copyFormatXml: u"EvE native XML format",
CopySelectDialog.copyFormatDna: u"A one-line text format"}
selector = wx.RadioBox(self, wx.ID_ANY, label = u"Copy to the clipboard using:", choices = copyFormats, style = wx.RA_SPECIFY_ROWS)
selector.Bind(wx.EVT_RADIOBOX, self.Selected)
for format, tooltip in copyFormatTooltips.iteritems():
selector.SetItemToolTip(format, tooltip)
self.copyFormat = CopySelectDialog.copyFormatEft
selector.SetSelection(self.copyFormat)
mainSizer.Add(selector)
buttonSizer = self.CreateButtonSizer(wx.OK | wx.CANCEL)
if (buttonSizer):
mainSizer.Add(buttonSizer)
self.SetSizer(mainSizer)
def Selected(self, event):
self.copyFormat = event.GetSelection()
def GetSelected(self):
return self.copyFormat

View File

@@ -31,6 +31,7 @@ from gui.characterEditor import CharacterEditor
from gui.characterSelection import CharacterSelection
from gui.patternEditor import DmgPatternEditorDlg
from gui.preferenceDialog import PreferenceDialog
from gui.copySelectDialog import CopySelectDialog
import aboutData
import gui.fittingView as fv
from wx._core import PyDeadObjectError
@@ -255,6 +256,11 @@ class MainFrame(wx.Frame):
def exportToClipboard(self, event):
sFit = service.Fit.getInstance()
dlg = CopySelectDialog(self)
dlg.ShowModal()
selected = dlg.GetSelected()
print selected
dlg.Destroy()
def toClipboard(self, text):
clip = wx.TheClipboard