Skip to content

Commit 514e7d2

Browse files
Only pass ints to self.ui.move
as floats to QWidget.move are depreceated and raise an exception. Also update the log line to print the full exception for easier detection of issues in the future.
1 parent fb8bcd9 commit 514e7d2

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

blacs/__main__.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -464,8 +464,17 @@ def restore_window(self,tab_data):
464464
# Actually this is a waste of time because if you close when maximized, reoopen and then
465465
# de-maximize, the window moves to a random position (not the position it was at before maximizing)
466466
# so bleh!
467-
self.ui.move(tab_data['BLACS settings']["window_xpos"]-tab_data['BLACS settings']['window_frame_width']/2,tab_data['BLACS settings']["window_ypos"]-tab_data['BLACS settings']['window_frame_height']+tab_data['BLACS settings']['window_frame_width']/2)
468-
self.ui.resize(tab_data['BLACS settings']["window_width"],tab_data['BLACS settings']["window_height"])
467+
self.ui.move(
468+
tab_data['BLACS settings']["window_xpos"]
469+
- tab_data['BLACS settings']['window_frame_width'] // 2,
470+
tab_data['BLACS settings']["window_ypos"]
471+
- tab_data['BLACS settings']['window_frame_height']
472+
+ tab_data['BLACS settings']['window_frame_width'] // 2,
473+
)
474+
self.ui.resize(
475+
tab_data['BLACS settings']["window_width"],
476+
tab_data['BLACS settings']["window_height"],
477+
)
469478

470479
if 'window_maximized' in tab_data['BLACS settings'] and tab_data['BLACS settings']['window_maximized']:
471480
self.ui.showMaximized()
@@ -474,7 +483,7 @@ def restore_window(self,tab_data):
474483
pane.setSizes(tab_data['BLACS settings'][pane_name])
475484

476485
except Exception as e:
477-
logger.warning("Unable to load window and notebook defaults. Exception:"+str(e))
486+
logger.exception("Unable to load window and notebook defaults. Exception:"+str(e))
478487

479488
def order_tabs(self,tab_data):
480489
# Move the tabs to the correct notebook

0 commit comments

Comments
 (0)