Modify Piecasso for building with PyInstaller.
1478
paint/MainWindow.py
BIN
paint/Piecasso.ifp
Normal file
Before Width: | Height: | Size: 758 B After Width: | Height: | Size: 758 B |
Before Width: | Height: | Size: 206 B After Width: | Height: | Size: 206 B |
Before Width: | Height: | Size: 755 B After Width: | Height: | Size: 755 B |
Before Width: | Height: | Size: 507 B After Width: | Height: | Size: 507 B |
Before Width: | Height: | Size: 671 B After Width: | Height: | Size: 671 B |
Before Width: | Height: | Size: 282 B After Width: | Height: | Size: 282 B |
Before Width: | Height: | Size: 247 B After Width: | Height: | Size: 247 B |
Before Width: | Height: | Size: 274 B After Width: | Height: | Size: 274 B |
Before Width: | Height: | Size: 445 B After Width: | Height: | Size: 445 B |
Before Width: | Height: | Size: 680 B After Width: | Height: | Size: 680 B |
Before Width: | Height: | Size: 761 B After Width: | Height: | Size: 761 B |
Before Width: | Height: | Size: 483 B After Width: | Height: | Size: 483 B |
Before Width: | Height: | Size: 643 B After Width: | Height: | Size: 643 B |
Before Width: | Height: | Size: 431 B After Width: | Height: | Size: 431 B |
Before Width: | Height: | Size: 646 B After Width: | Height: | Size: 646 B |
Before Width: | Height: | Size: 513 B After Width: | Height: | Size: 513 B |
Before Width: | Height: | Size: 704 B After Width: | Height: | Size: 704 B |
Before Width: | Height: | Size: 589 B After Width: | Height: | Size: 589 B |
Before Width: | Height: | Size: 697 B After Width: | Height: | Size: 697 B |
Before Width: | Height: | Size: 721 B After Width: | Height: | Size: 721 B |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
BIN
paint/icons/piecasso.ico
Normal file
After Width: | Height: | Size: 83 KiB |
BIN
paint/icons/piecasso.png
Normal file
After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 578 B After Width: | Height: | Size: 578 B |
Before Width: | Height: | Size: 715 B After Width: | Height: | Size: 715 B |
Before Width: | Height: | Size: 346 B After Width: | Height: | Size: 346 B |
Before Width: | Height: | Size: 231 B After Width: | Height: | Size: 231 B |
Before Width: | Height: | Size: 616 B After Width: | Height: | Size: 616 B |
Before Width: | Height: | Size: 621 B After Width: | Height: | Size: 621 B |
3204
paint/mainwindow.ui
@ -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
@ -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>
|
||||
|