@@ -184,7 +184,6 @@ def mixColor(self, tool):
184184 tool .isDipped = True
185185 elif tool .toolName == "A bucket" and self .alpha :
186186 """The pallette gets emptied """
187- print ('bucket selected' )
188187 self .r = 0
189188 self .g = 0
190189 self .b = 0
@@ -333,7 +332,8 @@ def connectTool(self, curTool=None, curisDipped=False):
333332 if self .currentTool .toolName != \
334333 "Pointy Pen" or \
335334 "A bucket" or \
336- "Sunbathing Eraser" \
335+ "Sunbathing Eraser" or \
336+ "A bucket filled" \
337337 and self .currentTool .isDipped :
338338 self .dripper = DripperEffect (
339339 self .currentTool .color ,
@@ -452,11 +452,9 @@ def colorBoxRun(self):
452452
453453 def dripperHandler (self , result ):
454454 Dripper = result
455- print ('drip' )
456455 self .painter .setPen (Dripper )
457456 point = QPoint (self .cursor ().pos ().x (), self .cursor ().pos ().y ())
458457 point = self .mapFromGlobal (point )
459- print (point .x (), point .y ())
460458 self .painter .drawLine (point , point )
461459 self .update ()
462460
@@ -466,7 +464,6 @@ def mousePressEvent(self, event):
466464 self .drawing = True
467465 if self .currentTool .toolName == "A bucket filled" \
468466 and self .currentTool .duration >= 0 :
469- print (self .currentTool .toolName )
470467 Pen = QPen ()
471468 Pen .setColor (self .currentTool .color )
472469 Pen .setWidth (self .currentTool .brushSize )
@@ -476,15 +473,13 @@ def mousePressEvent(self, event):
476473 self .currentTool .toolName = "A bucket"
477474 self .currentTool .color = QColor (0 , 0 , 0 , 0 )
478475 self .connectTool (self .currentTool )
479- print ('used bucket' )
480476
481477 self .lastPoint = event .pos ()
482478 self .update ()
483479 else :
484480 return None
485481
486482 def mouseMoveEvent (self , event ):
487- print ("hey" )
488483 self .mousePos = event .pos ()
489484 if (event .buttons () and Qt .LeftButton ) and \
490485 self .drawing and self .currentTool is not None :
@@ -494,23 +489,33 @@ def mouseMoveEvent(self, event):
494489 if self .currentTool .duration <= 0.0 :
495490 Pen .setDashPattern ([0 , 0 , 0 , 0 ])
496491 self .drawing = False
492+ self .dripper .stop ()
497493 else :
498494 self .currentTool .duration -= 0.1
499495 if "Brush" in self .currentTool .toolName :
500496 self .currentTool .opacityDuration -= 0.0125
501- # TODO EXTRA: find more fitting duration time
502497 # perhaps divide in class object
503498
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 )
514519 self .painter .drawLine (self .lastPoint + QPoint (randint (10 , 15 ), randint (1 , 5 )),
515520 self .lastPoint + QPoint (randint (5 , 10 ), randint (1 , 10 )))
516521
@@ -598,7 +603,8 @@ class DripperEffect(QThread):
598603 def __init__ (self , color , size ):
599604 QThread .__init__ (self )
600605 self .color = color
601- self .size = size
606+ self .size = size * 2
607+ print ('size: ' + str (self .size ))
602608 self ._stop = False
603609
604610 def stop (self ):
@@ -616,6 +622,7 @@ def run(self):
616622 Drip .setJoinStyle (Qt .RoundJoin )
617623 Drip .setCapStyle (Qt .RoundCap )
618624 self .drip .emit (Drip )
625+ print ('drip' )
619626 else :
620627 pass
621628 time .sleep (0.5 )
0 commit comments