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 os
|
||||||
import PySimpleGUI as sg
|
import FreeSimpleGUI as sg
|
||||||
from datetime import date, timedelta
|
from datetime import date, timedelta
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from PIL import Image, ImageDraw, ImageEnhance, ImageFilter, ImageFont, ImageOps
|
from PIL import Image, ImageDraw, ImageEnhance, ImageFilter, ImageFont, ImageOps
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
|
|
||||||
|
|
||||||
def resource_path(relative_path):
|
def resource_path(relative_path):
|
||||||
""" Get absolute path to resource, works for dev and for PyInstaller """
|
""" Get absolute path to resource, works for dev and for PyInstaller """
|
||||||
try:
|
try:
|
||||||
@@ -16,7 +15,7 @@ def resource_path(relative_path):
|
|||||||
|
|
||||||
def save_filename():
|
def save_filename():
|
||||||
"""determin file name by platform"""
|
"""determin file name by platform"""
|
||||||
folder = Path('D:/OBS Assets/Overlays')
|
folder = Path('C:/Users/harvest/Documents/OBS/Overlays')
|
||||||
if folder.exists():
|
if folder.exists():
|
||||||
return folder / 'Title.png'
|
return folder / 'Title.png'
|
||||||
return Path.home() / 'Pictures' / 'Title.png'
|
return Path.home() / 'Pictures' / 'Title.png'
|
||||||
@@ -108,9 +107,10 @@ def main():
|
|||||||
original = Image.open(image_path)
|
original = Image.open(image_path)
|
||||||
image = update_image(original, title, subtitle)
|
image = update_image(original, title, subtitle)
|
||||||
thumbnail = update_thumbnail(image)
|
thumbnail = update_thumbnail(image)
|
||||||
|
icon_file=resource_path('projector.ico')
|
||||||
|
|
||||||
layout = build_layout(title, subtitle, thumbnail)
|
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
|
# image contains the final image
|
||||||
while True:
|
while True:
|
||||||
@@ -118,7 +118,9 @@ def main():
|
|||||||
if event == sg.WIN_CLOSED:
|
if event == sg.WIN_CLOSED:
|
||||||
break
|
break
|
||||||
|
|
||||||
if event == "-TITLE-" or event == '-SUBTITLE-':
|
# if event == "-TITLE-" or event == '-SUBTITLE-':
|
||||||
|
|
||||||
|
if event == "-SAVE-":
|
||||||
if values['-TITLE-'] != title or values['-SUBTITLE-'] != subtitle:
|
if values['-TITLE-'] != title or values['-SUBTITLE-'] != subtitle:
|
||||||
title = values['-TITLE-']
|
title = values['-TITLE-']
|
||||||
subtitle = values['-SUBTITLE-']
|
subtitle = values['-SUBTITLE-']
|
||||||
@@ -128,9 +130,6 @@ def main():
|
|||||||
bio = BytesIO()
|
bio = BytesIO()
|
||||||
thumbnail.save(bio, format = 'PNG')
|
thumbnail.save(bio, format = 'PNG')
|
||||||
window['-IMAGE-'].update(data = bio.getvalue())
|
window['-IMAGE-'].update(data = bio.getvalue())
|
||||||
|
|
||||||
|
|
||||||
if event == "-SAVE-":
|
|
||||||
save_path = save_filename()
|
save_path = save_filename()
|
||||||
image.save(save_path, 'PNG')
|
image.save(save_path, 'PNG')
|
||||||
|
|
||||||
|
|||||||
Executable → Regular
+4
-8
@@ -1,9 +1,6 @@
|
|||||||
# -*- mode: python ; coding: utf-8 -*-
|
# -*- mode: python ; coding: utf-8 -*-
|
||||||
|
|
||||||
|
|
||||||
block_cipher = None
|
|
||||||
|
|
||||||
|
|
||||||
a = Analysis(
|
a = Analysis(
|
||||||
['hcatitles.py'],
|
['hcatitles.py'],
|
||||||
pathex=[],
|
pathex=[],
|
||||||
@@ -12,24 +9,22 @@ a = Analysis(
|
|||||||
('blank_title.png','.'),
|
('blank_title.png','.'),
|
||||||
('tahoma.ttf','.'),
|
('tahoma.ttf','.'),
|
||||||
('tahomabd.ttf','.'),
|
('tahomabd.ttf','.'),
|
||||||
|
('projector.ico','.'),
|
||||||
],
|
],
|
||||||
hiddenimports=[],
|
hiddenimports=[],
|
||||||
hookspath=[],
|
hookspath=[],
|
||||||
hooksconfig={},
|
hooksconfig={},
|
||||||
runtime_hooks=[],
|
runtime_hooks=[],
|
||||||
excludes=[],
|
excludes=[],
|
||||||
win_no_prefer_redirects=False,
|
|
||||||
win_private_assemblies=False,
|
|
||||||
cipher=block_cipher,
|
|
||||||
noarchive=False,
|
noarchive=False,
|
||||||
|
optimize=0,
|
||||||
)
|
)
|
||||||
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
|
pyz = PYZ(a.pure)
|
||||||
|
|
||||||
exe = EXE(
|
exe = EXE(
|
||||||
pyz,
|
pyz,
|
||||||
a.scripts,
|
a.scripts,
|
||||||
a.binaries,
|
a.binaries,
|
||||||
a.zipfiles,
|
|
||||||
a.datas,
|
a.datas,
|
||||||
[],
|
[],
|
||||||
name='hcatitles',
|
name='hcatitles',
|
||||||
@@ -45,4 +40,5 @@ exe = EXE(
|
|||||||
target_arch=None,
|
target_arch=None,
|
||||||
codesign_identity=None,
|
codesign_identity=None,
|
||||||
entitlements_file=None,
|
entitlements_file=None,
|
||||||
|
icon=['projector.ico'],
|
||||||
)
|
)
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 75 KiB |
+2
-1
@@ -1,4 +1,5 @@
|
|||||||
Pillow
|
Pillow
|
||||||
pyinstaller
|
pyinstaller
|
||||||
pyinstaller-hooks-contrib
|
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