Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
mantid
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mantidproject
mantid
Commits
a7213dc0
Commit
a7213dc0
authored
6 years ago
by
Dimitar Tasev
Browse files
Options
Downloads
Patches
Plain Diff
Choose slash based on width, re #23814
parent
fded5933
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
qt/applications/workbench/workbench/app/mainwindow.py
+23
-17
23 additions, 17 deletions
qt/applications/workbench/workbench/app/mainwindow.py
with
23 additions
and
17 deletions
qt/applications/workbench/workbench/app/mainwindow.py
+
23
−
17
View file @
a7213dc0
...
@@ -12,7 +12,7 @@ Defines the QMainWindow of the application and the main() entry point.
...
@@ -12,7 +12,7 @@ Defines the QMainWindow of the application and the main() entry point.
"""
"""
from
__future__
import
(
absolute_import
,
division
,
from
__future__
import
(
absolute_import
,
division
,
print_function
,
unicode_literals
)
print_function
,
unicode_literals
)
import
argparse
# for command line options
import
argparse
# for command line options
import
atexit
import
atexit
import
imp
import
imp
import
importlib
import
importlib
...
@@ -82,10 +82,16 @@ MAIN_APP = qapplication()
...
@@ -82,10 +82,16 @@ MAIN_APP = qapplication()
# -----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
# Importing resources loads the data in
# Importing resources loads the data in
from
workbench.app.resources
import
qCleanupResources
# noqa
from
workbench.app.resources
import
qCleanupResources
# noqa
atexit
.
register
(
qCleanupResources
)
SPLASH
=
QSplashScreen
(
QPixmap
(
'
:/images/MantidSplashScreen_4k.jpg
'
),
atexit
.
register
(
qCleanupResources
)
Qt
.
WindowStaysOnTopHint
)
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
.
show
()
SPLASH
.
showMessage
(
"
Starting...
"
,
Qt
.
AlignBottom
|
Qt
.
AlignLeft
SPLASH
.
showMessage
(
"
Starting...
"
,
Qt
.
AlignBottom
|
Qt
.
AlignLeft
|
Qt
.
AlignAbsolute
,
QColor
(
Qt
.
black
))
|
Qt
.
AlignAbsolute
,
QColor
(
Qt
.
black
))
...
@@ -98,13 +104,13 @@ QApplication.processEvents(QEventLoop.AllEvents)
...
@@ -98,13 +104,13 @@ QApplication.processEvents(QEventLoop.AllEvents)
from
mantidqt.utils.qt
import
add_actions
,
create_action
# noqa
from
mantidqt.utils.qt
import
add_actions
,
create_action
# noqa
from
mantidqt.widgets.manageuserdirectories
import
ManageUserDirectories
# noqa
from
mantidqt.widgets.manageuserdirectories
import
ManageUserDirectories
# noqa
# -----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
# MainWindow
# MainWindow
# -----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
class
MainWindow
(
QMainWindow
):
class
MainWindow
(
QMainWindow
):
DOCKOPTIONS
=
QMainWindow
.
AllowTabbedDocks
|
QMainWindow
.
AllowNestedDocks
DOCKOPTIONS
=
QMainWindow
.
AllowTabbedDocks
|
QMainWindow
.
AllowNestedDocks
def
__init__
(
self
):
def
__init__
(
self
):
...
@@ -251,7 +257,7 @@ class MainWindow(QMainWindow):
...
@@ -251,7 +257,7 @@ class MainWindow(QMainWindow):
add_actions
(
self
.
view_menu
,
self
.
view_menu_actions
)
add_actions
(
self
.
view_menu
,
self
.
view_menu_actions
)
def
launchCustomGUI
(
self
,
script
):
def
launchCustomGUI
(
self
,
script
):
exec
(
open
(
script
).
read
(),
globals
())
exec
(
open
(
script
).
read
(),
globals
())
def
populateAfterMantidImport
(
self
):
def
populateAfterMantidImport
(
self
):
from
mantid.kernel
import
ConfigService
,
logger
from
mantid.kernel
import
ConfigService
,
logger
...
@@ -334,12 +340,12 @@ class MainWindow(QMainWindow):
...
@@ -334,12 +340,12 @@ class MainWindow(QMainWindow):
# column 2
# column 2
[[
logmessages
]]
[[
logmessages
]]
],
],
'
width-fraction
'
:
[
0.25
,
# column 0 width
'
width-fraction
'
:
[
0.25
,
# column 0 width
0.50
,
# column 1 width
0.50
,
# column 1 width
0.25
],
# column 2 width
0.25
],
# column 2 width
'
height-fraction
'
:
[[
0.5
,
0.5
],
# column 0 row heights
'
height-fraction
'
:
[[
0.5
,
0.5
],
# column 0 row heights
[
1.0
],
# column 1 row heights
[
1.0
],
# column 1 row heights
[
1.0
]]
# column 2 row heights
[
1.0
]]
# column 2 row heights
}
}
with
widget_updates_disabled
(
self
):
with
widget_updates_disabled
(
self
):
...
@@ -351,13 +357,13 @@ class MainWindow(QMainWindow):
...
@@ -351,13 +357,13 @@ class MainWindow(QMainWindow):
w
.
toggle_view
(
True
)
w
.
toggle_view
(
True
)
# split everything on the horizontal
# split everything on the horizontal
for
i
in
range
(
len
(
widgets
)
-
1
):
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
,
self
.
splitDockWidget
(
first
.
dockwidget
,
second
.
dockwidget
,
Qt
.
Horizontal
)
Qt
.
Horizontal
)
# now arrange the rows
# now arrange the rows
for
column
in
widgets_layout
:
for
column
in
widgets_layout
:
for
i
in
range
(
len
(
column
)
-
1
):
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
,
self
.
splitDockWidget
(
first_row
[
0
].
dockwidget
,
second_row
[
0
].
dockwidget
,
second_row
[
0
].
dockwidget
,
Qt
.
Vertical
)
Qt
.
Vertical
)
...
@@ -365,7 +371,7 @@ class MainWindow(QMainWindow):
...
@@ -365,7 +371,7 @@ class MainWindow(QMainWindow):
for
column
in
widgets_layout
:
for
column
in
widgets_layout
:
for
row
in
column
:
for
row
in
column
:
for
i
in
range
(
len
(
row
)
-
1
):
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
)
self
.
tabifyDockWidget
(
first
.
dockwidget
,
second
.
dockwidget
)
# Raise front widget per row
# Raise front widget per row
...
@@ -456,8 +462,8 @@ class MainWindow(QMainWindow):
...
@@ -456,8 +462,8 @@ class MainWindow(QMainWindow):
widget
.
readSettings
(
settings
)
widget
.
readSettings
(
settings
)
def
writeSettings
(
self
,
settings
):
def
writeSettings
(
self
,
settings
):
settings
.
set
(
'
MainWindow/size
'
,
self
.
size
())
# QSize
settings
.
set
(
'
MainWindow/size
'
,
self
.
size
())
# QSize
settings
.
set
(
'
MainWindow/position
'
,
self
.
pos
())
# QPoint
settings
.
set
(
'
MainWindow/position
'
,
self
.
pos
())
# QPoint
settings
.
set
(
'
MainWindow/state
'
,
self
.
saveState
())
# QByteArray
settings
.
set
(
'
MainWindow/state
'
,
self
.
saveState
())
# QByteArray
# write out settings for children
# write out settings for children
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment