mirror of
https://github.com/nixietab/picodulce.git
synced 2025-04-10 10:28:56 +01:00
Compare commits
3 Commits
5eda9f1de4
...
1e03c986fd
Author | SHA1 | Date | |
---|---|---|---|
![]() |
1e03c986fd | ||
![]() |
0ebf31f223 | ||
![]() |
88cbd449ef |
84
picodulce.py
84
picodulce.py
@ -4,11 +4,12 @@ import threading
|
|||||||
from threading import Thread
|
from threading import Thread
|
||||||
import logging
|
import logging
|
||||||
import shutil
|
import shutil
|
||||||
|
import platform
|
||||||
import requests
|
import requests
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
from PyQt5.QtWidgets import QApplication, QComboBox, QWidget, QVBoxLayout, QListWidget, QPushButton, QMessageBox, QDialog, QHBoxLayout, QLabel, QLineEdit, QCheckBox, QTabWidget, QFrame, QSpacerItem, QSizePolicy, QMainWindow, QGridLayout
|
from PyQt5.QtWidgets import QApplication, QComboBox, QWidget, QVBoxLayout, QListWidget, QPushButton, QMessageBox, QDialog, QHBoxLayout, QLabel, QLineEdit, QCheckBox, QTabWidget, QFrame, QSpacerItem, QSizePolicy, QMainWindow, QGridLayout, QTextEdit
|
||||||
from PyQt5.QtGui import QFont, QIcon, QColor, QPalette, QMovie, QPixmap, QDesktopServices
|
from PyQt5.QtGui import QFont, QIcon, QColor, QPalette, QMovie, QPixmap, QDesktopServices
|
||||||
from PyQt5.QtCore import Qt, QObject, pyqtSignal, QThread, QUrl, QMetaObject, Q_ARG
|
from PyQt5.QtCore import Qt, QObject, pyqtSignal, QThread, QUrl, QMetaObject, Q_ARG
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
@ -42,26 +43,10 @@ class PicomcVersionSelector(QWidget):
|
|||||||
self.setGeometry(100, 100, 400, 250)
|
self.setGeometry(100, 100, 400, 250)
|
||||||
|
|
||||||
# Set application style and palette
|
# Set application style and palette
|
||||||
app_style = QApplication.setStyle("Fusion")
|
QApplication.setStyle("Fusion")
|
||||||
self.check_config_file()
|
self.check_config_file()
|
||||||
palette_type = self.config.get("Palette", "Dark")
|
palette_type = self.config.get("Palette", "Dark")
|
||||||
if palette_type == "Dark":
|
palette = self.get_palette(palette_type)
|
||||||
palette = self.create_dark_palette()
|
|
||||||
elif palette_type == "Obsidian":
|
|
||||||
palette = self.create_obsidian_palette()
|
|
||||||
elif palette_type == "Redstone":
|
|
||||||
palette = self.create_redstone_palette()
|
|
||||||
elif palette_type == "Alpha":
|
|
||||||
palette = self.create_alpha_palette()
|
|
||||||
elif palette_type == "Strawberry":
|
|
||||||
palette = self.create_strawberry_palette()
|
|
||||||
elif palette_type == "Native":
|
|
||||||
palette = self.create_native_palette()
|
|
||||||
elif palette_type == "Christmas":
|
|
||||||
palette = self.create_christmas_palette()
|
|
||||||
else:
|
|
||||||
# Default to dark palette if the type is not specified or invalid
|
|
||||||
palette = self.create_dark_palette()
|
|
||||||
QApplication.instance().setPalette(palette)
|
QApplication.instance().setPalette(palette)
|
||||||
|
|
||||||
# Create title label
|
# Create title label
|
||||||
@ -150,11 +135,10 @@ class PicomcVersionSelector(QWidget):
|
|||||||
with open(config_path, "r") as config_file:
|
with open(config_path, "r") as config_file:
|
||||||
self.config = json.load(config_file)
|
self.config = json.load(config_file)
|
||||||
|
|
||||||
|
|
||||||
def open_settings_dialog(self):
|
def open_settings_dialog(self):
|
||||||
dialog = QDialog(self)
|
dialog = QDialog(self)
|
||||||
dialog.setWindowTitle('Settings')
|
dialog.setWindowTitle('Settings')
|
||||||
dialog.setFixedSize(300, 200)
|
dialog.setFixedSize(300, 250)
|
||||||
|
|
||||||
# Create title label
|
# Create title label
|
||||||
title_label = QLabel('Settings')
|
title_label = QLabel('Settings')
|
||||||
@ -200,9 +184,65 @@ class PicomcVersionSelector(QWidget):
|
|||||||
open_game_directory_button.clicked.connect(self.open_game_directory)
|
open_game_directory_button.clicked.connect(self.open_game_directory)
|
||||||
layout.addWidget(open_game_directory_button)
|
layout.addWidget(open_game_directory_button)
|
||||||
|
|
||||||
|
# Create "Stats for Nerds" button
|
||||||
|
stats_button = QPushButton('Stats for Nerds')
|
||||||
|
stats_button.clicked.connect(self.show_system_info)
|
||||||
|
layout.addWidget(stats_button)
|
||||||
|
|
||||||
dialog.setLayout(layout)
|
dialog.setLayout(layout)
|
||||||
dialog.exec_()
|
dialog.exec_()
|
||||||
|
|
||||||
|
def get_palette(self, palette_type):
|
||||||
|
"""Retrieve the corresponding palette based on the palette type."""
|
||||||
|
palettes = {
|
||||||
|
"Dark": self.create_dark_palette,
|
||||||
|
"Obsidian": self.create_obsidian_palette,
|
||||||
|
"Redstone": self.create_redstone_palette,
|
||||||
|
"Alpha": self.create_alpha_palette,
|
||||||
|
"Strawberry": self.create_strawberry_palette,
|
||||||
|
"Native": self.create_native_palette,
|
||||||
|
"Christmas": self.create_christmas_palette,
|
||||||
|
}
|
||||||
|
# Default to dark palette if the type is not specified or invalid
|
||||||
|
return palettes.get(palette_type, self.create_dark_palette)()
|
||||||
|
|
||||||
|
def get_system_info(self):
|
||||||
|
# Get system information
|
||||||
|
java_version = subprocess.getoutput("java -version 2>&1 | head -n 1")
|
||||||
|
python_version = sys.version
|
||||||
|
pip_version = subprocess.getoutput("pip --version")
|
||||||
|
architecture = platform.architecture()[0]
|
||||||
|
operating_system = platform.system() + " " + platform.release()
|
||||||
|
|
||||||
|
# Get versions of installed pip packages
|
||||||
|
installed_packages = subprocess.getoutput("pip list")
|
||||||
|
|
||||||
|
return f"Java Version: {java_version}\nPython Version: {python_version}\nPip Version: {pip_version}\n" \
|
||||||
|
f"Architecture: {architecture}\nOperating System: {operating_system}\n\nPip Installed Packages:\n{installed_packages}"
|
||||||
|
|
||||||
|
def show_system_info(self):
|
||||||
|
system_info = self.get_system_info()
|
||||||
|
|
||||||
|
# Create a dialog to show the system info in a text box
|
||||||
|
info_dialog = QDialog(self)
|
||||||
|
info_dialog.setWindowTitle('Stats for Nerds')
|
||||||
|
|
||||||
|
layout = QVBoxLayout()
|
||||||
|
|
||||||
|
# Create a text box to display the system info
|
||||||
|
text_box = QTextEdit()
|
||||||
|
text_box.setText(system_info)
|
||||||
|
text_box.setReadOnly(True) # Make the text box read-only
|
||||||
|
layout.addWidget(text_box)
|
||||||
|
|
||||||
|
# Create a close button
|
||||||
|
close_button = QPushButton('Close')
|
||||||
|
close_button.clicked.connect(info_dialog.close)
|
||||||
|
layout.addWidget(close_button)
|
||||||
|
|
||||||
|
info_dialog.setLayout(layout)
|
||||||
|
info_dialog.exec_()
|
||||||
|
|
||||||
def open_game_directory(self):
|
def open_game_directory(self):
|
||||||
try:
|
try:
|
||||||
# Run the command and capture the output
|
# Run the command and capture the output
|
||||||
@ -371,7 +411,7 @@ class PicomcVersionSelector(QWidget):
|
|||||||
# Title
|
# Title
|
||||||
title_label = QLabel('Manage Accounts')
|
title_label = QLabel('Manage Accounts')
|
||||||
title_label.setFont(QFont("Arial", 14))
|
title_label.setFont(QFont("Arial", 14))
|
||||||
|
title_label.setAlignment(Qt.AlignCenter) # Center the text
|
||||||
# Dropdown for selecting accounts
|
# Dropdown for selecting accounts
|
||||||
account_combo = QComboBox()
|
account_combo = QComboBox()
|
||||||
self.populate_accounts(account_combo)
|
self.populate_accounts(account_combo)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"version": "0.9.9.7",
|
"version": "0.9.9.8",
|
||||||
"links": [
|
"links": [
|
||||||
"https://raw.githubusercontent.com/nixietab/picodulce/main/version.json",
|
"https://raw.githubusercontent.com/nixietab/picodulce/main/version.json",
|
||||||
"https://raw.githubusercontent.com/nixietab/picodulce/main/picodulce.py",
|
"https://raw.githubusercontent.com/nixietab/picodulce/main/picodulce.py",
|
||||||
|
Loading…
Reference in New Issue
Block a user