From cca7f1112a875d139c25bc62716a16e776a0fbe3 Mon Sep 17 00:00:00 2001 From: DarkPhoenix Date: Thu, 30 Apr 2015 19:47:15 +0300 Subject: [PATCH] Revert "Merge branch 'master' into wx3" This reverts commit 33a0c106507fec72e7d0699d0cd91fabcdd1efa6, reversing changes made to 2077655694a2eb20f6d29fc91998c1bb2f2e66f6. Reverting merges fucks up git, but oh well - we probably better merge stuff manually rather than fucking up master with wx3 which is apparently buggy --- 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 | 48 +++++++++++-------- gui/shipBrowser.py | 1 - gui/utils/fonts.py | 5 -- pyfa.py | 19 ++------ 9 files changed, 40 insertions(+), 51 deletions(-) diff --git a/gui/builtinStatsViews/resistancesViewFull.py b/gui/builtinStatsViews/resistancesViewFull.py index e98696fb6..9a1df251f 100644 --- a/gui/builtinStatsViews/resistancesViewFull.py +++ b/gui/builtinStatsViews/resistancesViewFull.py @@ -74,9 +74,12 @@ class ResistancesViewFull(StatsView): # Display table col = 0 row = 0 - sizerResistances = wx.GridBagSizer() + sizerResistances = wx.GridBagSizer(0, 0) 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 @@ -92,8 +95,6 @@ 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 ac0fc79e9..fc2673389 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(5, 2) + gridTargeting = wx.FlexGridSizer(4, 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(5, 2) + gridMisc = wx.FlexGridSizer(4, 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 19d55364e..1dfddf791 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 = 24 + self.size = 16 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 975267f4a..5f88227a6 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 = 24 + self.size = 16 self.maxsize = self.size self.mask = wx.LIST_MASK_IMAGE self.columnText = "" diff --git a/gui/chromeTabs.py b/gui/chromeTabs.py index 15c1141e1..3a0c7b11c 100644 --- a/gui/chromeTabs.py +++ b/gui/chromeTabs.py @@ -21,7 +21,6 @@ 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 @@ -672,8 +671,6 @@ 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 7cf088b24..ce92f10c8 100644 --- a/gui/pyfatogglepanel.py +++ b/gui/pyfatogglepanel.py @@ -146,6 +146,7 @@ class TogglePanel ( wx.Panel ): else: return True + def IsExpanded(self): """ Returns ``True`` if the pane window is currently shown. """ if self._toggle == 1: @@ -153,6 +154,7 @@ class TogglePanel ( wx.Panel ): else: return True + def OnStateChange(self, sz): """ Handles the status changes (collapsing/expanding). @@ -166,8 +168,9 @@ 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() @@ -175,36 +178,39 @@ 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.Hide() - self.headerBmp.SetBitmap(self.bmpCollapsed) - else: - self.contentPanel.Show() - self.headerBmp.SetBitmap(self.bmpExpanded) + self.contentPanel.SetMinSize(wx.Size(self.contentMinSize[0],0)) + self.headerBmp.SetBitmap( self.bmpCollapsed) + + + else: + self.contentPanel.SetMinSize(self.contentMinSize) + + self.headerBmp.SetBitmap( self.bmpExpanded) + + + self._toggle *=-1 - self._toggle *= -1 - self.Layout() self.Thaw() - if self.forceLayout == -1: - if wx.VERSION >= (3, 0): - x, y = self.GetBestSize() - y -= self.contentPanel.GetSize()[1] - else: - x, y = self.GetBestSize() - self.OnStateChange((x, y)) + self.OnStateChange(self.GetBestSize()) else: - self.parent.Layout() \ No newline at end of file + self.parent.Layout() diff --git a/gui/shipBrowser.py b/gui/shipBrowser.py index 7e916181c..20552aa55 100644 --- a/gui/shipBrowser.py +++ b/gui/shipBrowser.py @@ -15,7 +15,6 @@ 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 eb2dd95f5..08f858f21 100644 --- a/gui/utils/fonts.py +++ b/gui/utils/fonts.py @@ -1,8 +1,3 @@ -''' -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 2c0c7c00d..76b7ca336 100755 --- a/pyfa.py +++ b/pyfa.py @@ -20,7 +20,6 @@ import sys import re -import config if not hasattr(sys, 'frozen'): @@ -31,27 +30,18 @@ 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 try: - if getattr(config.configforced, "force28", False): - wxversion.select('2.8') - else: - # try 3.0, then 2.8. If any exceptions, go to ensureMinimal path - try: - wxversion.select('3.0') - except: - wxversion.select('2.9') + wxversion.select('2.8') except wxversion.VersionError: 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 @@ -82,6 +72,7 @@ if __name__ == "__main__": parser.add_option("-r", "--root", action="store_true", dest="rootsavedata", help="if you want pyfa to store its data in root folder, use this option", default=False) (options, args) = parser.parse_args() + import config # Configure paths if options.rootsavedata is True: config.saveInRoot = True