From 408e1246c71b0363c8f695a386a49830a07e0aa7 Mon Sep 17 00:00:00 2001 From: DarkPhoenix Date: Thu, 31 May 2018 14:47:38 +0300 Subject: [PATCH] Reduce font size for chrome tabs --- gui/builtinViews/fittingView.py | 19 +++++++------------ gui/chrome_tabs.py | 6 +++--- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/gui/builtinViews/fittingView.py b/gui/builtinViews/fittingView.py index 5a2972525..36b3da6b1 100644 --- a/gui/builtinViews/fittingView.py +++ b/gui/builtinViews/fittingView.py @@ -149,6 +149,7 @@ class FittingView(d.Display): self.mainFrame.Bind(EVT_FIT_RENAMED, self.fitRenamed) self.mainFrame.Bind(EVT_FIT_REMOVED, self.fitRemoved) self.mainFrame.Bind(ITEM_SELECTED, self.appendItem) + self.font = wx.SystemSettings.GetFont(wx.SYS_DEFAULT_GUI_FONT) self.Bind(wx.EVT_LEFT_DCLICK, self.removeItem) self.Bind(wx.EVT_LIST_BEGIN_DRAG, self.startDrag) @@ -661,9 +662,6 @@ class FittingView(d.Display): def slotColour(self, slot): return self.slotColourMap.get(slot) or self.GetBackgroundColour() - def getFittingFont(self): - return wx.SystemSettings.GetFont(wx.SYS_DEFAULT_GUI_FONT) - def refresh(self, stuff): """ Displays fitting @@ -683,8 +681,6 @@ class FittingView(d.Display): slot = Slot.getValue(slotType) slotMap[slot] = fit.getSlotsFree(slot) < 0 - font = self.getFittingFont() - for i, mod in enumerate(self.mods): self.SetItemBackgroundColour(i, self.GetBackgroundColour()) @@ -699,11 +695,11 @@ class FittingView(d.Display): if isinstance(mod, Rack) and \ sFit.serviceFittingOptions["rackSlots"] and \ sFit.serviceFittingOptions["rackLabels"]: - font.SetWeight(wx.FONTWEIGHT_BOLD) - self.SetItemFont(i, font) + self.font.SetWeight(wx.FONTWEIGHT_BOLD) + self.SetItemFont(i, self.font) else: - font.SetWeight(wx.FONTWEIGHT_NORMAL) - self.SetItemFont(i, font) + self.font.SetWeight(wx.FONTWEIGHT_NORMAL) + self.SetItemFont(i, self.font) self.Thaw() self.itemCount = self.GetItemCount() @@ -735,8 +731,7 @@ class FittingView(d.Display): tbmp = wx.Bitmap(16, 16) tdc = wx.MemoryDC() tdc.SelectObject(tbmp) - font = self.getFittingFont() - tdc.SetFont(font) + tdc.SetFont(self.font) columnsWidths = [] for i in range(len(self.DEFAULT_COLS)): @@ -832,7 +827,7 @@ class FittingView(d.Display): mdc.SetBackground(wx.Brush(wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOW))) mdc.Clear() - mdc.SetFont(font) + mdc.SetFont(self.font) mdc.SetTextForeground(wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOWTEXT)) cx = padding diff --git a/gui/chrome_tabs.py b/gui/chrome_tabs.py index 10354b9be..c2a1ed31c 100644 --- a/gui/chrome_tabs.py +++ b/gui/chrome_tabs.py @@ -357,7 +357,7 @@ class _TabRenderer: self.tab_bitmap = None self.tab_back_bitmap = None self.padding = 4 - self.font = wx.Font(10, wx.SWISS, wx.NORMAL, wx.NORMAL, False) + self.font = wx.Font(8, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False) self.tab_img = img self.position = (0, 0) # Not used internally for rendering - helper for tab container @@ -1322,7 +1322,7 @@ class PFNotebookPagePreview(wx.Frame): self.padding = 15 self.transp = 0 - hfont = wx.Font(10, wx.SWISS, wx.NORMAL, wx.NORMAL, False) + hfont = wx.Font(8, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False) self.SetFont(hfont) tx, ty = self.GetTextExtent(self.title) @@ -1384,7 +1384,7 @@ class PFNotebookPagePreview(wx.Frame): mdc.SetBackground(wx.Brush(color)) mdc.Clear() - font = wx.Font(10, wx.SWISS, wx.NORMAL, wx.NORMAL, False) + font = wx.Font(8, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False) mdc.SetFont(font) x, y = mdc.GetTextExtent(self.title)