Modify Piecasso for building with PyInstaller.

This commit is contained in:
Martin Fitzpatrick 2020-04-08 16:19:07 +02:00
parent dfc4bbf4b9
commit 002f0f800b
35 changed files with 27121 additions and 2344 deletions

View File

@ -2,16 +2,18 @@
# Form implementation generated from reading ui file 'mainwindow.ui'
#
# Created by: PyQt5 UI code generator 5.10
# Created by: PyQt5 UI code generator 5.13.0
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(549, 452)
MainWindow.resize(706, 556)
self.centralWidget = QtWidgets.QWidget(MainWindow)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Maximum)
sizePolicy.setHorizontalStretch(0)
@ -46,7 +48,7 @@ class Ui_MainWindow(object):
self.rectButton.setMaximumSize(QtCore.QSize(30, 30))
self.rectButton.setText("")
icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap("images/layer-shape.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
icon.addPixmap(QtGui.QPixmap(":/icons/layer-shape.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.rectButton.setIcon(icon)
self.rectButton.setCheckable(True)
self.rectButton.setObjectName("rectButton")
@ -56,7 +58,7 @@ class Ui_MainWindow(object):
self.polylineButton.setMaximumSize(QtCore.QSize(30, 30))
self.polylineButton.setText("")
icon1 = QtGui.QIcon()
icon1.addPixmap(QtGui.QPixmap("images/layer-shape-polyline.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
icon1.addPixmap(QtGui.QPixmap(":/icons/layer-shape-polyline.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.polylineButton.setIcon(icon1)
self.polylineButton.setCheckable(True)
self.polylineButton.setObjectName("polylineButton")
@ -71,7 +73,7 @@ class Ui_MainWindow(object):
self.selectrectButton.setMaximumSize(QtCore.QSize(30, 30))
self.selectrectButton.setText("")
icon2 = QtGui.QIcon()
icon2.addPixmap(QtGui.QPixmap("images/selection.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
icon2.addPixmap(QtGui.QPixmap(":/icons/selection.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.selectrectButton.setIcon(icon2)
self.selectrectButton.setCheckable(True)
self.selectrectButton.setObjectName("selectrectButton")
@ -86,7 +88,7 @@ class Ui_MainWindow(object):
self.eraserButton.setMaximumSize(QtCore.QSize(30, 30))
self.eraserButton.setText("")
icon3 = QtGui.QIcon()
icon3.addPixmap(QtGui.QPixmap("images/eraser.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
icon3.addPixmap(QtGui.QPixmap(":/icons/eraser.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.eraserButton.setIcon(icon3)
self.eraserButton.setCheckable(True)
self.eraserButton.setObjectName("eraserButton")
@ -101,7 +103,7 @@ class Ui_MainWindow(object):
self.stampButton.setMaximumSize(QtCore.QSize(30, 30))
self.stampButton.setText("")
icon4 = QtGui.QIcon()
icon4.addPixmap(QtGui.QPixmap("images/cake.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
icon4.addPixmap(QtGui.QPixmap(":/icons/cake.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.stampButton.setIcon(icon4)
self.stampButton.setCheckable(True)
self.stampButton.setObjectName("stampButton")
@ -116,7 +118,7 @@ class Ui_MainWindow(object):
self.dropperButton.setMaximumSize(QtCore.QSize(30, 30))
self.dropperButton.setText("")
icon5 = QtGui.QIcon()
icon5.addPixmap(QtGui.QPixmap("images/pipette.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
icon5.addPixmap(QtGui.QPixmap(":/icons/pipette.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.dropperButton.setIcon(icon5)
self.dropperButton.setCheckable(True)
self.dropperButton.setObjectName("dropperButton")
@ -131,7 +133,7 @@ class Ui_MainWindow(object):
self.selectpolyButton.setMaximumSize(QtCore.QSize(30, 30))
self.selectpolyButton.setText("")
icon6 = QtGui.QIcon()
icon6.addPixmap(QtGui.QPixmap("images/selection-poly.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
icon6.addPixmap(QtGui.QPixmap(":/icons/selection-poly.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.selectpolyButton.setIcon(icon6)
self.selectpolyButton.setCheckable(True)
self.selectpolyButton.setObjectName("selectpolyButton")
@ -146,7 +148,7 @@ class Ui_MainWindow(object):
self.brushButton.setMaximumSize(QtCore.QSize(30, 30))
self.brushButton.setText("")
icon7 = QtGui.QIcon()
icon7.addPixmap(QtGui.QPixmap("images/paint-brush.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
icon7.addPixmap(QtGui.QPixmap(":/icons/paint-brush.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.brushButton.setIcon(icon7)
self.brushButton.setCheckable(True)
self.brushButton.setObjectName("brushButton")
@ -161,7 +163,7 @@ class Ui_MainWindow(object):
self.penButton.setMaximumSize(QtCore.QSize(30, 30))
self.penButton.setText("")
icon8 = QtGui.QIcon()
icon8.addPixmap(QtGui.QPixmap("images/pencil.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
icon8.addPixmap(QtGui.QPixmap(":/icons/pencil.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.penButton.setIcon(icon8)
self.penButton.setCheckable(True)
self.penButton.setObjectName("penButton")
@ -176,7 +178,7 @@ class Ui_MainWindow(object):
self.fillButton.setMaximumSize(QtCore.QSize(30, 30))
self.fillButton.setText("")
icon9 = QtGui.QIcon()
icon9.addPixmap(QtGui.QPixmap("images/paint-can.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
icon9.addPixmap(QtGui.QPixmap(":/icons/paint-can.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.fillButton.setIcon(icon9)
self.fillButton.setCheckable(True)
self.fillButton.setObjectName("fillButton")
@ -191,7 +193,7 @@ class Ui_MainWindow(object):
self.textButton.setMaximumSize(QtCore.QSize(30, 30))
self.textButton.setText("")
icon10 = QtGui.QIcon()
icon10.addPixmap(QtGui.QPixmap("images/edit.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
icon10.addPixmap(QtGui.QPixmap(":/icons/edit.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.textButton.setIcon(icon10)
self.textButton.setCheckable(True)
self.textButton.setObjectName("textButton")
@ -201,7 +203,7 @@ class Ui_MainWindow(object):
self.polygonButton.setMaximumSize(QtCore.QSize(30, 30))
self.polygonButton.setText("")
icon11 = QtGui.QIcon()
icon11.addPixmap(QtGui.QPixmap("images/layer-shape-polygon.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
icon11.addPixmap(QtGui.QPixmap(":/icons/layer-shape-polygon.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.polygonButton.setIcon(icon11)
self.polygonButton.setCheckable(True)
self.polygonButton.setObjectName("polygonButton")
@ -211,7 +213,7 @@ class Ui_MainWindow(object):
self.roundrectButton.setMaximumSize(QtCore.QSize(30, 30))
self.roundrectButton.setText("")
icon12 = QtGui.QIcon()
icon12.addPixmap(QtGui.QPixmap("images/layer-shape-round.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
icon12.addPixmap(QtGui.QPixmap(":/icons/layer-shape-round.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.roundrectButton.setIcon(icon12)
self.roundrectButton.setCheckable(True)
self.roundrectButton.setObjectName("roundrectButton")
@ -221,7 +223,7 @@ class Ui_MainWindow(object):
self.ellipseButton.setMaximumSize(QtCore.QSize(30, 30))
self.ellipseButton.setText("")
icon13 = QtGui.QIcon()
icon13.addPixmap(QtGui.QPixmap("images/layer-shape-ellipse.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
icon13.addPixmap(QtGui.QPixmap(":/icons/layer-shape-ellipse.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.ellipseButton.setIcon(icon13)
self.ellipseButton.setCheckable(True)
self.ellipseButton.setObjectName("ellipseButton")
@ -231,7 +233,7 @@ class Ui_MainWindow(object):
self.lineButton.setMaximumSize(QtCore.QSize(30, 30))
self.lineButton.setText("")
icon14 = QtGui.QIcon()
icon14.addPixmap(QtGui.QPixmap("images/layer-shape-line.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
icon14.addPixmap(QtGui.QPixmap(":/icons/layer-shape-line.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.lineButton.setIcon(icon14)
self.lineButton.setCheckable(True)
self.lineButton.setObjectName("lineButton")
@ -246,7 +248,7 @@ class Ui_MainWindow(object):
self.sprayButton.setMaximumSize(QtCore.QSize(30, 30))
self.sprayButton.setText("")
icon15 = QtGui.QIcon()
icon15.addPixmap(QtGui.QPixmap("images/spray.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
icon15.addPixmap(QtGui.QPixmap(":/icons/spray.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.sprayButton.setIcon(icon15)
self.sprayButton.setCheckable(True)
self.sprayButton.setFlat(False)
@ -614,7 +616,7 @@ class Ui_MainWindow(object):
self.verticalLayout.addLayout(self.horizontalLayout_2)
MainWindow.setCentralWidget(self.centralWidget)
self.menuBar = QtWidgets.QMenuBar(MainWindow)
self.menuBar.setGeometry(QtCore.QRect(0, 0, 549, 22))
self.menuBar.setGeometry(QtCore.QRect(0, 0, 706, 26))
self.menuBar.setObjectName("menuBar")
self.menuFIle = QtWidgets.QMenu(self.menuBar)
self.menuFIle.setObjectName("menuFIle")
@ -646,12 +648,12 @@ class Ui_MainWindow(object):
self.actionClearImage.setObjectName("actionClearImage")
self.actionOpenImage = QtWidgets.QAction(MainWindow)
icon16 = QtGui.QIcon()
icon16.addPixmap(QtGui.QPixmap("images/blue-folder-open-image.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
icon16.addPixmap(QtGui.QPixmap(":/icons/blue-folder-open-image.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.actionOpenImage.setIcon(icon16)
self.actionOpenImage.setObjectName("actionOpenImage")
self.actionSaveImage = QtWidgets.QAction(MainWindow)
icon17 = QtGui.QIcon()
icon17.addPixmap(QtGui.QPixmap("images/disk.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
icon17.addPixmap(QtGui.QPixmap(":/icons/disk.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.actionSaveImage.setIcon(icon17)
self.actionSaveImage.setObjectName("actionSaveImage")
self.actionInvertColors = QtWidgets.QAction(MainWindow)
@ -662,31 +664,31 @@ class Ui_MainWindow(object):
self.actionFlipVertical.setObjectName("actionFlipVertical")
self.actionNewImage = QtWidgets.QAction(MainWindow)
icon18 = QtGui.QIcon()
icon18.addPixmap(QtGui.QPixmap("images/document-image.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
icon18.addPixmap(QtGui.QPixmap(":/icons/document-image.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.actionNewImage.setIcon(icon18)
self.actionNewImage.setObjectName("actionNewImage")
self.actionBold = QtWidgets.QAction(MainWindow)
self.actionBold.setCheckable(True)
icon19 = QtGui.QIcon()
icon19.addPixmap(QtGui.QPixmap("images/edit-bold.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
icon19.addPixmap(QtGui.QPixmap(":/icons/edit-bold.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.actionBold.setIcon(icon19)
self.actionBold.setObjectName("actionBold")
self.actionItalic = QtWidgets.QAction(MainWindow)
self.actionItalic.setCheckable(True)
icon20 = QtGui.QIcon()
icon20.addPixmap(QtGui.QPixmap("images/edit-italic.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
icon20.addPixmap(QtGui.QPixmap(":/icons/edit-italic.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.actionItalic.setIcon(icon20)
self.actionItalic.setObjectName("actionItalic")
self.actionUnderline = QtWidgets.QAction(MainWindow)
self.actionUnderline.setCheckable(True)
icon21 = QtGui.QIcon()
icon21.addPixmap(QtGui.QPixmap("images/edit-underline.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
icon21.addPixmap(QtGui.QPixmap(":/icons/edit-underline.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.actionUnderline.setIcon(icon21)
self.actionUnderline.setObjectName("actionUnderline")
self.actionFillShapes = QtWidgets.QAction(MainWindow)
self.actionFillShapes.setCheckable(True)
icon22 = QtGui.QIcon()
icon22.addPixmap(QtGui.QPixmap("images/paint-can-color.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
icon22.addPixmap(QtGui.QPixmap(":/icons/paint-can-color.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.actionFillShapes.setIcon(icon22)
self.actionFillShapes.setObjectName("actionFillShapes")
self.menuFIle.addAction(self.actionNewImage)
@ -735,4 +737,4 @@ class Ui_MainWindow(object):
self.actionItalic.setShortcut(_translate("MainWindow", "Ctrl+I"))
self.actionUnderline.setText(_translate("MainWindow", "Underline"))
self.actionFillShapes.setText(_translate("MainWindow", "Fill Shapes?"))
import resources_rc

BIN
paint/Piecasso.ifp Normal file

Binary file not shown.

View File

Before

Width:  |  Height:  |  Size: 758 B

After

Width:  |  Height:  |  Size: 758 B

View File

Before

Width:  |  Height:  |  Size: 206 B

After

Width:  |  Height:  |  Size: 206 B

View File

Before

Width:  |  Height:  |  Size: 755 B

After

Width:  |  Height:  |  Size: 755 B

View File

Before

Width:  |  Height:  |  Size: 507 B

After

Width:  |  Height:  |  Size: 507 B

View File

Before

Width:  |  Height:  |  Size: 671 B

After

Width:  |  Height:  |  Size: 671 B

View File

Before

Width:  |  Height:  |  Size: 282 B

After

Width:  |  Height:  |  Size: 282 B

View File

Before

Width:  |  Height:  |  Size: 247 B

After

Width:  |  Height:  |  Size: 247 B

View File

Before

Width:  |  Height:  |  Size: 274 B

After

Width:  |  Height:  |  Size: 274 B

View File

Before

Width:  |  Height:  |  Size: 445 B

After

Width:  |  Height:  |  Size: 445 B

View File

Before

Width:  |  Height:  |  Size: 680 B

After

Width:  |  Height:  |  Size: 680 B

View File

Before

Width:  |  Height:  |  Size: 761 B

After

Width:  |  Height:  |  Size: 761 B

View File

Before

Width:  |  Height:  |  Size: 483 B

After

Width:  |  Height:  |  Size: 483 B

View File

Before

Width:  |  Height:  |  Size: 643 B

After

Width:  |  Height:  |  Size: 643 B

View File

Before

Width:  |  Height:  |  Size: 431 B

After

Width:  |  Height:  |  Size: 431 B

View File

Before

Width:  |  Height:  |  Size: 646 B

After

Width:  |  Height:  |  Size: 646 B

View File

Before

Width:  |  Height:  |  Size: 513 B

After

Width:  |  Height:  |  Size: 513 B

View File

Before

Width:  |  Height:  |  Size: 704 B

After

Width:  |  Height:  |  Size: 704 B

View File

Before

Width:  |  Height:  |  Size: 589 B

After

Width:  |  Height:  |  Size: 589 B

View File

Before

Width:  |  Height:  |  Size: 697 B

After

Width:  |  Height:  |  Size: 697 B

View File

Before

Width:  |  Height:  |  Size: 721 B

After

Width:  |  Height:  |  Size: 721 B

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
paint/icons/piecasso.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 KiB

BIN
paint/icons/piecasso.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

Before

Width:  |  Height:  |  Size: 578 B

After

Width:  |  Height:  |  Size: 578 B

View File

Before

Width:  |  Height:  |  Size: 715 B

After

Width:  |  Height:  |  Size: 715 B

View File

Before

Width:  |  Height:  |  Size: 346 B

After

Width:  |  Height:  |  Size: 346 B

View File

Before

Width:  |  Height:  |  Size: 231 B

After

Width:  |  Height:  |  Size: 231 B

View File

Before

Width:  |  Height:  |  Size: 616 B

After

Width:  |  Height:  |  Size: 616 B

View File

Before

Width:  |  Height:  |  Size: 621 B

After

Width:  |  Height:  |  Size: 621 B

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>549</width>
<height>452</height>
<width>706</width>
<height>556</height>
</rect>
</property>
<property name="windowTitle">
@ -58,8 +58,8 @@
<string/>
</property>
<property name="icon">
<iconset>
<normaloff>images/layer-shape.png</normaloff>images/layer-shape.png</iconset>
<iconset resource="resources.qrc">
<normaloff>:/icons/layer-shape.png</normaloff>:/icons/layer-shape.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
@ -84,8 +84,8 @@
<string/>
</property>
<property name="icon">
<iconset>
<normaloff>images/layer-shape-polyline.png</normaloff>images/layer-shape-polyline.png</iconset>
<iconset resource="resources.qrc">
<normaloff>:/icons/layer-shape-polyline.png</normaloff>:/icons/layer-shape-polyline.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
@ -116,8 +116,8 @@
<string/>
</property>
<property name="icon">
<iconset>
<normaloff>images/selection.png</normaloff>images/selection.png</iconset>
<iconset resource="resources.qrc">
<normaloff>:/icons/selection.png</normaloff>:/icons/selection.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
@ -148,8 +148,8 @@
<string/>
</property>
<property name="icon">
<iconset>
<normaloff>images/eraser.png</normaloff>images/eraser.png</iconset>
<iconset resource="resources.qrc">
<normaloff>:/icons/eraser.png</normaloff>:/icons/eraser.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
@ -180,8 +180,8 @@
<string/>
</property>
<property name="icon">
<iconset>
<normaloff>images/cake.png</normaloff>images/cake.png</iconset>
<iconset resource="resources.qrc">
<normaloff>:/icons/cake.png</normaloff>:/icons/cake.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
@ -212,8 +212,8 @@
<string/>
</property>
<property name="icon">
<iconset>
<normaloff>images/pipette.png</normaloff>images/pipette.png</iconset>
<iconset resource="resources.qrc">
<normaloff>:/icons/pipette.png</normaloff>:/icons/pipette.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
@ -244,8 +244,8 @@
<string/>
</property>
<property name="icon">
<iconset>
<normaloff>images/selection-poly.png</normaloff>images/selection-poly.png</iconset>
<iconset resource="resources.qrc">
<normaloff>:/icons/selection-poly.png</normaloff>:/icons/selection-poly.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
@ -276,8 +276,8 @@
<string/>
</property>
<property name="icon">
<iconset>
<normaloff>images/paint-brush.png</normaloff>images/paint-brush.png</iconset>
<iconset resource="resources.qrc">
<normaloff>:/icons/paint-brush.png</normaloff>:/icons/paint-brush.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
@ -308,8 +308,8 @@
<string/>
</property>
<property name="icon">
<iconset>
<normaloff>images/pencil.png</normaloff>images/pencil.png</iconset>
<iconset resource="resources.qrc">
<normaloff>:/icons/pencil.png</normaloff>:/icons/pencil.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
@ -340,8 +340,8 @@
<string/>
</property>
<property name="icon">
<iconset>
<normaloff>images/paint-can.png</normaloff>images/paint-can.png</iconset>
<iconset resource="resources.qrc">
<normaloff>:/icons/paint-can.png</normaloff>:/icons/paint-can.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
@ -372,8 +372,8 @@
<string/>
</property>
<property name="icon">
<iconset>
<normaloff>images/edit.png</normaloff>images/edit.png</iconset>
<iconset resource="resources.qrc">
<normaloff>:/icons/edit.png</normaloff>:/icons/edit.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
@ -398,8 +398,8 @@
<string/>
</property>
<property name="icon">
<iconset>
<normaloff>images/layer-shape-polygon.png</normaloff>images/layer-shape-polygon.png</iconset>
<iconset resource="resources.qrc">
<normaloff>:/icons/layer-shape-polygon.png</normaloff>:/icons/layer-shape-polygon.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
@ -424,8 +424,8 @@
<string/>
</property>
<property name="icon">
<iconset>
<normaloff>images/layer-shape-round.png</normaloff>images/layer-shape-round.png</iconset>
<iconset resource="resources.qrc">
<normaloff>:/icons/layer-shape-round.png</normaloff>:/icons/layer-shape-round.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
@ -450,8 +450,8 @@
<string/>
</property>
<property name="icon">
<iconset>
<normaloff>images/layer-shape-ellipse.png</normaloff>images/layer-shape-ellipse.png</iconset>
<iconset resource="resources.qrc">
<normaloff>:/icons/layer-shape-ellipse.png</normaloff>:/icons/layer-shape-ellipse.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
@ -476,8 +476,8 @@
<string/>
</property>
<property name="icon">
<iconset>
<normaloff>images/layer-shape-line.png</normaloff>images/layer-shape-line.png</iconset>
<iconset resource="resources.qrc">
<normaloff>:/icons/layer-shape-line.png</normaloff>:/icons/layer-shape-line.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
@ -508,8 +508,8 @@
<string/>
</property>
<property name="icon">
<iconset>
<normaloff>images/spray.png</normaloff>images/spray.png</iconset>
<iconset resource="resources.qrc">
<normaloff>:/icons/spray.png</normaloff>:/icons/spray.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
@ -1391,8 +1391,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>549</width>
<height>22</height>
<width>706</width>
<height>26</height>
</rect>
</property>
<widget class="QMenu" name="menuFIle">
@ -1500,8 +1500,8 @@
</action>
<action name="actionOpenImage">
<property name="icon">
<iconset>
<normaloff>images/blue-folder-open-image.png</normaloff>images/blue-folder-open-image.png</iconset>
<iconset resource="resources.qrc">
<normaloff>:/icons/blue-folder-open-image.png</normaloff>:/icons/blue-folder-open-image.png</iconset>
</property>
<property name="text">
<string>Open Image...</string>
@ -1509,8 +1509,8 @@
</action>
<action name="actionSaveImage">
<property name="icon">
<iconset>
<normaloff>images/disk.png</normaloff>images/disk.png</iconset>
<iconset resource="resources.qrc">
<normaloff>:/icons/disk.png</normaloff>:/icons/disk.png</iconset>
</property>
<property name="text">
<string>Save Image As...</string>
@ -1533,8 +1533,8 @@
</action>
<action name="actionNewImage">
<property name="icon">
<iconset>
<normaloff>images/document-image.png</normaloff>images/document-image.png</iconset>
<iconset resource="resources.qrc">
<normaloff>:/icons/document-image.png</normaloff>:/icons/document-image.png</iconset>
</property>
<property name="text">
<string>New Image</string>
@ -1545,8 +1545,8 @@
<bool>true</bool>
</property>
<property name="icon">
<iconset>
<normaloff>images/edit-bold.png</normaloff>images/edit-bold.png</iconset>
<iconset resource="resources.qrc">
<normaloff>:/icons/edit-bold.png</normaloff>:/icons/edit-bold.png</iconset>
</property>
<property name="text">
<string>Bold</string>
@ -1560,8 +1560,8 @@
<bool>true</bool>
</property>
<property name="icon">
<iconset>
<normaloff>images/edit-italic.png</normaloff>images/edit-italic.png</iconset>
<iconset resource="resources.qrc">
<normaloff>:/icons/edit-italic.png</normaloff>:/icons/edit-italic.png</iconset>
</property>
<property name="text">
<string>Italic</string>
@ -1575,8 +1575,8 @@
<bool>true</bool>
</property>
<property name="icon">
<iconset>
<normaloff>images/edit-underline.png</normaloff>images/edit-underline.png</iconset>
<iconset resource="resources.qrc">
<normaloff>:/icons/edit-underline.png</normaloff>:/icons/edit-underline.png</iconset>
</property>
<property name="text">
<string>Underline</string>
@ -1587,8 +1587,8 @@
<bool>true</bool>
</property>
<property name="icon">
<iconset>
<normaloff>images/paint-can-color.png</normaloff>images/paint-can-color.png</iconset>
<iconset resource="resources.qrc">
<normaloff>:/icons/paint-can-color.png</normaloff>:/icons/paint-can-color.png</iconset>
</property>
<property name="text">
<string>Fill Shapes?</string>
@ -1596,6 +1596,8 @@
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>
<resources>
<include location="resources.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -2,12 +2,26 @@ from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
from PyQt5 import QtGui, QtWidgets, QtCore
from PyQt5.QtGui import QPainter, QBitmap, QPolygon, QPen, QBrush, QColor
from PyQt5.QtCore import Qt
from MainWindow import Ui_MainWindow
import os
import sys
import random
import types
try:
# Include in try/except block if you're also targeting Mac/Linux
from PyQt5.QtWinExtras import QtWin
myappid = 'com.learnpyqt.minute-apps.paint'
QtWin.setCurrentProcessExplicitAppUserModelID(myappid)
except ImportError:
pass
BRUSH_MULT = 3
SPRAY_PAINT_MULT = 5
@ -36,8 +50,16 @@ MODES = [
CANVAS_DIMENSIONS = 600, 400
STAMP_DIR = './stamps'
STAMPS = [os.path.join(STAMP_DIR, f) for f in os.listdir(STAMP_DIR)]
STAMPS = [
':/stamps/pie-apple.png',
':/stamps/pie-cherry.png',
':/stamps/pie-cherry2.png',
':/stamps/pie-lemon.png',
':/stamps/pie-moon.png',
':/stamps/pie-pork.png',
':/stamps/pie-pumpkin.png',
':/stamps/pie-walnut.png',
]
SELECTION_PEN = QPen(QColor(0xff, 0xff, 0xff), 1, Qt.DashLine)
PREVIEW_PEN = QPen(QColor(0xff, 0xff, 0xff), 1, Qt.SolidLine)
@ -222,7 +244,8 @@ class Canvas(QLabel):
bitmap.clear() # Starts with random data visible.
p = QPainter(bitmap)
# Construct a mask where the user selected area will be kept, the rest removed from the image is transparent.
# Construct a mask where the user selected area will be kept,
# the rest removed from the image is transparent.
userpoly = QPolygon(self.history_pos + [self.current_pos])
p.setPen(QPen(Qt.color1))
p.setBrush(QBrush(Qt.color1)) # Solid color, Qt.color1 == bit on.
@ -764,7 +787,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self.actionUnderline.triggered.connect(lambda s: self.canvas.set_config('underline', s))
sizeicon = QLabel()
sizeicon.setPixmap(QPixmap(os.path.join('images', 'border-weight.png')))
sizeicon.setPixmap(QPixmap(':/icons/border-weight.png'))
self.drawingToolbar.addWidget(sizeicon)
self.sizeselect = QSlider()
self.sizeselect.setRange(1,20)
@ -878,6 +901,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
if __name__ == '__main__':
app = QApplication([])
app = QApplication(sys.argv)
app.setWindowIcon(QtGui.QIcon(':/icons/piecasso.ico'))
window = MainWindow()
app.exec_()

45
paint/resources.qrc Normal file
View File

@ -0,0 +1,45 @@
<!DOCTYPE RCC>
<RCC version="1.0">
<qresource prefix="icons">
<file alias="piecasso.ico">icons/piecasso.ico</file>
<file alias="blue-folder-open-image.png">icons/blue-folder-open-image.png</file>
<file alias="border-weight.png">icons/border-weight.png</file>
<file alias="cake.png">icons/cake.png</file>
<file alias="disk.png">icons/disk.png</file>
<file alias="document-image.png">icons/document-image.png</file>
<file alias="edit-bold.png">icons/edit-bold.png</file>
<file alias="edit-italic.png">icons/edit-italic.png</file>
<file alias="edit-underline.png">icons/edit-underline.png</file>
<file alias="edit.png">icons/edit.png</file>
<file alias="eraser.png">icons/eraser.png</file>
<file alias="layer-shape-ellipse.png">icons/layer-shape-ellipse.png</file>
<file alias="layer-shape-line.png">icons/layer-shape-line.png</file>
<file alias="layer-shape-polygon.png">icons/layer-shape-polygon.png</file>
<file alias="layer-shape-polyline.png">icons/layer-shape-polyline.png</file>
<file alias="layer-shape-round.png">icons/layer-shape-round.png</file>
<file alias="layer-shape.png">icons/layer-shape.png</file>
<file alias="magnifier-zoom.png">icons/magnifier-zoom.png</file>
<file alias="paint-brush.png">icons/paint-brush.png</file>
<file alias="paint-can-color.png">icons/paint-can-color.png</file>
<file alias="paint-can.png">icons/paint-can.png</file>
<file alias="pencil.png">icons/pencil.png</file>
<file alias="pipette.png">icons/pipette.png</file>
<file alias="printer.png">icons/printer.png</file>
<file alias="selection-poly.png">icons/selection-poly.png</file>
<file alias="selection.png">icons/selection.png</file>
<file alias="spray.png">icons/spray.png</file>
<file alias="stamp.png">icons/stamp.png</file>
</qresource>
<qresource prefix="stamps">
<file alias="pie-apple.png">stamps/pie-apple.png</file>
<file alias="pie-cherry.png">stamps/pie-cherry.png</file>
<file alias="pie-cherry2.png">stamps/pie-cherry2.png</file>
<file alias="pie-lemon.png">stamps/pie-lemon.png</file>
<file alias="pie-moon.png">stamps/pie-moon.png</file>
<file alias="pie-pork.png">stamps/pie-pork.png</file>
<file alias="pie-pumpkin.png">stamps/pie-pumpkin.png</file>
<file alias="pie-walnut.png">stamps/pie-walnut.png</file>
</qresource>
</RCC>

24704
paint/resources_rc.py Normal file

File diff suppressed because it is too large Load Diff