updated to silent print

This commit is contained in:
2025-09-24 21:42:22 +03:00
parent b49a22832d
commit 198563aaba
26 changed files with 693 additions and 1520 deletions

View File

@@ -0,0 +1,7 @@
# Placeholder for icon files - in production, add actual PNG icons:
# - icon16.png (16x16 pixels)
# - icon48.png (48x48 pixels)
# - icon128.png (128x128 pixels)
# For now, create simple text-based icons using SVG converted to PNG
# These should be replaced with proper icons later

View File

@@ -0,0 +1,27 @@
# Simple text-based icons for the Chrome extension
# These are placeholder files - replace with actual PNG icons for production
# Create simple SVG icons that can be converted to PNG
ICON_16_SVG = '''
<svg width="16" height="16" xmlns="http://www.w3.org/2000/svg">
<rect width="16" height="16" fill="#007bff"/>
<text x="8" y="12" font-family="Arial" font-size="10" fill="white" text-anchor="middle">🖨</text>
</svg>
'''
ICON_48_SVG = '''
<svg width="48" height="48" xmlns="http://www.w3.org/2000/svg">
<rect width="48" height="48" fill="#007bff" rx="8"/>
<text x="24" y="32" font-family="Arial" font-size="24" fill="white" text-anchor="middle">🖨️</text>
</svg>
'''
ICON_128_SVG = '''
<svg width="128" height="128" xmlns="http://www.w3.org/2000/svg">
<rect width="128" height="128" fill="#007bff" rx="16"/>
<text x="64" y="84" font-family="Arial" font-size="48" fill="white" text-anchor="middle">🖨️</text>
</svg>
'''
# For now, create simple text placeholders
# In production, convert these SVGs to PNG files

View File

@@ -0,0 +1,122 @@
#!/usr/bin/env python3
"""
Generate PNG icons for Chrome extension
Creates simple colored squares with printer icons
"""
try:
from PIL import Image, ImageDraw, ImageFont
PIL_AVAILABLE = True
except ImportError:
PIL_AVAILABLE = False
import os
def create_simple_icon(size, filename):
"""Create a simple colored square icon"""
if PIL_AVAILABLE:
# Create image with PIL
img = Image.new('RGBA', (size, size), (0, 123, 255, 255)) # Blue background
draw = ImageDraw.Draw(img)
# Add a white border
border_width = max(1, size // 16)
draw.rectangle([0, 0, size-1, size-1], outline=(255, 255, 255, 255), width=border_width)
# Add text (P for Print)
try:
font_size = size // 2
font = ImageFont.load_default()
text = "P"
bbox = draw.textbbox((0, 0), text, font=font)
text_width = bbox[2] - bbox[0]
text_height = bbox[3] - bbox[1]
x = (size - text_width) // 2
y = (size - text_height) // 2
draw.text((x, y), text, fill=(255, 255, 255, 255), font=font)
except:
pass
img.save(filename, 'PNG')
print(f"Created {filename} ({size}x{size})")
else:
# Create a minimal PNG file without PIL
create_minimal_png(size, filename)
def create_minimal_png(size, filename):
"""Create a minimal PNG file without PIL"""
# This creates a very basic PNG file
# Blue square with minimal PNG structure
import struct
import zlib
# PNG signature
png_signature = b'\x89PNG\r\n\x1a\n'
# IHDR chunk
width = height = size
bit_depth = 8
color_type = 2 # RGB
compression = 0
filter_method = 0
interlace = 0
ihdr_data = struct.pack('>IIBBBBB', width, height, bit_depth, color_type, compression, filter_method, interlace)
ihdr_crc = zlib.crc32(b'IHDR' + ihdr_data) & 0xffffffff
ihdr_chunk = struct.pack('>I', len(ihdr_data)) + b'IHDR' + ihdr_data + struct.pack('>I', ihdr_crc)
# IDAT chunk (blue pixels)
pixels = []
for y in range(height):
row = [0] # Filter byte
for x in range(width):
# Blue color RGB(0, 123, 255)
row.extend([0, 123, 255])
pixels.extend(row)
pixel_data = bytes(pixels)
compressed_data = zlib.compress(pixel_data)
idat_crc = zlib.crc32(b'IDAT' + compressed_data) & 0xffffffff
idat_chunk = struct.pack('>I', len(compressed_data)) + b'IDAT' + compressed_data + struct.pack('>I', idat_crc)
# IEND chunk
iend_crc = zlib.crc32(b'IEND') & 0xffffffff
iend_chunk = struct.pack('>I', 0) + b'IEND' + struct.pack('>I', iend_crc)
# Write PNG file
with open(filename, 'wb') as f:
f.write(png_signature)
f.write(ihdr_chunk)
f.write(idat_chunk)
f.write(iend_chunk)
print(f"Created minimal {filename} ({size}x{size})")
def main():
# Create icons directory if it doesn't exist
icons_dir = "/home/ske087/quality_recticel/windows_print_service/chrome_extension/icons"
print("Creating Chrome extension icons...")
print(f"PIL available: {PIL_AVAILABLE}")
# Create required icon sizes
sizes = [16, 32, 48, 128]
for size in sizes:
filename = os.path.join(icons_dir, f"icon{size}.png")
create_simple_icon(size, filename)
print("✅ All icons created successfully!")
print("\nIcons created:")
for size in sizes:
filename = f"icon{size}.png"
filepath = os.path.join(icons_dir, filename)
if os.path.exists(filepath):
file_size = os.path.getsize(filepath)
print(f"{filename} ({size}x{size}px, {file_size} bytes)")
else:
print(f"{filename} - FAILED")
if __name__ == "__main__":
main()

Binary file not shown.

After

Width:  |  Height:  |  Size: 545 B

View File

@@ -0,0 +1,4 @@
# Placeholder for 128x128 icon
# This is a text file placeholder
# Replace with actual icon128.png file
🖨️

Binary file not shown.

After

Width:  |  Height:  |  Size: 207 B

View File

@@ -0,0 +1,4 @@
# Placeholder for 16x16 icon
# This is a text file placeholder
# Replace with actual icon16.png file
🖨️

Binary file not shown.

After

Width:  |  Height:  |  Size: 235 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 285 B

View File

@@ -0,0 +1,4 @@
# Placeholder for 48x48 icon
# This is a text file placeholder
# Replace with actual icon48.png file
🖨️