Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Jan Zelenka
prasopes
Commits
9a52a523
Commit
9a52a523
authored
Sep 09, 2018
by
Yan
Browse files
QToolBar in main window now
parent
eef2fe46
Changes
1
Hide whitespace changes
Inline
Side-by-side
prasopes/__main__.py
View file @
9a52a523
...
...
@@ -95,30 +95,71 @@ def main():
app
=
QtWidgets
.
QApplication
(
sys
.
argv
)
main_window
=
QtWidgets
.
QMainWindow
(
windowTitle
=
"Prasopes"
)
openact
=
QtWidgets
.
QAction
(
QtGui
.
QIcon
.
fromTheme
(
"document-open"
),
"&Open..."
)
openact
.
setShortcut
(
QtCore
.
Qt
.
CTRL
+
QtCore
.
Qt
.
Key_O
)
openact
.
triggered
.
connect
(
lambda
:
load_file
(
chromatogram
,
spectrum
,
ds
,
ms
,
filename
,
chrom
,
config
))
exportact
=
QtWidgets
.
QAction
(
QtGui
.
QIcon
.
fromTheme
(
"document-save-as"
),
"&Export..."
)
exportact
.
setShortcut
(
QtCore
.
Qt
.
CTRL
+
QtCore
.
Qt
.
Key_E
)
exportact
.
triggered
.
connect
(
lambda
:
ft
.
export_dial
(
ms
,
chrom
,
filename
,
main_window
))
settingsact
=
QtWidgets
.
QAction
(
QtGui
.
QIcon
.
fromTheme
(
"preferences-system"
),
"&Settings..."
)
settingsact
.
triggered
.
connect
(
lambda
:
cf
.
dial
(
main_window
))
quitact
=
QtWidgets
.
QAction
(
QtGui
.
QIcon
.
fromTheme
(
"application-exit"
),
"&Quit"
)
quitact
.
setShortcut
(
QtCore
.
Qt
.
CTRL
+
QtCore
.
Qt
.
Key_Q
)
quitact
.
triggered
.
connect
(
main_window
.
close
)
zceact
=
QtWidgets
.
QAction
(
QtGui
.
QIcon
.
fromTheme
(
"applications-utilities"
),
"&TSQ zce..."
)
zceact
.
setShortcut
(
QtCore
.
Qt
.
CTRL
+
QtCore
.
Qt
.
Key_T
)
zceact
.
triggered
.
connect
(
lambda
:
zce
.
dialog
(
main_window
,
ds
,
filename
))
drlact
=
QtWidgets
.
QAction
(
QtGui
.
QIcon
.
fromTheme
(
"applications-utilities"
),
"&DRL..."
)
drlact
.
setShortcut
(
QtCore
.
Qt
.
CTRL
+
QtCore
.
Qt
.
Key_D
)
drlact
.
triggered
.
connect
(
lambda
:
drl
.
main_window
(
main_window
,
ds
,
filename
,
drlcache
))
file_menu
=
QtWidgets
.
QMenu
(
'&File'
,
main_window
)
main_window
.
menuBar
().
addMenu
(
file_menu
)
file_menu
.
addAction
(
'&Open..'
,
lambda
:
load_file
(
chromatogram
,
spectrum
,
ds
,
ms
,
filename
,
chrom
,
config
),
QtCore
.
Qt
.
CTRL
+
QtCore
.
Qt
.
Key_O
)
file_menu
.
addAction
(
'&Export..'
,
lambda
:
ft
.
export_dial
(
ms
,
chrom
,
filename
,
main_window
),
QtCore
.
Qt
.
CTRL
+
QtCore
.
Qt
.
Key_E
)
file_menu
.
addAction
(
'Settings'
,
lambda
:
cf
.
dial
(
main_window
))
file_menu
.
addAction
(
'&Quit'
,
main_window
.
close
,
QtCore
.
Qt
.
CTRL
+
QtCore
.
Qt
.
Key_Q
)
file_menu
.
addAction
(
openact
)
file_menu
.
addAction
(
exportact
)
file_menu
.
addSeparator
()
file_menu
.
addAction
(
settingsact
)
file_menu
.
addSeparator
()
file_menu
.
addAction
(
quitact
)
tools_menu
=
QtWidgets
.
QMenu
(
'&Tools'
,
main_window
)
main_window
.
menuBar
().
addMenu
(
tools_menu
)
tools_menu
.
addAction
(
'&TSQ zce'
,
lambda
:
zce
.
dialog
(
tools_menu
.
addAction
(
zceact
)
tools_menu
.
addAction
(
drlact
)
"""tools_menu.addAction('&TSQ zce', lambda: zce.dialog(
main_window, ds, filename), QtCore.Qt.CTRL + QtCore.Qt.Key_T)
tools_menu.addAction('&DRL..', lambda: drl.main_window(
main_window, ds, filename, drlcache),
QtCore
.
Qt
.
CTRL
+
QtCore
.
Qt
.
Key_D
)
QtCore.Qt.CTRL + QtCore.Qt.Key_D)
"""
main_widget
=
QtWidgets
.
QWidget
(
main_window
)
main_window
.
setCentralWidget
(
main_widget
)
toolBar
=
QtWidgets
.
QToolBar
(
main_window
)
toolBar
.
setAllowedAreas
(
QtCore
.
Qt
.
TopToolBarArea
)
toolBar
.
setFloatable
(
False
)
toolBar
.
setMovable
(
False
)
toolBar
.
setToolButtonStyle
(
QtCore
.
Qt
.
ToolButtonTextBesideIcon
)
toolBar
.
addAction
(
openact
)
toolBar
.
addAction
(
exportact
)
toolBar
.
addSeparator
()
toolBar
.
addAction
(
zceact
)
toolBar
.
addAction
(
drlact
)
layout
=
QtWidgets
.
QVBoxLayout
(
main_widget
)
layout
.
addWidget
(
toolBar
)
layout
.
addWidget
(
mpl_canvas
)
mpl_canvas
.
setFocus
()
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment