Skip to content
This repository has been archived by the owner on Aug 22, 2023. It is now read-only.

Commit

Permalink
✨ Format, add icon
Browse files Browse the repository at this point in the history
  • Loading branch information
osfanbuff63 committed Feb 9, 2023
1 parent 1b12695 commit 39cd807
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 9 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ include = [
]

[tool.poetry.dependencies]
python = ">=3.8.1,<=3.11.1"
python = ">=3.8.1,<3.12"
requests = "^2.28.2"
tomli = "^2.0.1"
darkdetect = "^0.8.0"
Expand Down
Binary file added vanilla_installer/assets/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 9 additions & 4 deletions vanilla_installer/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""Runs the GUI for VanillaInstaller."""
# IMPORTS
import pathlib
import platform
import sys
import webbrowser
from time import sleep
Expand All @@ -25,13 +26,12 @@
QTextEdit,
QWidget,
)
import platform

# LOCAL
from vanilla_installer import config, main, theme
from vanilla_installer.log import logger



def run() -> None:
"""Runs the GUI."""
global global_font
Expand Down Expand Up @@ -186,6 +186,9 @@ def setupUi(self, MainWindow: QMainWindow) -> None:
)
self.settingsButtonIcon.setGeometry(70, 0, 24, 24)

self.windowIcon = Ui_MainWindow.getAsset("icon.png")
MainWindow.setWindowIcon(QIcon(self.windowIcon))

self.reloadTheme()

MainWindow.setCentralWidget(self.centralwidget)
Expand Down Expand Up @@ -305,7 +308,7 @@ def addVersions(self) -> None:
self.versionSelector.addItem(version)
self.versionSelector.setCurrentIndex(0)

def getAsset(asset) -> str:
def getAsset(asset: str) -> str:
"""Get the path to a given asset.
Args:
Expand Down Expand Up @@ -334,7 +337,9 @@ def selectDirectory(self, parent) -> None:
dialog.setFileMode(QFileDialog.FileMode.Directory)
current_path = pathlib.Path(self.selectedLocation.toPlainText()).absolute()
if not current_path.exists():
current_path = pathlib.Path(mll.utils.get_minecraft_directory()).absolute().mkdir()
current_path = (
pathlib.Path(mll.utils.get_minecraft_directory()).absolute().mkdir()
)
dialog.setDirectory(str(current_path))
config.write("path", str(current_path))
if dialog.exec():
Expand Down
5 changes: 3 additions & 2 deletions vanilla_installer/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ def get_dir() -> str:
return path["config"]["path"]



def newest_version() -> str:
"""Returns the latest version of Minecraft that FO supports.
Expand Down Expand Up @@ -381,7 +380,9 @@ def get_pack_mc_versions() -> dict:
# For this to work, you need to be in the root directory of the repository running this, otherwise the files will not be found.
logger.warning("GitHub failed, falling back to local...")
try:
local_path = Path("vanilla_installer/assets").resolve() / "versions.json"
local_path = (
Path("vanilla_installer/assets").resolve() / "versions.json"
)
except:
local_path = Path("assets").resolve() / "versions.json"
response = json.loads(local_path.read_bytes())
Expand Down
5 changes: 3 additions & 2 deletions vanilla_installer/theme.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@
"""

import pathlib
from vanilla_installer import config
from vanilla_installer.log import logger
from typing import Optional

import darkdetect

from vanilla_installer import config
from vanilla_installer.log import logger

FILE = str(pathlib.Path("data/theme.txt").resolve())


Expand Down

0 comments on commit 39cd807

Please sign in to comment.