-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsticker.py
68 lines (54 loc) · 2.09 KB
/
sticker.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
from PySide6 import QtCore, QtWidgets, QtGui
class Sticker(QtWidgets.QListWidgetItem):
width = 37
height = 13
topLeftRoundedCorner = 4
topRightRoundedCorner = 4
bottomLeftRoundedCorner = 0
bottomRightRoundedCorner = 0
textLine1 = ""
textLine2 = ""
qrCodeUrl = ""
modelPath = ""
alpha = 180
beta = 180
hideObstructed = True
def __init__(self, jsonData={}, parent=None):
super().__init__(parent)
if jsonData:
self.width = jsonData["width"]
self.height = jsonData["height"]
self.topLeftRoundedCorner = jsonData["topLeftRoundedCorner"]
self.topRightRoundedCorner = jsonData["topRightRoundedCorner"]
self.bottomLeftRoundedCorner = jsonData["bottomLeftRoundedCorner"]
self.bottomRightRoundedCorner = jsonData["bottomRightRoundedCorner"]
self.textLine1 = jsonData["textLine1"]
self.textLine2 = jsonData["textLine2"]
self.qrCodeUrl = jsonData["qrCodeUrl"]
self.modelPath = jsonData["modelPath"]
self.alpha = jsonData["alpha"]
self.beta = jsonData["beta"]
self.hideObstructed = jsonData["hideObstructed"]
self.valueChanged()
@QtCore.Slot()
def valueChanged(self):
if self.textLine1 == "":
self.setText("Sticker")
return
self.setText(self.textLine1 + " " + self.textLine2)
def getJson(self):
return {
"width": self.width,
"height": self.height,
"topLeftRoundedCorner": self.topLeftRoundedCorner,
"topRightRoundedCorner": self.topRightRoundedCorner,
"bottomLeftRoundedCorner": self.bottomLeftRoundedCorner,
"bottomRightRoundedCorner": self.bottomRightRoundedCorner,
"textLine1": self.textLine1,
"textLine2": self.textLine2,
"qrCodeUrl": self.qrCodeUrl,
"modelPath": self.modelPath,
"alpha": self.alpha,
"beta": self.beta,
"hideObstructed": self.hideObstructed
}