@@ -184,7 +184,6 @@ def mixColor(self, tool):
184
184
tool .isDipped = True
185
185
elif tool .toolName == "A bucket" and self .alpha :
186
186
"""The pallette gets emptied """
187
- print ('bucket selected' )
188
187
self .r = 0
189
188
self .g = 0
190
189
self .b = 0
@@ -333,7 +332,8 @@ def connectTool(self, curTool=None, curisDipped=False):
333
332
if self .currentTool .toolName != \
334
333
"Pointy Pen" or \
335
334
"A bucket" or \
336
- "Sunbathing Eraser" \
335
+ "Sunbathing Eraser" or \
336
+ "A bucket filled" \
337
337
and self .currentTool .isDipped :
338
338
self .dripper = DripperEffect (
339
339
self .currentTool .color ,
@@ -452,11 +452,9 @@ def colorBoxRun(self):
452
452
453
453
def dripperHandler (self , result ):
454
454
Dripper = result
455
- print ('drip' )
456
455
self .painter .setPen (Dripper )
457
456
point = QPoint (self .cursor ().pos ().x (), self .cursor ().pos ().y ())
458
457
point = self .mapFromGlobal (point )
459
- print (point .x (), point .y ())
460
458
self .painter .drawLine (point , point )
461
459
self .update ()
462
460
@@ -466,7 +464,6 @@ def mousePressEvent(self, event):
466
464
self .drawing = True
467
465
if self .currentTool .toolName == "A bucket filled" \
468
466
and self .currentTool .duration >= 0 :
469
- print (self .currentTool .toolName )
470
467
Pen = QPen ()
471
468
Pen .setColor (self .currentTool .color )
472
469
Pen .setWidth (self .currentTool .brushSize )
@@ -476,15 +473,13 @@ def mousePressEvent(self, event):
476
473
self .currentTool .toolName = "A bucket"
477
474
self .currentTool .color = QColor (0 , 0 , 0 , 0 )
478
475
self .connectTool (self .currentTool )
479
- print ('used bucket' )
480
476
481
477
self .lastPoint = event .pos ()
482
478
self .update ()
483
479
else :
484
480
return None
485
481
486
482
def mouseMoveEvent (self , event ):
487
- print ("hey" )
488
483
self .mousePos = event .pos ()
489
484
if (event .buttons () and Qt .LeftButton ) and \
490
485
self .drawing and self .currentTool is not None :
@@ -494,23 +489,33 @@ def mouseMoveEvent(self, event):
494
489
if self .currentTool .duration <= 0.0 :
495
490
Pen .setDashPattern ([0 , 0 , 0 , 0 ])
496
491
self .drawing = False
492
+ self .dripper .stop ()
497
493
else :
498
494
self .currentTool .duration -= 0.1
499
495
if "Brush" in self .currentTool .toolName :
500
496
self .currentTool .opacityDuration -= 0.0125
501
- # TODO EXTRA: find more fitting duration time
502
497
# perhaps divide in class object
503
498
504
- # this here is to add more realism to the point when its breaking
505
- if self .currentTool .duration <= 0.5 and self .currentTool .toolName == "Pointy Pen" :
506
- broken_pen = QPen ()
507
- broken_pen .setCapStyle (Qt .RoundCap )
508
- broken_pen .setJoinStyle (Qt .MiterJoin )
509
- broken_pen .setWidth (1 )
510
- broken_pen .setColor (self .currentTool .color )
511
- broken_pen .setDashPattern ([25 , 50 , 25 , 50 ])
512
- broken_pen .setStyle (Qt .DashDotDotLine )
513
- self .painter .setPen (broken_pen )
499
+ # this here is to add more realism to the point when its breaking
500
+ if self .currentTool .duration <= 0.2 :
501
+ dots = QPen ()
502
+ broken_tools = QPen ()
503
+ if self .currentTool .toolName == "Pointy Pen" :
504
+ dots .setColor (Qt .black )
505
+ dots .setWidth (1 )
506
+ if self .currentTool .toolName == "Solid Brush" :
507
+ broken_tools .setColor (self .currentTool .color )
508
+ broken_tools .setCapStyle (Qt .SquareCap )
509
+ broken_tools .setJoinStyle (Qt .BevelJoin )
510
+ broken_tools .setWidth (self .currentTool .brushSize - 2 )
511
+ self .painter .setPen (broken_tools )
512
+ self .painter .drawLine (self .lastPoint , self .lastPoint )
513
+ dots .setCapStyle (Qt .RoundCap )
514
+ dots .setJoinStyle (Qt .RoundJoin )
515
+ dots .setColor (self .currentTool .color )
516
+ dots .setDashPattern ([25 , 50 , 25 , 50 ])
517
+ dots .setStyle (Qt .DashDotDotLine )
518
+ self .painter .setPen (dots )
514
519
self .painter .drawLine (self .lastPoint + QPoint (randint (10 , 15 ), randint (1 , 5 )),
515
520
self .lastPoint + QPoint (randint (5 , 10 ), randint (1 , 10 )))
516
521
@@ -598,7 +603,8 @@ class DripperEffect(QThread):
598
603
def __init__ (self , color , size ):
599
604
QThread .__init__ (self )
600
605
self .color = color
601
- self .size = size
606
+ self .size = size * 2
607
+ print ('size: ' + str (self .size ))
602
608
self ._stop = False
603
609
604
610
def stop (self ):
@@ -616,6 +622,7 @@ def run(self):
616
622
Drip .setJoinStyle (Qt .RoundJoin )
617
623
Drip .setCapStyle (Qt .RoundCap )
618
624
self .drip .emit (Drip )
625
+ print ('drip' )
619
626
else :
620
627
pass
621
628
time .sleep (0.5 )
0 commit comments