Document code partially
This commit is contained in:
parent
26dd4a1363
commit
0cf3035cf8
47
README.md
47
README.md
|
@ -11,13 +11,12 @@
|
||||||
<br/>
|
<br/>
|
||||||
<br/>
|
<br/>
|
||||||
<a href="https://github.com/mcpiscript/Planet/issues">Report Bug</a>
|
<a href="https://github.com/mcpiscript/Planet/issues">Report Bug</a>
|
||||||
.
|
|
|
||||||
<a href="https://github.com/mcpiscript/Planet/issues">Request Feature</a>
|
<a href="https://github.com/mcpiscript/Planet/issues">Request Feature</a>
|
||||||
</p>
|
</p>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
![Downloads](https://img.shields.io/github/downloads/mcpiscript/Planet/total) ![Contributors](https://img.shields.io/github/contributors/mcpiscript/Planet?color=dark-green) ![Issues](https://img.shields.io/github/issues/mcpiscript/Planet) ![License](https://img.shields.io/github/license/mcpiscript/Planet)
|
![Downloads](https://img.shields.io/github/downloads/mcpiscript/Planet/total) ![Contributors](https://img.shields.io/github/contributors/mcpiscript/Planet?color=dark-green) ![Issues](https://img.shields.io/github/issues/mcpiscript/Planet) ![License](https://img.shields.io/github/license/mcpiscript/Planet) [![Hits](https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2Fmcpiscript%2FPlanet&count_bg=%2379C83D&title_bg=%23555555&icon=&icon_color=%23E7E7E7&title=hits&edge_flat=false)](https://hits.seeyoufarm.com)
|
||||||
[![Hits](https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2Fmcpiscript%2FPlanet&count_bg=%2379C83D&title_bg=%23555555&icon=&icon_color=%23E7E7E7&title=hits&edge_flat=false)](https://hits.seeyoufarm.com)
|
|
||||||
|
|
||||||
|
|
||||||
<!--## Table Of Contents
|
<!--## Table Of Contents
|
||||||
|
@ -36,25 +35,37 @@
|
||||||
-->
|
-->
|
||||||
|
|
||||||
![Screenshot](https://github.com/mcpiscript/planet/raw/master/screenshot.png)
|
![Screenshot](https://github.com/mcpiscript/planet/raw/master/screenshot.png)
|
||||||
|
<!--
|
||||||
|
**Is there a a launcher for MCPi that works everywhere and has all the essenitial features?**:
|
||||||
|
Yes there is. Introducing Planet. Planet was made because the other launchers didn't work properly or were unmaintained.
|
||||||
|
And, no launcher supports AppImage, thus Planet is required to run new versions of MCPi-Reborn.-->
|
||||||
|
## Installation
|
||||||
|
#### Prerequisites
|
||||||
|
* [Minecraft Pi: Reborn](https://jenkins.thebrokenrail.com) AppImage or DEB install
|
||||||
|
#### Installation
|
||||||
|
1. Download the DEB from the releases section.
|
||||||
|
2. Install the DEB using `apt`
|
||||||
|
3. Follow the on-screen instructions
|
||||||
|
|
||||||
### gMCPIL vs jMCPIL vs Planet
|
### gMCPIL vs jMCPIL vs pipan vs Planet
|
||||||
| Feature | Planet | [gMCPIL](https://github.com/mcpi-revival/gmcpil) | [jMCPIL](https://github.com/mcpi-revival/jmcpil) |
|
| Feature | Planet | [gMCPIL](https://github.com/mcpi-revival/gmcpil) | [jMCPIL](https://github.com/mcpi-revival/jmcpil) | [pipan](https://github.com/randomsoup/pipan) |
|
||||||
|---------|--------|--------|--------|
|
|---------|--------|--------|--------|-------|
|
||||||
| Profile & feature saving | Yes | No | Yes |
|
| Profile & feature saving | Yes | No | Yes | No |
|
||||||
| AppImage support | Yes | No | No |
|
| AppImage support | Yes | No | No | No |
|
||||||
| Legacy DEB support | Yes | Yes | Yes |
|
| Legacy DEB support | Yes | Yes | Yes | Yes |
|
||||||
| Official MCPi-Revival | No | Yes | Yes |
|
| Official MCPi-Revival | No | Yes | Yes | No |
|
||||||
| Tab icons | Yes | No | No |
|
| Tab icons | Yes | No | No | No |
|
||||||
| Maintained | Yes | Yes | No |
|
| Maintained | Yes | Yes | No | Yes |
|
||||||
| Supported on Debian Buster | Yes | No | Yes |
|
| Supported on Debian Buster | Yes | No | Yes | Yes |
|
||||||
| Discord RPC | Yes | No | No |
|
| Discord RPC | Yes | No | No | No |
|
||||||
| External server support | Yes | Yes | Yes |
|
| External server support | Yes | Yes | Yes | No |
|
||||||
| Flatpak support | Yes | No | No |
|
| Flatpak support | Yes | No | No | No |
|
||||||
| Pre-made profiles | No | Yes | Yes |
|
| Pre-made profiles | No | Yes | Yes | Yes |
|
||||||
|
| Easy GUI navigation | Yes | Yes | Yes | No |
|
||||||
## Credits
|
## Credits
|
||||||
- @leha-code - Creator and maintainer
|
- @leha-code - Creator and maintainer
|
||||||
- @red-exe-engineer - Active contributor
|
- @red-exe-engineer - Active contributor
|
||||||
|
- @bigjango13 - Multiple fixes
|
||||||
|
|
||||||
### Additional Credits
|
### Additional Credits
|
||||||
Heart, Planet, Pi, Steve and Portal icons by LEHAtupointow
|
Heart, Planet, Pi, Steve and Portal icons by LEHAtupointow
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
#!/usr/bin/python3
|
#!/usr/bin/python3
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
Planet is an improed launcher, inspired by jMCPIL, MCPIL and MCPIl-R
|
||||||
|
|
||||||
Copyright (C) 2022 Alexey Pavlov
|
Copyright (C) 2022 Alexey Pavlov
|
||||||
Copyright (C) 2022 Red-Exe-Engineer
|
Copyright (C) 2022 Red-Exe-Engineer
|
||||||
|
Copyright (C) 2022 Bigjango13
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
|
@ -300,7 +302,7 @@ class Planet(QMainWindow):
|
||||||
|
|
||||||
# Load the logo pixmap
|
# Load the logo pixmap
|
||||||
logopixmap = QPixmap(f"{absolute_path}/assets/logo512.png").scaled(
|
logopixmap = QPixmap(f"{absolute_path}/assets/logo512.png").scaled(
|
||||||
100, 100, Qt.KeepAspectRatio
|
100, 100, Qt.KeepAspectRatio #Scale it, but keep the aspect ratio
|
||||||
)
|
)
|
||||||
|
|
||||||
logolabel = QLabel() # Label for the pixmap
|
logolabel = QLabel() # Label for the pixmap
|
||||||
|
@ -311,12 +313,12 @@ class Planet(QMainWindow):
|
||||||
|
|
||||||
# Ester eggs
|
# Ester eggs
|
||||||
if date.today().month == 4 and date.today().day == 1:
|
if date.today().month == 4 and date.today().day == 1:
|
||||||
namelabel.setText("Banana Launcher")
|
namelabel.setText("Banana Launcher") # If the date is april fish, show the banana easter egg
|
||||||
else:
|
else:
|
||||||
if random.randint(1, 100) == 1:
|
if random.randint(1, 100) == 1:
|
||||||
namelabel.setText("Pluto Launcher")
|
namelabel.setText("Pluto Launcher") # a 1/100, Pluto launcher
|
||||||
else:
|
else:
|
||||||
namelabel.setText("Planet Launcher")
|
namelabel.setText("Planet Launcher") #Else, just set it normal
|
||||||
|
|
||||||
font = namelabel.font() # Font used
|
font = namelabel.font() # Font used
|
||||||
font.setPointSize(30) # Set the font size
|
font.setPointSize(30) # Set the font size
|
||||||
|
@ -342,25 +344,27 @@ class Planet(QMainWindow):
|
||||||
|
|
||||||
self.profilebox = QComboBox()
|
self.profilebox = QComboBox()
|
||||||
self.profilebox.addItems(
|
self.profilebox.addItems(
|
||||||
["Vanilla MCPi", "Modded MCPi", "Modded MCPE", "Optimized MCPE", "Custom"]
|
["Vanilla MCPi", "Modded MCPi", "Modded MCPE", "Optimized MCPE", "Custom"] # Add items into the combo box
|
||||||
)
|
)
|
||||||
self.profilebox.setCurrentText("Modded MCPE")
|
self.profilebox.setCurrentText("Modded MCPE") # Set the current selection
|
||||||
|
|
||||||
self.showlauncher = QRadioButton("Hide Launcher")
|
self.showlauncher = QRadioButton("Hide Launcher") # RadioButton used for hiding the launcher
|
||||||
|
|
||||||
self.playbutton = QPushButton("Play")
|
self.playbutton = QPushButton("Play") # The most powerful button
|
||||||
|
|
||||||
self.playbutton.setCheckable(True)
|
|
||||||
self.playbutton.clicked.connect(self.launch)
|
|
||||||
|
|
||||||
|
self.playbutton.setCheckable(True) # Allow checking it
|
||||||
|
self.playbutton.clicked.connect(self.launch) # Connect it to the executing function
|
||||||
|
|
||||||
|
# Add widgets into the title layout
|
||||||
titlelayout.addWidget(logolabel, 0, 0)
|
titlelayout.addWidget(logolabel, 0, 0)
|
||||||
titlelayout.addWidget(namelabel, 0, 1)
|
titlelayout.addWidget(namelabel, 0, 1)
|
||||||
|
|
||||||
titlewidget = QWidget()
|
titlewidget = QWidget()
|
||||||
titlewidget.setLayout(titlelayout)
|
titlewidget.setLayout(titlelayout) # Apply the layout onto a fake widget
|
||||||
|
|
||||||
layout.addWidget(titlewidget, 0, 0, 2, 5)
|
|
||||||
|
|
||||||
|
layout.addWidget(titlewidget, 0, 0, 2, 5) # Apply that widget onto the main layout
|
||||||
|
|
||||||
|
# All other widgets are applied here
|
||||||
layout.addWidget(splashlabel, 2, 0, 1, 6)
|
layout.addWidget(splashlabel, 2, 0, 1, 6)
|
||||||
|
|
||||||
layout.addWidget(usernamelabel, 3, 0)
|
layout.addWidget(usernamelabel, 3, 0)
|
||||||
|
@ -378,7 +382,7 @@ class Planet(QMainWindow):
|
||||||
|
|
||||||
widget = QWidget()
|
widget = QWidget()
|
||||||
|
|
||||||
widget.setLayout(layout)
|
widget.setLayout(layout) # Apply the layout onto the main widget
|
||||||
|
|
||||||
return widget
|
return widget
|
||||||
|
|
||||||
|
@ -386,36 +390,37 @@ class Planet(QMainWindow):
|
||||||
|
|
||||||
layout = QVBoxLayout()
|
layout = QVBoxLayout()
|
||||||
|
|
||||||
self.features = dict()
|
self.features = dict() # Dictionary used for storing checkboxes for features
|
||||||
default_features = launcher.get_features_dict(
|
default_features = launcher.get_features_dict( # Get default feature list
|
||||||
f"/home/{USER}/.planet-launcher/minecraft.AppImage"
|
f"/home/{USER}/.planet-launcher/minecraft.AppImage"
|
||||||
)
|
)
|
||||||
|
|
||||||
for feature in default_features:
|
for feature in default_features: # Loop in default features
|
||||||
checkbox = QCheckBox(feature)
|
checkbox = QCheckBox(feature) # For each feature, create a checkbox
|
||||||
if default_features[feature]:
|
# TODO: Fix the error if newer features are added here, or check for them in self.conf
|
||||||
|
if default_features[feature]: # Check if it's checked. If so, check it
|
||||||
checkbox.setCheckState(Qt.Checked)
|
checkbox.setCheckState(Qt.Checked)
|
||||||
else:
|
else:
|
||||||
checkbox.setCheckState(Qt.Unchecked)
|
checkbox.setCheckState(Qt.Unchecked)
|
||||||
|
|
||||||
checkbox.clicked.connect(self.set_features)
|
checkbox.clicked.connect(self.set_features) # Connect saving function
|
||||||
|
|
||||||
self.features[feature] = checkbox
|
self.features[feature] = checkbox # Add the checkbox into the list
|
||||||
|
|
||||||
layout.addWidget(checkbox)
|
layout.addWidget(checkbox) #Add the checkbox into the layout
|
||||||
|
|
||||||
fakewidget = QWidget()
|
fakewidget = QWidget() # Create a fake widget to apply the layout on
|
||||||
fakewidget.setLayout(layout)
|
fakewidget.setLayout(layout) # Apply the layoutonto
|
||||||
|
|
||||||
scroll = QScrollArea()
|
scroll = QScrollArea() # Add a scoll area
|
||||||
|
|
||||||
scroll.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
|
scroll.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn) # Shoe the vertical scroll bar
|
||||||
scroll.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
|
scroll.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) # Hide the horizontak scroll bar
|
||||||
scroll.setWidgetResizable(True)
|
scroll.setWidgetResizable(True) # Allow window resizing and fix itt with the scrollbar
|
||||||
scroll.setWidget(fakewidget)
|
scroll.setWidget(fakewidget) # Set the main widget into the scrollbar
|
||||||
|
|
||||||
fakelayout = QGridLayout()
|
fakelayout = QGridLayout()
|
||||||
fakelayout.addWidget(scroll, 0, 0)
|
fakelayout.addWidget(scroll, 0, 0) #Apply the scrollbar onto the layout
|
||||||
|
|
||||||
widget = QWidget()
|
widget = QWidget()
|
||||||
|
|
||||||
|
@ -426,18 +431,18 @@ class Planet(QMainWindow):
|
||||||
def servers_tab(self) -> QWidget:
|
def servers_tab(self) -> QWidget:
|
||||||
widget = QWidget()
|
widget = QWidget()
|
||||||
layout = QGridLayout()
|
layout = QGridLayout()
|
||||||
|
|
||||||
|
self.serversedit = QTextEdit() # Create a text editing area
|
||||||
|
|
||||||
self.serversedit = QTextEdit()
|
self.serversedit.textChanged.connect(self.save_servers) # Connect on change to the save function
|
||||||
|
|
||||||
self.serversedit.textChanged.connect(self.save_servers)
|
|
||||||
with open(f"/home/{USER}/.minecraft-pi/servers.txt") as servers:
|
with open(f"/home/{USER}/.minecraft-pi/servers.txt") as servers:
|
||||||
self.serversedit.setPlainText(servers.read())
|
self.serversedit.setPlainText(servers.read()) # Set the text of the text editing area
|
||||||
|
|
||||||
infolabel = QLabel(
|
infolabel = QLabel( #Label with information about the server format
|
||||||
'Servers are stored in the format of <font color="gold">IP: </font><font color="blue">Port</font>'
|
'Servers are stored in the format of <font color="gold">IP: </font><font color="blue">Port</font>'
|
||||||
)
|
)
|
||||||
|
|
||||||
layout.addWidget(self.serversedit, 0, 0)
|
layout.addWidget(self.serversedit, 0, 0) # Add the widgets
|
||||||
layout.addWidget(infolabel, 6, 0)
|
layout.addWidget(infolabel, 6, 0)
|
||||||
|
|
||||||
widget.setLayout(layout)
|
widget.setLayout(layout)
|
||||||
|
@ -446,9 +451,9 @@ class Planet(QMainWindow):
|
||||||
def custom_mods_tab(self) -> QWidget:
|
def custom_mods_tab(self) -> QWidget:
|
||||||
layout = QVBoxLayout()
|
layout = QVBoxLayout()
|
||||||
|
|
||||||
for mod in os.listdir(f"/home/{USER}/.planet-launcher/mods/"):
|
for mod in os.listdir(f"/home/{USER}/.planet-launcher/mods/"): # Loop in every mod in the mod directory
|
||||||
checkbox = QCheckBox(mod)
|
checkbox = QCheckBox(mod) # Create a checkbox with the mod name
|
||||||
checkbox.setCheckState(Qt.Unchecked)
|
checkbox.setCheckState(Qt.Unchecked) # Set it to unchecked
|
||||||
|
|
||||||
layout.addWidget(checkbox)
|
layout.addWidget(checkbox)
|
||||||
|
|
||||||
|
@ -472,8 +477,9 @@ class Planet(QMainWindow):
|
||||||
return widget
|
return widget
|
||||||
|
|
||||||
def changelog_tab(self):
|
def changelog_tab(self):
|
||||||
web = QWebView()
|
web = QWebView() # Create a webview object
|
||||||
web.load(QUrl().fromLocalFile(f"{absolute_path}/assets/changelog.html"))
|
web.load(QUrl().fromLocalFile(f"{absolute_path}/assets/changelog.html")) # Load the local file
|
||||||
|
# TODO: Use two different tabs for the webview
|
||||||
|
|
||||||
return web
|
return web
|
||||||
|
|
||||||
|
@ -501,6 +507,7 @@ class Planet(QMainWindow):
|
||||||
self.launchfeatures[feature] = False
|
self.launchfeatures[feature] = False
|
||||||
|
|
||||||
def save_profile(self):
|
def save_profile(self):
|
||||||
|
self.set_features()
|
||||||
self.conf["username"] = self.usernameedit.text()
|
self.conf["username"] = self.usernameedit.text()
|
||||||
self.conf["options"] = self.launchfeatures
|
self.conf["options"] = self.launchfeatures
|
||||||
self.conf["render_distance"] = self.distancebox.currentText()
|
self.conf["render_distance"] = self.distancebox.currentText()
|
||||||
|
|
Loading…
Reference in New Issue