From 5372f31be8d4c94b4fef01db8b62a2b7722b96de Mon Sep 17 00:00:00 2001 From: blitzmann Date: Sat, 27 Jun 2015 19:46:49 -0400 Subject: [PATCH] Revert "Revert "Merge branch 'master' into wx3"". So many reverts. This reverts commit cca7f1112a875d139c25bc62716a16e776a0fbe3. --- gui/builtinStatsViews/resistancesViewFull.py | 7 ++- .../targetingMiscViewFull.py | 4 +- gui/builtinViewColumns/ammoIcon.py | 2 +- gui/builtinViewColumns/baseIcon.py | 2 +- gui/chromeTabs.py | 3 ++ gui/pyfatogglepanel.py | 46 ++++++++----------- gui/shipBrowser.py | 1 + gui/utils/fonts.py | 5 ++ pyfa.py | 6 +-- 9 files changed, 39 insertions(+), 37 deletions(-) diff --git a/gui/builtinStatsViews/resistancesViewFull.py b/gui/builtinStatsViews/resistancesViewFull.py index 9a1df251f..e98696fb6 100644 --- a/gui/builtinStatsViews/resistancesViewFull.py +++ b/gui/builtinStatsViews/resistancesViewFull.py @@ -74,12 +74,9 @@ class ResistancesViewFull(StatsView): # Display table col = 0 row = 0 - sizerResistances = wx.GridBagSizer(0, 0) + sizerResistances = wx.GridBagSizer() contentSizer.Add( sizerResistances, 0, wx.EXPAND , 0) - for i in xrange(6): - sizerResistances.AddGrowableCol(i + 1) - # Add an empty label, then the rest. sizerResistances.Add(wx.StaticText(contentPanel, wx.ID_ANY), wx.GBPosition( row, col ), wx.GBSpan( 1, 1 )) col+=1 @@ -95,6 +92,8 @@ class ResistancesViewFull(StatsView): self.stEHPs.Bind(wx.EVT_BUTTON, self.toggleEHP) + for i in xrange(4): + sizerResistances.AddGrowableCol(i+1) sizerResistances.Add(self.stEHPs, wx.GBPosition( row, col ), wx.GBSpan( 1, 1 ), wx.ALIGN_CENTER) col=0 diff --git a/gui/builtinStatsViews/targetingMiscViewFull.py b/gui/builtinStatsViews/targetingMiscViewFull.py index fc2673389..ac0fc79e9 100644 --- a/gui/builtinStatsViews/targetingMiscViewFull.py +++ b/gui/builtinStatsViews/targetingMiscViewFull.py @@ -52,7 +52,7 @@ class TargetingMiscViewFull(StatsView): gridTargetingMisc.AddGrowableCol(2) # Targeting - gridTargeting = wx.FlexGridSizer(4, 2) + gridTargeting = wx.FlexGridSizer(5, 2) gridTargeting.AddGrowableCol(1) gridTargetingMisc.Add(gridTargeting, 0, wx.ALIGN_LEFT | wx.ALL, 5) @@ -77,7 +77,7 @@ class TargetingMiscViewFull(StatsView): # Misc gridTargetingMisc.Add( wx.StaticLine( contentPanel, wx.ID_ANY, style = wx.VERTICAL),0, wx.EXPAND, 3 ) - gridMisc = wx.FlexGridSizer(4, 2) + gridMisc = wx.FlexGridSizer(5, 2) gridMisc.AddGrowableCol(1) gridTargetingMisc.Add(gridMisc,0 , wx.ALIGN_LEFT | wx.ALL, 5) diff --git a/gui/builtinViewColumns/ammoIcon.py b/gui/builtinViewColumns/ammoIcon.py index 1dfddf791..19d55364e 100644 --- a/gui/builtinViewColumns/ammoIcon.py +++ b/gui/builtinViewColumns/ammoIcon.py @@ -27,7 +27,7 @@ class AmmoIcon(ViewColumn): name = "Ammo Icon" def __init__(self, fittingView, params): ViewColumn.__init__(self, fittingView) - self.size = 16 + self.size = 24 self.maxsize = self.size self.mask = wx.LIST_MASK_IMAGE self.columnText = "" diff --git a/gui/builtinViewColumns/baseIcon.py b/gui/builtinViewColumns/baseIcon.py index 5f88227a6..975267f4a 100644 --- a/gui/builtinViewColumns/baseIcon.py +++ b/gui/builtinViewColumns/baseIcon.py @@ -8,7 +8,7 @@ class BaseIcon(ViewColumn): name = "Base Icon" def __init__(self, fittingView, params): ViewColumn.__init__(self, fittingView) - self.size = 16 + self.size = 24 self.maxsize = self.size self.mask = wx.LIST_MASK_IMAGE self.columnText = "" diff --git a/gui/chromeTabs.py b/gui/chromeTabs.py index 49946c453..e6b248278 100644 --- a/gui/chromeTabs.py +++ b/gui/chromeTabs.py @@ -21,6 +21,7 @@ import wx import wx.lib.newevent import gui.utils.colorUtils as colorUtils import gui.utils.drawUtils as drawUtils +import gui.utils.fonts as fonts from gui import bitmapLoader import gui.utils.fonts as fonts @@ -671,6 +672,8 @@ class PFTabsContainer(wx.Panel): """ wx.Panel.__init__(self, parent, id, pos, size) + if wx.VERSION >= (3,0): + self.SetBackgroundStyle(wx.BG_STYLE_PAINT) self.tabs = [] width, height = size diff --git a/gui/pyfatogglepanel.py b/gui/pyfatogglepanel.py index ce92f10c8..7cf088b24 100644 --- a/gui/pyfatogglepanel.py +++ b/gui/pyfatogglepanel.py @@ -146,7 +146,6 @@ class TogglePanel ( wx.Panel ): else: return True - def IsExpanded(self): """ Returns ``True`` if the pane window is currently shown. """ if self._toggle == 1: @@ -154,7 +153,6 @@ class TogglePanel ( wx.Panel ): else: return True - def OnStateChange(self, sz): """ Handles the status changes (collapsing/expanding). @@ -168,9 +166,8 @@ class TogglePanel ( wx.Panel ): self.parent.GetSizer().SetSizeHints(self.parent) - if self.IsCollapsed(): - # expanded . collapsed transition + # expanded . collapsed transition if self.parent.GetSizer(): # we have just set the size hints... sz = self.parent.GetSizer().CalcMin() @@ -178,39 +175,36 @@ class TogglePanel ( wx.Panel ): # use SetClientSize() and not SetSize() otherwise the size for # e.g. a wxFrame with a menubar wouldn't be correctly set self.parent.SetClientSize(sz) - else: self.parent.Layout() - else: - - # collapsed . expanded transition - - # force our parent to "fit", i.e. expand so that it can honour - # our minimal size + # collapsed . expanded transition + # force our parent to "fit", i.e. expand so that it can honour + # our minimal size self.parent.Fit() - # Toggle the content panel (hide/show) - - def toggleContent( self, event ): + def toggleContent(self, event): self.Freeze() + print self.contentPanel.GetSize() if self._toggle == 1: self.contentMinSize = self.contentPanel.GetSize() - self.contentPanel.SetMinSize(wx.Size(self.contentMinSize[0],0)) - self.headerBmp.SetBitmap( self.bmpCollapsed) - - + self.contentPanel.Hide() + self.headerBmp.SetBitmap(self.bmpCollapsed) else: - self.contentPanel.SetMinSize(self.contentMinSize) - - self.headerBmp.SetBitmap( self.bmpExpanded) - - - self._toggle *=-1 + self.contentPanel.Show() + self.headerBmp.SetBitmap(self.bmpExpanded) + self._toggle *= -1 + self.Layout() self.Thaw() + if self.forceLayout == -1: - self.OnStateChange(self.GetBestSize()) + if wx.VERSION >= (3, 0): + x, y = self.GetBestSize() + y -= self.contentPanel.GetSize()[1] + else: + x, y = self.GetBestSize() + self.OnStateChange((x, y)) else: - self.parent.Layout() + self.parent.Layout() \ No newline at end of file diff --git a/gui/shipBrowser.py b/gui/shipBrowser.py index 5e59e6c83..c5d81c3f1 100644 --- a/gui/shipBrowser.py +++ b/gui/shipBrowser.py @@ -15,6 +15,7 @@ import gui.utils.animEffects as animEffects import gui.sfBrowserItem as SFItem from gui.contextMenu import ContextMenu +import gui.utils.fonts as fonts import service import gui.utils.fonts as fonts diff --git a/gui/utils/fonts.py b/gui/utils/fonts.py index 08f858f21..eb2dd95f5 100644 --- a/gui/utils/fonts.py +++ b/gui/utils/fonts.py @@ -1,3 +1,8 @@ +''' +Font file to handle the differences in font calculations between +different wxPython versions +''' + import wx if 'wxMac' in wx.PlatformInfo: diff --git a/pyfa.py b/pyfa.py index e112ba06b..3e6b77e2d 100755 --- a/pyfa.py +++ b/pyfa.py @@ -31,7 +31,7 @@ if not hasattr(sys, 'frozen'): try: import wxversion except ImportError: - print("Cannot find wxPython\nYou can download wxPython (2.8) from http://www.wxpython.org/") + print("Cannot find wxPython\nYou can download wxPython (2.8+) from http://www.wxpython.org/") sys.exit(1) # if user wants to force 2.8, try that and go directly to ensureMinimal path if fails @@ -48,10 +48,10 @@ if not hasattr(sys, 'frozen'): try: wxversion.ensureMinimal('2.8') except wxversion.VersionError: - print("Installed wxPython version doesn't meet requirements.\nYou can download wxPython (2.8) from http://www.wxpython.org/") + print "Installed wxPython version doesn't meet requirements.\nYou can download wxPython (2.8+) from http://www.wxpython.org/" sys.exit(1) else: - print("wxPython 2.8 not found; attempting to use newer version, expect errors") + print "wxPython 2.8 not found; attempting to use newer version, expect errors" try: import sqlalchemy