Commit fadf8b36 authored by Tijmen de Mes's avatar Tijmen de Mes

Python 3.10 fixes

parent 34a6ef00
......@@ -516,7 +516,7 @@ class ChatTextInput(QTextEdit):
QTextEdit.keyPressEvent(self, event)
def _SH_DocumentLayoutSizeChanged(self, new_size):
self.setFixedHeight(min(new_size.height()+self.contentsMargins().top()+self.contentsMargins().bottom(), self.parent().height()/2))
self.setFixedHeight(int(min(new_size.height() + self.contentsMargins().top() + self.contentsMargins().bottom(), self.parent().height()/2)))
def _SH_LockWidgetConfirmButtonClicked(self):
self.lockReleased.emit(self.lock_queue.popleft())
......@@ -2068,7 +2068,7 @@ class ChatWindow(base_class, ui_class, ColorHelperMixin):
self._EH_ShowSessions()
elif watched is self.state_label:
if event_type == QEvent.MouseButtonRelease and event.button() == Qt.LeftButton and event.modifiers() == Qt.NoModifier:
upper_half = QRect(0, 0, self.state_label.width(), self.state_label.height()/2)
upper_half = QRect(0, 0, int(self.state_label.width()), int(self.state_label.height()/2))
if upper_half.contains(event.pos()):
self._EH_CloseSession()
else:
......@@ -2175,12 +2175,12 @@ class ChatWindow(base_class, ui_class, ColorHelperMixin):
painter.translate(+1.5, +1)
painter.translate(0, +1)
painter.setPen(contrast_pen)
painter.drawLine(-3.5, -3.5, 3.5, 3.5)
painter.drawLine(-3.5, 3.5, 3.5, -3.5)
painter.drawLine(-3, -3, 3, 3)
painter.drawLine(-3, 3, 3, -3)
painter.translate(0, -1)
painter.setPen(pen)
painter.drawLine(-3.5, -3.5, 3.5, 3.5)
painter.drawLine(-3.5, 3.5, 3.5, -3.5)
painter.drawLine(-3, -3, 3, 3)
painter.drawLine(-3, 3, 3, -3)
painter.restore()
def send_pending_imdn_messages(self, session):
......
......@@ -3259,8 +3259,8 @@ class ChatSessionDelegate(QStyledItemDelegate, ColorHelperMixin):
def editorEvent(self, event, model, option, index):
if event.type() == QEvent.MouseButtonRelease and event.button() == Qt.LeftButton and event.modifiers() == Qt.NoModifier:
arrow_rect = option.rect.adjusted(option.rect.width()-14, option.rect.height()/2, 0, 0) # bottom half of the rightmost 14 pixels
cross_rect = option.rect.adjusted(option.rect.width()-14, 0, 0, -option.rect.height()/2) # top half of the rightmost 14 pixels
arrow_rect = option.rect.adjusted(int(option.rect.width()-14), int(option.rect.height()/2), 0, 0) # bottom half of the rightmost 14 pixels
cross_rect = option.rect.adjusted(int(option.rect.width()-14), 0, 0, int(-option.rect.height()/2)) # top half of the rightmost 14 pixels
if arrow_rect.contains(event.pos()):
session_list = self.parent()
session_list.animation.setDirection(QPropertyAnimation.Backward)
......@@ -3350,12 +3350,12 @@ class ChatSessionDelegate(QStyledItemDelegate, ColorHelperMixin):
painter.translate(+1.5, +1)
painter.translate(0, +1)
painter.setPen(contrast_pen)
painter.drawLine(-3.5, -3.5, 3.5, 3.5)
painter.drawLine(-3.5, 3.5, 3.5, -3.5)
painter.drawLine(-3, 3, 3, -3)
painter.drawLine(-3, 3, 3, -3)
painter.translate(0, -1)
painter.setPen(pen)
painter.drawLine(-3.5, -3.5, 3.5, 3.5)
painter.drawLine(-3.5, 3.5, 3.5, -3.5)
painter.drawLine(-3, -3, 3, 3)
painter.drawLine(-3, 3, 3, -3)
painter.restore()
def sizeHint(self, option, index):
......@@ -3545,7 +3545,7 @@ class ChatSessionListView(QListView):
return selection_model.NoUpdate
elif event.type() == QEvent.MouseButtonRelease:
index_rect = self.visualRect(index)
cross_rect = index_rect.adjusted(index_rect.width()-14, 0, 0, -index_rect.height()/2) # the top half of the rightmost 14 pixels
cross_rect = index_rect.adjusted(int(index_rect.width()-14), 0, 0, int(-index_rect.height()/2)) # the top half of the rightmost 14 pixels
if cross_rect.contains(event.pos()):
return selection_model.NoUpdate
else:
......
......@@ -296,7 +296,7 @@ class ColorHelperMixin(object):
def color_with_alpha(self, color, alpha):
color = QColor(color)
color.setAlpha(alpha)
color.setAlpha(int(alpha))
return color
def alpha_color(self, color, alpha):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment