summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/build/settings/base.json6
-rw-r--r--src/build/settings/linux.json6
-rw-r--r--src/build/settings/mac.json3
-rw-r--r--src/main/icons/Icon.icobin0 -> 168229 bytes
-rw-r--r--src/main/icons/README.md11
-rw-r--r--src/main/icons/base/16.pngbin0 -> 544 bytes
-rw-r--r--src/main/icons/base/24.pngbin0 -> 783 bytes
-rw-r--r--src/main/icons/base/32.pngbin0 -> 912 bytes
-rw-r--r--src/main/icons/base/48.pngbin0 -> 1497 bytes
-rw-r--r--src/main/icons/base/64.pngbin0 -> 1657 bytes
-rw-r--r--src/main/icons/linux/1024.pngbin0 -> 26841 bytes
-rw-r--r--src/main/icons/linux/128.pngbin0 -> 3177 bytes
-rw-r--r--src/main/icons/linux/256.pngbin0 -> 5641 bytes
-rw-r--r--src/main/icons/linux/512.pngbin0 -> 11653 bytes
-rw-r--r--src/main/icons/mac/1024.pngbin0 -> 47311 bytes
-rw-r--r--src/main/icons/mac/128.pngbin0 -> 4978 bytes
-rw-r--r--src/main/icons/mac/256.pngbin0 -> 10278 bytes
-rw-r--r--src/main/icons/mac/512.pngbin0 -> 21699 bytes
-rw-r--r--src/main/python/main.py79
-rw-r--r--src/main/python/utils/__init__.py0
-rw-r--r--src/main/python/utils/sizes.py32
21 files changed, 137 insertions, 0 deletions
diff --git a/src/build/settings/base.json b/src/build/settings/base.json
new file mode 100644
index 0000000..e6321bb
--- /dev/null
+++ b/src/build/settings/base.json
@@ -0,0 +1,6 @@
+{
+ "app_name": "PFD-Tool",
+ "author": "FOSSEE",
+ "main_module": "src/main/python/main.py",
+ "version": "0.0.0"
+} \ No newline at end of file
diff --git a/src/build/settings/linux.json b/src/build/settings/linux.json
new file mode 100644
index 0000000..7a64c95
--- /dev/null
+++ b/src/build/settings/linux.json
@@ -0,0 +1,6 @@
+{
+ "categories": "Utility;",
+ "description": "",
+ "author_email": "",
+ "url": ""
+} \ No newline at end of file
diff --git a/src/build/settings/mac.json b/src/build/settings/mac.json
new file mode 100644
index 0000000..f7bd610
--- /dev/null
+++ b/src/build/settings/mac.json
@@ -0,0 +1,3 @@
+{
+ "mac_bundle_identifier": ""
+} \ No newline at end of file
diff --git a/src/main/icons/Icon.ico b/src/main/icons/Icon.ico
new file mode 100644
index 0000000..3312d86
--- /dev/null
+++ b/src/main/icons/Icon.ico
Binary files differ
diff --git a/src/main/icons/README.md b/src/main/icons/README.md
new file mode 100644
index 0000000..c6c4194
--- /dev/null
+++ b/src/main/icons/README.md
@@ -0,0 +1,11 @@
+![Sample app icon](linux/128.png)
+
+This directory contains the icons that are displayed for your app. Feel free to
+change them.
+
+The difference between the icons on Mac and the other platforms is that on Mac,
+they contain a ~5% transparent margin. This is because otherwise they look too
+big (eg. in the Dock or in the app switcher).
+
+You can create Icon.ico from the .png files with
+[an online tool](http://icoconvert.com/Multi_Image_to_one_icon/). \ No newline at end of file
diff --git a/src/main/icons/base/16.png b/src/main/icons/base/16.png
new file mode 100644
index 0000000..f7d02dc
--- /dev/null
+++ b/src/main/icons/base/16.png
Binary files differ
diff --git a/src/main/icons/base/24.png b/src/main/icons/base/24.png
new file mode 100644
index 0000000..faa6710
--- /dev/null
+++ b/src/main/icons/base/24.png
Binary files differ
diff --git a/src/main/icons/base/32.png b/src/main/icons/base/32.png
new file mode 100644
index 0000000..36b25e8
--- /dev/null
+++ b/src/main/icons/base/32.png
Binary files differ
diff --git a/src/main/icons/base/48.png b/src/main/icons/base/48.png
new file mode 100644
index 0000000..4a5dcbd
--- /dev/null
+++ b/src/main/icons/base/48.png
Binary files differ
diff --git a/src/main/icons/base/64.png b/src/main/icons/base/64.png
new file mode 100644
index 0000000..4b0a423
--- /dev/null
+++ b/src/main/icons/base/64.png
Binary files differ
diff --git a/src/main/icons/linux/1024.png b/src/main/icons/linux/1024.png
new file mode 100644
index 0000000..2248377
--- /dev/null
+++ b/src/main/icons/linux/1024.png
Binary files differ
diff --git a/src/main/icons/linux/128.png b/src/main/icons/linux/128.png
new file mode 100644
index 0000000..05b2b35
--- /dev/null
+++ b/src/main/icons/linux/128.png
Binary files differ
diff --git a/src/main/icons/linux/256.png b/src/main/icons/linux/256.png
new file mode 100644
index 0000000..578fdc7
--- /dev/null
+++ b/src/main/icons/linux/256.png
Binary files differ
diff --git a/src/main/icons/linux/512.png b/src/main/icons/linux/512.png
new file mode 100644
index 0000000..0fbac4f
--- /dev/null
+++ b/src/main/icons/linux/512.png
Binary files differ
diff --git a/src/main/icons/mac/1024.png b/src/main/icons/mac/1024.png
new file mode 100644
index 0000000..c1c8691
--- /dev/null
+++ b/src/main/icons/mac/1024.png
Binary files differ
diff --git a/src/main/icons/mac/128.png b/src/main/icons/mac/128.png
new file mode 100644
index 0000000..de9bee6
--- /dev/null
+++ b/src/main/icons/mac/128.png
Binary files differ
diff --git a/src/main/icons/mac/256.png b/src/main/icons/mac/256.png
new file mode 100644
index 0000000..c3a68b9
--- /dev/null
+++ b/src/main/icons/mac/256.png
Binary files differ
diff --git a/src/main/icons/mac/512.png b/src/main/icons/mac/512.png
new file mode 100644
index 0000000..b2fc07e
--- /dev/null
+++ b/src/main/icons/mac/512.png
Binary files differ
diff --git a/src/main/python/main.py b/src/main/python/main.py
new file mode 100644
index 0000000..88fc48b
--- /dev/null
+++ b/src/main/python/main.py
@@ -0,0 +1,79 @@
+from fbs_runtime.application_context.PyQt5 import ApplicationContext
+from PyQt5.QtCore import Qt
+from PyQt5.QtGui import (QBrush, QColor, QImage, QPainter,
+ QPalette)
+from PyQt5.QtWidgets import (QApplication, QComboBox, QDialog, QGraphicsScene,
+ QGraphicsView, QGridLayout, QHBoxLayout, QLabel,
+ QMessageBox, QPushButton, QStyleFactory)
+from utils.sizes import paperSizes
+import sys
+class appWindow(QDialog):
+ def __init__(self, parent=None):
+ super(appWindow, self).__init__(parent)
+
+ self._ppi = 72
+ self._canvasSize = "A0"
+ self.resize(1280, 720)
+
+
+ self.painter = QGraphicsScene(0, 0, *paperSizes[self.canvasSize][self.ppi])
+ self.painter.setBackgroundBrush(QBrush(Qt.white))
+
+ self.createToolbar()
+ self.canvas = QGraphicsView(self.painter)
+ mainLayout = QGridLayout()
+ mainLayout.addLayout(self.topLayout, 0, 0, 1, -1)
+ mainLayout.addWidget(self.canvas, 1, 0, -1, -1)
+ self.setLayout(mainLayout)
+
+ def createToolbar(self):
+ self.topLayout = QHBoxLayout()
+ sizeComboBox = QComboBox()
+ sizeComboBox.addItems([f'A{i}' for i in range(5)])
+ sizeComboBox.activated[str].connect(self.setCanvasSize)
+ sizeLabel = QLabel("Canvas Size")
+ sizeLabel.setBuddy(sizeComboBox)
+ self.topLayout.addWidget(sizeLabel)
+ self.topLayout.addWidget(sizeComboBox)
+
+ ppiComboBox = QComboBox()
+ ppiComboBox.addItems(["72", "96", "150", "300"])
+ ppiComboBox.activated[str].connect(self.setCanvasPPI)
+ ppiLabel = QLabel("Canvas ppi")
+ ppiLabel.setBuddy(ppiComboBox)
+ self.topLayout.addWidget(ppiLabel)
+ self.topLayout.addWidget(ppiComboBox)
+
+ def setCanvasSize(self, size):
+ self.canvasSize = size
+
+ def setCanvasPPI(self, ppi):
+ self.ppi = ppi
+
+ @property
+ def canvasSize(self):
+ return self._canvasSize
+ @property
+ def ppi(self):
+ return self._ppi
+
+ @canvasSize.setter
+ def canvasSize(self, size):
+ self._canvasSize = size
+ if self.painter:
+ self.painter.setSceneRect(0, 0, *paperSizes[self.canvasSize][self.ppi])
+ print(*paperSizes[self.canvasSize][self.ppi])
+
+ @ppi.setter
+ def ppi(self, ppi):
+ self._ppi = int(ppi)
+ if self.painter:
+ self.painter.setSceneRect(0, 0, *paperSizes[self.canvasSize][self.ppi])
+ print(*paperSizes[self.canvasSize][self.ppi])
+
+if __name__ == '__main__':
+ app = ApplicationContext() # 1. Instantiate ApplicationContext
+ test = appWindow()
+ test.show()
+ exit_code = app.app.exec_() # 2. Invoke appctxt.app.exec_()
+ sys.exit(exit_code) \ No newline at end of file
diff --git a/src/main/python/utils/__init__.py b/src/main/python/utils/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/main/python/utils/__init__.py
diff --git a/src/main/python/utils/sizes.py b/src/main/python/utils/sizes.py
new file mode 100644
index 0000000..fc444cf
--- /dev/null
+++ b/src/main/python/utils/sizes.py
@@ -0,0 +1,32 @@
+paperSizes = {
+ "A0": {
+ 72: {2384, 3370},
+ 96: {3179, 4494},
+ 150: {4967, 7022},
+ 300: {9933, 14043}
+ },
+ "A1": {
+ 72: {1684, 2384},
+ 96: {2245, 3179},
+ 150: {3508, 4967},
+ 300: {7016, 9933}
+ },
+ "A2": {
+ 72: {1191, 1684},
+ 96: {1587, 2245},
+ 150: {2480, 3508},
+ 300: {4960, 7016}
+ },
+ "A3": {
+ 72: {842, 1191},
+ 96: {1123, 1587},
+ 150: {1754, 2480},
+ 300: {3508, 4960}
+ },
+ "A4": {
+ 72: {595, 842},
+ 96: {794, 1123},
+ 150: {1240, 1754},
+ 300: {2480, 3508}
+ }
+} \ No newline at end of file