Compare commits
10
Commits
76a907c586
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fd8acf21ec | ||
|
|
5a51f49bef | ||
|
|
369bb537d4 | ||
|
|
2d123e1a74 | ||
|
|
ea8930ad14 | ||
|
|
802fd2a955 | ||
|
|
20b1768bb1 | ||
|
|
e5a9a5bce3 | ||
|
|
d515b2a031 | ||
|
|
828f266171 |
No files matched your search
@@ -0,0 +1,64 @@
|
||||
# hcatitles
|
||||
This program will update the png file found at `D:\OBS Assets\Overlays\title.png`
|
||||
|
||||
## Setting up the build environment
|
||||
Making the assumption that python is installed in `C:\Program Files\Python39` and Develmpent is being done under `D:\Development`
|
||||
|
||||
Pull a copy of this project from git:
|
||||
```
|
||||
D:\
|
||||
cd \development
|
||||
git clone https://git.elder-geek.net/Harvest/hcatitles.git
|
||||
```
|
||||
|
||||
Then setup this foulder with a virtual environment:
|
||||
```
|
||||
cd hcatitles
|
||||
& "C:\Program Files\Python39\python" -m venv venv
|
||||
```
|
||||
|
||||
Activate the virtual enviroment:
|
||||
```
|
||||
venv\Script\activate
|
||||
```
|
||||
|
||||
Update `pip `and install requirments:
|
||||
```
|
||||
python -m pip install --upgrade pip
|
||||
pip install -r requisments.txt
|
||||
```
|
||||
|
||||
Testing code after making edits:
|
||||
```
|
||||
python hcatitiles.py
|
||||
```
|
||||
|
||||
To create an executable in `D:\Development\hcatitles\dist`:
|
||||
```
|
||||
pyinstaller hcatitles.spec
|
||||
```
|
||||
|
||||
|
||||
## To Activate the virtual enviroment from a new DOS prompt
|
||||
```
|
||||
D:\
|
||||
cd \development\hcatitles
|
||||
venv\Scripts\activate
|
||||
```
|
||||
|
||||
When done working in the virtual enviroment:
|
||||
```
|
||||
deactivate
|
||||
```
|
||||
|
||||
|
||||
## First time run of pyinstaller to generate hcatitles.spec
|
||||
Windows uses `^` to continues a command on the next line.
|
||||
```
|
||||
pyinstaller --onefile --windowed --icon projector.ico ^
|
||||
--add-data "blank_title.png:." ^
|
||||
--add-data "tahoma.ttf:." ^
|
||||
--add-data "tahomabd.ttf:." ^
|
||||
--add-data "projector.ico:." ^
|
||||
hcatitles.py
|
||||
```
|
||||
+7
-8
@@ -1,11 +1,10 @@
|
||||
import os
|
||||
import PySimpleGUI as sg
|
||||
import FreeSimpleGUI as sg
|
||||
from datetime import date, timedelta
|
||||
from pathlib import Path
|
||||
from PIL import Image, ImageDraw, ImageEnhance, ImageFilter, ImageFont, ImageOps
|
||||
from io import BytesIO
|
||||
|
||||
|
||||
def resource_path(relative_path):
|
||||
""" Get absolute path to resource, works for dev and for PyInstaller """
|
||||
try:
|
||||
@@ -16,7 +15,7 @@ def resource_path(relative_path):
|
||||
|
||||
def save_filename():
|
||||
"""determin file name by platform"""
|
||||
folder = Path('D:/OBS Assets/Overlays')
|
||||
folder = Path('C:/Users/harvest/Documents/OBS/Overlays')
|
||||
if folder.exists():
|
||||
return folder / 'Title.png'
|
||||
return Path.home() / 'Pictures' / 'Title.png'
|
||||
@@ -108,9 +107,10 @@ def main():
|
||||
original = Image.open(image_path)
|
||||
image = update_image(original, title, subtitle)
|
||||
thumbnail = update_thumbnail(image)
|
||||
icon_file=resource_path('projector.ico')
|
||||
|
||||
layout = build_layout(title, subtitle, thumbnail)
|
||||
window = sg.Window('Harvest Christian Assembly Message Title', layout)
|
||||
window = sg.Window('Harvest Christian Assembly Message Title', layout, icon=icon_file)
|
||||
|
||||
# image contains the final image
|
||||
while True:
|
||||
@@ -118,7 +118,9 @@ def main():
|
||||
if event == sg.WIN_CLOSED:
|
||||
break
|
||||
|
||||
if event == "-TITLE-" or event == '-SUBTITLE-':
|
||||
# if event == "-TITLE-" or event == '-SUBTITLE-':
|
||||
|
||||
if event == "-SAVE-":
|
||||
if values['-TITLE-'] != title or values['-SUBTITLE-'] != subtitle:
|
||||
title = values['-TITLE-']
|
||||
subtitle = values['-SUBTITLE-']
|
||||
@@ -128,9 +130,6 @@ def main():
|
||||
bio = BytesIO()
|
||||
thumbnail.save(bio, format = 'PNG')
|
||||
window['-IMAGE-'].update(data = bio.getvalue())
|
||||
|
||||
|
||||
if event == "-SAVE-":
|
||||
save_path = save_filename()
|
||||
image.save(save_path, 'PNG')
|
||||
|
||||
|
||||
Executable → Regular
+4
-8
@@ -1,9 +1,6 @@
|
||||
# -*- mode: python ; coding: utf-8 -*-
|
||||
|
||||
|
||||
block_cipher = None
|
||||
|
||||
|
||||
a = Analysis(
|
||||
['hcatitles.py'],
|
||||
pathex=[],
|
||||
@@ -12,24 +9,22 @@ a = Analysis(
|
||||
('blank_title.png','.'),
|
||||
('tahoma.ttf','.'),
|
||||
('tahomabd.ttf','.'),
|
||||
('projector.ico','.'),
|
||||
],
|
||||
hiddenimports=[],
|
||||
hookspath=[],
|
||||
hooksconfig={},
|
||||
runtime_hooks=[],
|
||||
excludes=[],
|
||||
win_no_prefer_redirects=False,
|
||||
win_private_assemblies=False,
|
||||
cipher=block_cipher,
|
||||
noarchive=False,
|
||||
optimize=0,
|
||||
)
|
||||
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
|
||||
pyz = PYZ(a.pure)
|
||||
|
||||
exe = EXE(
|
||||
pyz,
|
||||
a.scripts,
|
||||
a.binaries,
|
||||
a.zipfiles,
|
||||
a.datas,
|
||||
[],
|
||||
name='hcatitles',
|
||||
@@ -45,4 +40,5 @@ exe = EXE(
|
||||
target_arch=None,
|
||||
codesign_identity=None,
|
||||
entitlements_file=None,
|
||||
icon=['projector.ico'],
|
||||
)
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 75 KiB |
+2
-1
@@ -1,4 +1,5 @@
|
||||
Pillow
|
||||
pyinstaller
|
||||
pyinstaller-hooks-contrib
|
||||
PySimpleGUI
|
||||
FreeSimpleGUI
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
cd C:\Development\hcatitles
|
||||
call venv\scripts\activate.bat
|
||||
python hcatitles.py
|
||||
@@ -0,0 +1,3 @@
|
||||
Set objShell = CreateObject("WScript.Shell")
|
||||
objShell.Run Chr(34) & "C:\Development\hcatitles\startup.bat" & Chr(34), 0
|
||||
Set objShell = Nothing
|
||||
Executable → Regular
File mode changed.
Executable → Regular
File mode changed.
Reference in new issue
Block a user