Skip to content

Commit

Permalink
Remove coffandro pinging, remove curl dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
coffandro committed Jul 26, 2024
1 parent 43617f3 commit 9dc3ba0
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 29 deletions.
58 changes: 30 additions & 28 deletions FOLON-Downgrader.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from QLines import *
import argparse
import pexpect.popen_spawn
import urllib.request, zipfile, io

from LoadScreenFuncs import LoadingThread, LoadingTranslucentScreen

Expand All @@ -35,37 +36,30 @@ def run(self):


def SetupFont():
import zipfile
url = "https://dl.dafont.com/dl/?f=overseer"
with urllib.request.urlopen(url) as dl_file:
with open("FOLON-Downgrader-Files/overseer.zip", 'wb') as out_file:
out_file.write(dl_file.read())

if not os.path.isdir("FOLON-Downgrader-Files/Fonts"):
if Util.IsWindows():
os.system(
'curl.exe -sqL "https://dl.dafont.com/dl/?f=overseer" -o FOLON-Downgrader-Files/overseer.zip'
)
else:
os.system(
'curl -sqL "https://dl.dafont.com/dl/?f=overseer" -o FOLON-Downgrader-Files/overseer.zip'
)
with zipfile.ZipFile("FOLON-Downgrader-Files/overseer.zip", "r") as zip_ref:
zip_ref.extractall("FOLON-Downgrader-Files/Fonts")
os.remove("FOLON-Downgrader-Files/overseer.zip")
with zipfile.ZipFile("FOLON-Downgrader-Files/overseer.zip", "r") as zip_ref:
zip_ref.extractall("FOLON-Downgrader-Files/Fonts/")
os.remove("FOLON-Downgrader-Files/overseer.zip")

QFontDatabase.addApplicationFont("FOLON-Downgrader-Files/Fonts/Overseer.otf")


def SetupSteam():
import zipfile
global curlcommand

if not os.path.isdir("FOLON-Downgrader-Files/SteamFiles"):
if Util.IsWindows():
os.system(
'curl -sqL "https://github.com/coffandro/DepotDownloader/releases/download/release/DepotDownloader-windows-x64.zip" -o FOLON-Downgrader-Files/steam.zip'
)

url = "https://github.com/coffandro/DepotDownloader/releases/download/release/DepotDownloader-windows-x64.zip"
else:
os.system(
'curl -sqL "https://github.com/coffandro/DepotDownloader/releases/download/release/DepotDownloader-linux-x64.zip" -o FOLON-Downgrader-Files/steam.zip'
)
url = "https://github.com/coffandro/DepotDownloader/releases/download/release/DepotDownloader-linux-x64.zip"

with urllib.request.urlopen(url) as dl_file:
with open("FOLON-Downgrader-Files/steam.zip", 'wb') as out_file:
out_file.write(dl_file.read())

with zipfile.ZipFile("FOLON-Downgrader-Files/steam.zip", "r") as zip_ref:
zip_ref.extractall("FOLON-Downgrader-Files/SteamFiles/")
Expand Down Expand Up @@ -547,7 +541,7 @@ def SteamDialog2(self): # GUI
)

GuardButton = QPushButton(text="Submit")
GuardButton.pressed.connect(self.LoginSteam)
GuardButton.pressed.connect(self.GuardSubmitInit2)
SteamGDlgLayout.addWidget(
GuardButton,
2,
Expand All @@ -568,6 +562,19 @@ def SteamDialog2(self): # GUI
self.SteamGDlg.setLayout(SteamGDlgLayout)
self.GuardEntry.setFocus()
self.SteamGDlg.exec()

def GuardSubmitInit2(self):
try:
self.SteamGDlg.close()
except:
pass

self.Loading(
self.LoginSteam,
text="Checking auth",
UseResult=True,
PostFunction=self.LoginPopups,
)

def SteamGuideDialog(self, parent): # GUI
if not self.shown:
Expand Down Expand Up @@ -695,7 +702,7 @@ def OpenRateDialog(self): # GUI
)
LinkLabel.setOpenExternalLinks(True)
RateDialogLayout.addRow(LinkLabel)
RateDialogLayout.addRow(QLabel("And ping @Coffandro for help"))
RateDialogLayout.addRow(QLabel("And ask in Downgrader-Bugs for help"))

RateDialogButton = QPushButton(text="Close")
RateDialogButton.pressed.connect(self.CloseRateDialog)
Expand Down Expand Up @@ -858,11 +865,6 @@ def Finish(self):


def main(steampath=None):
if Util.IsWindows():
Util.IsBinaryAvilable("curl.exe")
else:
Util.IsBinaryAvilable("curl")

if not os.path.isdir("FOLON-Downgrader-Files"):
os.mkdir("FOLON-Downgrader-Files")
shutil.copy(Util.resource_path("img/check.svg"), "FOLON-Downgrader-Files/")
Expand Down
2 changes: 1 addition & 1 deletion Utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def oops(type, value, tb):
def IsBinaryAvilable(Binary):
try:
import subprocess
subprocess.call([Binary])
subprocess.call(Binary)
except:
from tkinter import messagebox
messagebox.showerror('Missing Binary', f'Error: {Binary} is not available, please install it depending on OS')
Expand Down

0 comments on commit 9dc3ba0

Please sign in to comment.