class CentralWidget(QtWidgets.QWidget): def __init__(self, parent): QtWidgets.QWidget.__init__(self, parent) self.control = parent.control self.setWindowTitle('pyMolDyn 2') self.widget_titles = ( "3D View", "Pair Distribution Functions", "Cavity Histograms") self.init_gui() def init_gui(self): self.gl_stack = GLStack(self, self.parent()) self.gl_widget = self.gl_stack.gl_widget self.combo = QtWidgets.QComboBox() for title in self.widget_titles: self.combo.addItem(title) self.combo.activated[str].connect(self.on_combo) layout = QtWidgets.QVBoxLayout() layout.addWidget(self.gl_stack) layout.addWidget(self.combo) self.setFocusPolicy(QtCore.Qt.StrongFocus) self.setLayout(layout) def on_combo(self, string): index = self.widget_titles.index(string) self.gl_stack.activate(index)
class CentralWidget(QtWidgets.QWidget): def __init__(self, parent): QtWidgets.QWidget.__init__(self, parent) self.control = parent.control self.setWindowTitle('pyMolDyn 2') self.widget_titles = ("3D View", "Pair Distribution Functions", "Cavity Histograms") self.init_gui() def init_gui(self): self.gl_stack = GLStack(self, self.parent()) self.gl_widget = self.gl_stack.gl_widget self.combo = QtWidgets.QComboBox() for title in self.widget_titles: self.combo.addItem(title) self.combo.activated[str].connect(self.on_combo) layout = QtWidgets.QVBoxLayout() layout.addWidget(self.gl_stack) layout.addWidget(self.combo) self.setFocusPolicy(QtCore.Qt.StrongFocus) self.setLayout(layout) def on_combo(self, string): index = self.widget_titles.index(string) self.gl_stack.activate(index)
def init_gui(self): self.gl_stack = GLStack(self, self.parent()) self.gl_widget = self.gl_stack.gl_widget self.combo = QtWidgets.QComboBox() for title in self.widget_titles: self.combo.addItem(title) self.combo.activated[str].connect(self.on_combo) layout = QtWidgets.QVBoxLayout() layout.addWidget(self.gl_stack) layout.addWidget(self.combo) self.setFocusPolicy(QtCore.Qt.StrongFocus) self.setLayout(layout)