diff --git a/gui/aboutData.py b/gui/aboutData.py index 5af49e734..0d1b029b5 100644 --- a/gui/aboutData.py +++ b/gui/aboutData.py @@ -23,4 +23,4 @@ license = "pyfa is released under GNU GPLv3" licenseLocation = "gpl.txt" developers = ("\n cncfanatics \t(Sakari Orisi)\n" , " DarkPhoenix \t(Kadesh Priestess)\n", " Darriele \t(Darriele)") credits = (("Entity (Entity) \t\tCapacitor calculations / EVEAPI python lib / Reverence"), ("Aurora \t\tMaths"), ("Corollax (Aamrr) \tVarious EOS/pyfa improvements")) -description = "Pyfa (the Python Fitting Assistant) is a standalone application able to create and simulate fittings for EVE-Online SciFi MMORPG with a very high degree of accuracy.\nPyfa can be virtually ran on all platforms where python and wxwidgets are supported.\n\n\nAll EVE-Online related materials are property of CCP hf.\n\nSilk Icons Set by famfamfam.com released under Creative Commons Attribution 2.5 License" +description = "Pyfa (the Python Fitting Assistant) is a standalone application able to create and simulate fittings for EVE-Online SciFi MMORPG with a very high degree of accuracy.\nPyfa can be virtually ran on all platforms where python and wxwidgets are supported.\n\n\nAll EVE-Online related materials are property of CCP hf.\n\nSilk Icons Set by famfamfam.com released under Creative Commons Attribution 2.5 License\n\nFat Cow Icons by fatcow.com released under Creative Commons Attribution 3.0 License" diff --git a/gui/builtinPreferenceViews/__init__.py b/gui/builtinPreferenceViews/__init__.py index ef3d543ed..ac253597d 100644 --- a/gui/builtinPreferenceViews/__init__.py +++ b/gui/builtinPreferenceViews/__init__.py @@ -1 +1 @@ -__all__ = ["pyfaGlobalPreferences","pyfaHTMLExportPreferences","pyfaUpdatePreferences"] +__all__ = ["pyfaGeneralPreferences","pyfaHTMLExportPreferences","pyfaUpdatePreferences","pyfaProxyPreferences"] \ No newline at end of file diff --git a/gui/builtinPreferenceViews/pyfaGeneralPreferences.py b/gui/builtinPreferenceViews/pyfaGeneralPreferences.py new file mode 100644 index 000000000..81bb81856 --- /dev/null +++ b/gui/builtinPreferenceViews/pyfaGeneralPreferences.py @@ -0,0 +1,92 @@ +import wx +import service +import urllib2 + +from gui.preferenceView import PreferenceView +from gui import bitmapLoader + +import gui.mainFrame +import service +import gui.globalEvents as GE + + +class PFGeneralPref ( PreferenceView): + title = "General" + + def populatePanel( self, panel ): + self.mainFrame = gui.mainFrame.MainFrame.getInstance() + self.dirtySettings = False + + mainSizer = wx.BoxSizer( wx.VERTICAL ) + + self.stTitle = wx.StaticText( panel, wx.ID_ANY, self.title, wx.DefaultPosition, wx.DefaultSize, 0 ) + self.stTitle.Wrap( -1 ) + self.stTitle.SetFont( wx.Font( 12, 70, 90, 90, False, wx.EmptyString ) ) + + mainSizer.Add( self.stTitle, 0, wx.ALL, 5 ) + + self.m_staticline1 = wx.StaticLine( panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL ) + mainSizer.Add( self.m_staticline1, 0, wx.EXPAND|wx.TOP|wx.BOTTOM, 5 ) + + self.cbGlobalChar = wx.CheckBox( panel, wx.ID_ANY, u"Use global character", wx.DefaultPosition, wx.DefaultSize, 0 ) + mainSizer.Add( self.cbGlobalChar, 0, wx.ALL|wx.EXPAND, 5 ) + + self.cbGlobalDmgPattern = wx.CheckBox( panel, wx.ID_ANY, u"Use global damage pattern", wx.DefaultPosition, wx.DefaultSize, 0 ) + mainSizer.Add( self.cbGlobalDmgPattern, 0, wx.ALL|wx.EXPAND, 5 ) + + self.cbGlobalForceReload = wx.CheckBox( panel, wx.ID_ANY, u"Factor in reload time", wx.DefaultPosition, wx.DefaultSize, 0 ) + mainSizer.Add( self.cbGlobalForceReload, 0, wx.ALL|wx.EXPAND, 5 ) + + self.cbFitColorSlots = wx.CheckBox( panel, wx.ID_ANY, u"Color fitting view by slot", wx.DefaultPosition, wx.DefaultSize, 0 ) + mainSizer.Add( self.cbFitColorSlots, 0, wx.ALL|wx.EXPAND, 5 ) + + # Needs to be implemented - save active fittings and reapply when starting pyfa + #self.cbReopenFits = wx.CheckBox( panel, wx.ID_ANY, u"Reopen Fits", wx.DefaultPosition, wx.DefaultSize, 0 ) + #mainSizer.Add( self.cbReopenFits, 0, wx.ALL|wx.EXPAND, 5 ) + + defCharSizer = wx.BoxSizer( wx.HORIZONTAL ) + + self.sFit = service.Fit.getInstance() + useGlobalChar = self.sFit.serviceFittingOptions["useGlobalCharacter"] + useGlobalDmgPattern = self.sFit.serviceFittingOptions["useGlobalDamagePattern"] + useGlobalForceReload = self.sFit.serviceFittingOptions["useGlobalForceReload"] + + self.cbGlobalChar.SetValue(useGlobalChar) + self.cbGlobalDmgPattern.SetValue(useGlobalDmgPattern) + self.cbGlobalForceReload.SetValue(useGlobalForceReload) + self.cbFitColorSlots.SetValue(self.sFit.serviceFittingOptions["colorFitBySlot"] or False) + + self.cbGlobalChar.Bind(wx.EVT_CHECKBOX, self.OnCBGlobalCharStateChange) + self.cbGlobalDmgPattern.Bind(wx.EVT_CHECKBOX, self.OnCBGlobalDmgPatternStateChange) + self.cbGlobalForceReload.Bind(wx.EVT_CHECKBOX, self.OnCBGlobalForceReloadStateChange) + self.cbFitColorSlots.Bind(wx.EVT_CHECKBOX, self.onCBGlobalColorBySlot) + + panel.SetSizer( mainSizer ) + panel.Layout() + + def onCBGlobalColorBySlot(self, event): + self.sFit.serviceFittingOptions["colorFitBySlot"] = self.cbFitColorSlots.GetValue() + fitID = self.mainFrame.getActiveFit() + self.sFit.refreshFit(fitID) + wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=fitID)) + event.Skip() + + def OnCBGlobalForceReloadStateChange(self, event): + self.sFit.serviceFittingOptions["useGlobalForceReload"] = self.cbGlobalForceReload.GetValue() + fitID = self.mainFrame.getActiveFit() + self.sFit.refreshFit(fitID) + wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=fitID)) + event.Skip() + + def OnCBGlobalCharStateChange(self, event): + self.sFit.serviceFittingOptions["useGlobalCharacter"] = self.cbGlobalChar.GetValue() + event.Skip() + + def OnCBGlobalDmgPatternStateChange(self, event): + self.sFit.serviceFittingOptions["useGlobalDamagePattern"] = self.cbGlobalDmgPattern.GetValue() + event.Skip() + + def getImage(self): + return bitmapLoader.getBitmap("prefs_settings", "icons") + +PFGeneralPref.register() \ No newline at end of file diff --git a/gui/builtinPreferenceViews/pyfaHTMLExportPreferences.py b/gui/builtinPreferenceViews/pyfaHTMLExportPreferences.py index 1e9a50bbd..bc5928cd7 100644 --- a/gui/builtinPreferenceViews/pyfaHTMLExportPreferences.py +++ b/gui/builtinPreferenceViews/pyfaHTMLExportPreferences.py @@ -12,41 +12,44 @@ import gui.globalEvents as GE class PFHTMLExportPref ( PreferenceView): - title = "Pyfa HTML Export Options" - desc = """Turning this feature on will create a HTML file at the specified location -with all your fits in it. If you browse to this HTML file from the -in-game browser you can easily view and import your fits by clicking on them. -The file will be updated every time a fit changes or gets added. -""" + title = "HTML Export" + desc = "Turning this feature on will create a HTML file at the specified location "+ \ + "with all your fits in it. If you browse to this HTML file from the "+\ + "in-game browser you can easily view and import your fits by clicking on them. "+\ + "The file will be updated every time a fit changes or gets added." def populatePanel( self, panel ): self.mainFrame = gui.mainFrame.MainFrame.getInstance() self.HTMLExportSettings = service.settings.HTMLExportSettings.getInstance() self.dirtySettings = False - + dlgWidth = panel.GetParent().GetParent().ClientSize.width mainSizer = wx.BoxSizer( wx.VERTICAL ) self.stTitle = wx.StaticText( panel, wx.ID_ANY, self.title, wx.DefaultPosition, wx.DefaultSize, 0 ) self.stTitle.Wrap( -1 ) self.stTitle.SetFont( wx.Font( 12, 70, 90, 90, False, wx.EmptyString ) ) mainSizer.Add( self.stTitle, 0, wx.ALL, 5 ) - + + self.m_staticline1 = wx.StaticLine( panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL ) + mainSizer.Add( self.m_staticline1, 0, wx.EXPAND|wx.TOP|wx.BOTTOM, 5 ) + self.stDesc = wx.StaticText( panel, wx.ID_ANY, self.desc, wx.DefaultPosition, wx.DefaultSize, 0 ) + self.stDesc.Wrap(dlgWidth - 50) mainSizer.Add( self.stDesc, 0, wx.ALL, 5 ) - + self.exportEnabled = wx.CheckBox( panel, wx.ID_ANY, u"Enable HTML export", wx.DefaultPosition, wx.DefaultSize, 0 ) self.exportEnabled.SetValue(self.HTMLExportSettings.getEnabled()) self.exportEnabled.Bind(wx.EVT_CHECKBOX, self.OnExportEnabledChange) mainSizer.Add( self.exportEnabled, 0, wx.ALL|wx.EXPAND, 5 ) self.PathLinkCtrl = wx.HyperlinkCtrl( panel, wx.ID_ANY, str(self.HTMLExportSettings.getPath()), 'file:///' + str(self.HTMLExportSettings.getPath()), wx.DefaultPosition, wx.DefaultSize, wx.HL_ALIGN_LEFT|wx.NO_BORDER|wx.HL_CONTEXTMENU ) - mainSizer.Add( self.PathLinkCtrl, 0, wx.ALL|wx.EXPAND, 5) + mainSizer.Add( self.PathLinkCtrl, 0, wx.ALL|wx.EXPAND, 5) self.fileSelectDialog = wx.FileDialog(None, "Save Fitting As...", wildcard = "EVE IGB HTML fitting file (*.html)|*.html", style = wx.FD_SAVE) self.fileSelectDialog.SetPath(self.HTMLExportSettings.getPath()) self.fileSelectDialog.SetFilename(os.path.basename(self.HTMLExportSettings.getPath())); - - self.fileSelectButton = wx.Button(panel, -1, "Set export destination", pos=(0,0)) + + self.fileSelectButton = wx.Button(panel, -1, "Set export destination", pos=(0,0)) self.fileSelectButton.Bind(wx.EVT_BUTTON, self.selectHTMLExportFilePath) mainSizer.Add( self.fileSelectButton, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5) @@ -55,7 +58,7 @@ The file will be updated every time a fit changes or gets added. def setPathLinkCtrlValues(self, path): self.PathLinkCtrl.SetLabel(self.HTMLExportSettings.getPath()) - self.PathLinkCtrl.SetURL('file:///' + self.HTMLExportSettings.getPath()) + self.PathLinkCtrl.SetURL('file:///' + self.HTMLExportSettings.getPath()) self.PathLinkCtrl.SetSize(wx.DefaultSize); self.PathLinkCtrl.Refresh() @@ -69,6 +72,6 @@ The file will be updated every time a fit changes or gets added. self.HTMLExportSettings.setEnabled(self.exportEnabled.GetValue()) def getImage(self): - return bitmapLoader.getBitmap("pyfa64", "icons") + return bitmapLoader.getBitmap("prefs_html", "icons") PFHTMLExportPref.register() \ No newline at end of file diff --git a/gui/builtinPreferenceViews/pyfaGlobalPreferences.py b/gui/builtinPreferenceViews/pyfaProxyPreferences.py similarity index 56% rename from gui/builtinPreferenceViews/pyfaGlobalPreferences.py rename to gui/builtinPreferenceViews/pyfaProxyPreferences.py index e40b87f91..40c2286f1 100644 --- a/gui/builtinPreferenceViews/pyfaGlobalPreferences.py +++ b/gui/builtinPreferenceViews/pyfaProxyPreferences.py @@ -10,8 +10,8 @@ import service import gui.globalEvents as GE -class PFGlobalPref ( PreferenceView): - title = "Pyfa Global Options" +class PFProxyPref ( PreferenceView): + title = "Proxy" def populatePanel( self, panel ): @@ -24,7 +24,6 @@ class PFGlobalPref ( PreferenceView): self.nPort = self.proxySettings.getPort() self.nType = self.proxySettings.getType() - mainSizer = wx.BoxSizer( wx.VERTICAL ) self.stTitle = wx.StaticText( panel, wx.ID_ANY, self.title, wx.DefaultPosition, wx.DefaultSize, 0 ) @@ -33,44 +32,8 @@ class PFGlobalPref ( PreferenceView): mainSizer.Add( self.stTitle, 0, wx.ALL, 5 ) -# self.m_staticline1 = wx.StaticLine( panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL ) -# mainSizer.Add( self.m_staticline1, 0, wx.EXPAND, 5 ) - - self.cbGlobalChar = wx.CheckBox( panel, wx.ID_ANY, u"Use global character", wx.DefaultPosition, wx.DefaultSize, 0 ) - mainSizer.Add( self.cbGlobalChar, 0, wx.ALL|wx.EXPAND, 5 ) - - self.cbGlobalDmgPattern = wx.CheckBox( panel, wx.ID_ANY, u"Use global damage pattern", wx.DefaultPosition, wx.DefaultSize, 0 ) - mainSizer.Add( self.cbGlobalDmgPattern, 0, wx.ALL|wx.EXPAND, 5 ) - - self.cbGlobalForceReload = wx.CheckBox( panel, wx.ID_ANY, u"Factor in reload time", wx.DefaultPosition, wx.DefaultSize, 0 ) - mainSizer.Add( self.cbGlobalForceReload, 0, wx.ALL|wx.EXPAND, 5 ) - - self.cbFitColorSlots = wx.CheckBox( panel, wx.ID_ANY, u"Color fitting view by slot", wx.DefaultPosition, wx.DefaultSize, 0 ) - mainSizer.Add( self.cbFitColorSlots, 0, wx.ALL|wx.EXPAND, 5 ) - - defCharSizer = wx.BoxSizer( wx.HORIZONTAL ) - - self.stDefChar = wx.StaticText( panel, wx.ID_ANY, u"Default character:", wx.DefaultPosition, wx.DefaultSize, 0 ) - self.stDefChar.Wrap( -1 ) - defCharSizer.Add( self.stDefChar, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 ) - - chDefaultCharChoices = [] - self.chDefaultChar = wx.Choice( panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, chDefaultCharChoices, 0 ) - self.chDefaultChar.SetSelection( 0 ) - defCharSizer.Add( self.chDefaultChar, 1, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 ) - - mainSizer.Add( defCharSizer, 0, wx.EXPAND, 5 ) - - - self.m_staticline2 = wx.StaticLine( panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL ) - mainSizer.Add( self.m_staticline2, 0, wx.EXPAND, 5 ) - - self.stPTitle = wx.StaticText( panel, wx.ID_ANY, "Proxy settings", wx.DefaultPosition, wx.DefaultSize, 0 ) - self.stPTitle.Wrap( -1 ) - self.stPTitle.SetFont( wx.Font( 12, 70, 90, 90, False, wx.EmptyString ) ) - - mainSizer.Add( self.stPTitle, 0, wx.ALL, 5 ) - + self.m_staticline1 = wx.StaticLine( panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL ) + mainSizer.Add( self.m_staticline1, 0, wx.EXPAND|wx.TOP|wx.BOTTOM, 5 ) ptypeSizer = wx.BoxSizer( wx.HORIZONTAL ) @@ -137,33 +100,6 @@ class PFGlobalPref ( PreferenceView): self.stPSAutoDetected.SetLabel("Auto-detected: " + txt) self.stPSAutoDetected.Disable() - cChar = service.Character.getInstance() - charList = cChar.getCharacterList() - - for id, name, active in charList: - self.chDefaultChar.Append(name, id) - - self.chDefaultChar.SetSelection(0) - - self.sFit = service.Fit.getInstance() - useGlobalChar = self.sFit.serviceFittingOptions["useGlobalCharacter"] - useGlobalDmgPattern = self.sFit.serviceFittingOptions["useGlobalDamagePattern"] - useGlobalForceReload = self.sFit.serviceFittingOptions["useGlobalForceReload"] - - self.cbGlobalChar.SetValue(useGlobalChar) - self.cbGlobalDmgPattern.SetValue(useGlobalDmgPattern) - self.cbGlobalForceReload.SetValue(useGlobalForceReload) - self.cbFitColorSlots.SetValue(self.sFit.serviceFittingOptions["colorFitBySlot"] or False) - - self.cbGlobalChar.Bind(wx.EVT_CHECKBOX, self.OnCBGlobalCharStateChange) - self.cbGlobalDmgPattern.Bind(wx.EVT_CHECKBOX, self.OnCBGlobalDmgPatternStateChange) - self.cbGlobalForceReload.Bind(wx.EVT_CHECKBOX, self.OnCBGlobalForceReloadStateChange) - self.cbFitColorSlots.Bind(wx.EVT_CHECKBOX, self.onCBGlobalColorBySlot) - - self.chDefaultChar.Disable() - self.chDefaultChar.Show(False) - self.stDefChar.Show(False) - self.chProxyType.Bind(wx.EVT_CHOICE, self.OnCHProxyTypeSelect) self.editProxySettingsAddr.Bind(wx.EVT_TEXT, self.OnEditPSAddrText) self.editProxySettingsPort.Bind(wx.EVT_TEXT, self.OnEditPSPortText) @@ -233,33 +169,7 @@ class PFGlobalPref ( PreferenceView): self.stPSetPort.Disable() self.editProxySettingsPort.Disable() - def OnCBProxySettingsStateChange(self, event): - self.ToggleProxySettings(self.cbProxySettings.GetValue()) - event.Skip() - - def onCBGlobalColorBySlot(self, event): - self.sFit.serviceFittingOptions["colorFitBySlot"] = self.cbFitColorSlots.GetValue() - fitID = self.mainFrame.getActiveFit() - self.sFit.refreshFit(fitID) - wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=fitID)) - event.Skip() - - def OnCBGlobalForceReloadStateChange(self, event): - self.sFit.serviceFittingOptions["useGlobalForceReload"] = self.cbGlobalForceReload.GetValue() - fitID = self.mainFrame.getActiveFit() - self.sFit.refreshFit(fitID) - wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=fitID)) - event.Skip() - - def OnCBGlobalCharStateChange(self, event): - self.sFit.serviceFittingOptions["useGlobalCharacter"] = self.cbGlobalChar.GetValue() - event.Skip() - - def OnCBGlobalDmgPatternStateChange(self, event): - self.sFit.serviceFittingOptions["useGlobalDamagePattern"] = self.cbGlobalDmgPattern.GetValue() - event.Skip() - def getImage(self): - return bitmapLoader.getBitmap("pyfa64", "icons") + return bitmapLoader.getBitmap("prefs_proxy", "icons") -PFGlobalPref.register() \ No newline at end of file +PFProxyPref.register() \ No newline at end of file diff --git a/gui/builtinPreferenceViews/pyfaUpdatePreferences.py b/gui/builtinPreferenceViews/pyfaUpdatePreferences.py index 0655564fd..94b49b759 100644 --- a/gui/builtinPreferenceViews/pyfaUpdatePreferences.py +++ b/gui/builtinPreferenceViews/pyfaUpdatePreferences.py @@ -10,17 +10,17 @@ import gui.globalEvents as GE class PFUpdatePref (PreferenceView): - title = "Pyfa Update Options" - desc = """ -Pyfa can automatically check and notify you of new releases. -These options will allow you to choose what kind of updates, if any, you wish -to receive notifications for. -""" + title = "Updates" + desc = "Pyfa can automatically check and notify you of new releases. "+\ + "These options will allow you to choose what kind of updates, "+\ + "if any, you wish to receive notifications for." def populatePanel( self, panel ): self.UpdateSettings = service.settings.UpdateSettings.getInstance() self.dirtySettings = False + dlgWidth = panel.GetParent().GetParent().ClientSize.width + mainSizer = wx.BoxSizer( wx.VERTICAL ) self.stTitle = wx.StaticText( panel, wx.ID_ANY, self.title, wx.DefaultPosition, wx.DefaultSize, 0 ) @@ -28,7 +28,11 @@ to receive notifications for. self.stTitle.SetFont( wx.Font( 12, 70, 90, 90, False, wx.EmptyString ) ) mainSizer.Add( self.stTitle, 0, wx.ALL, 5 ) + self.m_staticline1 = wx.StaticLine( panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL ) + mainSizer.Add( self.m_staticline1, 0, wx.EXPAND|wx.TOP|wx.BOTTOM, 5 ) + self.stDesc = wx.StaticText( panel, wx.ID_ANY, self.desc, wx.DefaultPosition, wx.DefaultSize, 0 ) + self.stDesc.Wrap(dlgWidth - 50) mainSizer.Add( self.stDesc, 0, wx.ALL, 5 ) self.suppressAll = wx.CheckBox( panel, wx.ID_ANY, u"Don't check for updates", wx.DefaultPosition, wx.DefaultSize, 0 ) @@ -51,11 +55,9 @@ to receive notifications for. self.versionTitle.Wrap( -1 ) self.versionTitle.SetFont( wx.Font( 12, 70, 90, 90, False, wx.EmptyString ) ) - self.versionInfo = ''' -There is a release available which you have chosen to suppress. -You can choose to reset notification suppression for this release, -or download the new release from GitHub. -''' + self.versionInfo = "There is a release available which you have chosen to suppress. "+\ + "You can choose to reset notification suppression for this release, "+\ + "or download the new release from GitHub." self.versionSizer.AddSpacer( ( 5, 5), 0, wx.EXPAND, 5 ) @@ -64,6 +66,7 @@ or download the new release from GitHub. self.versionSizer.Add( self.versionTitle, 0, wx.EXPAND, 5 ) self.versionDesc = wx.StaticText( panel, wx.ID_ANY, self.versionInfo, wx.DefaultPosition, wx.DefaultSize, 0 ) + self.versionDesc.Wrap(dlgWidth - 50) self.versionSizer.Add( self.versionDesc, 0, wx.ALL, 5 ) actionSizer = wx.BoxSizer( wx.HORIZONTAL ) @@ -114,6 +117,6 @@ or download the new release from GitHub. wx.LaunchDefaultBrowser('https://github.com/DarkFenX/Pyfa/releases/tag/'+self.UpdateSettings.get('version')) def getImage(self): - return bitmapLoader.getBitmap("pyfa64", "icons") + return bitmapLoader.getBitmap("prefs_update", "icons") PFUpdatePref.register() \ No newline at end of file diff --git a/gui/preferenceDialog.py b/gui/preferenceDialog.py index 8127ad77f..c3a1f9f1a 100644 --- a/gui/preferenceDialog.py +++ b/gui/preferenceDialog.py @@ -31,10 +31,12 @@ class PreferenceDialog(wx.Dialog): mainSizer = wx.BoxSizer(wx.VERTICAL) self.listbook = wx.Listbook(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LB_DEFAULT) - self.listbook.GetListView().SetMinSize((500, -1)) - self.listbook.GetListView().SetSize((500, -1)) - self.imageList = wx.ImageList(64,64) + self.listview = self.listbook.GetListView() + self.listview.SetMinSize((500, -1)) + self.listview.SetSize((500, -1)) + + self.imageList = wx.ImageList(32,32) self.listbook.SetImageList(self.imageList) mainSizer.Add(self.listbook, 1, wx.EXPAND | wx.TOP|wx.BOTTOM|wx.LEFT, 5) @@ -51,7 +53,7 @@ class PreferenceDialog(wx.Dialog): self.Centre(wx.BOTH) - for title, prefView in PreferenceView.views.iteritems(): + for prefView in PreferenceView.views: page = wx.Panel(self.listbook) bmp = prefView.getImage() if bmp: @@ -59,9 +61,17 @@ class PreferenceDialog(wx.Dialog): else: imgID = -1 prefView.populatePanel(page) - self.listbook.AddPage(page, title, imageId = imgID) + self.listbook.AddPage(page, prefView.title, imageId = imgID) + + # Set the height based on a condition. Can all the panels fit in the current height? + # If not, use the .GetBestVirtualSize() to ensure that all content is available. + minHeight = 360 + bestFit = self.GetBestVirtualSize() + if minHeight > bestFit[1]: + self.SetSizeWH(450, minHeight) + else: + self.SetSizeWH(450, bestFit[1]) - self.Fit() self.Layout() self.btnOK.Bind(wx.EVT_BUTTON, self.OnBtnOK) diff --git a/gui/preferenceView.py b/gui/preferenceView.py index 8833d8cb7..bf1ba76ed 100644 --- a/gui/preferenceView.py +++ b/gui/preferenceView.py @@ -20,17 +20,13 @@ import wx class PreferenceView(object): - views = {} + views = [] def __init__(self): pass @classmethod def register(cls): - PreferenceView.views[cls.title] = cls() - - @classmethod - def getView(cls, name): - return cls.views[name] + PreferenceView.views.append(cls()) def populatePanel(self, panel): raise NotImplementedError() diff --git a/icons/prefs_html.png b/icons/prefs_html.png new file mode 100644 index 000000000..d86548cd5 Binary files /dev/null and b/icons/prefs_html.png differ diff --git a/icons/prefs_proxy.png b/icons/prefs_proxy.png new file mode 100644 index 000000000..e54b67685 Binary files /dev/null and b/icons/prefs_proxy.png differ diff --git a/icons/prefs_settings.png b/icons/prefs_settings.png new file mode 100644 index 000000000..2a1e72744 Binary files /dev/null and b/icons/prefs_settings.png differ diff --git a/icons/prefs_update.png b/icons/prefs_update.png new file mode 100644 index 000000000..c1ab75d3b Binary files /dev/null and b/icons/prefs_update.png differ