Compare commits

..

No commits in common. "1e03c986fd311e2e17dc6adcccc32fe8451547c3" and "5eda9f1de450188cd371afe2a84ef89e56e4c931" have entirely different histories.

2 changed files with 23 additions and 63 deletions

View File

@ -4,12 +4,11 @@ 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, QTextEdit from PyQt5.QtWidgets import QApplication, QComboBox, QWidget, QVBoxLayout, QListWidget, QPushButton, QMessageBox, QDialog, QHBoxLayout, QLabel, QLineEdit, QCheckBox, QTabWidget, QFrame, QSpacerItem, QSizePolicy, QMainWindow, QGridLayout
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
@ -43,10 +42,26 @@ 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
QApplication.setStyle("Fusion") app_style = 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")
palette = self.get_palette(palette_type) if palette_type == "Dark":
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
@ -135,10 +150,11 @@ 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, 250) dialog.setFixedSize(300, 200)
# Create title label # Create title label
title_label = QLabel('Settings') title_label = QLabel('Settings')
@ -184,65 +200,9 @@ 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
@ -411,7 +371,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)

View File

@ -1,5 +1,5 @@
{ {
"version": "0.9.9.8", "version": "0.9.9.7",
"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",