Skip to content

Commit

Permalink
v2.0.1 update
Browse files Browse the repository at this point in the history
  • Loading branch information
amamic1803 committed Nov 26, 2023
1 parent e461eb0 commit 7876b3d
Show file tree
Hide file tree
Showing 8 changed files with 172 additions and 41 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Lint

on:
push:
pull_request:

jobs:
lint-ruff:
name: Lint with Ruff
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
name: Checkout repository

- uses: chartboost/ruff-action@v1
name: Run Ruff
118 changes: 118 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
name: Release

on:
workflow_dispatch:

permissions:
contents: write
discussions: write
packages: read

jobs:
build-windows:
name: Build (Windows)
runs-on: windows-latest
defaults:
run:
shell: bash

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Install Python
uses: actions/setup-python@v4
with:
python-version: '3.12'

- name: Install requirements
run: pip install -r requirements.txt

- name: Install UPX
uses: crazy-max/ghaction-upx@v2
with:
install-only: true

- name: Get name and version
id: get_info
run: |
NAME=$(python build.py --name)
VERSION=$(python build.py --version)
echo "NAME=${NAME}" >> $GITHUB_OUTPUT
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
- name: Package binary
run: python build.py

- name: Rename binary
run: mv "${{ steps.get_info.outputs.NAME }}-v${{ steps.get_info.outputs.VERSION }}.exe" "${{ steps.get_info.outputs.NAME }}-v${{ steps.get_info.outputs.VERSION }}-win-x86_64.exe"

- uses: actions/upload-artifact@v3
name: Upload binary artifact
with:
name: windows-binary
retention-days: 3
path: "${{ steps.get_info.outputs.NAME }}-v${{ steps.get_info.outputs.VERSION }}-win-x86_64.exe"

publish-release:
name: Publish GitHub release
runs-on: ubuntu-latest
needs: build-windows
defaults:
run:
shell: bash

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Install Python
uses: actions/setup-python@v4
with:
python-version: '3.12'

- name: Install requirements
run: pip install -r requirements.txt

- name: Get name and version
id: get_info
run: |
NAME=$(python build.py --name)
VERSION=$(python build.py --version)
echo "NAME=${NAME}" >> $GITHUB_OUTPUT
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
- name: Create binary folders
run: mkdir -p windows-binary

- name: Download Windows binary
uses: actions/download-artifact@v3
with:
name: windows-binary
path: windows-binary

- uses: mukunku/[email protected]
name: Check if this version was already released
id: checkTag
with:
tag: 'v${{ steps.get_info.outputs.VERSION }}'

- name: Terminate if this version was already released
if: steps.checkTag.outputs.exists == 'true'
run: |
echo "v${{ steps.get_info.outputs.VERSION }} was already released!" >&2
exit 1
- name: Create release
uses: softprops/action-gh-release@v1
with:
body: |
### **_${{ steps.get_info.outputs.NAME }}-v${{ steps.get_info.outputs.VERSION }}_**
draft: false
prerelease: false
files: |
windows-binary/${{ steps.get_info.outputs.NAME }}-v${{ steps.get_info.outputs.VERSION }}-win-x86_64.exe
name: v${{ steps.get_info.outputs.VERSION }}
tag_name: v${{ steps.get_info.outputs.VERSION }}
fail_on_unmatched_files: true
token: ${{ secrets.GITHUB_TOKEN }}
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Key-Click
A program that makes arrow keys act like mouse buttons
A program that makes arrow keys act like mouse buttons.

![screenshot](https://user-images.githubusercontent.com/40371578/202002959-90bf250d-bca1-4320-aa43-4f8a0e21b273.png)

Expand All @@ -8,6 +8,8 @@ Prebuilt program is available under Releases

## Building
1. Clone repository
2. Run command: `pip install -r requirements.txt`
3. Run build.py
4. Built `*.exe` will be placed in the same folder
2. Install Python
3. Install dependencies: `pip install -r requirements.txt`
4. Install UPX (optional)
5. Run build.py
6. Built `*.exe` will be placed in the same folder
40 changes: 20 additions & 20 deletions build.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
import datetime
import os
import random
import shutil
import sys

import PyInstaller.__main__


def build(name, console, onefile, uac_admin, key, icon, upx, files, folders):
def build(name, console, onefile, uac_admin, icon, files, folders):
work_path = "build"
while os.path.isdir(work_path):
work_path = f"build_{random.randint(1, 1_000_000_000)}"
work_path = os.path.join(os.path.abspath("."), work_path)

result_path = os.path.abspath(".")

if os.path.isfile(os.path.join(result_path, f"{name}.exe")):
os.remove(os.path.join(result_path, f"{name}.exe"))

run_list = ['main.py',
'--noconfirm',
'--clean',
'--name', f"{name}_{datetime.datetime.now().strftime('%Y-%m-%d_%H.%M.%S')}",
'--name', name,
'--workpath', work_path,
'--specpath', work_path,
'--distpath', result_path]
Expand All @@ -35,23 +38,13 @@ def build(name, console, onefile, uac_admin, key, icon, upx, files, folders):
if uac_admin:
run_list.append("--uac-admin")

if key != "":
run_list.extend(('--key', key))

if icon != "":
icon_path = os.path.join(os.path.abspath("."), icon)
if not os.path.isfile(icon_path):
raise Exception("Invalid icon!")
else:
run_list.extend(('--icon', icon_path))

if upx != "":
if not os.path.isfile(upx):
raise Exception("Invalid UPX!")
else:
upx_path = os.path.join(os.path.abspath("."), os.path.dirname(upx))
run_list.extend(('--upx-dir', upx_path))

for file in files:
if os.path.isfile(os.path.join(os.path.abspath("."), file)):
run_list.extend(('--add-data', f'{os.path.join(os.path.abspath("."), file)};{os.path.dirname(file)}'))
Expand All @@ -73,17 +66,24 @@ def build(name, console, onefile, uac_admin, key, icon, upx, files, folders):
shutil.rmtree(path=work_path, ignore_errors=True)

def main():
name = "Key-Click-v2"
name = "Key-Click"
version = "2.0.1"

console = False
onefile = True
uac_admin = False
key = "DarkLord76865"
icon = "data/key-click-icon.ico"
upx = "data\\upx.exe"
files = [icon]
folders = []
icon = "resources\\key-click-icon.ico"

files = []
folders = ["resources"]

build(name, console, onefile, uac_admin, key, icon, upx, files, folders)
if len(sys.argv) > 1 and sys.argv[1] == "--version":
print(version)
elif len(sys.argv) > 1 and sys.argv[1] == "--name":
print(name)
else:
name = f"{name}-v{version}"
build(name, console, onefile, uac_admin, icon, files, folders)


if __name__ == '__main__':
Expand Down
Binary file removed data/upx.exe
Binary file not shown.
20 changes: 10 additions & 10 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os
import sys
from tkinter import *
import tkinter as tk

import keyboard
import mouse
Expand Down Expand Up @@ -56,22 +56,22 @@ def main():
global stat
stat = [False, False, False] # left - 0 | middle - 1 | right - 0

root = Tk()
root = tk.Tk()
root.resizable(False, False)
root.geometry(f"250x125+{root.winfo_screenwidth() // 2 - 125}+{root.winfo_screenheight() // 2 - 62}")
root.title("Key-Click")
root.iconbitmap(resource_path("data/key-click-icon.ico"))
root.iconbitmap(resource_path("resources/key-click-icon.ico"))
root.config(background="#ffffff")

title = Label(root, background="#ffffff", activebackground="#ffffff", foreground="#000000", activeforeground="#000000", text="Key-Click", font=("Helvetica", 23, "italic", "bold"))
title = tk.Label(root, background="#ffffff", activebackground="#ffffff", foreground="#000000", activeforeground="#000000", text="Key-Click", font=("Helvetica", 23, "italic", "bold"))
title.place(x=0, y=0, width=250, height=65)

instructions = Label(root, background="#ffffff", activebackground="#ffffff",
foreground="#000000", activeforeground="#000000",
text="left arrow key = left mouse button\n"
"right arrow key = right mouse button\n"
"down arrow key = middle mouse button",
font=("Helvetica", 9, "italic", "bold"))
instructions = tk.Label(root, background="#ffffff", activebackground="#ffffff",
foreground="#000000", activeforeground="#000000",
text="left arrow key = left mouse button\n"
"right arrow key = right mouse button\n"
"down arrow key = middle mouse button",
font=("Helvetica", 9, "italic", "bold"))
instructions.place(x=0, y=60, width=250, height=65)

keyboard.on_press_key("Left", lambda event: s(0), suppress=True)
Expand Down
8 changes: 1 addition & 7 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
altgraph==0.17.3
future==0.18.2
keyboard==0.13.5
mouse==0.7.1
pefile==2022.5.30
pyinstaller==5.6.2
pyinstaller-hooks-contrib==2022.13
pywin32-ctypes==0.2.0
tinyaes==1.0.4
pyinstaller==6.2.0
File renamed without changes.

0 comments on commit 7876b3d

Please sign in to comment.