Skip to content

Commit

Permalink
int for text coords
Browse files Browse the repository at this point in the history
  • Loading branch information
sozykinsa committed Jan 24, 2024
1 parent e0f8a2f commit 298dbeb
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 19 deletions.
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
pyopengl
pyside6
qtpy==2.4.1
qtpy
ase
numpy==1.26.2
scipy==1.11.4
numpy
scipy
matplotlib
pyqtgraph
scikit-image
5 changes: 1 addition & 4 deletions src/core_atomistic_qt/opengl_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -619,9 +619,6 @@ def light_prepare(self) -> None:
gl.glEnable(gl.GL_LIGHT0)
gl.glEnable(gl.GL_DEPTH_TEST)
gl.glEnable(gl.GL_COLOR_MATERIAL)
# gl.glDisable(gl.GL_COLOR_MATERIAL)

# Determine the current lighting model
gl.glLightModelf(gl.GL_LIGHT_MODEL_TWO_SIDE, gl.GL_TRUE) # two-side lighting calculation

gl.glEnable(gl.GL_LIGHT0)
Expand Down Expand Up @@ -680,7 +677,7 @@ def render_text(self, text_to_render, font=QFont()):
fl = False
if fl:
used_space.append([pos_x, pos_y])
painter.drawText(pos_x - self.property_x_shift, pos_y - self.property_y_shift, st)
painter.drawText(int(pos_x - self.property_x_shift), int(pos_y - self.property_y_shift), st)
painter.end()

@staticmethod
Expand Down
33 changes: 21 additions & 12 deletions src/qtbased/gui4dftform.py
Original file line number Diff line number Diff line change
Expand Up @@ -2230,20 +2230,29 @@ def plot_bands(self):
title = self.ui.bands_title.text()

if os.path.exists(file):
if self.ui.bands_spin_up.isChecked():
if self.ui.bands_spin_up.isChecked() or self.ui.bands_spin_up_down.isChecked():
bands, emaxf, eminf, homo, kmesh, lumo, xticklabels, xticks = read_siesta_bands(file, True, kmax, kmin)
self.ui.PyqtGraphWidget.plot([kmesh], bands, [None], title, x_title, y_title, False)

if self.ui.bands_spin_down.isChecked():
bands, emaxf, eminf, homo, kmesh, lumo, xticklabels, xticks = read_siesta_bands(file, False, kmax, kmin)
self.ui.PyqtGraphWidget.plot([kmesh], bands, [None], title, x_title, y_title, False)

if self.ui.bands_spin_up_down.isChecked():
bands, emaxf, eminf, homo, kmesh, lumo, xticklabels, xticks = read_siesta_bands(file, True, kmax, kmin)
self.ui.PyqtGraphWidget.plot([kmesh], bands, [None], title, x_title, y_title, False)

b_mins = np.min(bands, 1)
b_maxs = np.max(bands, 1)
inds = np.zeros(len(bands), dtype=int)
for i in range(len(bands)):
if (b_mins[i] >= emin) and (b_mins[i] <= emax) or (b_maxs[i] >= emin) and (b_maxs[i] <= emax):
inds[i] = i
self.ui.PyqtGraphWidget.plot([kmesh], bands[inds], [None], title, x_title, y_title, False)

if self.ui.bands_spin_down.isChecked() or self.ui.bands_spin_up_down.isChecked():
bands, emaxf, eminf, homo, kmesh, lumo, xticklabels, xticks = read_siesta_bands(file, False, kmax, kmin)
self.ui.PyqtGraphWidget.plot([kmesh], bands, [None], title, x_title, y_title, False, _style=Qt.DotLine)
b_mins = np.min(bands, 1)
b_maxs = np.max(bands, 1)
inds = np.zeros(len(bands), dtype=int)
for i in range(len(bands)):
if (b_mins[i] >= emin) and (b_mins[i] <= emax) or (b_maxs[i] >= emin) and (b_maxs[i] <= emax):
inds[i] = i
if self.ui.bands_spin_down.isChecked():
self.ui.PyqtGraphWidget.plot([kmesh], bands[inds], [None], title, x_title, y_title, False)
if self.ui.bands_spin_up_down.isChecked():
self.ui.PyqtGraphWidget.plot([kmesh], bands[inds], [None], title, x_title, y_title, False,
_style=Qt.DotLine)

major_tick = []
for index in range(len(xticks)):
Expand Down

0 comments on commit 298dbeb

Please sign in to comment.