#!/usr/bin/env bash

# Installation de spyder3
apt-get update --fix-missing
apt-get install spyder3 -y

# Ce script resout un problème de Spyder 4.2.1
# La résolution de se problème ressort du poste stack overflow suivant
# https://stackoverflow.com/questions/72114520/error-when-starting-spyder-on-ubuntu-22-04

# Les lignes à commanter dans
# /usr/lib/python3/dist-packages/spyder/plugins/completion/kite/widgets/install.py :

filetochange="/usr/lib/python3/dist-packages/spyder/plugins/completion/kite/widgets/install.py"

# l58
# image = image.scaled(image_width, image_height, Qt.KeepAspectRatio,
#                           Qt.SmoothTransformation)

sed -i '58,59 s/^/#/' $filetochange

# l145
# install_gif.setScaledSize(QSize(image_width, image_height))

sed -e 's/install_gif\.setScaledSize/# install_gif\.setScaledSize/' -i $filetochange

# l245-l248
# copilot_label.setPixmap(
#          copilot_image.scaled(image_width, image_height,
#                               Qt.KeepAspectRatio,
#                               Qt.SmoothTransformation))

sed -i '245,248 s/^/#/' $filetochange
