Remove web components (#70)

* Remove old web code

* Add back missing gears file

* Client fetches thumbnails instead of being sent by server
This commit is contained in:
2023-12-17 12:07:10 -06:00
committed by GitHub
parent 8863a38904
commit d55f6a5187
16 changed files with 24 additions and 530 deletions

View File

@@ -1,13 +1,14 @@
''' app/ui/main_window.py '''
import datetime
import io
import logging
import os
import socket
import subprocess
import sys
import threading
import time
import PIL
from PIL import Image
from PyQt6.QtCore import Qt, QByteArray, QBuffer, QIODevice, QThread
from PyQt6.QtGui import QPixmap, QImage, QFont, QIcon
@@ -15,7 +16,6 @@ from PyQt6.QtWidgets import QMainWindow, QWidget, QHBoxLayout, QListWidget, QTab
QTableWidgetItem, QLabel, QVBoxLayout, QHeaderView, QMessageBox, QGroupBox, QPushButton, QListWidgetItem, \
QFileDialog
from src.api.server_proxy import RenderServerProxy
from src.render_queue import RenderQueue
from src.utilities.misc_helper import get_time_elapsed, resources_dir, is_localhost
from src.utilities.status_utils import RenderStatus
@@ -278,15 +278,25 @@ class MainWindow(QMainWindow):
def fetch_preview(job_id):
try:
default_image_path = "error.png"
before_fetch_hostname = self.current_server_proxy.hostname
response = self.current_server_proxy.request(f'job/{job_id}/thumbnail?size=big')
if response.ok:
import io
image_data = response.content
image = Image.open(io.BytesIO(image_data))
if self.current_server_proxy.hostname == before_fetch_hostname and job_id == \
self.selected_job_ids()[0]:
self.load_image_data(image)
try:
with io.BytesIO(response.content) as image_data_stream:
image = Image.open(image_data_stream)
if self.current_server_proxy.hostname == before_fetch_hostname and job_id == \
self.selected_job_ids()[0]:
self.load_image_data(image)
return
except PIL.UnidentifiedImageError:
default_image_path = response.text
else:
default_image_path = default_image_path or response.text
self.load_image_path(os.path.join(resources_dir(), default_image_path))
except ConnectionError as e:
logger.error(f"Connection error fetching image: {e}")
except Exception as e: