Skip to content

Commit

Permalink
Choose slash based on width, re #23814
Browse files Browse the repository at this point in the history
  • Loading branch information
Dimitar Tasev committed Nov 13, 2018
1 parent fded593 commit a7213dc
Showing 1 changed file with 23 additions and 17 deletions.
40 changes: 23 additions & 17 deletions qt/applications/workbench/workbench/app/mainwindow.py
Expand Up @@ -12,7 +12,7 @@
"""
from __future__ import (absolute_import, division,
print_function, unicode_literals)
import argparse # for command line options
import argparse # for command line options
import atexit
import imp
import importlib
Expand Down Expand Up @@ -82,10 +82,16 @@ def qapplication():
# -----------------------------------------------------------------------------
# Importing resources loads the data in
from workbench.app.resources import qCleanupResources # noqa
atexit.register(qCleanupResources)

SPLASH = QSplashScreen(QPixmap(':/images/MantidSplashScreen_4k.jpg'),
Qt.WindowStaysOnTopHint)
atexit.register(qCleanupResources)
width = QApplication.desktop().availableGeometry().width()

if width > 2048:
SPLASH = QSplashScreen(QPixmap(':/images/MantidSplashScreen_4k.jpg'),
Qt.WindowStaysOnTopHint)
else:
SPLASH = QSplashScreen(QPixmap(':/images/MantidSplashScreen.png'),
Qt.WindowStaysOnTopHint)
SPLASH.show()
SPLASH.showMessage("Starting...", Qt.AlignBottom | Qt.AlignLeft
| Qt.AlignAbsolute, QColor(Qt.black))
Expand All @@ -98,13 +104,13 @@ def qapplication():
from mantidqt.utils.qt import add_actions, create_action # noqa
from mantidqt.widgets.manageuserdirectories import ManageUserDirectories # noqa


# -----------------------------------------------------------------------------
# MainWindow
# -----------------------------------------------------------------------------


class MainWindow(QMainWindow):

DOCKOPTIONS = QMainWindow.AllowTabbedDocks | QMainWindow.AllowNestedDocks

def __init__(self):
Expand Down Expand Up @@ -251,7 +257,7 @@ def populate_menus(self):
add_actions(self.view_menu, self.view_menu_actions)

def launchCustomGUI(self, script):
exec(open(script).read(), globals())
exec (open(script).read(), globals())

def populateAfterMantidImport(self):
from mantid.kernel import ConfigService, logger
Expand Down Expand Up @@ -334,12 +340,12 @@ def setup_default_layouts(self):
# column 2
[[logmessages]]
],
'width-fraction': [0.25, # column 0 width
0.50, # column 1 width
0.25], # column 2 width
'height-fraction': [[0.5, 0.5], # column 0 row heights
[1.0], # column 1 row heights
[1.0]] # column 2 row heights
'width-fraction': [0.25, # column 0 width
0.50, # column 1 width
0.25], # column 2 width
'height-fraction': [[0.5, 0.5], # column 0 row heights
[1.0], # column 1 row heights
[1.0]] # column 2 row heights
}

with widget_updates_disabled(self):
Expand All @@ -351,21 +357,21 @@ def setup_default_layouts(self):
w.toggle_view(True)
# split everything on the horizontal
for i in range(len(widgets) - 1):
first, second = widgets[i], widgets[i+1]
first, second = widgets[i], widgets[i + 1]
self.splitDockWidget(first.dockwidget, second.dockwidget,
Qt.Horizontal)
# now arrange the rows
for column in widgets_layout:
for i in range(len(column) - 1):
first_row, second_row = column[i], column[i+1]
first_row, second_row = column[i], column[i + 1]
self.splitDockWidget(first_row[0].dockwidget,
second_row[0].dockwidget,
Qt.Vertical)
# and finally tabify those in the same position
for column in widgets_layout:
for row in column:
for i in range(len(row) - 1):
first, second = row[i], row[i+1]
first, second = row[i], row[i + 1]
self.tabifyDockWidget(first.dockwidget, second.dockwidget)

# Raise front widget per row
Expand Down Expand Up @@ -456,8 +462,8 @@ def readSettings(self, settings):
widget.readSettings(settings)

def writeSettings(self, settings):
settings.set('MainWindow/size', self.size()) # QSize
settings.set('MainWindow/position', self.pos()) # QPoint
settings.set('MainWindow/size', self.size()) # QSize
settings.set('MainWindow/position', self.pos()) # QPoint
settings.set('MainWindow/state', self.saveState()) # QByteArray

# write out settings for children
Expand Down

0 comments on commit a7213dc

Please sign in to comment.