programmify
Advanced tools
+1
-1
| Metadata-Version: 2.1 | ||
| Name: programmify | ||
| Version: 0.0.3 | ||
| Version: 0.0.4 | ||
| Summary: Quickly make a windows executable with a system tray icon and an configurable (read empty) PyQT5 window | ||
@@ -5,0 +5,0 @@ Author-email: Torin Halsted <modularizer@gmail.com> |
+1
-1
@@ -7,3 +7,3 @@ [build-system] | ||
| name = "programmify" | ||
| version = "0.0.3" | ||
| version = "0.0.4" | ||
| description = "Quickly make a windows executable with a system tray icon and an configurable (read empty) PyQT5 window" | ||
@@ -10,0 +10,0 @@ readme = "README.md" |
| Metadata-Version: 2.1 | ||
| Name: programmify | ||
| Version: 0.0.3 | ||
| Version: 0.0.4 | ||
| Summary: Quickly make a windows executable with a system tray icon and an configurable (read empty) PyQT5 window | ||
@@ -5,0 +5,0 @@ Author-email: Torin Halsted <modularizer@gmail.com> |
@@ -14,2 +14,3 @@ import argparse | ||
| def png_to_ico(png_path: str, ico_path: str = None, size: int = 16): | ||
@@ -174,2 +175,6 @@ png_path = str(Path(png_path).resolve()) | ||
| if dst is None: | ||
| dst = Path.cwd() / f"{name}.exe" | ||
| dst = Path(dst).expanduser() | ||
| if isinstance(hidden_imports, str): | ||
@@ -183,9 +188,13 @@ hidden_imports = [v.strip() for v in hidden_imports.replace(" ", ",").split(",")] | ||
| # make a temporary config | ||
| with open(cfg_file, "w") as f: | ||
| print("dumping", {"icon": icon, "name": name, "mode": mode}) | ||
| f.write(yaml.dump({"icon": icon, "name": name, "mode": mode})) | ||
| print("dumping", {"name": name, "mode": mode}) | ||
| f.write(yaml.dump({"name": name, "mode": mode})) | ||
| print(f"dumped to {cfg_file}: {cfg_file.read_text()}") | ||
| if cmd is None: | ||
| cmd = ["pyinstaller", "--onefile", "--windowed", | ||
| "--icon=favicon.ico", "--add-data", f"{icon};.", | ||
| "--add-data", f"{cfg_file};.", | ||
| "--distpath", str(dst.parent.resolve()), | ||
| f"--icon={icon}", "--add-data", f"{icon};programmify", | ||
| "--add-data", f"{cfg_file};programmify", | ||
| "--add-data", f"{__file__};.", | ||
@@ -203,8 +212,7 @@ "--hidden-import", "setproctitle", | ||
| cmd.extend(args) | ||
| return _build_from_cmd(cmd=cmd, name=name, dst=dst, cleanup=cleanup, preclean=preclean, show_cmd=show_cmd) | ||
| return _build_from_cmd(cmd, dst, cleanup=cleanup, preclean=preclean, show_cmd=show_cmd) | ||
| def _build_from_cmd(cmd: list, | ||
| name: str = default_name, | ||
| dst: str = None, | ||
| dst, | ||
| cleanup: bool = True, | ||
@@ -214,5 +222,3 @@ preclean: bool = True, | ||
| ): | ||
| if dst is None: | ||
| dst = Path.cwd() / f"{name}.exe" | ||
| dst = Path(dst).expanduser() | ||
| if isinstance(cmd, str): | ||
@@ -241,3 +247,3 @@ cmd = [v.strip() for v in cmd.split(" ") if v.strip()] | ||
| RESET = "\033[0m" | ||
| print(f"{RED}{BOLD}{name}{RESET}{RED} is already a valid command. Please choose a different name{RESET}.") | ||
| print(f"{RED}{BOLD}{dst.stem}{RESET}{RED} is already a valid command. Please choose a different name{RESET}.") | ||
| sys.exit(1) | ||
@@ -252,8 +258,4 @@ | ||
| RESET = "\033[0m" | ||
| print(f"{RED}{BOLD}Failed to build {name}{RESET}{RED}. Please check the error message above ^{RESET}.") | ||
| print(f"{RED}{BOLD}Failed to build {dst}{RESET}{RED}. Please check the error message above ^{RESET}.") | ||
| sys.exit(1) | ||
| exe = Path("dist") / f"{dst.stem}.exe" | ||
| if name: | ||
| shutil.copy(exe, dst) | ||
| exe = dst | ||
@@ -271,3 +273,3 @@ # cleanup | ||
| print(f"Built {str(exe.resolve())}") | ||
| print(f"Built {dst}") | ||
@@ -277,8 +279,8 @@ GRAY = "\033[90m" | ||
| print(f"""Built {str(exe.resolve())} | ||
| print(f"""Built {dst} | ||
| To run the program: | ||
| a. Open your File Explorer and double-click the file {str(exe.resolve())} | ||
| b. Open a command prompt and run the command `{GRAY}{str(exe.resolve())}{RESET} | ||
| c. In the command prompt if you are in the same directory as the file, you can run `{GRAY}{exe.stem}{RESET}` | ||
| a. Open your File Explorer and double-click the file {dst} | ||
| b. Open a command prompt and run the command `{GRAY}{dst}{RESET} | ||
| c. In the command prompt if you are in the same directory as the file, you can run `{GRAY}{dst.stem}{RESET}` | ||
| """) | ||
@@ -289,2 +291,4 @@ | ||
| def __init__(self, name: str = default_name, icon: str = default_icon, **kwargs): | ||
| if name is None: | ||
| raise ValueError(f"Program name cannot be None: {cfg_file}, {cfg_file.read_text() if cfg_file.exists() else None}") | ||
| super().__init__(**kwargs) | ||
@@ -316,7 +320,8 @@ self.trayIcon = QtWidgets.QSystemTrayIcon(self) | ||
| def set_name(self, title: str): | ||
| self.setWindowTitle(title) | ||
| if self.trayIcon: | ||
| self.trayIcon.setToolTip(title) | ||
| self.name = title | ||
| setproctitle.setproctitle(title) | ||
| if title: | ||
| self.setWindowTitle(title) | ||
| if self.trayIcon: | ||
| self.trayIcon.setToolTip(title) | ||
| setproctitle.setproctitle(title) | ||
| return self.name | ||
@@ -323,0 +328,0 @@ |
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.
173071
0.05%351
0.29%