Оптимизация + на мини-картинках схем открывания рисуется спейсер и москитная сетка
This commit is contained in:
@@ -397,7 +397,7 @@ def flap_analiz(flap_config: str) -> list:
|
|||||||
return dim_flap
|
return dim_flap
|
||||||
|
|
||||||
|
|
||||||
def make_flap_mini_pictures(path_to_img_file: str, str_flap_config: str, is_door: bool = False) -> None:
|
def make_flap_mini_pictures(path_to_img_file: str, str_flap_config: str) -> None:
|
||||||
""" Функция создает файл мини-картинки схем открывания окна
|
""" Функция создает файл мини-картинки схем открывания окна
|
||||||
|
|
||||||
:param path_to_img_file: путь к файлу с изображением
|
:param path_to_img_file: путь к файлу с изображением
|
||||||
@@ -465,7 +465,18 @@ def make_flap_mini_pictures(path_to_img_file: str, str_flap_config: str, is_door
|
|||||||
fill=(225, 125, 125), width=1)
|
fill=(225, 125, 125), width=1)
|
||||||
draw.line((local_right - 3, local_top + 3, local_left + 3, (local_bottom+local_top) / 2),
|
draw.line((local_right - 3, local_top + 3, local_left + 3, (local_bottom+local_top) / 2),
|
||||||
fill=(225, 125, 125), width=1)
|
fill=(225, 125, 125), width=1)
|
||||||
|
if "Z" in j["flap"] or "S" in j["flap"] or "z" in j["flap"] or "s" in j["flap"]: # расширитель (спейсер)
|
||||||
|
draw.line(((local_left * 3 + local_right) / 4, (local_top * 3 + local_bottom) / 4,
|
||||||
|
(local_right * 3 - local_left) / 4, (local_top * 3 + local_bottom) / 4),
|
||||||
|
fill=(225, 125, 125), width=1)
|
||||||
|
draw.line(((local_left * 3 + local_right) / 4, (local_bottom * 3 + local_top) / 4,
|
||||||
|
(local_right * 3 - local_left) / 4, (local_bottom * 3 + local_top) / 4),
|
||||||
|
fill=(225, 125, 125), width=1)
|
||||||
|
draw.line(((local_left * 3 + local_right) / 4, (local_top * 3 + local_bottom) / 4,
|
||||||
|
(local_right * 3 - local_left) / 4, (local_bottom * 3 + local_top) / 4),
|
||||||
|
fill=(225, 125, 125), width=1)
|
||||||
|
if "M" in j["flap"] or "m" in j["flap"] or "м" in j["flap"] or "М" in j["flap"]: # москитная сетка
|
||||||
|
draw.rectangle((local_left, local_top, local_right, local_bottom), fill=(16, 125, 16, 50), outline=None)
|
||||||
# Отрисовка створки. ПЕРИМЕТР
|
# Отрисовка створки. ПЕРИМЕТР
|
||||||
draw.line((local_left, local_bottom, local_right, local_bottom), fill=(125, 125, 125), width=3)
|
draw.line((local_left, local_bottom, local_right, local_bottom), fill=(125, 125, 125), width=3)
|
||||||
draw.line((local_left, local_top, local_right, local_top), fill=(125, 125, 125), width=3)
|
draw.line((local_left, local_top, local_right, local_top), fill=(125, 125, 125), width=3)
|
||||||
@@ -478,3 +489,18 @@ def make_flap_mini_pictures(path_to_img_file: str, str_flap_config: str, is_door
|
|||||||
img.save(path_to_img_file)
|
img.save(path_to_img_file)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
|
def get_flaps_for_mini_pictures(flap_cofig: str) -> str:
|
||||||
|
image_file_name = flap_cofig
|
||||||
|
image_file_name = image_file_name.replace(">", u"G")
|
||||||
|
image_file_name = image_file_name.replace("<", "L")
|
||||||
|
image_file_name = image_file_name.replace("|", "I")
|
||||||
|
image_file_name = image_file_name.replace("[", "(")
|
||||||
|
image_file_name = image_file_name.replace("]", ")")
|
||||||
|
image_file_name = image_file_name.replace("/", "-")
|
||||||
|
image_file_name = image_file_name.replace("\\", "-")
|
||||||
|
image_file_name = image_file_name.replace(".", "-") + u".png"
|
||||||
|
image_file_name = f"{PATH_FOR_IMG}/{PATH_FOR_IMGFLAPCONFIG}/{image_file_name}"
|
||||||
|
if not os.path.isfile(f"{STATIC_BASE_PATH}/{image_file_name}"):
|
||||||
|
make_flap_mini_pictures(f"{STATIC_BASE_PATH}/{image_file_name}", flap_cofig)
|
||||||
|
return image_file_name
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ from django.utils import timezone
|
|||||||
from oknardia.settings import *
|
from oknardia.settings import *
|
||||||
from oknardia.models import PVCprofiles, Seria_Info, Win_MountDim, Building_Info, MerchantBrand
|
from oknardia.models import PVCprofiles, Seria_Info, Win_MountDim, Building_Info, MerchantBrand
|
||||||
from web.report1 import get_last_all_user_visit_list, get_last_user_visit_cookies, get_last_user_visit_list
|
from web.report1 import get_last_all_user_visit_list, get_last_user_visit_cookies, get_last_user_visit_list
|
||||||
from web.add_func import normalize, get_rating_set_for_stars, get_flaps_for_big_pictures, make_flap_mini_pictures
|
from web.add_func import normalize, get_rating_set_for_stars, get_flaps_for_big_pictures, get_flaps_for_mini_pictures
|
||||||
import django.utils.dateformat
|
import django.utils.dateformat
|
||||||
import time
|
import time
|
||||||
import json
|
import json
|
||||||
@@ -847,18 +847,7 @@ def standard_opening(request: HttpRequest) -> HttpResponse:
|
|||||||
for i in q_win_opening:
|
for i in q_win_opening:
|
||||||
if tmp_id != i.id:
|
if tmp_id != i.id:
|
||||||
tmp_id = i.id
|
tmp_id = i.id
|
||||||
image_file_name = i.sFlapConfig
|
image_file_name = get_flaps_for_mini_pictures(i.sFlapConfig)
|
||||||
image_file_name = image_file_name.replace(">", u"G")
|
|
||||||
image_file_name = image_file_name.replace("<", "L")
|
|
||||||
image_file_name = image_file_name.replace("|", "I")
|
|
||||||
image_file_name = image_file_name.replace("[", "(")
|
|
||||||
image_file_name = image_file_name.replace("]", ")")
|
|
||||||
image_file_name = image_file_name.replace("/", "-")
|
|
||||||
image_file_name = image_file_name.replace("\\", "-")
|
|
||||||
image_file_name = image_file_name.replace(".", "-") + u".png"
|
|
||||||
image_file_name = f"{PATH_FOR_IMG}/{PATH_FOR_IMGFLAPCONFIG}/{image_file_name}"
|
|
||||||
if not os.path.isfile(f"{STATIC_BASE_PATH}/{image_file_name}"):
|
|
||||||
make_flap_mini_pictures(f"{STATIC_BASE_PATH}/{image_file_name}", i.sFlapConfig, i.bIsDoor)
|
|
||||||
list_windows_opening.append({
|
list_windows_opening.append({
|
||||||
"ID": i.id,
|
"ID": i.id,
|
||||||
"INCLUDING_IN_SERIA": [{
|
"INCLUDING_IN_SERIA": [{
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 114 B After Width: | Height: | Size: 168 B |
Reference in New Issue
Block a user