Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
header_text.setText(str(header))
header_text.setReadOnly(True)
layout.addWidget(header_text, 1, 0, 1, 2)
# Buttons to change between a volume and a contour.
def change_volume_type(type):
global volume_type
if(type != volume_type):
volume_type = type
mayavi_widget.visualization.update_volume()
mayavi_widget.visualization.create_wireframe()
volume_button = QtGui.QPushButton("Volumen", window)
volume_button.clicked.connect(lambda: change_volume_type('volume'))
layout.addWidget(volume_button, 2, 1)
contour_button = QtGui.QPushButton("Contorno", window)
contour_button.clicked.connect(lambda: change_volume_type('contour'))
layout.addWidget(contour_button, 3, 1)
# Function to update the number of contours.
def contours_text_change():
global contours
contours = int(contours_text.text())
if(volume_type == 'contour'):
mayavi_widget.visualization.update_volume()
mayavi_widget.visualization.create_wireframe()
# Label for the contours number.
label = QtGui.QLabel(container)
label.setText("Contornos")
label.setAlignment(QtCore.Qt.AlignHCenter|QtCore.Qt.AlignVCenter)
layout.addWidget(label, 3, 2)
parent : parent of the returned root
"""
# setup leftchild
left = EditorAreaWidget(editor_area=AdvancedEditorAreaPane(), parent=None)
btn0 = QtGui.QPushButton('btn0')
btn1 = QtGui.QPushButton('btn1')
tabwidget = left.tabwidget()
tabwidget.addTab(btn0, '0')
tabwidget.addTab(btn1, '1')
tabwidget.setCurrentIndex(1)
# setup rightchild
right = EditorAreaWidget(editor_area=left.editor_area, parent=None)
btn2 = QtGui.QPushButton('btn2')
btn3 = QtGui.QPushButton('btn3')
tabwidget = right.tabwidget()
tabwidget.addTab(btn2, '2')
tabwidget.addTab(btn3, '3')
tabwidget.setCurrentIndex(0)
# setup root
root = EditorAreaWidget(editor_area=left.editor_area, parent=parent)
tabwidget = root.tabwidget()
tabwidget.setParent(None)
root.addWidget(left)
root.addWidget(right)
root.leftchild = left
root.rightchild = right
return root, left, right
def _setUp_collapse(self, parent=None):
""" Creates a root, its leftchild and rightchild, so that collapse can be tested on
one of the children.
Returns the root, leftchild and rightchild of such layout.
parent : parent of the returned root
"""
# setup leftchild
left = EditorAreaWidget(editor_area=AdvancedEditorAreaPane(), parent=None)
btn0 = QtGui.QPushButton('btn0')
btn1 = QtGui.QPushButton('btn1')
tabwidget = left.tabwidget()
tabwidget.addTab(btn0, '0')
tabwidget.addTab(btn1, '1')
tabwidget.setCurrentIndex(1)
# setup rightchild
right = EditorAreaWidget(editor_area=left.editor_area, parent=None)
btn2 = QtGui.QPushButton('btn2')
btn3 = QtGui.QPushButton('btn3')
tabwidget = right.tabwidget()
tabwidget.addTab(btn2, '2')
tabwidget.addTab(btn3, '3')
tabwidget.setCurrentIndex(0)
# setup root
root = EditorAreaWidget(editor_area=left.editor_area, parent=parent)
Returns the root, leftchild and rightchild of such layout.
parent : parent of the returned root
"""
# setup leftchild
left = EditorAreaWidget(editor_area=AdvancedEditorAreaPane(), parent=None)
btn0 = QtGui.QPushButton('btn0')
btn1 = QtGui.QPushButton('btn1')
tabwidget = left.tabwidget()
tabwidget.addTab(btn0, '0')
tabwidget.addTab(btn1, '1')
tabwidget.setCurrentIndex(1)
# setup rightchild
right = EditorAreaWidget(editor_area=left.editor_area, parent=None)
btn2 = QtGui.QPushButton('btn2')
btn3 = QtGui.QPushButton('btn3')
tabwidget = right.tabwidget()
tabwidget.addTab(btn2, '2')
tabwidget.addTab(btn3, '3')
tabwidget.setCurrentIndex(0)
# setup root
root = EditorAreaWidget(editor_area=left.editor_area, parent=parent)
tabwidget = root.tabwidget()
tabwidget.setParent(None)
root.addWidget(left)
root.addWidget(right)
root.leftchild = left
root.rightchild = right
return root, left, right
def _create_find_control(self):
control = QtGui.QWidget(self)
self.line_edit = QtGui.QLineEdit()
self.next_button = QtGui.QPushButton("&Next")
self.next_button.setFixedWidth(self.button_size)
self.prev_button = QtGui.QPushButton("&Prev")
self.prev_button.setFixedWidth(self.button_size)
self.options_button = QtGui.QPushButton("&Options")
self.options_button.setFixedWidth(self.button_size)
options_menu = QtGui.QMenu(self)
self.case_action = QtGui.QAction("Match &case", options_menu)
self.case_action.setCheckable(True)
self.word_action = QtGui.QAction("Match words", options_menu)
self.word_action.setCheckable(True)
self.wrap_action = QtGui.QAction("Wrap search", options_menu)
self.wrap_action.setCheckable(True)
self.wrap_action.setChecked(True)
options_menu.addAction(self.case_action)
options_menu.addAction(self.word_action)
def _create_replace_control(self):
control = QtGui.QWidget(self)
self.replace_edit = QtGui.QLineEdit()
self.replace_button = QtGui.QPushButton("&Replace")
self.replace_button.setFixedWidth(self.button_size)
self.replace_all_button = QtGui.QPushButton("Replace &All")
self.replace_all_button.setFixedWidth(self.button_size)
layout = QtGui.QHBoxLayout()
layout.addWidget(self.replace_edit)
layout.addWidget(self.replace_button)
layout.addWidget(self.replace_all_button)
layout.addStretch(2)
layout.setContentsMargins(0, 0, 0, 0)
control.setLayout(layout)
return control
button_layout = QtGui.QHBoxLayout(button_frame)
self.calculate_button = QtGui.QPushButton('Calculate KS State', button_frame)
self.calculate_button.setFixedWidth(150)
self.calculate_button.setFixedHeight(50)
self.calculate_button.clicked.connect(self.calculate_ks_state)
button_layout.addWidget(self.calculate_button)
self.calculate_density_button = QtGui.QPushButton('Calculate\nelectron density', button_frame)
self.calculate_density_button.setFixedWidth(150)
self.calculate_density_button.setFixedHeight(50)
self.calculate_density_button.clicked.connect(self.calculate_electron_density)
button_layout.addWidget(self.calculate_density_button)
self.choose_nk_button = QtGui.QPushButton(button_frame)
self.choose_nk_button.setFixedWidth(150)
self.choose_nk_button.setFixedHeight(50)
self.choose_nk_button.clicked.connect(self.choose_nk)
button_layout.addWidget(self.choose_nk_button)
self.plot_group = QtGui.QGroupBox(parent=self.main_widget)
self.plot_group.setTitle('Plot Options')
self.layout.addWidget(self.plot_group)
self.plot_widget = OptionWithTreeview(KsStatePlotOptionWidget, self.parent.ks_densities, parent=self)
self.sub_layout2 = QtGui.QVBoxLayout(self.plot_group)
self.sub_layout2.addWidget(self.plot_widget)
self.plot_widget.update_tree()
self.start_relax_button = QtGui.QPushButton('Start Structure\nRelaxation', self.button_widget)
self.start_relax_button.setFixedSize(*button_size)
self.start_relax_button.clicked.connect(self.start_relax)
self.button_layout.addWidget(self.start_relax_button)
self.start_gw_button = QtGui.QPushButton('Start GW', self.button_widget)
self.start_gw_button.setFixedSize(*button_size)
self.start_gw_button.clicked.connect(self.start_gw)
self.button_layout.addWidget(self.start_gw_button)
self.start_phonon_button = QtGui.QPushButton('Start Phonon\nBandstructure', self.button_widget)
self.start_phonon_button.setFixedSize(*button_size)
self.start_phonon_button.clicked.connect(self.start_phonons)
self.button_layout.addWidget(self.start_phonon_button)
self.start_optical_spectrum_button = QtGui.QPushButton('Calculate optical\nspectrum', self.button_widget)
self.start_optical_spectrum_button.setFixedSize(*button_size)
self.start_optical_spectrum_button.clicked.connect(self.start_optical_spectrum_calculation)
self.button_layout.addWidget(self.start_optical_spectrum_button)
self.abort_calculation_button = QtGui.QPushButton('Abort Calculation', self.button_widget)
self.abort_calculation_button.setFixedSize(*button_size)
self.abort_calculation_button.clicked.connect(self.abort_calculation)
self.button_layout.addWidget(self.abort_calculation_button)
self.execute_error_dialog = QtGui.QErrorMessage(parent=self)
self.execute_error_dialog.resize(500, 200)
self.layout.addWidget(self.button_widget)
self.band_structure_points = None
self.show()
self.cmd_button = QtGui.QCommandLinkButton(buttons_container)
self.cmd_button.setVisible(True)
self.cmd_button.setCheckable(True)
self.cmd_button.setFlat(True)
self.cmd_button.setAutoFillBackground(True)
self.cmd_button.clicked.connect(self._handle_page_toggle)
self.cmd_button.setText(self.name)
self.cmd_button.setDescription(self.description)
self.cmd_button.setIcon(self.cmd_button.style().standardIcon(self.icon))
buttons_layout.addWidget(self.cmd_button)
if self.notebook.delete:
self.del_button = QtGui.QPushButton(buttons_container)
self.del_button.setVisible(True)
self.del_button.setFlat(True)
self.del_button.setEnabled(self.deletable)
self.del_button.setIcon(self.del_button.style().standardIcon(QtGui.QStyle.SP_TitleBarCloseButton))
self.del_button.clicked.connect(self._handle_close_button)
buttons_layout.addWidget(self.del_button)
buttons_layout.addStretch(1)
buttons_container.setLayout(buttons_layout)
self.layout.addWidget(buttons_container)
self.ui.control.setVisible(self.is_open)
self.layout.addWidget(self.ui.control)
self.colormap_combobox = QtGui.QComboBox(self)
self.verticalLayout.addWidget(self.colormap_combobox)
for el in colormap_list:
self.colormap_combobox.addItem(el)
index = self.colormap_combobox.findText('hot', QtCore.Qt.MatchFixedString)
if index >= 0:
self.colormap_combobox.setCurrentIndex(index)
self.colormap_combobox.currentIndexChanged.connect(self.parent.handle_item_changed)
button_frame = QtGui.QWidget(self)
self.button_layout = QtGui.QHBoxLayout(button_frame)
self.verticalLayout.addWidget(button_frame)
self.button_layout.setAlignment(QtCore.Qt.AlignLeft)
self.apply_button = QtGui.QPushButton('Apply')
self.apply_button.setFixedSize(100, 50)
self.apply_button.clicked.connect(self.parent.handle_item_changed)
self.button_layout.addWidget(self.apply_button)
self.slice_button = QtGui.QPushButton('Slice')
self.slice_button.setFixedSize(100, 50)
self.slice_button.clicked.connect(self.parent.open_slice_widget)
self.button_layout.addWidget(self.slice_button)