Finish the modular preference dialog and add a dummy view
This commit is contained in:
@@ -1 +1 @@
|
||||
__all__ = []
|
||||
__all__ = ["dummyView"]
|
||||
|
||||
31
gui/builtinPreferenceViews/dummyView.py
Executable file
31
gui/builtinPreferenceViews/dummyView.py
Executable file
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
#===============================================================================
|
||||
|
||||
from gui.preferenceView import PreferenceView
|
||||
|
||||
class DummyView(PreferenceView):
|
||||
title = "Dummy"
|
||||
|
||||
def populatePanel(self, panel):
|
||||
panel.SetBackgroundColour("cyan")
|
||||
|
||||
def refreshPanel(self, fit):
|
||||
pass
|
||||
|
||||
DummyView.register()
|
||||
@@ -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)
|
||||
|
||||
@@ -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")
|
||||
|
||||
39
gui/preferenceDialog.py
Executable file
39
gui/preferenceDialog.py
Executable file
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
#===============================================================================
|
||||
|
||||
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)
|
||||
@@ -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 *
|
||||
|
||||
|
||||
Reference in New Issue
Block a user