Add translation support (And first translation)

This commit is contained in:
leha-code 2022-04-15 20:35:33 -04:00
parent 4511e99c5c
commit 04da586fd6
No known key found for this signature in database
GPG Key ID: 15227A6455DDF7EE
31 changed files with 737 additions and 82 deletions

View File

@ -17,7 +17,7 @@
</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) [![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) ![Discord](https://img.shields.io/discord/936428193521487953?color=blue&label=Discord%20server&logo=Discord&logoColor=blue) ![GitHub commit activity](https://img.shields.io/github/commit-activity/w/mcpiscript/planet?label=Commits) ![GitHub commits since latest release (by date)](https://img.shields.io/github/commits-since/mcpiscript/planet/latest/master) ![GitHub last commit](https://img.shields.io/github/last-commit/mcpiscript/planet) ![GitHub Release Date](https://img.shields.io/github/release-date/mcpiscript/planet?label=Latest%20release%20date) ![GitHub repo size](https://img.shields.io/github/repo-size/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) ![Discord](https://img.shields.io/discord/936428193521487953?color=blue&label=Discord%20server&logo=Discord&logoColor=blue) ![GitHub commit activity](https://img.shields.io/github/commit-activity/w/mcpiscript/planet?label=Commits) ![GitHub commits since latest release (by date)](https://img.shields.io/github/commits-since/mcpiscript/planet/latest/master) ![GitHub last commit](https://img.shields.io/github/last-commit/mcpiscript/planet) ![GitHub Release Date](https://img.shields.io/github/release-date/mcpiscript/planet?label=Latest%20release%20date) ![GitHub repo size](https://img.shields.io/github/repo-size/mcpiscript/planet) [![Crowdin](https://badges.crowdin.net/planet-launcher/localized.svg)](https://crowdin.com/project/planet-launcher)
<!--## Table Of Contents

View File

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View File

Before

Width:  |  Height:  |  Size: 6.4 KiB

After

Width:  |  Height:  |  Size: 6.4 KiB

View File

Before

Width:  |  Height:  |  Size: 9.1 KiB

After

Width:  |  Height:  |  Size: 9.1 KiB

View File

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

Before

Width:  |  Height:  |  Size: 7.6 KiB

After

Width:  |  Height:  |  Size: 7.6 KiB

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 190 B

After

Width:  |  Height:  |  Size: 190 B

View File

Before

Width:  |  Height:  |  Size: 136 B

After

Width:  |  Height:  |  Size: 136 B

View File

Before

Width:  |  Height:  |  Size: 380 B

After

Width:  |  Height:  |  Size: 380 B

View File

Before

Width:  |  Height:  |  Size: 527 B

After

Width:  |  Height:  |  Size: 527 B

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

View File

Before

Width:  |  Height:  |  Size: 255 B

After

Width:  |  Height:  |  Size: 255 B

Binary file not shown.

View File

@ -0,0 +1,163 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR ORGANIZATION
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2022-04-15 19:08-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: pygettext.py 1.5\n"
#: main.py:134
msgid ""
"Please select the executable you downloaded.\n"
"If you installed a DEB, please select the \"Link\" option"
msgstr ""
#: main.py:138 main.py:182
msgid "Select executable"
msgstr ""
#: main.py:143
msgid "Link /usr/bin/minecraft-pi-reborn-client"
msgstr ""
#: main.py:148
msgid "Link flatpak"
msgstr ""
#: main.py:227
msgid "Launched with Planet Launcher"
msgstr ""
#: main.py:228
msgid "Minecraft Pi Edition: Reborn"
msgstr ""
#: main.py:238
msgid "Unable to initalize Discord RPC. Skipping."
msgstr ""
#: main.py:269
msgid "Planet"
msgstr ""
#: main.py:283
msgid "Play"
msgstr ""
#: main.py:288
msgid "Features"
msgstr ""
#: main.py:293
msgid "Servers"
msgstr ""
#: main.py:299
msgid "Settings"
msgstr ""
#: main.py:359
msgid "Banana Launcher"
msgstr ""
#: main.py:363
msgid "Pluto Launcher"
msgstr ""
#: main.py:365
msgid "Planet Launcher"
msgstr ""
#: main.py:378
msgid "Username"
msgstr ""
#: main.py:381
msgid "StevePi"
msgstr ""
#: main.py:384
msgid "Render Distance"
msgstr ""
#: main.py:391
msgid "Profile"
msgstr ""
#: main.py:406
msgid "Hide Launcher"
msgstr ""
#: main.py:535
msgid "Servers are stored in the format of <font color=\"gold\">IP: </font><font color=\"blue\">Port</font>"
msgstr ""
#: main.py:588
msgid "Set the skin"
msgstr ""
#: main.py:590
msgid "Select Skin"
msgstr ""
#: main.py:593
msgid "Reset config"
msgstr ""
#: main.py:595
msgid "Delete config"
msgstr ""
#: main.py:598
msgid "Delete executable"
msgstr ""
#: main.py:600
msgid "Delete"
msgstr ""
#: main.py:603
msgid "Import settings"
msgstr ""
#: main.py:623
msgid "General"
msgstr ""
#: main.py:624
msgid "Changelog"
msgstr ""
#: main.py:625
msgid "MCPIEdit"
msgstr ""
#: main.py:705
msgid "Select skin file"
msgstr ""
#: main.py:719 main.py:736
msgid "Are you sure you want to reset?"
msgstr ""
#: main.py:721
msgid "Are you sure you want to delete the config? This action is unrecoverable."
msgstr ""
#: main.py:738
msgid "Are you sure you want to delete the AppImage? This action is unrecoverable."
msgstr ""
#: main.py:812
msgid "Using /usr/bin as an executable."
msgstr ""

Binary file not shown.

View File

@ -0,0 +1,124 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR ORGANIZATION
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2022-04-15 19:08-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: pygettext.py 1.5\n"
#: mcpiedit.py:74
msgid ""
"The default built-in NBT editor for Planet.\n"
"\n"
"MCPIedit makes use of Pi-NBT\n"
" from the original MCPIedit project\n"
"by TheBrokenRail, which is\n"
"licensed under the MIT license."
msgstr ""
#: mcpiedit.py:91
msgid ""
"NBT editors allow you to edit your world\n"
"files to change game modes, time,\n"
"and even the world name. Select an NBT\n"
"file to edit using the button below."
msgstr ""
#: mcpiedit.py:95
msgid "Select NBT File"
msgstr ""
#: mcpiedit.py:97
msgid "About"
msgstr ""
#: mcpiedit.py:125
msgid "General"
msgstr ""
#: mcpiedit.py:126
msgid "World"
msgstr ""
#: mcpiedit.py:155
msgid "World name"
msgstr ""
#: mcpiedit.py:158
msgid "OneChunk"
msgstr ""
#: mcpiedit.py:166
msgid "Last Played Timestamp"
msgstr ""
#: mcpiedit.py:171
msgid "Game mode"
msgstr ""
#: mcpiedit.py:181
msgid "Time (In Ticks)"
msgstr ""
#: mcpiedit.py:187
msgid "Back"
msgstr ""
#: mcpiedit.py:189
msgid "Save"
msgstr ""
#: mcpiedit.py:218
msgid "Spawnpoint X"
msgstr ""
#: mcpiedit.py:224
msgid "Spawnpoint Y"
msgstr ""
#: mcpiedit.py:230
msgid "Spawnpoint Z"
msgstr ""
#: mcpiedit.py:236
msgid "Player Spawnpoint X"
msgstr ""
#: mcpiedit.py:242
msgid "Player Spawnpoint Y"
msgstr ""
#: mcpiedit.py:248
msgid "Player Spawnpoint Z"
msgstr ""
#: mcpiedit.py:263
msgid ""
"Note:\n"
"Player spawnpoints are very buggy!\n"
"You might spawn in the wrong\n"
"place or even outside the world!\n"
"Do not use on valuable worlds."
msgstr ""
#: mcpiedit.py:328
msgid "Open NBT File"
msgstr ""
#: mcpiedit.py:330
msgid "Minecraft Pi Level NBT (level.dat)"
msgstr ""
#: mcpiedit.py:349
msgid "MCPIEdit"
msgstr ""

Binary file not shown.

View File

@ -0,0 +1,165 @@
msgid ""
msgstr ""
"Project-Id-Version: planet-launcher\n"
"POT-Creation-Date: 2022-04-15 16:48-0400\n"
"PO-Revision-Date: 2022-04-16 00:26\n"
"Last-Translator: \n"
"Language-Team: Russian\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: pygettext.py 1.5\n"
"Plural-Forms: nplurals=4; plural=((n%10==1 && n%100!=11) ? 0 : ((n%10 >= 2 && n%10 <=4 && (n%100 < 12 || n%100 > 14)) ? 1 : ((n%10 == 0 || (n%10 >= 5 && n%10 <=9)) || (n%100 >= 11 && n%100 <= 14)) ? 2 : 3));\n"
"X-Crowdin-Project: planet-launcher\n"
"X-Crowdin-Project-ID: 510486\n"
"X-Crowdin-Language: ru\n"
"X-Crowdin-File: main.po\n"
"X-Crowdin-File-ID: 2\n"
"Language: ru_RU\n"
#: main.py:134
msgid "Please select the executable you downloaded.\n"
"If you installed a DEB, please select the \"Link\" option"
msgstr "Пожалуйста выберите запускной файл который Вы скачали.\n"
"Если Вы установили DEB-архив, пожалуйста выберите \"Создать ссылку\""
#: main.py:138 main.py:182
msgid "Select executable"
msgstr "Выберите запускной файл"
#: main.py:143
msgid "Link /usr/bin/minecraft-pi-reborn-client"
msgstr "Создать ссылку на /usr/bin/minecraft-pi-reborn-client"
#: main.py:148
msgid "Link flatpak"
msgstr "Создаиь ссылку на FlatPak"
#: main.py:227
msgid "Launched with Planet Launcher"
msgstr "Запущено с помощью Planet Launcher"
#: main.py:228
msgid "Minecraft Pi Edition: Reborn"
msgstr "Майнкрафт Pi Edition: Перерожденная версия"
#: main.py:238
msgid "Unable to initalize Discord RPC. Skipping."
msgstr "Не удалось запустить Discord RPC. Пропускаем."
#: main.py:269
msgid "Planet"
msgstr "Planet (Планет Лаунчер)"
#: main.py:283
msgid "Play"
msgstr "Играть"
#: main.py:288
msgid "Features"
msgstr "Опции"
#: main.py:293
msgid "Servers"
msgstr "Сетевая игра"
#: main.py:299
msgid "Settings"
msgstr "Настройки"
#: main.py:359
msgid "Banana Launcher"
msgstr "Банановый Лаунчер"
#: main.py:363
msgid "Pluto Launcher"
msgstr "Лаунчер Плутона"
#: main.py:365
msgid "Planet Launcher"
msgstr "Planet Лаунчер"
#: main.py:378
msgid "Username"
msgstr "Имя пользователя"
#: main.py:381
msgid "StevePi"
msgstr "СтивПи"
#: main.py:384
msgid "Render Distance"
msgstr "Расстояние отображения"
#: main.py:391
msgid "Profile"
msgstr "Профиль запуска"
#: main.py:406
msgid "Hide Launcher"
msgstr "Скрыть после запуска"
#: main.py:535
msgid "Servers are stored in the format of <font color=\"gold\">IP: </font><font color=\"blue\">Port</font>"
msgstr "Серверы хранятся в формате <font color=\"gold\">IP: </font><font color=\"blue\">Порт</font>"
#: main.py:588
msgid "Set the skin"
msgstr "Выбрать скин"
#: main.py:590
msgid "Select Skin"
msgstr "Выбрать скин"
#: main.py:593
msgid "Reset config"
msgstr "Сбросить конфигурацию"
#: main.py:595
msgid "Delete config"
msgstr "Удалить конфигурвцию"
#: main.py:598
msgid "Delete executable"
msgstr "Удалить запускной файл"
#: main.py:600
msgid "Delete"
msgstr "Удалить"
#: main.py:603
msgid "Import settings"
msgstr "Импортировать настройки"
#: main.py:623
msgid "General"
msgstr "Общее"
#: main.py:624
msgid "Changelog"
msgstr "Журнал изменений"
#: main.py:625
msgid "MCPIEdit"
msgstr "Редактор MCPIEdit"
#: main.py:705
msgid "Select skin file"
msgstr "Выберите скин"
#: main.py:719 main.py:736
msgid "Are you sure you want to reset?"
msgstr "Вы действительно хотите сбросить данные?"
#: main.py:721
msgid "Are you sure you want to delete the config? This action is unrecoverable."
msgstr "Вы действительно хотите удалить файл конфигурации? Это действие необратимо."
#: main.py:738
msgid "Are you sure you want to delete the AppImage? This action is unrecoverable."
msgstr "Вы действительно хотите удалить файл AppImage? Это действие необратимо."
#: main.py:812
msgid "Using /usr/bin as an executable."
msgstr "Использование /usr/bin в качестве запускного файла."

View File

@ -0,0 +1,133 @@
msgid ""
msgstr ""
"Project-Id-Version: planet-launcher\n"
"POT-Creation-Date: 2022-04-15 18:43-0400\n"
"PO-Revision-Date: 2022-04-16 00:26\n"
"Last-Translator: \n"
"Language-Team: Russian\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: pygettext.py 1.5\n"
"Plural-Forms: nplurals=4; plural=((n%10==1 && n%100!=11) ? 0 : ((n%10 >= 2 && n%10 <=4 && (n%100 < 12 || n%100 > 14)) ? 1 : ((n%10 == 0 || (n%10 >= 5 && n%10 <=9)) || (n%100 >= 11 && n%100 <= 14)) ? 2 : 3));\n"
"X-Crowdin-Project: planet-launcher\n"
"X-Crowdin-Project-ID: 510486\n"
"X-Crowdin-Language: ru\n"
"X-Crowdin-File: mcpiedit.po\n"
"X-Crowdin-File-ID: 4\n"
"Language: ru_RU\n"
#: mcpiedit.py:69
msgid "The default built-in NBT editor for Planet.\n\n"
"MCPIedit makes use of Pi-NBT\n"
" from the original MCPIedit project\n"
"by TheBrokenRail, which is\n"
"licensed under the MIT license."
msgstr "Встроенный редактор NBT для Planet.\n\n"
"MCPIedit использует Pi-NBT\n"
"из оригинального проекта MCPIedit, который создан\n"
"TheBrokenRail, \n"
"лицензирован под лицензией MIT."
#: mcpiedit.py:86
msgid "NBT editors allow you to edit your world\n"
"files to change game modes, time,\n"
"and even the world name. Select an NBT\n"
"file to edit using the button below."
msgstr "Редакторы NBT позволяют редактировать\n"
"файлы, чтобы изменить игровые режимы, время,\n"
"и даже название мира. Выберите файл NBT\n"
"для редактирования с помощью кнопки ниже."
#: mcpiedit.py:90
msgid "Select NBT File"
msgstr "Выберите NBT файл"
#: mcpiedit.py:92
msgid "About"
msgstr "О программе"
#: mcpiedit.py:120
msgid "General"
msgstr "Общее"
#: mcpiedit.py:121
msgid "World"
msgstr "Мир"
#: mcpiedit.py:150
msgid "World name"
msgstr "Название мира"
#: mcpiedit.py:153
msgid "OneChunk"
msgstr "Еднственный Чанк"
#: mcpiedit.py:161
msgid "Last Played Timestamp"
msgstr "Отметка времени последнего открытия мира"
#: mcpiedit.py:166
msgid "Game mode"
msgstr "Игровой режим"
#: mcpiedit.py:176
msgid "Time (In Ticks)"
msgstr "Время (в тиках)"
#: mcpiedit.py:182
msgid "Back"
msgstr "Обратно"
#: mcpiedit.py:184
msgid "Save"
msgstr "Сохранить"
#: mcpiedit.py:213
msgid "Spawnpoint X"
msgstr "Координаты Х"
#: mcpiedit.py:219
msgid "Spawnpoint Y"
msgstr "Координаты Y"
#: mcpiedit.py:225
msgid "Spawnpoint Z"
msgstr "Координаты Z"
#: mcpiedit.py:231
msgid "Player Spawnpoint X"
msgstr "Точка возрождения игрока X"
#: mcpiedit.py:237
msgid "Player Spawnpoint Y"
msgstr "Точка возрождения игрока Y"
#: mcpiedit.py:243
msgid "Player Spawnpoint Z"
msgstr "Точка возрождения игрока Z"
#: mcpiedit.py:258
msgid "Note:\n"
"Player spawnpoints are very buggy!\n"
"You might spawn in the wrong\n"
"place or even outside the world!\n"
"Do not use on valuable worlds."
msgstr "Примечание:\n"
"Точки появления игрока очень неточны!\n"
"Вы можете возродиться в неправильном\n"
"месте или даже за пределами мира!\n"
"Не пробуйте это на ценных мирах."
#: mcpiedit.py:323
msgid "Open NBT File"
msgstr "Открыть файл NBT"
#: mcpiedit.py:325
msgid "Minecraft Pi Level NBT (level.dat)"
msgstr "Файлы NBT уровня Minecraft Pi (level.dat)"
#: mcpiedit.py:344
msgid "MCPIEdit"
msgstr "Редактор MCPIEdit"

View File

@ -32,6 +32,9 @@ import random
from datetime import date
import json
import pathlib
import gettext
LOCALE = os.getenv('LANG', 'en')
# Define the path used for later
absolute_path = pathlib.Path(__file__).parent.absolute()
@ -46,6 +49,8 @@ if os.path.exists("/usr/lib/planet-launcher/"):
sys.path.append("/usr/lib/planet-launcher/")
_ = gettext.translation('main', localedir=str(absolute_path)+"/assets/translations/", languages=[LOCALE]).gettext
# Local imports
import launcher
from splashes import SPLASHES
@ -103,7 +108,7 @@ class ConfigPluto(QDialog):
titlelayout = QGridLayout() # Layout for the title
# Load the logo pixmap
logopixmap = QPixmap(f"{absolute_path}/assets/logo512.png").scaled(
logopixmap = QPixmap(f"{absolute_path}/assets/img/full/logo512.png").scaled(
100, 100, Qt.KeepAspectRatio
)
@ -126,21 +131,21 @@ class ConfigPluto(QDialog):
titlewidget.setLayout(titlelayout) # Set the layout
# Label with information
info_label = QLabel(
info_label = QLabel(_(
'Please select the executable you downloaded.\nIf you installed a DEB, please select the "Link" option'
)
))
self.executable_btn = QPushButton("Select executable") # Button for AppImage
self.executable_btn = QPushButton(_("Select executable")) # Button for AppImage
self.executable_btn.clicked.connect(
self.get_appimage
) # Connect to the function
self.premade_btn = QPushButton(
self.premade_btn = QPushButton(_(
"Link /usr/bin/minecraft-pi-reborn-client"
) # Button for Pre-installed debs
)) # Button for Pre-installed debs
self.premade_btn.clicked.connect(self.link_appimage) # Connect to the function
self.flatpak_btn = QPushButton("Link flatpak") # Button for linking flatpak
self.flatpak_btn = QPushButton(_("Link flatpak")) # Button for linking flatpak
self.flatpak_btn.clicked.connect(self.link_flatpak) # Connect to the function
# Adding things to widgets
@ -174,7 +179,7 @@ class ConfigPluto(QDialog):
self.hide() # Hide the dialog
# Open the file dialog
self.filename = QFileDialog.getOpenFileName(
self, "Select executable", "/", "Executable files (*.AppImage *.bin *.sh *)"
self, _("Select executable"), "/", "Executable files (*.AppImage *.bin *.sh *)"
)
def link_appimage(self):
@ -219,8 +224,8 @@ class Planet(QMainWindow):
RPC.connect() # Connect to Discord
# Set the RPC Status
RPC.update(
state="Launched with Planet Launcher",
details="Minecraft Pi Edition: Reborn",
state=_("Launched with Planet Launcher"),
details=_("Minecraft Pi Edition: Reborn"),
large_image=random.choice(
["revival", "logo"]
), # Randomly select the logo
@ -230,7 +235,7 @@ class Planet(QMainWindow):
)
except:
print(
"Unable to initalize Discord RPC. Skipping."
_("Unable to initalize Discord RPC. Skipping.")
) # If it fails, e.g Discord is not found, skip. This doesn't matter much.
if not os.path.exists(
@ -261,10 +266,10 @@ class Planet(QMainWindow):
) as file: # Else, it exists: Read from it.
self.conf = json.loads(file.read())
self.setWindowTitle("Planet") # Set the window title
self.setWindowTitle(_("Planet")) # Set the window title
self.setWindowIcon(
QIcon(f"{absolute_path}/assets/logo512.png")
QIcon(f"{absolute_path}/assets/img/full/logo512.png")
) # Set the window icon
self.widget = QWidget()
@ -275,24 +280,24 @@ class Planet(QMainWindow):
tabs.setMovable(True) # Allow tab movement.
# Tab part. Please check every function for more info
play_tab = tabs.addTab(self.play_tab(), "Play") # Add the play tab
play_tab = tabs.addTab(self.play_tab(), _("Play")) # Add the play tab
tabs.setTabIcon(
play_tab, QIcon(f"{absolute_path}/assets/logo512.png")
play_tab, QIcon(f"{absolute_path}/assets/img/full/logo512.png")
) # Set the icon for the tab
features_tab = tabs.addTab(
self.features_tab(), "Features"
self.features_tab(), _("Features")
) # Add the features tab
tabs.setTabIcon(
features_tab, QIcon(f"{absolute_path}/assets/heart512.png")
features_tab, QIcon(f"{absolute_path}/assets/img/full/heart512.png")
) # set the icon for the tab
servers_tab = tabs.addTab(self.servers_tab(), "Servers") # Servers tab
servers_tab = tabs.addTab(self.servers_tab(), _("Servers")) # Servers tab
tabs.setTabIcon(
servers_tab, QIcon(f"{absolute_path}/assets/portal512.png")
servers_tab, QIcon(f"{absolute_path}/assets/img/full/portal512.png")
) # Set the icon
# mods_tab = tabs.addTab(self.custom_mods_tab(), "Mods")
# tabs.setTabIcon(mods_tab, QIcon(f"{absolute_path}/assets/portal512.png"))
settings_tab = tabs.addTab(self.settings_tab(), "Settings") # Changelog tab
tabs.setTabIcon(settings_tab, QIcon(f"{absolute_path}/assets/wrench512.png"))
settings_tab = tabs.addTab(self.settings_tab(), _("Settings")) # Changelog tab
tabs.setTabIcon(settings_tab, QIcon(f"{absolute_path}/assets/img/full/wrench512.png"))
self.layout.addWidget(tabs)
@ -338,7 +343,7 @@ class Planet(QMainWindow):
titlelayout = QGridLayout() # The layout for the title
# Load the logo pixmap
logopixmap = QPixmap(f"{absolute_path}/assets/logo512.png").scaled(
logopixmap = QPixmap(f"{absolute_path}/assets/img/full/logo512.png").scaled(
100, 100, Qt.KeepAspectRatio # Scale it, but keep the aspect ratio
)
@ -351,13 +356,13 @@ class Planet(QMainWindow):
# Ester eggs
if date.today().month == 4 and date.today().day == 1:
namelabel.setText(
"Banana Launcher"
_("Banana Launcher")
) # If the date is april fish, show the banana easter egg
else:
if random.randint(1, 100) == 1:
namelabel.setText("Pluto Launcher") # a 1/100, Pluto launcher
namelabel.setText(_("Pluto Launcher")) # a 1/100, Pluto launcher
else:
namelabel.setText("Planet Launcher") # Else, just set it normal
namelabel.setText(_("Planet Launcher")) # Else, just set it normal
font = namelabel.font() # Font used
font.setPointSize(30) # Set the font size
@ -370,20 +375,20 @@ class Planet(QMainWindow):
splashlabel.adjustSize() # Adjust the size just in case
splashlabel.setAlignment(Qt.AlignHCenter) # Align the label
usernamelabel = QLabel("Username") # Label that is used to direct the line edit
usernamelabel = QLabel(_("Username")) # Label that is used to direct the line edit
self.usernameedit = QLineEdit() # Line Edit for username
self.usernameedit.setPlaceholderText("StevePi") # Set ghost value
self.usernameedit.setPlaceholderText(_("StevePi")) # Set ghost value
distancelabel = QLabel(
"Render Distance"
_("Render Distance")
) # Label that is used to direct the combo box
self.distancebox = QComboBox()
self.distancebox.addItems(["Far", "Normal", "Short", "Tiny"]) # Set the values
self.distancebox.setCurrentText("Short") # Set the default option
profilelabel = QLabel("Profile") # Label that is used to direct the combo box
profilelabel = QLabel(_("Profile")) # Label that is used to direct the combo box
self.profilebox = QComboBox()
self.profilebox.addItems(
@ -398,7 +403,7 @@ class Planet(QMainWindow):
self.profilebox.setCurrentText("Modded MCPE") # Set the current selection
self.showlauncher = QRadioButton(
"Hide Launcher"
_("Hide Launcher")
) # RadioButton used for hiding the launcher
self.versionbox = QComboBox()
@ -527,7 +532,7 @@ class Planet(QMainWindow):
) # Set the text of the text editing area
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) # Add the widgets
@ -569,7 +574,7 @@ class Planet(QMainWindow):
def changelog_widget(self):
web_engine = QWebView() # Create a webview object
web_engine.load(
QUrl().fromLocalFile(f"{absolute_path}/assets/changelog.html")
QUrl().fromLocalFile(f"{absolute_path}/assets/misc/changelog.html")
) # Load the local file
# TODO: Use two different tabs for the webview
@ -580,22 +585,22 @@ class Planet(QMainWindow):
layout = QGridLayout()
skin_label = QLabel("Set the skin")
skin_label = QLabel(_("Set the skin"))
self.skin_button = QPushButton("Select Skin")
self.skin_button = QPushButton(_("Select Skin"))
self.skin_button.clicked.connect(self.select_skin)
config_label = QLabel("Reset config")
config_label = QLabel(_("Reset config"))
self.delete_config_button = QPushButton("Delete config")
self.delete_config_button = QPushButton(_("Delete config"))
self.delete_config_button.clicked.connect(self.delete_config)
appimage_label = QLabel("Delete executable")
appimage_label = QLabel(_("Delete executable"))
self.delete_appimage_button = QPushButton("Delete")
self.delete_appimage_button = QPushButton(_("Delete"))
self.delete_appimage_button.clicked.connect(self.delete_appimage)
self.import_gmcpil_button = QPushButton("Import settings")
self.import_gmcpil_button = QPushButton(_("Import settings"))
self.import_gmcpil_button.clicked.connect(self.import_gmcpil)
layout.addWidget(skin_label, 0, 0)
@ -615,20 +620,20 @@ class Planet(QMainWindow):
tabs = QTabWidget()
tabs.setTabPosition(QTabWidget.South)
settings_tab = tabs.addTab(self.settings_widget(), "General")
changelog_tab = tabs.addTab(self.changelog_widget(), "Changelog")
editor_tab = tabs.addTab(mcpiedit.NBTEditor(), "MCPIEdit")
settings_tab = tabs.addTab(self.settings_widget(), _("General"))
changelog_tab = tabs.addTab(self.changelog_widget(), _("Changelog"))
editor_tab = tabs.addTab(mcpiedit.NBTEditor(), _("MCPIEdit"))
tabs.setTabIcon(
settings_tab, QIcon(f"{absolute_path}/assets/wrench512.png")
settings_tab, QIcon(f"{absolute_path}/assets/img/full/wrench512.png")
) # Set the icon
tabs.setTabIcon(
changelog_tab, QIcon(f"{absolute_path}/assets/git.png")
changelog_tab, QIcon(f"{absolute_path}/assets/img/full/git.png")
) # Set the icon
tabs.setTabIcon(
editor_tab, QIcon(f"{absolute_path}/assets/mcpiedit.png")
editor_tab, QIcon(f"{absolute_path}/assets/img/full/mcpiedit.png")
) # Set the icon
return tabs
@ -697,7 +702,7 @@ class Planet(QMainWindow):
def select_skin(self):
filename = QFileDialog.getOpenFileName(
self, "Select skin file", "/", "PNG files (*.png)"
self, _("Select skin file"), "/", "PNG files (*.png)"
)
if not filename == "":
with open(
@ -711,9 +716,9 @@ class Planet(QMainWindow):
def delete_config(self):
dialog = QMessageBox()
dialog.setWindowTitle("Are you sure you want to reset?")
dialog.setWindowTitle(_("Are you sure you want to reset?"))
dialog.setText(
"Are you sure you want to delete the config? This action is unrecoverable."
_("Are you sure you want to delete the config? This action is unrecoverable.")
)
dialog.setStandardButtons(QMessageBox.Ok | QMessageBox.Abort)
dialog.setIcon(QMessageBox.Warning)
@ -728,9 +733,9 @@ class Planet(QMainWindow):
def delete_appimage(self):
dialog = QMessageBox()
dialog.setWindowTitle("Are you sure you want to reset?")
dialog.setWindowTitle(_("Are you sure you want to reset?"))
dialog.setText(
"Are you sure you want to delete the AppImage? This action is unrecoverable."
_("Are you sure you want to delete the AppImage? This action is unrecoverable.")
)
dialog.setStandardButtons(QMessageBox.Ok | QMessageBox.Abort)
dialog.setIcon(QMessageBox.Warning)
@ -804,7 +809,7 @@ if __name__ == "__main__":
if pluto.filename[0] == "":
sys.exit(-1)
elif pluto.filename[0] == False:
print("Using /usr/bin as an executable.")
print(_("Using /usr/bin as an executable."))
else:
with open(pluto.filename[0], "rb") as appimage:
with open(

View File

@ -24,6 +24,9 @@ Copyright (C) 2022 Alexey Pavlov
import sys
import os
import pathlib
import gettext
LOCALE = os.getenv('LANG')
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
@ -44,6 +47,8 @@ if os.path.exists("/usr/lib/planet-launcher/"):
if not os.path.exists(f"/home/{USER}/.minecraft-pi/games/com.mojang/minecraftWorlds/"):
os.makedirs(f"/home/{USER}/.minecraft-pi/games/com.mojang/minecraftWorlds/")
_ = gettext.translation('mcpiedit', localedir=str(absolute_path)+"/assets/translations/", languages=[LOCALE]).gettext
GAME_TYPES = {"Survival": nbt.pynbt.TAG_Int(0), "Creative": nbt.pynbt.TAG_Int(1)}
@ -66,7 +71,7 @@ class AboutWindow(QWidget):
label.setFont(font) # Aplly the font onto the label
desc_label = QLabel(
"The default built-in NBT editor for Planet.\n\nMCPIedit makes use of Pi-NBT\n from the original MCPIedit project\nby TheBrokenRail, which is\nlicensed under the MIT license."
_("The default built-in NBT editor for Planet.\n\nMCPIedit makes use of Pi-NBT\n from the original MCPIedit project\nby TheBrokenRail, which is\nlicensed under the MIT license.")
)
desc_label.setAlignment(Qt.AlignHCenter)
@ -83,13 +88,13 @@ class FileSelectorTab(QWidget):
layout = QVBoxLayout()
info_label = QLabel(
"NBT editors allow you to edit your world\nfiles to change game modes, time,\nand even the world name. Select an NBT\nfile to edit using the button below."
_("NBT editors allow you to edit your world\nfiles to change game modes, time,\nand even the world name. Select an NBT\nfile to edit using the button below.")
)
info_label.setAlignment(Qt.AlignHCenter)
self.load_button = QPushButton("Select NBT File")
self.load_button = QPushButton(_("Select NBT File"))
self.about_button = QPushButton("About")
self.about_button = QPushButton(_("About"))
self.about_button.clicked.connect(self.about_window)
layout.addWidget(info_label)
@ -117,8 +122,8 @@ class EditorTab(QWidget):
self.tabs.setTabPosition(QTabWidget.West)
self.tabs.setMovable(True)
self.tabs.addTab(self.main_tab(), "General")
self.tabs.addTab(self.world_tab(), "World")
self.tabs.addTab(self.main_tab(), _("General"))
self.tabs.addTab(self.world_tab(), _("World"))
self.name_edit.setText(str(self.nbt["LevelName"].value))
self.timestamp_box.setValue(int(self.nbt["LastPlayed"].value))
@ -147,10 +152,10 @@ class EditorTab(QWidget):
layout = QGridLayout()
self.name_label = QLabel("World name")
self.name_label = QLabel(_("World name"))
self.name_edit = QLineEdit()
self.name_edit.setPlaceholderText("OneChunk")
self.name_edit.setPlaceholderText(_("OneChunk"))
self.seed_label = QLabel("World Seed")
@ -158,12 +163,12 @@ class EditorTab(QWidget):
self.seed_edit.setPlaceholderText("-121542953")
self.seed_edit.setValidator(QIntValidator())
self.timestamp_label = QLabel("Last Played Timestamp")
self.timestamp_label = QLabel(_("Last Played Timestamp"))
self.timestamp_box = QSpinBox()
self.timestamp_box.setMaximum(2147483647)
self.game_label = QLabel("Game mode")
self.game_label = QLabel(_("Game mode"))
self.game_box = QComboBox()
self.game_box.addItems(["Survival", "Creative"])
@ -173,15 +178,15 @@ class EditorTab(QWidget):
# pulse_checked_color="#92cee8"
# )
self.time_label = QLabel("Time (In Ticks)")
self.time_label = QLabel(_("Time (In Ticks)"))
self.time_edit = QLineEdit()
self.time_edit.setPlaceholderText("1770")
self.time_edit.setValidator(QIntValidator())
self.back_button = QPushButton("Back")
self.back_button = QPushButton(_("Back"))
self.save_button = QPushButton("Save")
self.save_button = QPushButton(_("Save"))
self.save_button.clicked.connect(self.save)
layout.addWidget(self.name_label, 0, 0)
@ -210,37 +215,37 @@ class EditorTab(QWidget):
layout = QGridLayout()
x_label = QLabel("Spawnpoint X")
x_label = QLabel(_("Spawnpoint X"))
self.spawn_x_box = QSpinBox()
self.spawn_x_box.setMinimum(-128)
self.spawn_x_box.setMaximum(128)
y_label = QLabel("Spawnpoint Y")
y_label = QLabel(_("Spawnpoint Y"))
self.spawn_y_box = QSpinBox()
self.spawn_y_box.setMinimum(-64)
self.spawn_y_box.setMaximum(64)
z_label = QLabel("Spawnpoint Z")
z_label = QLabel(_("Spawnpoint Z"))
self.spawn_z_box = QSpinBox()
self.spawn_z_box.setMinimum(-128)
self.spawn_z_box.setMaximum(128)
player_x_label = QLabel("Player Spawnpoint X")
player_x_label = QLabel(_("Player Spawnpoint X"))
self.player_spawn_x_box = QSpinBox()
self.player_spawn_x_box.setMinimum(-128)
self.player_spawn_x_box.setMaximum(128)
player_y_label = QLabel("Player Spawnpoint Y")
player_y_label = QLabel(_("Player Spawnpoint Y"))
self.player_spawn_y_box = QSpinBox()
self.player_spawn_y_box.setMinimum(-64)
self.player_spawn_y_box.setMaximum(64)
player_z_label = QLabel("Player Spawnpoint Z")
player_z_label = QLabel(_("Player Spawnpoint Z"))
self.player_spawn_z_box = QSpinBox()
self.player_spawn_z_box.setMinimum(-128)
@ -255,7 +260,7 @@ class EditorTab(QWidget):
layout.addWidget(player_z_label, 5, 0)
note_label = QLabel(
"Note:\nPlayer spawnpoints are very buggy!\nYou might spawn in the wrong\nplace or even outside the world!\nDo not use on valuable worlds."
_("Note:\nPlayer spawnpoints are very buggy!\nYou might spawn in the wrong\nplace or even outside the world!\nDo not use on valuable worlds.")
)
layout.addWidget(self.spawn_x_box, 0, 1)
@ -318,12 +323,11 @@ class NBTEditor(QWidget):
self.setLayout(self.layout)
def load_nbt(self):
print("Hellow, Cruel World!")
fname = QFileDialog.getOpenFileName(
self,
"Open NBT File",
_("Open NBT File"),
f"/home/{USER}/.minecraft-pi/games/com.mojang/minecraftWorlds/",
"Minecraft Pi Level NBT (level.dat)",
_("Minecraft Pi Level NBT (level.dat)"),
)
if fname[0] == "":
@ -342,8 +346,8 @@ if __name__ == "__main__":
window = QMainWindow()
window.setCentralWidget(NBTEditor())
window.setWindowTitle("MCPIEdit")
window.setWindowIcon(QIcon(f"{absolute_path}/assets/mcpiedit.png"))
window.setWindowTitle(_("MCPIEdit"))
window.setWindowIcon(QIcon(f"{absolute_path}/assets/img/full/mcpiedit.png"))
window.show()
app.exec()

69
planet/textures.py Normal file → Executable file
View File

@ -1,3 +1,4 @@
#!/usr/bin/env python3
"""
Copyright (C) 2022 Alexey Pavlov
@ -77,16 +78,76 @@ INDEX = [
"terrain.png",
]
INDEX = [
# Armor
"chain_1.png",
"chain_2.png",
"cloth_1.png",
"cloth_2.png",
"diamond_1.png",
"diamond_2.png",
"gold_1.png",
"gold_2.png",
"iron_1.png",
"iron_2.png",
# Miscelannous
"kz.png",
"clouds.png",
# Font and GUI
"default8.png",
"background.png",
"bg32.png",
"cursor.png",
"default_world.png",
"gui.png",
"gui2.png",
"gui_blocks.png",
"icons.png",
"itemframe.png",
"items.png", # Items
"pi_title.png",
"spritesheet.png",
"title.png",
"touchgui.png",
"minecon140.png",
"raknet_high_72.png",
"raknet_low_18.png",
# Item entitites
"arrows.png",
"camera.png",
"sign.png",
# Mobs
"char.png",
"chicken.png",
"cow.png",
"creeper.png",
"pig.png",
"pigzombie.png",
"sheep.png",
"sheep_fur.png",
"skeleton.png",
"spider.png",
"zombie.png",
# Misc entities
"particles.png",
# Blocks
"terrain.png",
]
@click.group()
def main():
pass
@main.command()
@click.option("--path", "-p", "texture_path", help="Texture pack path.")
@click.option("--mcpit", is_flag=True)
@main.command(help="Install a texture pack")
@click.option("--file", "--zipfile", "-f", "texture_path", help="Texture pack path.", type=click.Path(exists=True))
@click.option("--mcpit", is_flag=True, default=True)
def install(texture_path, mcpit):
click.echo("bruh")
if texture_path == None:
click.echo("Please supply a path")
return
click.echo("Path is "+click.format_filename(texture_path))
if __name__ == "__main__":
main()

View File

@ -1,5 +1,5 @@
pip3 install pyqtdarktheme pypresence pillow darkdetect qtwidgets pynbt
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
link /usr/lib/planet-launcher/assets/misc/planet-launcher.desktop /usr/share/applications/planet-launcher.desktop
gcc /usr/lib/planet-launcher/pi-nbt.c -o /usr/bin/pi-nbt