26 from PyQt4
import QtCore, QtGui
34 QtCore.QObject.__init__(self, menu_bar)
36 persp=gui.GostyApp.Instance().perspective
37 file=persp.GetMenu(
"File")
38 options=persp.GetMenu(
"Options")
39 window=persp.GetMenu(
"Window")
40 help=persp.GetMenu(
"Help")
42 load = QtGui.QAction(QtGui.QIcon(
'icons/open.png'),
'&Open', self)
43 load.setStatusTip(
'Load a file')
44 load.setShortcut(
'Ctrl+O')
45 self.connect(load, QtCore.SIGNAL(
'triggered()'), self.
Load)
48 webpage = QtGui.QAction(
'&Documentation', self)
49 webpage.setStatusTip(
'Documentation')
50 webpage.setShortcut(
'Ctrl+D')
51 self.connect(webpage, QtCore.SIGNAL(
'triggered()'), self.
OpenDocs)
52 help.addAction(webpage)
53 if sys.platform==
'darwin':
54 install_ctl=QtGui.QAction(
'Install Command Line Tool', self)
55 self.connect(install_ctl, QtCore.SIGNAL(
'triggered()'),
56 termuse.InstallTerminalPrograms)
57 help.addAction(install_ctl)
58 about = QtGui.QAction(
'&About', self)
59 about.setStatusTip(
'About')
60 about.setShortcut(
'Ctrl+A')
61 self.connect(about, QtCore.SIGNAL(
'triggered()'), self.
About)
65 window.addMenu(persp.panels.menu)
66 gl_win = QtGui.QAction(
'&GL Window', self)
67 gl_win.setStatusTip(
'Display gl windows')
68 gl_win.setShortcut(
'Ctrl+G')
69 self.connect(gl_win, QtCore.SIGNAL(
'triggered()'), self.
ShowGLWin)
70 window.addAction(gl_win)
72 reset = QtGui.QAction(
'Reset View', self)
73 reset.setStatusTip(
'Reset the Panels and Widgets')
74 self.connect(reset, QtCore.SIGNAL(
'triggered()'), self.
ResetView)
75 window.addAction(reset)
79 loader_manager = QtGui.QAction(
'File &Loader', self)
80 loader_manager.setStatusTip(
'Loader Manager')
81 self.connect(loader_manager, QtCore.SIGNAL(
'triggered()'), self.
LoaderManager)
82 options.addAction(loader_manager)
87 reply = QtGui.QMessageBox()
88 reply.addButton(QtGui.QMessageBox.Yes)
92 filename = QtGui.QFileDialog.getOpenFileName(
None,
'Open file',
'')
93 if(QtCore.QFileInfo(filename).isFile()):
94 FileLoader.LoadObject(str(filename))
97 self.loader_manager.exec_()
100 QtGui.QDesktopServices.openUrl(QtCore.QUrl(
"http://www.openstructure.org/docs/"))
106 gosty=gui.GostyApp.Instance()
107 gl_win=gosty.GetGLWin()
108 if gl_win
and gl_win.qobject.isHidden():
112 msg_box = QtGui.QMessageBox()
113 msg_box.setWindowTitle(
"Reset the Panels and Widget");
114 msg_box.setIcon(QtGui.QMessageBox.Question)
115 msg_box.setText(
"Do you really want to reset the Panels and Widgets?");
116 msg_box.setStandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.Cancel);
117 msg_box.setDefaultButton(QtGui.QMessageBox.Cancel);
118 ret = msg_box.exec_();
119 if(ret == QtGui.QMessageBox.Yes):
120 settings = QtCore.QSettings()
121 settings.setValue(
"restore_settings",QtCore.QVariant(
False))
122 info_box = QtGui.QMessageBox()
123 info_box.setStandardButtons(QtGui.QMessageBox.Ok)
124 info_box.setIcon(QtGui.QMessageBox.Information)
125 info_box.setWindowTitle(
"Restart OpenStructure")
126 info_box.setText(
"You must restart OpenStructure for the changes to take effect!");
129 def _InitMenuBar(app):