25 from PyQt5
import QtCore, QtGui
31 QtCore.QObject.__init__(self, menu_bar)
33 persp=gui.GostyApp.Instance().perspective
34 file=persp.GetMenu(
"File")
35 options=persp.GetMenu(
"Options")
36 window=persp.GetMenu(
"Window")
37 help=persp.GetMenu(
"Help")
39 load = QtGui.QAction(QtGui.QIcon(
'icons/open.png'),
'&Open', self)
40 load.setStatusTip(
'Load a file')
41 load.setShortcut(
'Ctrl+O')
42 self.connect(load, QtCore.SIGNAL(
'triggered()'), self.
LoadLoad)
45 webpage = QtGui.QAction(
'&Documentation', self)
46 webpage.setStatusTip(
'Documentation')
47 webpage.setShortcut(
'Ctrl+D')
48 self.connect(webpage, QtCore.SIGNAL(
'triggered()'), self.
OpenDocsOpenDocs)
49 help.addAction(webpage)
50 if sys.platform==
'darwin':
51 install_ctl=QtGui.QAction(
'Install Command Line Tool', self)
52 self.connect(install_ctl, QtCore.SIGNAL(
'triggered()'),
53 termuse.InstallTerminalPrograms)
54 help.addAction(install_ctl)
55 about = QtGui.QAction(
'&About', self)
56 about.setStatusTip(
'About')
57 about.setShortcut(
'Ctrl+A')
58 self.connect(about, QtCore.SIGNAL(
'triggered()'), self.
AboutAbout)
62 window.addMenu(persp.panels.menu)
63 gl_win = QtGui.QAction(
'&GL Window', self)
64 gl_win.setStatusTip(
'Display gl windows')
65 gl_win.setShortcut(
'Ctrl+G')
66 self.connect(gl_win, QtCore.SIGNAL(
'triggered()'), self.
ShowGLWinShowGLWin)
67 window.addAction(gl_win)
69 reset = QtGui.QAction(
'Reset View', self)
70 reset.setStatusTip(
'Reset the Panels and Widgets')
71 self.connect(reset, QtCore.SIGNAL(
'triggered()'), self.
ResetViewResetView)
72 window.addAction(reset)
75 reply = QtGui.QMessageBox()
76 reply.addButton(QtGui.QMessageBox.Yes)
80 filename = QtGui.QFileDialog.getOpenFileName(
None,
'Open file',
'')
81 if(QtCore.QFileInfo(filename).isFile()):
82 FileLoader.LoadObject(str(filename))
85 QtGui.QDesktopServices.openUrl(QtCore.QUrl(
"http://www.openstructure.org/docs/"))
91 gosty=gui.GostyApp.Instance()
92 gl_win=gosty.GetGLWin()
93 if gl_win
and gl_win.qobject.isHidden():
97 msg_box = QtGui.QMessageBox()
98 msg_box.setWindowTitle(
"Reset the Panels and Widget");
99 msg_box.setIcon(QtGui.QMessageBox.Question)
100 msg_box.setText(
"Do you really want to reset the Panels and Widgets?");
101 msg_box.setStandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.Cancel);
102 msg_box.setDefaultButton(QtGui.QMessageBox.Cancel);
103 ret = msg_box.exec_();
104 if(ret == QtGui.QMessageBox.Yes):
105 settings = QtCore.QSettings()
106 settings.setValue(
"restore_settings",QtCore.QVariant(
False))
107 info_box = QtGui.QMessageBox()
108 info_box.setStandardButtons(QtGui.QMessageBox.Ok)
109 info_box.setIcon(QtGui.QMessageBox.Information)
110 info_box.setWindowTitle(
"Restart OpenStructure")
111 info_box.setText(
"You must restart OpenStructure for the changes to take effect!");
114 def _InitMenuBar(app):