summaryrefslogtreecommitdiff
path: root/src/main/python
diff options
context:
space:
mode:
authorBlaine2020-06-20 12:35:09 +0530
committerBlaine2020-06-20 12:35:09 +0530
commit7ff2d30a1c16216f3bfaebc8f71924d6a6f8ec8d (patch)
tree15fb8a5c672500203b942115b12086d385cfec08 /src/main/python
parentfc4db2978591b1ce62f2f7399e2a74c07b046d62 (diff)
downloadChemical-PFD-7ff2d30a1c16216f3bfaebc8f71924d6a6f8ec8d.tar.gz
Chemical-PFD-7ff2d30a1c16216f3bfaebc8f71924d6a6f8ec8d.tar.bz2
Chemical-PFD-7ff2d30a1c16216f3bfaebc8f71924d6a6f8ec8d.zip
complete string formatting
Diffstat (limited to 'src/main/python')
-rw-r--r--src/main/python/utils/custom.py33
1 files changed, 25 insertions, 8 deletions
diff --git a/src/main/python/utils/custom.py b/src/main/python/utils/custom.py
index 5625ea4..7e6b197 100644
--- a/src/main/python/utils/custom.py
+++ b/src/main/python/utils/custom.py
@@ -125,13 +125,31 @@ class ShapeDialog(QDialog):
entry.append(i.width)
gripList.append(entry)
+
+ grips = ",\n ".join([str(i) for i in gripList]) if gripList else ""
+ if grips:
+ grips = "self.grips = [" + grips + "]\n"
temp = QDialog(self)
tempLayout = QBoxLayout(QBoxLayout.TopToBottom)
- output = OutputBox(temp, f"""class {className}(NodeItem):
- def __init__(self):
- super({className}, self).__init__("svg/{category}/{str.split(name[0], "/")[-1][:-4]}")
- self.grips = {gripList}
- """)
+ output = OutputBox(temp, f"""
+<b> Class Definition:</b>
+<pre>
+class {className}(NodeItem):
+ def __init__(self):
+ super({className}, self).__init__("svg/{category}/{str.split(name[0], "/")[-1][:-4]}")
+ {grips}
+</pre>
+<b> Items.json entry:</b>
+<pre>
+"{category}": {{
+ "{itemName}": {{
+ "name": "{itemName}",
+ "icon": ".\\{category}\\{str.split(name[0], "/")[-1]}",
+ "class": "{category}",
+ "object": "{className}",
+ "args": []
+ }}
+}}</pre>""")
tempLayout.addWidget(output)
temp.setLayout(tempLayout)
temp.exec()
@@ -229,6 +247,5 @@ class OutputBox(QTextEdit):
def __init__(self, parent, text):
super(OutputBox, self).__init__(parent)
self.setReadOnly(True)
- self.resize(600, 300)
- self.text = text
- self.setMarkdown("```python\n"+text+"\n```")
+ self.setFontWeight(10)
+ self.setHtml(text) \ No newline at end of file