Skip to content

Commit 77a79da

Browse files
Attempt to change title fonts globally
1 parent 237803c commit 77a79da

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

src/robotide/application/application.py

+5
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ class RIDE(wx.App):
7272
_plugin_loader = None
7373
editor = None
7474
fileexplorerplugin = None
75+
fontinfo = None
7576
frame = None
7677
namespace = None
7778
preferences = None
@@ -105,6 +106,10 @@ class Message:
105106
self.preferences = Preferences(self.settings)
106107
self.namespace = Namespace(self.settings)
107108
self._controller = Project(self.namespace, self.settings)
109+
# Try to get FontInfo as soon as possible
110+
font_size = self.settings['General'].get('font size', 12)
111+
font_face = self.settings['General'].get('font face', 'Helvetica')
112+
self.fontinfo = wx.FontInfo(font_size).FaceName(font_face).Bold(False)
108113
self.frame = RideFrame(self, self._controller)
109114
# DEBUG self.frame.Show()
110115
self._editor_provider = EditorProvider()

src/robotide/ui/mainframe.py

+9
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,9 @@ def __init__(self, application, controller):
126126
self.SetLayoutDirection(wx.Layout_LeftToRight)
127127
# self.SetLayoutDirection(wx.Layout_RightToLeft)
128128

129+
self.fontinfo = application.fontinfo
130+
self.SetFont(wx.Font(self.fontinfo))
131+
129132
self.aui_mgr = aui.AuiManager(self)
130133

131134
# tell AuiManager to manage this frame
@@ -215,6 +218,7 @@ def _init_ui(self):
215218
# DEBUG: self._notebook_theme = 0 (allow to select themes for notebooks)
216219
# DEBUG:self.notebook = NoteBook(self.splitter, self._application, self._notebook_style)
217220
self.notebook = NoteBook(self, self._application, self._notebook_style)
221+
self.notebook.SetFont(wx.Font(self.fontinfo))
218222
self.notebook.SetBackgroundColour(Colour(self.color_background))
219223
self.notebook.SetForegroundColour(Colour(self.color_foreground))
220224
self.aui_mgr.AddPane(self.notebook, aui.AuiPaneInfo().Name("notebook_editors").
@@ -232,6 +236,8 @@ def _init_ui(self):
232236
_menudata = get_menudata()
233237

234238
self.main_menu = MenuBar(self)
239+
self.main_menu._mb.SetFont(wx.Font(self.fontinfo))
240+
self.main_menu.m_frame.SetFont(wx.Font(self.fontinfo))
235241
self.toolbar = ToolBar(self)
236242
self.toolbar.SetMinSize(wx.Size(100, 60))
237243
self.toolbar.SetBackgroundColour(Colour(self.color_background))
@@ -257,6 +263,7 @@ def _init_ui(self):
257263
# Tree is always created here
258264
self.tree = Tree(self, self.actions, self._application.settings)
259265
self.tree.SetMinSize(wx.Size(275, 250))
266+
self.tree.SetFont(wx.Font(self.fontinfo))
260267
# self.leftpanel.Bind(wx.EVT_SIZE, self.tree.OnSize)
261268
# self.aui_mgr.AddPane(self.leftpanel, aui.AuiPaneInfo().Name("left_panel").Caption("left_panel").Left())
262269
# DEBUG: Next was already called from application.py
@@ -270,6 +277,7 @@ def _init_ui(self):
270277
if new_ui: # Only when creating UI we add panes
271278
# ##### File explorer panel is always created here
272279
self.filemgr = FileExplorer(self, self.controller)
280+
self.filemgr.SetFont(wx.Font(self.fontinfo))
273281
self.filemgr.SetMinSize(wx.Size(275, 250))
274282
# DEBUG: Next was already called from application.py
275283
self.aui_mgr.AddPane(self.filemgr, aui.AuiPaneInfo().Name("file_manager").LeftDockable())
@@ -279,6 +287,7 @@ def _init_ui(self):
279287
self.CreateStatusBar(name="StatusBar")
280288
self._status_bar = self.FindWindowByName("StatusBar", self)
281289
if self._status_bar:
290+
self._status_bar.SetFont(wx.Font(self.fontinfo))
282291
self._status_bar.SetBackgroundColour(Colour(self.color_background))
283292
self._status_bar.SetForegroundColour(Colour(self.color_foreground))
284293
# set main frame icon

src/robotide/ui/treeplugin.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@ def __init__(self, application):
9191
self._tree.Bind(wx.EVT_MOVE, self.on_tab_changed)
9292
# parent, action_registerer, , default_settings={'collapsed':True}
9393
self._pane = self._mgr.GetPane(self._tree)
94-
self.font = self._tree.GetFont()
94+
self.font = wx.Font(self._app.fontinfo) # self._tree.GetFont()
95+
self._tree.SetFont(self.font)
9596
# print(f"DEBUG: TreePlugin init self.pane_id={self.pane_id} \n"
9697
# f"self._pane = {self._pane}")
9798

@@ -181,7 +182,7 @@ def on_show_tree(self, event):
181182
self.font.SetFaceName(html_font_face)
182183
self.font.SetPointSize(html_font_size)
183184
self._tree.SetFont(self.font)
184-
self._tree.Refresh()
185+
self._tree.Refresh()
185186
self._tree.Raise()
186187
self.save_setting('opened', True)
187188
self._tree.populate(self._model)

0 commit comments

Comments
 (0)