Skip to content

Commit

Permalink
Merge pull request #91 from gitbarnabedikartola/main
Browse files Browse the repository at this point in the history
fix availableGeometry == None
  • Loading branch information
bigbruno authored Jun 20, 2024
2 parents 2dd7b77 + 3b9108c commit 9b9cf7e
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions bigbashview/usr/lib/bbv/ui/qt.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,16 +259,21 @@ def load_url(self, url):
def set_size(self, width, height, window_state):
# Set the window size and position based on the provided arguments
display = self.app.screenAt(QCursor().pos())
size = display.availableGeometry()
if width <= 0:
width = int(size.width()/2)
if height <= 0:
height = int(size.height()/2)
if display is None:
width = 1024
height = 600
else:
size = display.availableGeometry()
if width <= 0:
width = int(size.width()/2)
if height <= 0:
height = int(size.height()/2)

cp = display.availableGeometry().center()
qr.moveCenter(cp)

self.resize(width, height)
qr = self.frameGeometry()
cp = display.availableGeometry().center()
qr.moveCenter(cp)
self.move(qr.topLeft())
if window_state == "fixed":
self.setFixedSize(width, height)
Expand Down

0 comments on commit 9b9cf7e

Please sign in to comment.