Skip to content
This repository was archived by the owner on Mar 31, 2020. It is now read-only.

Commit 9f81761

Browse files
committed
optimized some of the code & added solid brush effect
1 parent fa5371a commit 9f81761

14 files changed

+50
-24
lines changed

.idea/workspace.xml

Lines changed: 32 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

project/ArtiQule.py

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,15 @@ def __init__(self, toolName, brushSize, color,
6565
6666
Arguments:
6767
toolName {str} -- Tools name for display
68-
duration {tuple} -- randint duration[0], max time[1]
69-
constDuration {int} -- the tool's duration time
70-
brushSize {float} -- tools brushsize
68+
brushSize {int} -- the Size of the Brush/Pen
7169
color {QColor} -- the Color to be used
7270
paintPattern {PaintPattern} -- the paint pattern that will be used
7371
PaintBoard {PaintBoard} -- Parent class
7472
iconPath {str} -- the path to the icon. duh...
7573
shortcut {str} -- well. its a shortcut. nothing less, nothing more.
7674
statusTip {str} -- the status tip that will be displayed...
75+
duration {int} -- the tool's duration time
76+
isDipped {bool} -- checks if the tool is dipped in paint
7777
"""
7878

7979
self.toolName = toolName
@@ -264,12 +264,12 @@ def Setup(self):
264264
(randint(5, 30), 30) # randint(5,30)
265265
)
266266

267-
self.solidifed_brush = Tool("Solid Brush", 10, QColor(0, 0, 0, 0.0),
267+
self.solidifed_brush = Tool("Solid Brush", 15, QColor(0, 0, 0, 0.0),
268268
[randint(1, 4), randint(1, 2),
269269
randint(0, 3), randint(0, 5)], self,
270270
'Design/icons/Solid Brush.png',
271271
"CTRL+J", "Gosh, that is a hard tip",
272-
(1, 1)
272+
(0, 0)
273273
)
274274

275275
self.sunbathing_eraser = Tool("Sunbathing Eraser", 10, Qt.white,
@@ -385,7 +385,8 @@ def mouseMoveEvent(self, event):
385385
self.drawing and self.currentTool is not None:
386386

387387
Pen = QPen()
388-
if self.currentTool.toolName != "Sunbathing Eraser":
388+
if self.currentTool.toolName != \
389+
"Sunbathing Eraser" or "Solid Brush":
389390
if self.currentTool.duration <= 0.0:
390391
Pen.setDashPattern([0, 0, 0, 0])
391392
self.drawing = False
@@ -398,9 +399,9 @@ def mouseMoveEvent(self, event):
398399

399400
# this here is to add more realism
400401
# to the point when its breaking
401-
if self.currentTool.duration <= 0.2 \
402+
if self.currentTool.duration < 0.1 \
402403
and self.currentTool.toolName != \
403-
'A bucket' or 'Sunbathing Eraser':
404+
'A bucket' and 'Sunbathing Eraser':
404405
dots = QPen()
405406
broken_tools = QPen()
406407
if self.currentTool.toolName == "Pointy Pen":
@@ -410,7 +411,7 @@ def mouseMoveEvent(self, event):
410411
broken_tools.setColor(self.currentTool.color)
411412
broken_tools.setCapStyle(Qt.SquareCap)
412413
broken_tools.setJoinStyle(Qt.BevelJoin)
413-
broken_tools.setWidth(self.currentTool.brushSize - 2)
414+
broken_tools.setWidth(self.currentTool.brushSize)
414415
self.painter.setPen(broken_tools)
415416
self.painter.drawLine(self.lastPoint, self.lastPoint)
416417
dots.setCapStyle(Qt.RoundCap)
@@ -421,23 +422,19 @@ def mouseMoveEvent(self, event):
421422
self.painter.setPen(dots)
422423
self.painter.drawLine(self.lastPoint +
423424
QPoint(randint(10, 15),
424-
randint(1, 5)),
425+
randint(5, 10)),
425426
self.lastPoint +
426427
QPoint(randint(5, 10),
427-
randint(1, 10)))
428+
randint(5, 10)))
428429

429430
if self.currentTool.toolName == "Pointy Pen":
430431
# QSound(SoundEffects['pen write']).play()
431432
Pen.setCapStyle(Qt.RoundCap)
432433
Pen.setJoinStyle(Qt.MiterJoin)
433434
elif self.currentTool.toolName == \
434-
'Straggly Paintbrush' or 'Solid Brush':
435-
if self.currentTool.toolName == "Solid Brush":
436-
Pen.setCapStyle(Qt.RoundCap)
437-
Pen.setJoinStyle(Qt.BevelJoin)
438-
else:
439-
Pen.setCapStyle(Qt.SquareCap)
440-
Pen.setJoinStyle(Qt.MiterJoin)
435+
'Straggly Paintbrush':
436+
Pen.setCapStyle(Qt.SquareCap)
437+
Pen.setJoinStyle(Qt.MiterJoin)
441438
Pen.setColor(self.currentTool.color)
442439
Pen.setWidth(self.currentTool.brushSize)
443440

@@ -449,7 +446,8 @@ def mouseMoveEvent(self, event):
449446
QPixmap("Design/icons/Pointy Pen Broken.png")))
450447
# QSound(SoundEffects['pen break']).play()
451448

452-
self.painter.drawLine(self.lastPoint, event.pos())
449+
if self.currentTool.toolName != 'Solid Brush':
450+
self.painter.drawLine(self.lastPoint, event.pos())
453451
self.lastPoint = event.pos()
454452
self.update()
455453
else:
@@ -531,7 +529,7 @@ def run(self):
531529
Drip.setJoinStyle(Qt.RoundJoin)
532530
Drip.setCapStyle(Qt.RoundCap)
533531
self.drip.emit(Drip)
534-
print('drip\n')
532+
print('drip')
535533
else:
536534
pass
537535
time.sleep(0.5)
-11.1 KB
Binary file not shown.

project/Design/sounds/fill bucket.mp3

-4.09 KB
Binary file not shown.
-7.51 KB
Binary file not shown.
-1.82 MB
Binary file not shown.
Binary file not shown.
Binary file not shown.

project/sounds/empty bucket.mp3

-11.1 KB
Binary file not shown.

project/sounds/fill bucket.mp3

-4.09 KB
Binary file not shown.

0 commit comments

Comments
 (0)