Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

convert float to int as expected by Qt API functions #18

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions plugins/tenet/ui/reg_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def _init_reg_positions(self):
y += self._char_height

name_rect = QtCore.QRect(0, 0, name_size.width(), name_size.height())
name_rect.moveBottomLeft(QtCore.QPoint(name_x, y))
name_rect.moveBottomLeft(QtCore.QPoint(int(name_x), int(y)))

prev_rect = QtCore.QRect(0, 0, arrow_size, arrow_size)
next_rect = QtCore.QRect(0, 0, arrow_size, arrow_size)
Expand All @@ -175,7 +175,7 @@ def _init_reg_positions(self):

value_x = prev_x + prev_rect.width() + self._char_width
value_rect = QtCore.QRect(0, 0, value_size.width(), value_size.height())
value_rect.moveBottomLeft(QtCore.QPoint(value_x, y))
value_rect.moveBottomLeft(QtCore.QPoint(int(value_x), int(y)))

next_x = value_x + value_size.width() + self._char_width
next_rect.moveCenter(name_rect.center())
Expand Down Expand Up @@ -542,4 +542,4 @@ def __init__(self, name, name_rect, value_rect, arrow_rects):
self.name_rect = name_rect
self.value_rect = value_rect
self.prev_rect = arrow_rects[0]
self.next_rect = arrow_rects[1]
self.next_rect = arrow_rects[1]
10 changes: 5 additions & 5 deletions plugins/tenet/util/qt/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def get_dpi_scale():
fm = QtGui.QFontMetricsF(font)

# xHeight is expected to be 40.0 at normal DPI
return fm.height() / 173.0
return int(fm.height() / 173.0)

def normalize_font(font_size):
"""
Expand All @@ -78,9 +78,9 @@ def compute_color_on_gradient(percent, color1, color2):
r2, g2, b2, _ = color2.getRgb()

# compute the new color across the gradient of color1 -> color 2
r = r1 + percent * (r2 - r1)
g = g1 + percent * (g2 - g1)
b = b1 + percent * (b2 - b1)
r = r1 + int(percent * (r2 - r1))
g = g1 + int(percent * (g2 - g1))
b = b1 + int(percent * (b2 - b1))

# return the new color
return QtGui.QColor(r,g,b)
return QtGui.QColor(r,g,b)
4 changes: 2 additions & 2 deletions plugins/tenet/util/qt/waitbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def _ui_init(self):
# configure the main widget / form
self.setSizeGripEnabled(False)
self.setModal(True)
self._dpi_scale = get_dpi_scale()*5.0
self._dpi_scale = get_dpi_scale()*5

# initialize abort button
self._abort_button = QtWidgets.QPushButton("Cancel")
Expand Down Expand Up @@ -99,4 +99,4 @@ def _ui_layout(self):
self.setMinimumHeight(height)

# compute the dialog layout
self.setLayout(v_layout)
self.setLayout(v_layout)