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
394c3767
Commit
394c3767
authored
6 years ago
by
Peterson, Peter
Browse files
Options
Downloads
Patches
Plain Diff
Add FilterEvents to interfaces menu
parent
2af9f74e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
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
+13
-12
13 additions, 12 deletions
qt/applications/workbench/workbench/app/mainwindow.py
with
13 additions
and
12 deletions
qt/applications/workbench/workbench/app/mainwindow.py
+
13
−
12
View file @
394c3767
...
...
@@ -250,13 +250,8 @@ class MainWindow(QMainWindow):
add_actions
(
self
.
file_menu
,
self
.
file_menu_actions
)
add_actions
(
self
.
view_menu
,
self
.
view_menu_actions
)
def
launchCustomGUI
(
self
,
name
):
try
:
importlib
.
import_module
(
name
)
except
ImportError
:
from
mantid.kernel
import
logger
logger
.
error
(
str
(
'
Failed to load {} interface
'
.
format
(
name
)))
# TODO logger should accept unicode
raise
def
launchCustomGUI
(
self
,
script
):
execfile
(
script
)
def
populateAfterMantidImport
(
self
):
from
mantid.kernel
import
ConfigService
,
logger
...
...
@@ -266,16 +261,18 @@ class MainWindow(QMainWindow):
# list of custom interfaces that have been made qt4/qt5 compatible
# TODO need to make *anything* compatible
GUI_WHITELIST
=
[]
GUI_WHITELIST
=
[
'
FilterEvents.py
'
]
# detect the python interfaces
interfaces
=
{}
for
item
in
items
:
key
,
scriptname
=
item
.
split
(
'
/
'
)
key
,
scriptname
=
item
.
split
(
'
/
'
)
# TODO logger should accept unicode
if
not
os
.
path
.
exists
(
os
.
path
.
join
(
interface_dir
,
scriptname
)):
logger
.
warning
(
'
Failed to find script
"
{}
"
in
"
{}
"'
.
format
(
scriptname
,
interface_dir
))
logger
.
warning
(
str
(
'
Failed to find script
"
{}
"
in
"
{}
"'
.
format
(
scriptname
,
interface_dir
))
)
continue
if
scriptname
not
in
GUI_WHITELIST
:
logger
.
information
(
str
(
'
Not adding gui
"
{}
"'
.
format
(
scriptname
)))
continue
temp
=
interfaces
.
get
(
key
,
[])
temp
.
append
(
scriptname
)
...
...
@@ -290,8 +287,8 @@ class MainWindow(QMainWindow):
names
.
sort
()
for
name
in
names
:
action
=
submenu
.
addAction
(
name
.
replace
(
'
.py
'
,
''
).
replace
(
'
_
'
,
'
'
))
script
=
name
.
replace
(
'
.py
'
,
''
)
action
.
triggered
.
connect
(
lambda
checked
,
script
=
script
:
self
.
launchCustomGUI
(
script
))
script
=
os
.
path
.
join
(
interface_dir
,
name
)
action
.
triggered
.
connect
(
lambda
checked
,
script
=
script
:
self
.
launchCustomGUI
(
script
))
def
add_dockwidget
(
self
,
plugin
):
"""
Create a dockwidget around a plugin and add the dock to window
"""
...
...
@@ -380,6 +377,10 @@ class MainWindow(QMainWindow):
import
matplotlib.pyplot
as
plt
# noqa
plt
.
close
(
'
all
'
)
app
=
QApplication
.
instance
()
if
app
is
not
None
:
app
.
closeAllWindows
()
event
.
accept
()
else
:
# Cancel was pressed when closing an editor
...
...
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