Skip to content
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ https://user-images.githubusercontent.com/45705751/166183555-ef11bf64-9cea-4c04-
Launch the application and wait for the model to load. Show the snipping window using shortcut `Alt+Q` and drag and hold the mouse cursor to start performing OCR.

### Installation <a name = "installation"></a>
Download the latest zip file [here](https://github.com/bluaxees/Cloe/releases/latest/). Decompress the file in the desired directory. Make sure that the `app` folder is in the same folder as the shortcut `Cloe`.
Download the latest zip file [here](https://github.com/romeoisntworking/Cloe/releases). Decompress the file in the desired directory. Make sure that the `app` folder is in the same folder as the shortcut `Cloe`.

### System Requirements

Expand Down
2 changes: 1 addition & 1 deletion app/components/popups/about.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"""

from .base import BasePopup
from utils.constants import ABOUT_MESSAGE, APP_NAME
from app.utils.constants import ABOUT_MESSAGE, APP_NAME


class AboutPopup(BasePopup):
Expand Down
2 changes: 1 addition & 1 deletion app/components/settings/tabs/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from PyQt5.QtCore import QSettings
from PyQt5.QtWidgets import QWidget

from components.popups import BasePopup
from app.components.popups import BasePopup


class BaseSettings(QWidget):
Expand Down
4 changes: 2 additions & 2 deletions app/components/settings/tabs/hotkey/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
from PyQt5.QtWidgets import QCheckBox, QComboBox, QHBoxLayout, QLabel

from ..base import BaseSettings
from utils.constants import HOTKEY_DEFAULT, HOTKEY_CONFIG, UNMAPPED_KEY, VALID_KEY_LIST
from utils.scripts import camelizeText
from app.utils.constants import HOTKEY_DEFAULT, HOTKEY_CONFIG, UNMAPPED_KEY, VALID_KEY_LIST
from app.utils.scripts import camelizeText


class HotkeyContainer(BaseSettings):
Expand Down
2 changes: 1 addition & 1 deletion app/components/settings/tabs/hotkey/tab.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

from ..tab import BaseSettingsTab
from .container import HotkeyContainer
from utils.constants import HOTKEY_CONFIG
from app.utils.constants import HOTKEY_CONFIG


class HotkeySettingsTab(BaseSettingsTab):
Expand Down
4 changes: 2 additions & 2 deletions app/components/settings/tabs/view/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
from PyQt5.QtWidgets import QWidget

from ..base import BaseSettings
from utils.constants import VIEW_DEFAULT, VIEW_CONFIG
from utils.scripts import colorToRGBA
from app.utils.constants import VIEW_DEFAULT, VIEW_CONFIG
from app.utils.scripts import colorToRGBA


class ViewContainer(BaseSettings):
Expand Down
2 changes: 1 addition & 1 deletion app/components/settings/tabs/view/preview.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from PyQt5.QtGui import QColor, QPainter, QPaintEvent, QPen, QResizeEvent
from PyQt5.QtWidgets import QLabel, QGridLayout, QWidget

from components.misc import RubberBand
from app.components.misc import RubberBand


class Preview(QWidget):
Expand Down
2 changes: 1 addition & 1 deletion app/components/settings/tabs/view/tab.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
from ..tab import BaseSettingsTab
from .container import ViewContainer
from .preview import Preview
from utils.constants import VIEW_CONFIG
from app.utils.constants import VIEW_CONFIG


class ViewSettingsTab(ViewContainer, BaseSettingsTab):
Expand Down
6 changes: 3 additions & 3 deletions app/components/views/ocr/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
from PyQt5.QtGui import QCursor, QPixmap
from PyQt5.QtWidgets import QApplication, QGraphicsView, QLabel, QWidget

from components.misc import RubberBand
from components.services import BaseWorker
from utils.scripts import logText, pixmapToText
from app.components.misc import RubberBand
from app.components.services import BaseWorker
from app.utils.scripts import logText, pixmapToText


class BaseOCRView(QGraphicsView):
Expand Down
4 changes: 2 additions & 2 deletions app/components/views/ocr/fullscreen.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
from PyQt5.QtGui import QColor, QMouseEvent
from PyQt5.QtWidgets import QWidget

from components.settings import ViewContainer
from app.components.settings import ViewContainer
from .base import BaseOCRView
from utils.scripts import colorToRGBA
from app.utils.scripts import colorToRGBA


class FullScreenView(BaseOCRView, ViewContainer):
Expand Down
2 changes: 1 addition & 1 deletion app/components/windows/external.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from PyQt5.QtGui import QCloseEvent, QCursor
from PyQt5.QtWidgets import QApplication, QDesktopWidget, QMainWindow

from components.views import FullScreenView
from app.components.views import FullScreenView

if TYPE_CHECKING:
from .tray import SystemTray
Expand Down
8 changes: 4 additions & 4 deletions app/components/windows/tray.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
from PyQt5.QtWidgets import QApplication, QMenu, QSystemTrayIcon

from .external import ExternalWindow
from components.popups import AboutPopup
from components.services import BaseWorker, Hotkeys
from components.settings import SettingsMenu
from utils.constants import (
from app.components.popups import AboutPopup
from app.components.services import BaseWorker, Hotkeys
from app.components.settings import SettingsMenu
from app.utils.constants import (
ABOUT_ICON,
APP_LOGO,
EXIT_ICON,
Expand Down
4 changes: 2 additions & 2 deletions app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import QApplication

from components.windows import SystemTray
from utils.constants import APP_LOGO, APP_NAME, STYLESHEET_DEFAULT
from app.components.windows import SystemTray
from app.utils.constants import APP_LOGO, APP_NAME, STYLESHEET_DEFAULT

if __name__ == "__main__":

Expand Down
28 changes: 20 additions & 8 deletions app/utils/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,34 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""

import os
import sys
from PyQt5.QtGui import QColor, QFont

# ------------------------------------- General ------------------------------------- #

def resource_path(relative_path):
"""Get absolute path to resource, works for dev and for PyInstaller"""
try:
# PyInstaller creates a temp folder and stores path in _MEIPASS
base_path = sys._MEIPASS
except Exception:
base_path = os.path.abspath(".")

return os.path.join(base_path, relative_path)

APP_NAME = "Cloe"

# Icons
APP_LOGO = "./assets/images/icons/logo.ico"
SETTINGS_ICON = "./assets/images/icons/settings.png"
ABOUT_ICON = "./assets/images/icons/about.png"
EXIT_ICON = "./assets/images/icons/exit.png"
APP_LOGO = resource_path("assets/images/icons/logo.ico")
SETTINGS_ICON = resource_path("assets/images/icons/settings.png")
ABOUT_ICON = resource_path("assets/images/icons/about.png")
EXIT_ICON = resource_path("assets/images/icons/exit.png")

# Styles
STYLESHEET_LIGHT = "./assets/styles.qss"
STYLESHEET_DARK = "./assets/styles-dark.qss"
STYLESHEET_DEFAULT = "./assets/styles.qss"
STYLESHEET_LIGHT = resource_path("assets/styles.qss")
STYLESHEET_DARK = resource_path("assets/styles-dark.qss")
STYLESHEET_DEFAULT = resource_path("assets/styles.qss")

# ------------------------------------- Settings ------------------------------------ #

Expand Down Expand Up @@ -123,4 +135,4 @@
"<a href='https://icons8.com/icon/aPtgRkkLiNl2/settings'>settings</a>"
", <a href='https://icons8.com/icon/45/close'>close</a>, and "
"<a href='https://icons8.com/icon/DHTiJWmR3fPx/about'>about</a>."
)
)
28 changes: 19 additions & 9 deletions build/main.spec
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,25 @@ from PyInstaller.utils.hooks import copy_metadata
datas = []
datas += collect_data_files('unidic_lite')
datas += collect_data_files('manga_ocr')
datas += collect_data_files('transformers')
datas += collect_data_files('huggingface_hub')
datas += copy_metadata('tqdm')
datas += copy_metadata('regex')
datas += copy_metadata('requests')
datas += copy_metadata('packaging')
datas += copy_metadata('filelock')
datas += copy_metadata('numpy')
datas += copy_metadata('tokenizers')
datas += copy_metadata('transformers')
datas += copy_metadata('huggingface_hub')
datas += copy_metadata('manga_ocr')

local_files = [
('../app/assets', './assets')
]


block_cipher = None


a = Analysis(['../app/main.py'],
pathex=['../app'],
binaries=[],
Expand All @@ -29,7 +32,14 @@ a = Analysis(['../app/main.py'],
'pynput.keyboard._xorg',
'pynput.mouse._xorg',
'pynput.keyboard._win32',
'pynput.mouse._win32'
'pynput.mouse._win32',
'transformers',
'transformers.models',
'transformers.models.auto',
'manga_ocr',
'huggingface_hub',
'torch',
'tokenizers'
],
hookspath=[],
hooksconfig={},
Expand All @@ -39,13 +49,13 @@ a = Analysis(['../app/main.py'],
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False)

pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)


PATH_TO_TORCH_LIB = "torch\\lib\\"
excluded_files = [
'asmjit.lib',
'asmjit.lib',
'c10.lib',
'clog.lib',
'cpuinfo.lib',
Expand Down Expand Up @@ -76,9 +86,8 @@ excluded_files = [
excluded_files = [PATH_TO_TORCH_LIB + x for x in excluded_files]
a.datas = [x for x in a.datas if not x[0] in excluded_files]


exe = EXE(pyz,
a.scripts,
a.scripts,
[],
exclude_binaries=True,
name='Cloe',
Expand All @@ -92,11 +101,12 @@ exe = EXE(pyz,
codesign_identity=None,
entitlements_file=None,
icon="../app/assets/images/icons/logo.ico")

coll = COLLECT(exe,
a.binaries,
a.zipfiles,
a.datas,
a.datas,
strip=False,
upx=True,
upx_exclude=[],
name='app')
name='app')
Loading