Add splashes and gMCPIL migration features

This commit is contained in:
leha-code 2022-03-03 21:09:31 -04:00
parent 3ec692cc3b
commit 40d0e02b5d
No known key found for this signature in database
GPG Key ID: 15227A6455DDF7EE
2 changed files with 92 additions and 54 deletions

View File

@ -23,19 +23,28 @@ with this program; if not, write to the Free Software Foundation, Inc.,
import sys
import launcher
from splashes import SPLASHES
import os
import random
from datetime import date
import json
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
USER = os.getenv("USER")
USER = os.getenv("USER")
if not os.path.exists(f"/home/{USER}/.planet-launcher/mods"):
os.makedirs(f"/home/{USER}/.planet-launcher/mods")
if os.path.exists(f"/home/{USER}/.gmcpil.json"):
with open(f"/home/{USER}/.gmcpil.json") as f:
DEFAULT_FEATURES = json.loads(f.read())["features"]
else:
DEFAULT_FEATURES = launcher.DEFAULT_FEATURES
class Planet(QMainWindow):
def __init__(self):
@ -50,32 +59,46 @@ class Planet(QMainWindow):
tabs.setMovable(True)
tabs.addTab(self.play_tab(), "Play")
tabs.addTab(self.features_tab(), "Features")
tabs.addTab(self.custom_mods_tab(), "Python")
tabs.addTab(self.features_tab(), "Features")
tabs.addTab(self.custom_mods_tab(), "Mods")
self.setCentralWidget(tabs)
self.setGeometry(480, 670, 100, 100)
self.setGeometry(600, 720, 100, 100)
def play_tab(self) -> QWidget:
layout = QGridLayout()
namelabel = QLabel("Planet Launcher")
namelabel = QLabel()
if date.today().month == 4 and date.today().day == 1:
namelabel.setText("Banana Launcher")
else:
if random.randint(1, 100) == 1:
namelabel.setText("Pluto Launcher")
else:
namelabel.setText('Planet Launcher')
font = namelabel.font()
font.setPointSize(30)
namelabel.setFont(font)
namelabel.setAlignment(Qt.AlignHCenter)
splashlabel = QLabel(random.choice(SPLASHES))
splashlabel.adjustSize()
splashlabel.setAlignment(Qt.AlignHCenter)
usernamelabel = QLabel("Username")
usernameedit = QLineEdit()
usernameedit.setPlaceholderText("StevePi")
self.usernameedit = QLineEdit()
self.usernameedit.setPlaceholderText("StevePi")
distancelabel = QLabel("Render Distance")
distancebox = QComboBox()
distancebox.addItems(["Far", "Normal", "Short", "Tiny"])
distancebox.setCurrentText("Short")
self.distancebox = QComboBox()
self.distancebox.addItems(["Far", "Normal", "Short", "Tiny"])
self.distancebox.setCurrentText("Short")
profilelabel = QLabel("Profile")
@ -84,100 +107,100 @@ class Planet(QMainWindow):
["Vanilla MCPi", "Modded MCPi", "Modded MCPE", "Optimized MCPE", "Custom"]
)
self.profilebox.setCurrentText("Modded MCPE")
self.showlauncher = QRadioButton("Hide Launcher")
playbutton = QPushButton("Play")
self.playbutton = QPushButton("Play")
layout.addWidget(namelabel, 0, 0, 2, 6)
layout.addWidget(namelabel, 0, 0, 2, 6)
layout.addWidget(splashlabel, 2, 0, 1, 6)
layout.addWidget(usernamelabel, 2, 0)
layout.addWidget(usernameedit, 2, 4, 1, 2)
layout.addWidget(usernamelabel, 3, 0)
layout.addWidget(self.usernameedit, 3, 4, 1, 2)
layout.addWidget(distancelabel, 3, 0)
layout.addWidget(distancebox, 3, 4, 1, 2)
layout.addWidget(distancelabel, 4, 0)
layout.addWidget(self.distancebox, 4, 4, 1, 2)
layout.addWidget(profilelabel, 4, 0)
layout.addWidget(self.profilebox, 4, 4, 1, 2)
layout.addWidget(self.showlauncher, 5, 4, 1, 2)
layout.addWidget(profilelabel, 5, 0)
layout.addWidget(self.profilebox, 5, 4, 1, 2)
layout.addWidget(playbutton, 7, 5)
layout.addWidget(self.showlauncher, 6, 4, 1, 2)
layout.addWidget(self.playbutton, 8, 5)
widget = QWidget()
widget.setLayout(layout)
return widget
def features_tab(self) -> QWidget:
layout = QVBoxLayout()
for feature in launcher.DEFAULT_FEATURES:
self.features = dict()
for feature in DEFAULT_FEATURES:
checkbox = QCheckBox(feature)
if launcher.DEFAULT_FEATURES[feature]:
if DEFAULT_FEATURES[feature]:
checkbox.setCheckState(Qt.Checked)
else:
checkbox.setCheckState(Qt.Unchecked)
self.features[feature] = checkbox
layout.addWidget(checkbox)
fakewidget = QWidget()
fakewidget.setLayout(layout)
scroll = QScrollArea()
scroll.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
scroll.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
scroll.setWidgetResizable(True)
scroll.setWidget(fakewidget)
fakelayout = QGridLayout()
fakelayout.addWidget(scroll, 0, 0)
fakelayout = QGridLayout()
fakelayout.addWidget(scroll, 0, 0)
widget = QWidget()
widget.setLayout(fakelayout)
return widget
def custom_mods_tab(self) -> QWidget:
layout = QVBoxLayout()
for mod in os.listdir(f"/home/{USER}/.planet-launcher/mods/"):
checkbox = QCheckBox(mod)
checkbox.setCheckState(Qt.Unchecked)
layout.addWidget(checkbox)
fakewidget = QWidget()
fakewidget.setLayout(layout)
scroll = QScrollArea()
scroll.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
scroll.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
scroll.setWidgetResizable(True)
scroll.setWidget(fakewidget)
fakelayout = QGridLayout()
fakelayout.addWidget(scroll, 0, 0)
fakelayout = QGridLayout()
fakelayout.addWidget(scroll, 0, 0)
widget = QWidget()
widget.setLayout(fakelayout)
return widget
def launch(self):
pass
if __name__ == "__main__":

15
planet/splashes.py Normal file
View File

@ -0,0 +1,15 @@
SPLASHES = [
"The moon is not a planet",
"Pluto = Planet",
"Ayy Yep!",
"What's my purpose?",
"MCPI_SPEEDHACK",
"MCPIL-Revival",
"Minescripters",
"AmogOS is Debian with amogus wallpapers. Nothing sussy.",
"I use Planet btw.",
"Snowball",
"Robo",
"If I could, I would. But I can't, so I shan't.",
"I make a launcher! I break the launcher! Everyone hates it! Everyone hates it?",
]