Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
EndangeredNayla committed Jul 25, 2024
0 parents commit 96a14e8
Show file tree
Hide file tree
Showing 11 changed files with 1,027 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/win32.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Windows CI

on:
push:
pull_request:

jobs:
build-win32:
name: "Windows Build"
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Install PIP Modules
run: python -m pip install -r requirements.txt

- name: Build Project (Dynamic build)
run: pyinstaller --onefile .\main.py --add-data "assets/operation/*;assets/operation/" --name="MIPS-CodeWrite" -w --icon="assets/icon.ico"

- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: MIPSCodeWrite-win32
path: D:\a\MIPS-CodeWrite\MIPS-CodeWrite\dist
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# MIPS-CodeWrite
An experimental MIPS ASM to GameShark Compiler.

![image](https://github.com/user-attachments/assets/ddd3a249-7773-4905-b6b4-ebf986ffbeab)
Binary file added assets/icon.ico
Binary file not shown.
Binary file added assets/operation/error.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/operation/success.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
75 changes: 75 additions & 0 deletions functions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# ============================================
# MIPS-CodeWrite
# Author: Nayla Hanegan ([email protected])
# Date: 6/20/2024
# License: GPLv2
# ============================================

import tkinter as tk
import customtkinter as ctk
from PIL import Image, ImageTk
from pathlib import Path
import sys
import requests
import sys
import webbrowser
import tkinter.filedialog
import os
import threading
import json
import subprocess

def createDialog(windowTitle, warn, info, buttonTxt=None):
completeWindow = ctk.CTkToplevel()
completeWindow.title(windowTitle)

# Load success image and display it in the success window
img = ctk.CTkImage(Image.open(fetchResource("assets/operation/" + warn + ".png")), size=(100, 100))
imgLabel = ctk.CTkLabel(completeWindow, image=img, text="")
imgLabel.grid(row=0, column=0, padx=10, pady=10)
imgLabel.image = img # Keep a reference to the image

if buttonTxt is not None:
try:
button = ctk.CTkButton(completeWindow, command=run_update, text=buttonTxt)
button.grid(row=1, column=0, padx=50, pady=10)
except Exception as e:
print("Error creating button:", e)

# Adjust geometry to place the window in the bottom right corner
screen_width = completeWindow.winfo_screenwidth()
screen_height = completeWindow.winfo_screenheight()
window_width = completeWindow.winfo_reqwidth()
window_height = completeWindow.winfo_reqheight()
if sys.platform == "darwin":
x_coordinate = 15
y_coordinate = screen_height - window_height
else:
x_coordinate = 15
y_coordinate = screen_height - window_height - 20
completeWindow.geometry(f"+{x_coordinate}+{y_coordinate}")

# Configure row and column weights
completeWindow.columnconfigure(0, weight=1)
completeWindow.rowconfigure(0, weight=1)

# Display success message in the success window
label = ctk.CTkLabel(completeWindow, text=info, font=ctk.CTkFont(size=18))
label.grid(row=0, column=1, padx=25, pady=10)

# Function to close the window after 2.5 seconds
def close_window():
completeWindow.destroy()

# Close the window after 2.5 seconds
completeWindow.after(2500, close_window)

completeWindow.focus()

def fetchResource(resource_path: Path) -> Path:
try: # Running as *.exe; fetch resource from temp directory
base_path = Path(sys._MEIPASS)
except AttributeError: # Running as script; return unmodified path
return resource_path
else: # Return temp resource path
return base_path.joinpath(resource_path)
Loading

0 comments on commit 96a14e8

Please sign in to comment.