12 QMenu.__init__(self, parent)
14 gui.AddMenuAction(self,
'Open', self.
_Open, shortcut=
'Ctrl+O')
15 gui.AddMenuAction(self,
'Save As...', self.
_SaveAs,
16 shortcut=
'Ctrl+Shift+S',
19 filename=QFileDialog.getOpenFileName(
None,
'Open file',
'')
20 if(QFileInfo(filename).isFile()):
21 gui.FileLoader.LoadObject(str(filename))
24 sel_node=gui.SceneSelection.Instance().GetActiveNode(0)
25 filename=QFileDialog.getSaveFileName(
None,
'Save As',
26 '%s.pdb' % sel_node.name)
27 io.SavePDB(sel_node.view, str(filename))
31 QWidget.__init__(self)
32 self.setWindowFlags(Qt.Tool)
34 l.addWidget(QLabel(
"Near"), 0, 0)
35 l.addWidget(QLabel(
"Far"), 1, 0)
36 bounds_near = QLineEdit(str(0))
37 bounds_near.setValidator(QIntValidator(0, 9999, bounds_near))
38 bounds_near.setMaxLength(4)
39 bounds_near.setMaximumWidth(50)
40 bounds_far = QLineEdit(str(200))
41 bounds_far.setValidator(QIntValidator(0, 9999, bounds_far))
42 bounds_far.setMaxLength(4)
43 bounds_far.setMaximumWidth(50)
44 l.addWidget(bounds_near, 0, 1, 2, 1)
45 l.addWidget(bounds_far, 0, 3, 2, 1)
46 self.
near_ = QSlider(Qt.Horizontal)
47 self.near_.setMinimum(int(bounds_near.text()))
48 self.near_.setMaximum(int(bounds_far.text()))
49 self.near_.setValue(int(
gfx.Scene().near))
50 self.
far_ = QSlider(Qt.Horizontal)
51 self.far_.setMinimum(int(bounds_near.text()))
52 self.far_.setMaximum(int(bounds_far.text()))
56 self.far_.setValue(far)
57 self.
auto_ = QCheckBox(
"Continuous Automatic Clipping")
58 self.auto_.setChecked(
gfx.Scene().GetAutoAutoslab())
60 l.addWidget(self.
near_, 0, 2)
61 l.addWidget(self.
far_, 1, 2)
62 l.addWidget(self.
auto_, 2, 0, 1, 4)
63 self.connect(self.
near_, SIGNAL(
'valueChanged(int)'), self.
SetNear)
64 self.connect(self.
far_, SIGNAL(
'valueChanged(int)'), self.
SetFar)
65 self.connect(self.
auto_, SIGNAL(
'stateChanged(int)'), self.
SetAuto)
66 self.connect(bounds_near, SIGNAL(
'textEdited(QString)'), self.
SetNearBounds)
67 self.connect(bounds_far, SIGNAL(
'textEdited(QString)'), self.
SetFarBounds)
77 gfx.Scene().near = int(self.near_.value())
82 self.near_.setMinimum(int(text))
83 self.far_.setMinimum(int(text))
87 self.near_.setMaximum(int(text))
88 self.far_.setMaximum(int(text))
92 QDialog.__init__(self)
94 l.setColumnMinimumWidth(0, 100)
95 l.addWidget(QLabel(
"Width (px)"), 0, 0)
96 l.addWidget(QLabel(
"Height (px)"), 1, 0)
99 self.width_.setValidator(QIntValidator(50, 3000, self.
width_))
100 self.height_.setValidator(QIntValidator(50, 3000, self.
height_))
101 self.
opaque_=QCheckBox(
"Force Opaque Background")
102 l.addWidget(self.
width_, 0, 1)
103 l.addWidget(self.
height_, 1, 1)
104 l.addWidget(self.
opaque_, 2, 1)
106 cancel=QPushButton(
"Cancel")
107 QObject.connect(cancel, SIGNAL(
'clicked()'), self.reject)
108 hbox.addWidget(cancel)
109 export=QPushButton(
"Export")
110 hbox.addWidget(export)
111 export.setDefault(
True)
112 l.addLayout(hbox, 3, 1, 2, 1)
113 QObject.connect(export, SIGNAL(
'clicked()'), self.accept)
116 return not self.opaque_.isChecked()
120 return int(self.width_.text())
124 return int(self.height_.text())
128 QMenu.__init__(self, parent)
129 self.setTitle(
'Scene')
130 QObject.connect(self, SIGNAL(
'aboutToShow()'), self.
_AboutToShow)
133 shortcut=
'Ctrl+Shift+F', checkable=
True,
135 gui.AddMenuAction(self,
'Center', self.
_Center,
137 gui.AddMenuAction(self,
'Fit To Screen', self.
_FitToScreen,
141 gui.AddMenuAction(self,
'Save Snapshot', self.
_ExportScene)
142 gui.AddMenuAction(self,
'Scene Clipping', self.
_ClipScene, shortcut=
'Ctrl+Shift+C')
144 def _ExportScene(self):
148 filename=QFileDialog.getSaveFileName(
None,
'Save Snapshot',
151 gfx.Scene().Export(str(filename), qd.width, qd.height, qd.transparent)
153 def _ClipScene(self):
157 def _AboutToShow(self):
158 self.fog_action.setChecked(
gfx.Scene().fog)
161 sel=gui.SceneSelection.Instance()
162 gfx.Scene().center=sel.GetActiveNode(0).center
164 def _SetSceneBackground(self):
169 def _ToggleFog(self):
171 self.fog_action.setChecked(
gfx.Scene().fog)
173 def _FitToScreen(self):
174 sel=gui.SceneSelection.Instance()
175 gfx.FitToScreen(sel.GetActiveNode(0))
177 def _SuperposeDialog(self):
178 sel=gui.SceneSelection.Instance()
179 act_count=sel.GetActiveNodeCount()
183 gfx_ent_1 = sel.GetActiveNode(i)
186 gfx_ent_1 = sel.GetActiveNode(i)
188 gfx_ent_2 = sel.GetActiveNode(i)
191 gfx_ent_2 = sel.GetActiveNode(i)
193 if sd.rmsd_superposed_atoms !=
None:
194 if sd.reference == 0:
195 gfx_ent_2.UpdatePositions()
198 gfx_ent_1.UpdatePositions()
200 LogScript(
'RMSD: %.3f'%sd.rmsd)
201 LogScript(
'RMSD superposed atoms: %.3f'%sd.rmsd_superposed_atoms)
202 LogScript(
'fraction superposed: %.3f'%sd.fraction_superposed)
203 elif sd.rmsd !=
None:
204 if sd.reference == 0:
205 gfx_ent_2.UpdatePositions()
208 gfx_ent_1.UpdatePositions()
210 LogScript(
'RMSD: %.3f'%sd.rmsd)
214 QMenu.__init__(self, parent)
215 self.setTitle(
'Window')
216 gosty=gui.GostyApp.Instance()
217 QObject.connect(self, SIGNAL(
'aboutToShow()'), self.
_AboutToShow)
218 inspector_visible=gosty.GetWidget(
'InspectorDialog').isVisible()
221 checked=gosty.gl_win.qobject.isVisible(),
226 checked=inspector_visible,
229 self.addMenu(gosty.perspective.panels.menu)
230 gui.AddMenuAction(self,
'Reset View', self.
_ResetView)
231 def _AboutToShow(self):
232 gosty=gui.GostyApp.Instance()
233 self._gl_win_action.setChecked(gosty.gl_win.qobject.isVisible())
234 inspector_visible=gosty.GetWidget(
'InspectorDialog').isVisible()
235 self._inspector_action.setChecked(inspector_visible)
237 def _ToggleShowGLWindow(self):
238 gosty=gui.GostyApp.Instance()
239 gl_win=gosty.GetGLWin()
240 if gl_win
and gl_win.qobject.isHidden():
245 def _ToggleShowInspector(self):
246 gosty=gui.GostyApp.Instance()
247 inspector=gosty.GetWidget(
'InspectorDialog')
248 if inspector
and inspector.isHidden():
253 def _ResetView(self):
254 msg_box = QMessageBox()
255 msg_box.setWindowTitle(
"Reset the Panels and Widget");
256 msg_box.setIcon(QMessageBox.Question)
257 msg_box.setText(
"Do you really want to reset the Panels and Widgets?");
258 msg_box.setStandardButtons(QMessageBox.Yes |
260 msg_box.setDefaultButton(QMessageBox.Cancel);
261 ret = msg_box.exec_();
262 if(ret == QMessageBox.Yes):
263 settings = QSettings()
264 settings.setValue(
"restore_settings",QVariant(
False))
265 info_box = QMessageBox()
266 info_box.setStandardButtons(QMessageBox.Ok)
267 info_box.setIcon(QMessageBox.Information)
268 info_box.setWindowTitle(
"Restart OpenStructure")
269 info_box.setText(
"You must restart OpenStructure for the changes to take effect!");
274 QMenu.__init__(self, parent)
275 self.setTitle(
'Help')
276 gui.AddMenuAction(self,
'Documentation', self.
_VisitDocs)
278 if sys.platform==
'darwin':
279 gui.AddMenuAction(self,
'Install Command Line Tool',
280 termuse.InstallTerminalPrograms)
281 def _VisitDocs(self):
282 QDesktopServices.openUrl(QUrl(
"http://www.openstructure.org/docs/"))
284 def _ShowAboutDialog(self):
288 _InitMenu.mbar=gui.GostyApp.Instance().perspective.GetMenuBar()
293 _InitMenu.mbar.addMenu(file_menu)
294 _InitMenu.mbar.addMenu(scene_menu)
295 _InitMenu.mbar.addMenu(win_menu)
296 _InitMenu.mbar.addMenu(help_menu)
main class for organization and root for the graphical display
main class for all graphic objects
graphical rendering of mol::EntityHandle entites