Yeet QtPy and bundle pi-nbt

This commit is contained in:
leha-code 2022-04-02 21:04:39 -04:00
parent a4a842168b
commit 8e544eba4f
No known key found for this signature in database
GPG Key ID: 15227A6455DDF7EE
7 changed files with 84 additions and 26 deletions

View File

@ -52,11 +52,11 @@ from splashes import SPLASHES
import web
# PyQt5 imports
from qtpy.QtCore import *
from qtpy.QtWidgets import *
from qtpy.QtGui import *
from qtpy.QtWebEngine import *
from qtpy.QtWebEngineWidgets import *
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtWebEngine import *
from PyQt5.QtWebEngineWidgets import *
# Additional imports
import qdarktheme # Dark style for PyQt5

54
planet/nbt.py Normal file
View File

@ -0,0 +1,54 @@
"""
This file is uniquely licensed under the MIT license because it may be useful in other applications an utilites.
MIT License
Copyright (c) 2022 Alexey Pavlov
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"""
import nbtlib
import subprocess
def remove_header(filename: str):
#with open(filename, "rb") as file:
# data = file.read()
#with open(filename, "wb") as write_file:
# write_file.write(data[8:])
# This is WIP code! Do not use!
return subprocess.Popen(["/usr/bin/pi-nbt", "remove-header", filename])
def add_header(filename: str):
return subprocess.Popen(["/usr/bin/pi-nbt", "add-header", filename])
def load_nbt(filename: str, header_type = None):
if header_type == "level.dat":
remove_header(filename)
elif header_type not in ["level.dat", None]:
raise Exception("Invalid file! Please use header_type=None to open a file without a header")
return nbtlib.load(filename, gzipped=False, byteorder="little")

View File

@ -1,20 +0,0 @@
#!/bin/bash
rm -r planet/__pycache__
mkdir build
mkdir build/planet
mkdir build/planet/usr
mkdir build/planet/usr/lib
cp -r ./planet/ ./build/planet/usr/lib/planet-launcher
mkdir build/planet/DEBIAN
cp ./scripts/deb/control ./build/planet/DEBIAN/control
cp ./scripts/deb/postinst ./build/planet/DEBIAN/postinst
cp ./scripts/deb/postrm ./build/planet/DEBIAN/postrm
dpkg-deb --build ./build/planet
mkdir dist
cp ./build/planet.deb ./dist/planet.deb
rm -r build

View File

@ -2,9 +2,10 @@ Package: planet-launcher
Version: 1.0.0
Architecture: all
Maintainer: mcpiscript <mcpiscript@gmail.com>
Depends: python3-pyqt5, python3:any, python3-pyqt5.qtwebkit, python3-pyqt5.qtsvg, python3-pyqt5.qtwebkit, python3-pyqt5.qtmultimedia
Depends: python3-pyqt5, python3:any, python3-pyqt5.qtwebkit, python3-pyqt5.qtsvg, python3-pyqt5.qtwebkit, python3-pyqt5.qtmultimedia, gcc
Replaces: mcpil, mcpil-r, gmcpil, jmcpil
Recommends: python3-pyqtdarkmode, python3-minecraftpi
Provides: pi-nbt
Section: games
Priority: optional
Homepage: https://github.com/mcpiscript/Planet

View File

@ -2,3 +2,4 @@ pip3 install pyqtdarktheme pypresence pillow darkdetect
link /usr/lib/planet-launcher/main.py /usr/bin/planet-launcher
chmod 755 /usr/lib/planet-launcher/main.py
link /usr/lib/planet-launcher/assets/planet-launcher.desktop /usr/share/applications/planet-launcher.desktop
gcc /usr/lib/planet-launcher/pi-nbt.c -o /usr/bin/pi-nbt

View File

@ -1,2 +1,3 @@
rm -rf /usr/bin/planet-launcher
rm -rf /usr/share/applications/planet-launcher.desktop
rm -rf /usr/bin/pi-nbt

21
scripts/package/debian.sh Executable file
View File

@ -0,0 +1,21 @@
#!/bin/bash
rm -r planet/__pycache__
mkdir build
mkdir build/planet
mkdir build/planet/usr
mkdir build/planet/usr/lib
cp -r ./planet/ ./build/planet/usr/lib/planet-launcher
mkdir build/planet/DEBIAN
cp ./scripts/package/deb/control ./build/planet/DEBIAN/control
cp ./scripts/package/deb/postinst ./build/planet/DEBIAN/postinst
cp ./scripts/package/deb/postrm ./build/planet/DEBIAN/postrm
wget https://github.com/MCPI-Revival/MCPIedit/raw/master/pi-nbt.c -O ./build/planet/usr/lib/planet-launcher/pi-nbt.c -q
dpkg-deb --build ./build/planet
mkdir dist
cp ./build/planet.deb ./dist/planet.deb
rm -r build