Dynamic building

This commit is contained in:
leha-code 2022-03-14 09:11:34 -04:00
parent cdfa740e16
commit 9f968b6d62
No known key found for this signature in database
GPG Key ID: 15227A6455DDF7EE
7 changed files with 72 additions and 12 deletions

3
.gitignore vendored
View File

@ -1,3 +1,6 @@
**/__pycache__ **/__pycache__
__pycache__ __pycache__
*.pyc *.pyc
**/build
*.deb
build

View File

@ -0,0 +1,9 @@
[Desktop Entry]
Name=Planet Launcher
Exec=/usr/bin/planet-launcher
Icon=/usr/lib/planet-launcher/assets/logo512.png
Type=Application
Comment=A better launcher
GenericName=Minecraft Pi Launcher
Categories=games, minecraft
Keywords=Minecraft, MCPIL, gMCPIL, jMCPIL, Minecraft Pi, Minecraft launcher, MCPI, MCPI-Revival, mcpiscript

View File

@ -1,3 +1,4 @@
#!/usr/bin/python3
""" """
@ -22,14 +23,24 @@ with this program; if not, write to the Free Software Foundation, Inc.,
import sys import sys
import launcher
from splashes import SPLASHES
import os import os
import random import random
from datetime import date from datetime import date
import json import json
import pathlib import pathlib
absolute_path = pathlib.Path(__file__).parent.absolute()
if str(absolute_path).startswith("/usr/bin"):
absolute_path = "/usr/lib/planet-launcher/"
sys.path.append(absolute_path)
if os.path.exists("/usr/lib/planet-launcher/"):
sys.path.append("/usr/lib/planet-launcher/")
import launcher
from splashes import SPLASHES
from PyQt5.QtCore import * from PyQt5.QtCore import *
from PyQt5.QtWidgets import * from PyQt5.QtWidgets import *
@ -40,7 +51,6 @@ from PyQt5.QtWebKitWidgets import *
import qdarktheme import qdarktheme
import pypresence import pypresence
dark_stylesheet = qdarktheme.load_stylesheet() dark_stylesheet = qdarktheme.load_stylesheet()
USER = os.getenv("USER") USER = os.getenv("USER")
@ -62,7 +72,7 @@ class ConfigPluto(QDialog):
layout = QVBoxLayout() layout = QVBoxLayout()
titlelayout = QGridLayout() titlelayout = QGridLayout()
logopixmap = QPixmap(f"{pathlib.Path(__file__).parent.absolute()}/assets/logo512.png").scaled(100, 100, Qt.KeepAspectRatio) logopixmap = QPixmap(f"{absolute_path}/assets/logo512.png").scaled(100, 100, Qt.KeepAspectRatio)
namelabel = QLabel("Pluto Wizard") namelabel = QLabel("Pluto Wizard")
logolabel = QLabel() logolabel = QLabel()
@ -158,22 +168,22 @@ class Planet(QMainWindow):
self.setWindowTitle("Planet") self.setWindowTitle("Planet")
self.setWindowIcon(QIcon(f"{pathlib.Path(__file__).parent.absolute()}/assets/logo512.png")) self.setWindowIcon(QIcon(f"{absolute_path}/assets/logo512.png"))
tabs = QTabWidget() tabs = QTabWidget()
tabs.setTabPosition(QTabWidget.West) tabs.setTabPosition(QTabWidget.West)
tabs.setMovable(True) tabs.setMovable(True)
play_tab = tabs.addTab(self.play_tab(), "Play") play_tab = tabs.addTab(self.play_tab(), "Play")
tabs.setTabIcon(play_tab, QIcon(f"{pathlib.Path(__file__).parent.absolute()}/assets/logo512.png")) tabs.setTabIcon(play_tab, QIcon(f"{absolute_path}/assets/logo512.png"))
features_tab = tabs.addTab(self.features_tab(), "Features") features_tab = tabs.addTab(self.features_tab(), "Features")
tabs.setTabIcon(features_tab, QIcon(f"{pathlib.Path(__file__).parent.absolute()}/assets/heart512.png")) tabs.setTabIcon(features_tab, QIcon(f"{absolute_path}/assets/heart512.png"))
servers_tab = tabs.addTab(self.servers_tab(), "Servers") servers_tab = tabs.addTab(self.servers_tab(), "Servers")
tabs.setTabIcon(servers_tab, QIcon(f"{pathlib.Path(__file__).parent.absolute()}/assets/multiplayer512.png")) tabs.setTabIcon(servers_tab, QIcon(f"{absolute_path}/assets/multiplayer512.png"))
#mods_tab = tabs.addTab(self.custom_mods_tab(), "Mods") #mods_tab = tabs.addTab(self.custom_mods_tab(), "Mods")
#tabs.setTabIcon(mods_tab, QIcon(f"{pathlib.Path(__file__).parent.absolute()}/assets/portal512.png")) #tabs.setTabIcon(mods_tab, QIcon(f"{absolute_path}/assets/portal512.png"))
changelog_tab = tabs.addTab(self.changelog_tab(), "Changelog") changelog_tab = tabs.addTab(self.changelog_tab(), "Changelog")
tabs.setTabIcon(changelog_tab, QIcon(f"{pathlib.Path(__file__).parent.absolute()}/assets/pi512.png")) tabs.setTabIcon(changelog_tab, QIcon(f"{absolute_path}/assets/pi512.png"))
self.setCentralWidget(tabs) self.setCentralWidget(tabs)
@ -198,7 +208,7 @@ class Planet(QMainWindow):
titlelayout = QGridLayout() titlelayout = QGridLayout()
logopixmap = QPixmap(f"{pathlib.Path(__file__).parent.absolute()}/assets/logo512.png").scaled(100, 100, Qt.KeepAspectRatio) logopixmap = QPixmap(f"{absolute_path}/assets/logo512.png").scaled(100, 100, Qt.KeepAspectRatio)
logolabel = QLabel() logolabel = QLabel()
logolabel.setPixmap(logopixmap) logolabel.setPixmap(logopixmap)
@ -367,7 +377,7 @@ class Planet(QMainWindow):
web = QWebView() web = QWebView()
web.load( web.load(
QUrl().fromLocalFile( QUrl().fromLocalFile(
f"{pathlib.Path(__file__).parent.absolute()}/assets/changelog.html" f"{absolute_path}/assets/changelog.html"
) )
) )

12
scripts/control Executable file
View File

@ -0,0 +1,12 @@
Package: planet-launcher
Version: 1.0rc2
Architecture: all
Maintainer: mcpiscript <mcpiscript@gmail.com>
Depends: python3-pyqt5, python3:any
Recommends: minecraft-pi-reborn-client, minecraft-pi-reborn-server, python3-pyqtdarkmode, python3-mcpi, python3-minecraft-pi, python3-morpheus-mcpi
Section: games
Priority: optional
Homepage: https://github.com/mcpiscript/Planet
Description: A better launcher for Minecraft: Pi Edition
A better launcher.
This launcher requires you to download an AppImage file from the official Jenkins.

20
scripts/debian.sh Executable file
View File

@ -0,0 +1,20 @@
#!/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/control ./build/planet/DEBIAN/control
cp ./scripts/postinst ./build/planet/DEBIAN/postinst
cp ./scripts/postrm ./build/planet/DEBIAN/postrm
dpkg-deb --build ./build/planet
mkdir dist
cp ./build/planet.deb ./dist/planet.deb
rm -r build

4
scripts/postinst Executable file
View File

@ -0,0 +1,4 @@
pip3 install pyqtdarktheme pypresence
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

2
scripts/postrm Executable file
View File

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