@@ -65,15 +65,15 @@ def __init__(self, toolName, brushSize, color,
65
65
66
66
Arguments:
67
67
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
71
69
color {QColor} -- the Color to be used
72
70
paintPattern {PaintPattern} -- the paint pattern that will be used
73
71
PaintBoard {PaintBoard} -- Parent class
74
72
iconPath {str} -- the path to the icon. duh...
75
73
shortcut {str} -- well. its a shortcut. nothing less, nothing more.
76
74
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
77
77
"""
78
78
79
79
self .toolName = toolName
@@ -264,12 +264,12 @@ def Setup(self):
264
264
(randint (5 , 30 ), 30 ) # randint(5,30)
265
265
)
266
266
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 ),
268
268
[randint (1 , 4 ), randint (1 , 2 ),
269
269
randint (0 , 3 ), randint (0 , 5 )], self ,
270
270
'Design/icons/Solid Brush.png' ,
271
271
"CTRL+J" , "Gosh, that is a hard tip" ,
272
- (1 , 1 )
272
+ (0 , 0 )
273
273
)
274
274
275
275
self .sunbathing_eraser = Tool ("Sunbathing Eraser" , 10 , Qt .white ,
@@ -385,7 +385,8 @@ def mouseMoveEvent(self, event):
385
385
self .drawing and self .currentTool is not None :
386
386
387
387
Pen = QPen ()
388
- if self .currentTool .toolName != "Sunbathing Eraser" :
388
+ if self .currentTool .toolName != \
389
+ "Sunbathing Eraser" or "Solid Brush" :
389
390
if self .currentTool .duration <= 0.0 :
390
391
Pen .setDashPattern ([0 , 0 , 0 , 0 ])
391
392
self .drawing = False
@@ -398,9 +399,9 @@ def mouseMoveEvent(self, event):
398
399
399
400
# this here is to add more realism
400
401
# to the point when its breaking
401
- if self .currentTool .duration <= 0.2 \
402
+ if self .currentTool .duration < 0.1 \
402
403
and self .currentTool .toolName != \
403
- 'A bucket' or 'Sunbathing Eraser' :
404
+ 'A bucket' and 'Sunbathing Eraser' :
404
405
dots = QPen ()
405
406
broken_tools = QPen ()
406
407
if self .currentTool .toolName == "Pointy Pen" :
@@ -410,7 +411,7 @@ def mouseMoveEvent(self, event):
410
411
broken_tools .setColor (self .currentTool .color )
411
412
broken_tools .setCapStyle (Qt .SquareCap )
412
413
broken_tools .setJoinStyle (Qt .BevelJoin )
413
- broken_tools .setWidth (self .currentTool .brushSize - 2 )
414
+ broken_tools .setWidth (self .currentTool .brushSize )
414
415
self .painter .setPen (broken_tools )
415
416
self .painter .drawLine (self .lastPoint , self .lastPoint )
416
417
dots .setCapStyle (Qt .RoundCap )
@@ -421,23 +422,19 @@ def mouseMoveEvent(self, event):
421
422
self .painter .setPen (dots )
422
423
self .painter .drawLine (self .lastPoint +
423
424
QPoint (randint (10 , 15 ),
424
- randint (1 , 5 )),
425
+ randint (5 , 10 )),
425
426
self .lastPoint +
426
427
QPoint (randint (5 , 10 ),
427
- randint (1 , 10 )))
428
+ randint (5 , 10 )))
428
429
429
430
if self .currentTool .toolName == "Pointy Pen" :
430
431
# QSound(SoundEffects['pen write']).play()
431
432
Pen .setCapStyle (Qt .RoundCap )
432
433
Pen .setJoinStyle (Qt .MiterJoin )
433
434
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 )
441
438
Pen .setColor (self .currentTool .color )
442
439
Pen .setWidth (self .currentTool .brushSize )
443
440
@@ -449,7 +446,8 @@ def mouseMoveEvent(self, event):
449
446
QPixmap ("Design/icons/Pointy Pen Broken.png" )))
450
447
# QSound(SoundEffects['pen break']).play()
451
448
452
- self .painter .drawLine (self .lastPoint , event .pos ())
449
+ if self .currentTool .toolName != 'Solid Brush' :
450
+ self .painter .drawLine (self .lastPoint , event .pos ())
453
451
self .lastPoint = event .pos ()
454
452
self .update ()
455
453
else :
@@ -531,7 +529,7 @@ def run(self):
531
529
Drip .setJoinStyle (Qt .RoundJoin )
532
530
Drip .setCapStyle (Qt .RoundCap )
533
531
self .drip .emit (Drip )
534
- print ('drip\n ' )
532
+ print ('drip' )
535
533
else :
536
534
pass
537
535
time .sleep (0.5 )
0 commit comments