removed looking for category group changes

main
alex 2023-09-05 21:27:19 +02:00
parent f977926fde
commit c069bec1fa
7 changed files with 308 additions and 8 deletions

View File

@ -0,0 +1,105 @@
{
"category": "Janex",
"name": "Produktionstask 2",
"globalInputs": [
{
"parameterName": "kundenname",
"type": "text",
"displayName": "Name des Kunden2"
},
{
"parameterName": "kiste",
"type": "number",
"displayName": "Nummer der Kiste"
},
{
"parameterName": "kiste2",
"type": "textarea",
"displayName": "Nummer der zweiten Kiste yooo"
}
],
"tasks": [
{
"name": "Bild zu Label konvertieren",
"onFinish": "pause",
"undoPossible": true,
"repeatPossible": true,
"scriptPath": "test1.py",
"parameters": [
{
"parameterName": "labelformat",
"type": "text",
"displayName": "Format des Labels",
"global": false
},
{
"parameterName": "kiste",
"type": "number",
"displayName": "Nummer der Kiste",
"global": true
},
{
"parameterName": "kiste2",
"type": "textarea",
"displayName": "Nummer der zweiten Kiste lul",
"global": true
}
]
},
{
"name": "Label drucken",
"onFinish": "next",
"undoPossible": false,
"repeatPossible": false,
"scriptPath": "test2.py",
"parameters": []
},
{
"name": "Label drucken1",
"onFinish": "next",
"undoPossible": false,
"repeatPossible": false,
"scriptPath": "test2.py",
"parameters": []
},
{
"name": "Label drucken2",
"onFinish": "next",
"undoPossible": false,
"repeatPossible": false,
"scriptPath": "test2.py",
"parameters": []
},
{
"name": "Label drucken3",
"onFinish": "next",
"undoPossible": false,
"repeatPossible": false,
"scriptPath": "test2.py",
"parameters": []
},
{
"name": "Label 1",
"onFinish": "next",
"undoPossible": false,
"repeatPossible": false,
"scriptPath": "test2.py",
"parameters": [
{
"parameterName": "kundenname",
"type": "text",
"displayName": "Name des Kunden",
"global": true
}
]
},
{
"name": "Label 2",
"onFinish": "pause",
"undoPossible": false,
"repeatPossible": true,
"scriptPath": "test3.py",
"parameters": []
}
]
}

View File

@ -0,0 +1,4 @@
matplotlib==3.7.2
numpy==1.24.3
numpy_stl==3.0.1
Pillow==10.0.0

View File

@ -0,0 +1,116 @@
import random
from PIL import Image, ImageDraw
import time
import sys
import numpy as np
from stl import mesh
time.sleep(3)
labelformat = sys.argv[1]
kiste = sys.argv[2]
if len(sys.argv) >= 5:
undo = sys.argv[4]
if undo == "--undo":
print("finish undo")
sys.exit(0)
print("hello this is test1")
if labelformat is None or kiste is None:
sys.exit(100)
print("hello friend", labelformat, kiste)
fp = open("customers.txt", "w")
fp.write("first line hey customer")
fp.close()
# Bildgröße und Pixelgröße festlegen
width = 100
height = 100
line_thickness = 5
max_lines = 5
# Das Bildgröße anpassen
image_width = width * line_thickness
image_height = height * line_thickness
# Hintergrundfarbe festlegen
background_color = (255, 255, 255) # Weiß
for i in range(10):
# Ein neues Bild erstellen
image = Image.new("RGB", (image_width, image_height), background_color)
# Eine Zeichenfläche für das Bild erstellen
draw = ImageDraw.Draw(image)
# Zufällige Linien zeichnen
for _ in range(max_lines):
start_x = random.randint(0, image_width)
start_y = random.randint(0, image_height)
end_x = random.randint(0, image_width)
end_y = random.randint(0, image_height)
color = (random.randint(0, 255), random.randint(
0, 255), random.randint(0, 255))
draw.line([(start_x, start_y), (end_x, end_y)],
fill=color, width=line_thickness)
# Bild als Datei speichern
image.save("generiertes_bild"+str(i)+".jpg")
# Abmessungen des rechteckigen Modells
width = 196
height = 196
depth = 26
# Eckpunkte des Modells erstellen
vertices = np.array([
[0, 0, 0],
[width, 0, 0],
[width, height, 0],
[0, height, 0],
[0, 0, depth],
[width, 0, depth],
[width, height, depth],
[0, height, depth]
])
# Flächen des Modells definieren
faces = np.array([
[0, 1, 2],
[0, 2, 3],
[0, 1, 5],
[0, 4, 5],
[0, 3, 7],
[0, 4, 7],
[1, 2, 6],
[1, 5, 6],
[2, 3, 7],
[2, 6, 7],
[4, 5, 6],
[4, 6, 7]
])
# Erstellen des Modells mit den Eckpunkten und Flächen
rectangular_mesh = mesh.Mesh(np.zeros(faces.shape[0], dtype=mesh.Mesh.dtype))
for i, face in enumerate(faces):
for j, vertex_id in enumerate(face):
rectangular_mesh.vectors[i][j] = vertices[vertex_id]
# Exportieren des Modells als .stl-Datei
rectangular_mesh.save('rectangular_model.stl')
print("Das 3D-Modell wurde erfolgreich als 'rectangular_model.stl' exportiert.")
"""
try:
x = 5 / 0 # Hier wird ein Fehler ausgelöst
except ZeroDivisionError:
print("Ein Fehler ist aufgetreten: Division durch Null.")
raise SystemExit(140) """

View File

@ -0,0 +1,32 @@
import time
import sys
import random
import string
import zipfile
time.sleep(5)
print("hello this is test2 lul")
def generate_random_text(length):
"""Generiert einen zufälligen Text mit der angegebenen Länge"""
letters = string.ascii_lowercase
return ''.join(random.choice(letters) for _ in range(length))
def create_zip_file(file_name, text_length):
"""Erstellt eine Zip-Datei mit einer Textdatei mit zufälligem Text"""
random_text = generate_random_text(text_length)
with open('random_text.txt', 'w') as file:
file.write(random_text)
with zipfile.ZipFile(file_name, 'w') as zip_file:
zip_file.write('random_text.txt')
print(f'Die Zip-Datei "{file_name}" wurde erfolgreich erstellt.')
# Beispielaufruf
create_zip_file('random_text.zip', 100)

View File

@ -0,0 +1,47 @@
import sys
import random
import matplotlib.pyplot as plt
def create_avatar(size):
# Erstelle ein neues Plot-Fenster
fig, ax = plt.subplots()
fig.set_size_inches(size/100, size/100) # Größe des Fensters festlegen
# Generiere zufällige Farben für Hintergrund und Formen
bg_color = (random.random(), random.random(), random.random())
shape_color = (random.random(), random.random(), random.random())
# Setze den Hintergrund
ax.set_facecolor(bg_color)
# Zeichne zufällige Formen
num_shapes = random.randint(3, 6)
for _ in range(num_shapes):
shape_type = random.choice(['circle', 'rectangle'])
if shape_type == 'circle':
x = random.randint(0, size)
y = random.randint(0, size)
radius = random.randint(0, size // 2)
circle = plt.Circle((x, y), radius, fc=shape_color)
ax.add_patch(circle)
elif shape_type == 'rectangle':
x = random.randint(0, size)
y = random.randint(0, size)
width = random.randint(0, size // 2)
height = random.randint(0, size // 2)
rectangle = plt.Rectangle((x, y), width, height, fc=shape_color)
ax.add_patch(rectangle)
# Verstecke Achsenbeschriftungen
ax.axis("off")
# Speichere das Bild
plt.savefig("random_avatar.png", dpi=100)
plt.close()
# Beispielaufruf
create_avatar(400)
print("hello")

View File

@ -5,7 +5,6 @@ import (
"jannex/admin-dashboard-backend/modules/notification"
"jannex/admin-dashboard-backend/modules/structs"
"jannex/admin-dashboard-backend/socketclients"
"slices"
"github.com/gofiber/fiber/v2"
)
@ -39,9 +38,6 @@ func UserInfo(c *fiber.Ctx) error {
categories := socketclients.GetAvailableCategories(userId)
// sort categories alphabetically
slices.Sort(categories)
return c.JSON(structs.UserInfoResponse{
UserId: userId,
Username: user.Username,

View File

@ -9,6 +9,7 @@ import (
"jannex/admin-dashboard-backend/modules/systempermissions"
"jannex/admin-dashboard-backend/modules/utils"
"os"
"slices"
"strconv"
"strings"
"time"
@ -1102,13 +1103,12 @@ func GetAvailableCategories(userId string) []string {
var categories []string
for _, categoryGroup := range cache.GetCategoryGroups() {
log.Info().Msgf("categoryGroup: %s", categoryGroup.Category)
//if HasXYPermission(userId, utils.PermissionGroupTasksOverviewXYView, categoryGroup.Category) {
categories = append(categories, categoryGroup.Category)
//}
}
// sort categories alphabetically
slices.Sort(categories)
return categories
}