Compare commits

..

No commits in common. "33d85e4cb2d8d69124b8476d8d0bd213bdc39f99" and "dc81d4285d61faa360bdd3db20beb49dd9c74603" have entirely different histories.

2 changed files with 17 additions and 57 deletions

View File

@ -18,7 +18,6 @@ logging.basicConfig(level=logging.ERROR, format='%(asctime)s - %(levelname)s - %
class PicomcVersionSelector(QWidget):
def __init__(self):
self.current_state = "menu"
self.open_dialogs = []
super().__init__()
@ -395,26 +394,16 @@ class PicomcVersionSelector(QWidget):
def run_game(self, selected_instance):
try:
# Set current_state to the selected instance
self.current_state = selected_instance
# Update lastplayed field in config.json on a separate thread
update_thread = threading.Thread(target=self.update_last_played, args=(selected_instance,))
update_thread.start()
# Run the game subprocess
subprocess.run(['picomc', 'play', selected_instance], check=True)
except subprocess.CalledProcessError as e:
error_message = f"Error playing {selected_instance}: {e}"
logging.error(error_message)
# Use QMetaObject.invokeMethod to call showError safely
QMetaObject.invokeMethod(
self, "showError", Qt.QueuedConnection,
Q_ARG(str, "Error"), Q_ARG(str, error_message)
)
finally:
# Reset current_state to "menu" after the game closes
self.current_state = "menu"
QMetaObject.invokeMethod(self, "showError", Qt.QueuedConnection,
Q_ARG(str, "Error"), Q_ARG(str, error_message))
def update_last_played(self, selected_instance):
config_path = "config.json"
@ -841,52 +830,25 @@ class PicomcVersionSelector(QWidget):
def start_discord_rcp(self):
from pypresence import Presence
import time
import logging
client_id = '1236906342086606848'
presence = Presence(client_id)
try:
presence.connect()
# Initialize start time for the session
start_time = time.time()
while True:
# Determine the state and details based on the current_state
if self.current_state == "menu":
state = "In the menu"
details = "Picodulce FOSS Launcher"
large_image = "launcher_icon"
else:
state = f"Playing {self.current_state}"
# Determine the appropriate large image based on the current_state
if "forge" in self.current_state.lower():
large_image = "forge"
elif "fabric" in self.current_state.lower():
large_image = "fabric"
elif "optifine" in self.current_state.lower(): # Check for OptiFine
large_image = "optifine"
else:
large_image = "vanilla" # Default to vanilla if no specific patterns match
# Update presence
presence.update(
state=state,
details=details,
large_image=large_image,
state="In the menu",
details="best launcher to exist",
large_image="launcher_icon",
large_text="PicoDulce Launcher",
start=start_time,
start=time.time(),
buttons=[{"label": "Download", "url": "https://github.com/nixietab/picodulce"}]
)
# Wait for 15 seconds before checking again
time.sleep(15)
# Keep the script running to maintain the presence
while True:
time.sleep(15) # Update presence every 15 seconds
except Exception as e:
logging.error("Failed to start Discord RPC: %s", str(e))
logging.error("Failed to start Discord RCP: %s", str(e))
def open_mod_loader_and_version_menu(self):
dialog = ModLoaderAndVersionMenu()
@ -1123,13 +1085,11 @@ class ModLoaderAndVersionMenu(QDialog):
logging.error(error_message)
if __name__ == '__main__':
app = QApplication(sys.argv)
current_date = datetime.now()
# ---------------------------------------------------------------------
# I wish for everyone that plays this to enjoy the game as much as I,
# may joy give a little more peace in this troubled world
# ---------------------------------------------------------------------
# Set the application icon based on the date
if (current_date.month == 12 and current_date.day >= 8) or (current_date.month == 1 and current_date.day <= 1):

View File

@ -1,5 +1,5 @@
{
"version": "0.10.1",
"version": "0.9.9.9",
"links": [
"https://raw.githubusercontent.com/nixietab/picodulce/main/version.json",
"https://raw.githubusercontent.com/nixietab/picodulce/main/picodulce.py",