end of development for python going to cpp made an exe file for main.py
|
Before Width: | Height: | Size: 954 KiB After Width: | Height: | Size: 954 KiB |
|
Before Width: | Height: | Size: 426 KiB After Width: | Height: | Size: 426 KiB |
|
Before Width: | Height: | Size: 580 KiB After Width: | Height: | Size: 580 KiB |
|
Before Width: | Height: | Size: 214 KiB After Width: | Height: | Size: 214 KiB |
@@ -0,0 +1,38 @@
|
|||||||
|
# -*- mode: python ; coding: utf-8 -*-
|
||||||
|
|
||||||
|
|
||||||
|
a = Analysis(
|
||||||
|
['D:/matic/project/image_shenanigans/python/main.py'],
|
||||||
|
pathex=[],
|
||||||
|
binaries=[],
|
||||||
|
datas=[('images', 'images')],
|
||||||
|
hiddenimports=[],
|
||||||
|
hookspath=[],
|
||||||
|
hooksconfig={},
|
||||||
|
runtime_hooks=[],
|
||||||
|
excludes=[],
|
||||||
|
noarchive=False,
|
||||||
|
optimize=0,
|
||||||
|
)
|
||||||
|
pyz = PYZ(a.pure)
|
||||||
|
|
||||||
|
exe = EXE(
|
||||||
|
pyz,
|
||||||
|
a.scripts,
|
||||||
|
a.binaries,
|
||||||
|
a.datas,
|
||||||
|
[],
|
||||||
|
name='main',
|
||||||
|
debug=False,
|
||||||
|
bootloader_ignore_signals=False,
|
||||||
|
strip=False,
|
||||||
|
upx=True,
|
||||||
|
upx_exclude=[],
|
||||||
|
runtime_tmpdir=None,
|
||||||
|
console=True,
|
||||||
|
disable_windowed_traceback=False,
|
||||||
|
argv_emulation=False,
|
||||||
|
target_arch=None,
|
||||||
|
codesign_identity=None,
|
||||||
|
entitlements_file=None,
|
||||||
|
)
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
|
import sys
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from glob import glob
|
|
||||||
|
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
import matplotlib.pylab as plt
|
import matplotlib.pylab as plt
|
||||||
@@ -10,11 +10,14 @@ import transition
|
|||||||
|
|
||||||
class ImageInterface:
|
class ImageInterface:
|
||||||
def __init__(self, base_dir=None):
|
def __init__(self, base_dir=None):
|
||||||
self.base_dir = Path(base_dir or Path(__file__).resolve().parent.parent)
|
if base_dir:
|
||||||
|
self.base_dir = Path(base_dir).expanduser().resolve()
|
||||||
|
else:
|
||||||
|
self.base_dir = Path(getattr(sys, "_MEIPASS", Path(__file__).resolve().parents[1]))
|
||||||
|
self.image_dir = self.base_dir / "images"
|
||||||
self.image_sets = {
|
self.image_sets = {
|
||||||
"source": self.load_images(str(self.base_dir / "images" / "source" / "*.png")),
|
"source": self.load_images(self.image_dir / "source"),
|
||||||
"goal": self.load_images(str(self.base_dir / "images" / "goal" / "*.png")),
|
"goal": self.load_images(self.image_dir / "goal"),
|
||||||
"shenanigans": self.load_images(str(self.base_dir / "images" / "shenanigans" / "*.png")),
|
|
||||||
}
|
}
|
||||||
self.current_category = None
|
self.current_category = None
|
||||||
self.current_index = 0
|
self.current_index = 0
|
||||||
@@ -31,8 +34,11 @@ class ImageInterface:
|
|||||||
"button": "#2b2b2b",
|
"button": "#2b2b2b",
|
||||||
"button_hover": "#3a3a3a",
|
"button_hover": "#3a3a3a",
|
||||||
}
|
}
|
||||||
def load_images(self, pattern):
|
def load_images(self, directory):
|
||||||
return sorted(glob(pattern))
|
paths = []
|
||||||
|
for extension in ("*.png", "*.jpg", "*.jpeg", "*.bmp", "*.gif", "*.webp"):
|
||||||
|
paths.extend(directory.glob(extension))
|
||||||
|
return sorted(str(path) for path in paths)
|
||||||
def ensure_figure(self):
|
def ensure_figure(self):
|
||||||
if self.figure is None:
|
if self.figure is None:
|
||||||
self.figure = plt.figure(figsize=(10, 6))
|
self.figure = plt.figure(figsize=(10, 6))
|
||||||
|
|||||||