Skip to content

Commit

Permalink
Merge pull request lukas-blecher#236 from JoepdeJong/fix/m2-apple-sil…
Browse files Browse the repository at this point in the history
…icon

Update GUI to PyQt6 (Fix for M1 and M2 OS X)
I found it doesn't work with an old environment.
  • Loading branch information
lukas-blecher authored Apr 13, 2023
2 parents 6fe881c + ab83c3d commit 9d99d1a
Show file tree
Hide file tree
Showing 3 changed files with 9,216 additions and 14,311 deletions.
21 changes: 8 additions & 13 deletions pix2tex/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@
import sys
import os
import tempfile
from PyQt5 import QtCore, QtGui
from PyQt5.QtCore import Qt, pyqtSlot, pyqtSignal, QThread
from PyQt5.QtWebEngineWidgets import QWebEngineView
from PyQt5.QtGui import QKeySequence
from PyQt5.QtWidgets import QMainWindow, QApplication, QMessageBox, QVBoxLayout, QWidget, QShortcut,\
from PyQt6 import QtCore, QtGui
from PyQt6.QtCore import Qt, pyqtSlot, pyqtSignal, QThread
from PyQt6.QtWebEngineWidgets import QWebEngineView
from PyQt6.QtWidgets import QMainWindow, QApplication, QMessageBox, QVBoxLayout, QWidget,\
QPushButton, QTextEdit, QFormLayout, QHBoxLayout, QDoubleSpinBox
from pix2tex.resources import resources
from pynput.mouse import Controller

from PIL import ImageGrab, Image
Expand All @@ -17,10 +15,7 @@
from pix2tex import cli
from pix2tex.utils import in_model_path

QApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling, True)
QApplication.setAttribute(QtCore.Qt.AA_UseHighDpiPixmaps, True)


import pix2tex.resources.resources
class App(QMainWindow):
isProcessing = False

Expand Down Expand Up @@ -65,7 +60,7 @@ def initUI(self):
self.snipButton = QPushButton('Snip [Alt+S]', self)
self.snipButton.clicked.connect(self.onClick)

self.shortcut = QShortcut(QKeySequence("Alt+S"), self)
self.shortcut = QtGui.QShortcut(QtGui.QKeySequence('Alt+S'), self)
self.shortcut.activated.connect(self.onClick)

# Create retry button
Expand Down Expand Up @@ -237,8 +232,8 @@ def __init__(self, parent):

def snip(self):
self.isSnipping = True
self.setWindowFlags(Qt.WindowStaysOnTopHint)
QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.CrossCursor))
self.setWindowFlags(QtCore.Qt.WindowType.WindowStaysOnTopHint)
QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.CursorShape.CrossCursor))

self.show()

Expand Down
Loading

0 comments on commit 9d99d1a

Please sign in to comment.