diff --git a/gui/builtinPreferenceViews/__init__.py b/gui/builtinPreferenceViews/__init__.py
index 3ba0f1a00..b4478713f 100755
--- a/gui/builtinPreferenceViews/__init__.py
+++ b/gui/builtinPreferenceViews/__init__.py
@@ -1 +1 @@
-__all__ = []
+__all__ = ["dummyView"]
diff --git a/gui/builtinPreferenceViews/dummyView.py b/gui/builtinPreferenceViews/dummyView.py
new file mode 100755
index 000000000..b70310df7
--- /dev/null
+++ b/gui/builtinPreferenceViews/dummyView.py
@@ -0,0 +1,31 @@
+#===============================================================================
+# Copyright (C) 2010 Diego Duclos
+#
+# 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 .
+#===============================================================================
+
+from gui.preferenceView import PreferenceView
+
+class DummyView(PreferenceView):
+ title = "Dummy"
+
+ def populatePanel(self, panel):
+ panel.SetBackgroundColour("cyan")
+
+ def refreshPanel(self, fit):
+ pass
+
+DummyView.register()
diff --git a/gui/mainFrame.py b/gui/mainFrame.py
index e0c569db1..8a62b6990 100644
--- a/gui/mainFrame.py
+++ b/gui/mainFrame.py
@@ -31,6 +31,7 @@ from gui.characterEditor import CharacterEditor
from gui.characterSelection import CharacterSelection
from gui.patternEditor import DmgPatternEditorDlg
from gui.importExport import ImportDialog, ExportDialog
+from gui.preferenceDialog import PreferenceDialog
import aboutData
import gui.fittingView as fv
from wx._core import PyDeadObjectError
@@ -150,6 +151,11 @@ class MainFrame(wx.Frame):
dlg.ShowModal()
dlg.Destroy()
+ def showPreferenceDialog(self, event):
+ dlg = PreferenceDialog(self)
+ dlg.ShowModal()
+ dlg.Destroy()
+
def registerMenu(self):
# Quit
self.Bind(wx.EVT_MENU, self.ExitApp, id=wx.ID_EXIT)
@@ -165,6 +171,8 @@ class MainFrame(wx.Frame):
self.Bind(wx.EVT_MENU, self.showImportDialog, id=wx.ID_OPEN)
# Export dialog
self.Bind(wx.EVT_MENU, self.showExportDialog, id=wx.ID_SAVEAS)
+ # Preference dialog
+ self.Bind(wx.EVT_MENU, self.showPreferenceDialog, id=wx.ID_PREFERENCES)
def toggleShipBrowser(self, event):
self.GetToolBar().toggleShipBrowser(event)
diff --git a/gui/mainMenuBar.py b/gui/mainMenuBar.py
index e9df54c30..10838232e 100644
--- a/gui/mainMenuBar.py
+++ b/gui/mainMenuBar.py
@@ -57,6 +57,8 @@ class MainMenuBar(wx.MenuBar):
damagePatternEditItem = wx.MenuItem(windowMenu, self.damagePatternEditorId, "Damage Pattern Editor\tCTRL+D")
windowMenu.AppendItem(damagePatternEditItem)
+ windowMenu.Append(wx.ID_PREFERENCES)
+
# Help menu
helpMenu = wx.Menu()
self.Append(helpMenu, "&Help")
diff --git a/gui/preferenceDialog.py b/gui/preferenceDialog.py
new file mode 100755
index 000000000..a5382283e
--- /dev/null
+++ b/gui/preferenceDialog.py
@@ -0,0 +1,39 @@
+#===============================================================================
+# Copyright (C) 2010 Diego Duclos
+#
+# 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 .
+#===============================================================================
+
+import wx
+from gui.preferenceView import PreferenceView
+class PreferenceDialog(wx.Dialog):
+
+ def __init__(self, parent):
+ wx.Dialog.__init__(self, parent, id=wx.ID_ANY, size=wx.Size(600, 400), style=wx.DEFAULT_DIALOG_STYLE)
+ mainSizer = wx.BoxSizer(wx.VERTICAL)
+
+ self.listbook = wx.Listbook(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LB_DEFAULT)
+
+ mainSizer.Add(self.listbook, 1, wx.EXPAND | wx.ALL, 5)
+ self.SetSizer(mainSizer)
+ self.Layout()
+
+ self.Centre(wx.BOTH)
+
+ for title, prefView in PreferenceView.views.iteritems():
+ page = wx.Panel(self.listbook)
+ prefView.populatePanel(page)
+ self.listbook.AddPage(page, title)
diff --git a/gui/preferenceView.py b/gui/preferenceView.py
index 64dff29a9..86e8a2537 100755
--- a/gui/preferenceView.py
+++ b/gui/preferenceView.py
@@ -24,7 +24,7 @@ class PreferenceView(object):
@classmethod
def register(cls):
- PreferenceView.views[cls.name] = cls
+ PreferenceView.views[cls.title] = cls()
@classmethod
def getView(cls, name):
@@ -33,10 +33,8 @@ class PreferenceView(object):
def populatePanel(self, panel):
raise NotImplementedError()
- def getHeaderText(self, fit):
- raise NotImplementedError()
-
def refreshPanel(self, fit):
raise NotImplementedError()
-from gui.builtinStatsViews import *
+from gui.builtinPreferenceViews import *
+