Skip to content

Commit

Permalink
Fix setGeometry failure on macOS
Browse files Browse the repository at this point in the history
Signed-off-by: Loren Eteval <[email protected]>
  • Loading branch information
LorenEteval committed Sep 1, 2023
1 parent e700b4f commit 6950607
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 5 deletions.
10 changes: 10 additions & 0 deletions Furious/Widget/AssetViewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,16 @@ def __init__(self, *args, **kwargs):
self._fileMenu = Menu(*fileMenuActions, title=_('File'), parent=self)
self.menuBar().addMenu(self._fileMenu)

if PLATFORM != 'Darwin':
self.setWidthAndHeight()

def show(self):
super().show()

if PLATFORM == 'Darwin':
self.setWidthAndHeight()

def setWidthAndHeight(self):
self.setGeometry(100, 100, 512 * GOLDEN_RATIO, 512)

moveToCenter(self)
Expand Down
12 changes: 11 additions & 1 deletion Furious/Widget/EditConfiguration.py
Original file line number Diff line number Diff line change
Expand Up @@ -1837,6 +1837,16 @@ def handleCursorPositionChanged():

self.menuBar().addMenu(menu)

if PLATFORM != 'Darwin':
self.setWidthAndHeight()

def show(self):
super().show()

if PLATFORM == 'Darwin':
self.setWidthAndHeight()

def setWidthAndHeight(self):
try:
self.setGeometry(
100,
Expand All @@ -1846,7 +1856,7 @@ def handleCursorPositionChanged():
except Exception:
# Any non-exit exceptions

self.setGeometry(100, 100, 1440, 1440 * GOLDEN_RATIO)
self.setGeometry(100, 100, 1568, 1568 * GOLDEN_RATIO)

moveToCenter(self)

Expand Down
26 changes: 25 additions & 1 deletion Furious/Widget/EditRouting.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
from Furious.Widget.AssetViewer import AssetViewerWidget
from Furious.Utility.Constants import (
APP,
PLATFORM,
APPLICATION_NAME,
GOLDEN_RATIO,
DATA_DIR,
Expand Down Expand Up @@ -596,6 +597,20 @@ def __init__(self, isBuiltin, *args, **kwargs):
self.menuBar().addMenu(self._fileMenu)
self.menuBar().addMenu(self._viewMenu)

if PLATFORM != 'Darwin':
self.setWidthAndHeight()

def show(self):
super().show()

if PLATFORM == 'Darwin':
self.setWidthAndHeight()

def setWidthAndHeight(self):
self.setGeometry(100, 100, 656, 856)

moveToCenter(self)

def addTabWithData(self, core, text):
if self.isBuiltin:
editor = RoutingTextBrowser(parent=self)
Expand Down Expand Up @@ -1017,7 +1032,6 @@ def appendRoutingEditor(self, title, isBuiltin=False):
routingEditor = RoutingEditor(isBuiltin)
routingEditor.title = title
routingEditor.setWindowTitle(title)
routingEditor.setGeometry(100, 100, 656, 856)

moveToCenter(routingEditor)

Expand Down Expand Up @@ -1227,6 +1241,16 @@ def __init__(self, *args, **kwargs):

self.setCentralWidget(self.fakeCentralWidget)

if PLATFORM != 'Darwin':
self.setWidthAndHeight()

def show(self):
super().show()

if PLATFORM == 'Darwin':
self.setWidthAndHeight()

def setWidthAndHeight(self):
try:
self.setGeometry(
100,
Expand Down
16 changes: 13 additions & 3 deletions Furious/Widget/TorRelaySettings.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from Furious.Widget.Widget import GroupBox, Label
from Furious.Utility.Constants import (
APP,
PLATFORM,
DEFAULT_TOR_SOCKS_PORT,
DEFAULT_TOR_HTTPS_PORT,
)
Expand Down Expand Up @@ -72,7 +73,10 @@ def __init__(self, *args, **kwargs):
self.httpsTunnelWidget.setLayout(self.httpsTunnelLayout)

self.endpointGroupBoxLayout = QGridLayout(parent=self.endpointGroupBox)
self.endpointGroupBoxLayout.setAlignment(QtCore.Qt.AlignmentFlag.AlignLeft)

if PLATFORM == 'Darwin':
self.endpointGroupBoxLayout.setAlignment(QtCore.Qt.AlignmentFlag.AlignLeft)

self.endpointGroupBoxLayout.addWidget(self.socksTunnelWidget, 0, 0)
self.endpointGroupBoxLayout.addWidget(self.httpsTunnelWidget, 0, 1)

Expand All @@ -90,7 +94,10 @@ def __init__(self, *args, **kwargs):
self.useProxyWidget.setLayout(self.useProxyLayout)

self.useProxyGroupBoxLayout = QGridLayout(parent=self.useProxyGroupBox)
self.useProxyGroupBoxLayout.setAlignment(QtCore.Qt.AlignmentFlag.AlignLeft)

if PLATFORM == 'Darwin':
self.useProxyGroupBoxLayout.setAlignment(QtCore.Qt.AlignmentFlag.AlignLeft)

self.useProxyGroupBoxLayout.addWidget(self.useProxyWidget, 0, 0)

self.useProxyGroupBox.setLayout(self.useProxyGroupBoxLayout)
Expand Down Expand Up @@ -123,7 +130,10 @@ def __init__(self, *args, **kwargs):
self.torRelayTimeoutWidget.setLayout(self.torRelayTimeoutLayout)

self.torOtherGroupBoxLayout = QGridLayout(parent=self.torOtherGroupBox)
self.torOtherGroupBoxLayout.setAlignment(QtCore.Qt.AlignmentFlag.AlignLeft)

if PLATFORM == 'Darwin':
self.torOtherGroupBoxLayout.setAlignment(QtCore.Qt.AlignmentFlag.AlignLeft)

self.torOtherGroupBoxLayout.addWidget(self.torLogLevelWidget, 0, 0)
self.torOtherGroupBoxLayout.addWidget(self.torRelayTimeoutWidget, 0, 1)

Expand Down

0 comments on commit 6950607

Please sign in to comment.