mirror of
https://github.com/bdnugget/runekit.git
synced 2026-11-07 09:07:30 +00:00
QRC resource file
This commit is contained in:
1 parent
b18e927b58
commit
93dfe1f304
10 files changed
+52
-51
No files matched your search
+2
-1
@@ -4,4 +4,5 @@ runekit/image/format.c
|
||||
runekit/image/format.*.*
|
||||
setup.py
|
||||
*.egg-info
|
||||
__pycache__
|
||||
__pycache__
|
||||
runekit/_resources.py
|
||||
@@ -1,5 +1,10 @@
|
||||
dist/runekit.tar.gz: runekit/ main.py
|
||||
dev: runekit/_resources.py
|
||||
|
||||
dist/runekit.tar.gz: runekit/ main.py runekit/_resources.py
|
||||
poetry build -f sdist
|
||||
cd dist; cp runekit-*.tar.gz runekit.tar.gz
|
||||
|
||||
.PHONY: flatpak
|
||||
runekit/_resources.py: resources.qrc $(wildcard **/*.js) $(wildcard **/*.png)
|
||||
pyside2-rcc $< -o $@
|
||||
|
||||
.PHONY: dev
|
||||
@@ -60,8 +60,7 @@ poetry install
|
||||
# If previous fails and you're on Big Sur, try this instead
|
||||
SYSTEM_VERSION_COMPAT=1 poetry install
|
||||
|
||||
poetry build
|
||||
cp build/lib.*/runekit/image/*.cpython*.* runekit/image/
|
||||
poetry run make dev
|
||||
|
||||
# If you just want to load AFKWarden
|
||||
poetry run python main.py https://runeapps.org/apps/alt1/afkscape/appconfig.json
|
||||
@@ -75,8 +74,6 @@ Requires libxcb to be installed
|
||||
|
||||
### macOS additional instruction
|
||||
|
||||
~~You'll probably need Command Line Tools to build the C code, run: `xcode-select --install` to get it~~ Currently the native code isn't really used (will be used for OCR features)
|
||||
|
||||
You will need to add Python in System Preferences > Security > Privacy in these sections:
|
||||
|
||||
- Accessibility
|
||||
|
||||
@@ -2,7 +2,7 @@ from Cython.Build import cythonize
|
||||
|
||||
# use cythonize to build the extensions
|
||||
modules = [
|
||||
"runekit/image/format.pyx",
|
||||
# "runekit/image/format.pyx",
|
||||
]
|
||||
|
||||
extensions = cythonize(modules)
|
||||
@@ -11,8 +11,4 @@ extensions = cythonize(modules)
|
||||
def build(setup_kwargs):
|
||||
"""Needed for the poetry building interface."""
|
||||
|
||||
setup_kwargs.update(
|
||||
{
|
||||
"ext_modules": extensions,
|
||||
}
|
||||
)
|
||||
setup_kwargs.update({"ext_modules": extensions, "scripts": ["main.py"]})
|
||||
@@ -10,6 +10,7 @@ from PySide2.QtWidgets import (
|
||||
QDialog,
|
||||
)
|
||||
|
||||
import runekit._resources
|
||||
from runekit import browser
|
||||
from runekit.game import get_platform_manager
|
||||
from runekit.host import Host
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
<!DOCTYPE RCC>
|
||||
<RCC version="1.0">
|
||||
<qresource>
|
||||
<file>runekit/browser/alt1.js</file>
|
||||
<file>runekit/ui/trayicon.png</file>
|
||||
<file>runekit/ui/skins/default/borderDrag.png</file>
|
||||
<file>runekit/ui/skins/default/exit.png</file>
|
||||
<file>runekit/ui/skins/default/exitHover.png</file>
|
||||
<file>runekit/ui/skins/default/settings.png</file>
|
||||
<file>runekit/ui/skins/default/settingsHover.png</file>
|
||||
<file>runekit/ui/skins/default/minimize.png</file>
|
||||
<file>runekit/ui/skins/default/minimizeHover.png</file>
|
||||
<file>runekit/ui/skins/default/borderTL.png</file>
|
||||
<file>runekit/ui/skins/default/borderT.png</file>
|
||||
<file>runekit/ui/skins/default/borderTR.png</file>
|
||||
<file>runekit/ui/skins/default/borderL.png</file>
|
||||
<file>runekit/ui/skins/default/borderR.png</file>
|
||||
<file>runekit/ui/skins/default/borderBL.png</file>
|
||||
<file>runekit/ui/skins/default/borderB.png</file>
|
||||
<file>runekit/ui/skins/default/borderBR.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
+11
-19
@@ -1,5 +1,4 @@
|
||||
import secrets
|
||||
from pathlib import Path
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from PySide2.QtCore import QFile, QIODevice
|
||||
@@ -7,18 +6,10 @@ from PySide2.QtWebEngineWidgets import QWebEngineProfile, QWebEngineScript
|
||||
|
||||
from runekit.browser.api import RuneKitSchemeHandler
|
||||
from runekit.browser.scheme import RuneKitScheme
|
||||
from runekit.utils import BASE
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from runekit.app import App
|
||||
|
||||
script_file = BASE / "browser" / "alt1.js"
|
||||
|
||||
with script_file.open() as fp:
|
||||
src = fp.read()
|
||||
|
||||
_added_qwebchannel = False
|
||||
|
||||
|
||||
class WebProfile(QWebEngineProfile):
|
||||
rpc_secret: str
|
||||
@@ -43,18 +34,19 @@ class WebProfile(QWebEngineProfile):
|
||||
)
|
||||
|
||||
def _insert_alt1_api(self):
|
||||
global _added_qwebchannel, src
|
||||
qwc_file = QFile(":/qtwebchannel/qwebchannel.js", parent=self)
|
||||
if not qwc_file.open(QIODevice.ReadOnly):
|
||||
raise IOError
|
||||
src = bytes(qwc_file.readAll()).decode("utf8")
|
||||
qwc_file.close()
|
||||
|
||||
if not _added_qwebchannel:
|
||||
qwc_file = QFile(":/qtwebchannel/qwebchannel.js", parent=self)
|
||||
if not qwc_file.open(QIODevice.ReadOnly):
|
||||
raise IOError
|
||||
qwc_src = bytes(qwc_file.readAll()).decode("utf8")
|
||||
qwc_file.close()
|
||||
src += "\n;;\n"
|
||||
|
||||
src = qwc_src + "\n;;\n" + src
|
||||
|
||||
_added_qwebchannel = True
|
||||
alt1_file = QFile(":/runekit/browser/alt1.js", parent=self)
|
||||
if not alt1_file.open(QIODevice.ReadOnly):
|
||||
raise IOError
|
||||
src += bytes(alt1_file.readAll()).decode("utf8")
|
||||
alt1_file.close()
|
||||
|
||||
script = QWebEngineScript()
|
||||
script.setName("alt1.js")
|
||||
|
||||
@@ -5,9 +5,6 @@ from PySide2.QtGui import QIcon
|
||||
from PySide2.QtWidgets import QSystemTrayIcon
|
||||
|
||||
from .tooltip import TooltipManager
|
||||
from ..utils import BASE
|
||||
|
||||
TRAY_ICON = BASE / "ui" / "trayicon.png"
|
||||
|
||||
|
||||
class Notifier(abc.ABC):
|
||||
@@ -26,7 +23,7 @@ class TooltipNotifier(Notifier):
|
||||
|
||||
class TrayIconNotifier(Notifier):
|
||||
def __init__(self):
|
||||
self.icon = QSystemTrayIcon(QIcon(str(TRAY_ICON)))
|
||||
self.icon = QSystemTrayIcon(QIcon(":/runekit/ui/trayicon.png"))
|
||||
self.icon.show()
|
||||
|
||||
def notify(self, text):
|
||||
|
||||
@@ -9,9 +9,7 @@ from PySide2.QtWidgets import (
|
||||
QPushButton,
|
||||
)
|
||||
|
||||
from runekit.utils import BASE
|
||||
|
||||
SKIN = BASE / "ui" / "skins" / "default"
|
||||
SKIN = ":/runekit/ui/skins/default/"
|
||||
|
||||
|
||||
class WindowFrame(QWidget):
|
||||
@@ -98,7 +96,7 @@ class _FrameInner(QWidget):
|
||||
bot_row.addWidget(self.build_image("borderBR", Qt.BottomEdge | Qt.RightEdge))
|
||||
|
||||
def build_image(self, name: str, edge=None, h_fix=True, v_fix=True):
|
||||
pixmap = QPixmap(str(SKIN / name))
|
||||
pixmap = QPixmap(SKIN + name)
|
||||
label = _ResizeHandle(edge, parent=self)
|
||||
label.setSizePolicy(
|
||||
QSizePolicy.Fixed if h_fix else QSizePolicy.Preferred,
|
||||
@@ -155,7 +153,7 @@ class _WindowButtons(QWidget):
|
||||
def button_style(self, normal, hover):
|
||||
return f"""
|
||||
QPushButton {{
|
||||
image: url({SKIN / normal});
|
||||
image: url({SKIN}{normal});
|
||||
border: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
@@ -163,7 +161,7 @@ class _WindowButtons(QWidget):
|
||||
height: 12px;
|
||||
}}
|
||||
QPushButton::hover {{
|
||||
image: url({SKIN / hover});
|
||||
image: url({SKIN}{hover});
|
||||
}}
|
||||
"""
|
||||
|
||||
@@ -172,7 +170,7 @@ class _DragHandle(QLabel):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
|
||||
self.setPixmap(QPixmap(str(SKIN / "borderDrag.png")))
|
||||
self.setPixmap(QPixmap(SKIN + "borderDrag.png"))
|
||||
self.setCursor(Qt.OpenHandCursor)
|
||||
|
||||
def mousePressEvent(self, ev):
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
if getattr(sys, 'frozen', False) and hasattr(sys, '_MEIPASS'):
|
||||
# PyInstaller
|
||||
BASE = Path(sys._MEIPASS) / 'runekit'
|
||||
else:
|
||||
BASE = Path(__file__).parent
|
||||
Reference in new issue
Block a user