File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change 1212from __future__ import annotations
1313
1414import abc
15+ import base64
1516import functools
1617import os
1718import os .path as osp
@@ -621,6 +622,7 @@ def __restore_state(self) -> None:
621622 """Restore main window state from configuration"""
622623 state = Conf .main .window_state .get (None )
623624 if state is not None :
625+ state = base64 .b64decode (state )
624626 self .restoreState (QC .QByteArray (state ))
625627 for widget in self .children ():
626628 if isinstance (widget , QW .QDockWidget ):
@@ -635,7 +637,10 @@ def __save_pos_size_and_state(self) -> None:
635637 Conf .main .window_size .set ((size .width (), size .height ()))
636638 pos = self .pos ()
637639 Conf .main .window_position .set ((pos .x (), pos .y ()))
638- Conf .main .window_state .set (self .saveState ().data ())
640+ # Encoding window state into base64 string to avoid sending binary data
641+ # to the configuration file:
642+ state = base64 .b64encode (self .saveState ().data ()).decode ("ascii" )
643+ Conf .main .window_state .set (state )
639644
640645 def setup (self , console : bool = False ) -> None :
641646 """Setup main window
You can’t perform that action at this time.
0 commit comments