Skip to content

Commit

Permalink
renaming and other fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nothing committed Jan 21, 2024
1 parent 447d276 commit 7ae3f37
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 22 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
build/
dist/
app.log
Keychron_updater.spec
innosetup/Keychron_updater_setup.exe
Keychron_mice_updater.spec
innosetup/Keychron_mice_updater_setup.exe
11 changes: 2 additions & 9 deletions Keychron_updater.py → Keychron_mice_updater.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import requests, gdown, zipfile, os, ctypes, tempfile, shutil, subprocess, logging
import requests, gdown, zipfile, os, ctypes, tempfile, shutil, subprocess
from tkinter import messagebox

logging.basicConfig(filename='app.log', filemode='w', format='%(name)s - %(levelname)s - %(message)s')

install_path = "C:\\Program Files (x86)\\Keychron"

def get_installed_version():
Expand All @@ -11,7 +9,6 @@ def get_installed_version():
installed_version = f.read().split('<software caption="Keychron" version="')[1].split('"')[0]
return installed_version
except Exception as e:
logging.error(f"Failed to get installed version: {e}")
messagebox.showerror("Error", f"Failed to get installed version: {e}")

def get_online_version_and_url():
Expand All @@ -28,16 +25,14 @@ def get_online_version_and_url():

return online_version, download_url
except Exception as e:
logging.error(f"Failed to get online version and url: {e}")
messagebox.showerror("Error", f"Failed to get online version and url: {e}")

def download_and_extract_file(download_url, tmp_path):
try:
gdown.download(download_url, tmp_path + '\\Keychron.zip', quiet=False)
gdown.download(download_url, tmp_path + '\\Keychron.zip', quiet=True)
with zipfile.ZipFile(tmp_path + '\\Keychron.zip', 'r') as zip_ref:
zip_ref.extractall(tmp_path)
except Exception as e:
logging.error(f"Failed to download and extract file: {e}")
messagebox.showerror("Error", f"Failed to download and extract file: {e}")

def run_exe(tmp_path):
Expand All @@ -48,7 +43,6 @@ def run_exe(tmp_path):
process = subprocess.Popen([os.path.join(root, file)], shell=True)
process.wait()
except Exception as e:
logging.error(f"Failed to run exe: {e}")
messagebox.showerror("Error", f"Failed to run exe: {e}")

def main():
Expand All @@ -65,7 +59,6 @@ def main():
run_exe(tmp_path)
shutil.rmtree(tmp_path)
except Exception as e:
logging.error(f"An error occurred: {e}")
messagebox.showerror("Error", f"An error occurred: {e}")

if __name__ == "__main__":
Expand Down
2 changes: 1 addition & 1 deletion build.bat
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pyinstaller --onefile --noconsole Keychron_updater.py
pyinstaller --onefile --noconsole Keychron_mice_updater.py
18 changes: 9 additions & 9 deletions innosetup/setup.iss
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
[Setup]
AppName=Keychron Software Update
AppName=Keychron Mice Software Updater
AppVersion=1.0
DefaultDirName={commonpf}\Keychron Software Update
DefaultGroupName=Keychron Software Update
DefaultDirName={commonpf}\Keychron Mice Software Updater
DefaultGroupName=Keychron Mice Software Updater
UninstallDisplayIcon={app}\keychron.exe
OutputDir=.
OutputBaseFilename=Keychron_updater_setup
OutputBaseFilename=Keychron_mice_updater_setup
Compression=lzma
SolidCompression=yes

[Files]
Source: "..\dist\Keychron_updater.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\dist\Keychron_mice_updater.exe"; DestDir: "{app}"; Flags: ignoreversion

[Icons]
Name: "{group}\Keychron Software Updater"; Filename: "{app}\Keychron_updater.exe"
Name: "{group}\Uninstall Keychron Software Updater"; Filename: "{uninstallexe}"
Name: "{commonstartup}\Keychron Software Updater"; Filename: "{app}\Keychron_updater.exe"; Tasks: autostart
Name: "{group}\Keychron Mice Software Updater"; Filename: "{app}\Keychron_mice_updater.exe"
Name: "{group}\Uninstall Keychron Mice Software Updater"; Filename: "{uninstallexe}"
Name: "{commonstartup}\Keychron Mice Software Updater"; Filename: "{app}\Keychron_mice_updater.exe"; Tasks: autostart

[Run]
Filename: "{app}\Keychron_updater.exe"; Description: "Launch the application"; Flags: nowait postinstall skipifsilent
Filename: "{app}\Keychron_mice_updater.exe"; Description: "Launch the application"; Flags: nowait postinstall skipifsilent

[Tasks]
Name: "autostart"; Description: "Start the application when Windows starts"; GroupDescription: "Additional tasks"; Flags: checkedonce
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ This Python script automatically checks for a new version of the Keychron mice s

## Installation

1. Navigate to the [Releases](https://github.com/Pyenb/Keychron_software_updater/releases) section of this repository.
1. Navigate to the [Releases](https://github.com/Pyenb/Keychron_mice_software_updater/releases) section of this repository.
2. Download the latest release of the Keychron Software Updater.
3. Extract the downloaded `.zip` file.
4. Run the downloaded `.exe` file to start the installation process. Follow the prompts to complete the installation.
Expand Down

0 comments on commit 7ae3f37

Please sign in to comment.