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