@@ -140,13 +140,14 @@ def __init__(self, parent=None):
140140 self .setFixedSize (1000 , 500 )
141141 self .setWindowTitle ('ArtiQule' )
142142 self .setWindowIcon (QIcon ("Design/icons/app_logo.png" ))
143-
144143 self .Setup ()
145144
146145 def Setup (self ):
147146 self .canvas = QImage (self .size (), QImage .Format_RGB32 )
148147 self .canvas .fill (Qt .white )
149148 self .changePaintBoardVars ()
149+ self .painter = QPainter (self .canvas )
150+ self .ToolDead = False
150151
151152 # patterns = [] # TODO: custom paintPatterns here
152153
@@ -183,6 +184,7 @@ def Setup(self):
183184 exit_action .triggered .connect (self .exit )
184185
185186 self .toolbar = self .addToolBar ("Toolbar" )
187+ self .toolbar .setStyleSheet ('background-color: white' )
186188
187189 self .pointy_pen = Tool ("Pointy Pen" , 1 , Qt .black ,
188190 [randint (1 , 4 ), randint (1 , 2 ), randint (0 , 3 ),
@@ -268,7 +270,6 @@ def colorBoxRun(self):
268270 colorBox .addPallette (p2 )
269271 p3 .setStyleSheet ("background-color: rgb{0}"
270272 .format (c3 .color ))
271- print ("background-color: rgb{0}" .format (c3 .color ))
272273 p3 .clicked .connect (lambda : c3 .mixColor (self .currentTool ))
273274 colorBox .addPallette (p3 )
274275 p4 .setStyleSheet ("background-color: rgb{0};"
@@ -279,7 +280,7 @@ def colorBoxRun(self):
279280 .format (c5 .color ))
280281 p5 .clicked .connect (lambda : c5 .mixColor (self .currentTool ))
281282 colorBox .addPallette (p5 )
282- p1 .setStyleSheet ("background-color: rgb{0}"
283+ p6 .setStyleSheet ("background-color: rgb{0}"
283284 .format (c6 .color ))
284285 p6 .clicked .connect (lambda : c6 .mixColor (self .currentTool ))
285286 colorBox .addPallette (p6 )
@@ -291,28 +292,29 @@ def mousePressEvent(self, event):
291292 if event .button () == Qt .LeftButton :
292293 self .drawing = True
293294 if self .currentToolName == "A Bucket" :
294- painter = QPainter (self .canvas )
295295 Pen = QPen ()
296296 Pen .setWidth (self .currentBrushSize )
297297 Pen .setColor (self .currentBrushColor )
298- painter .setPen (Pen )
299- painter .drawLine (0 , 0 , 1000 , 500 )
300- print ('called directly' )
298+ self .painter .setPen (Pen )
299+ self .painter .drawLine (0 , 0 , 1000 , 500 )
301300 self .lastPoint = event .pos ()
302301 self .update ()
303302
304303 def mouseMoveEvent (self , event ):
305304 if (event .buttons () and Qt .LeftButton ) and \
306305 self .drawing and self .currentToolName is not None :
307- painter = QPainter ( self . canvas )
306+
308307 Pen = QPen ()
309- if self .currentToolName != "A Bucket" :
308+ if self .currentToolName != "A Bucket" and \
309+ self .currentToolName != "Eraser" :
310310 if self .currentToolDuration <= 0.0 :
311+ self .ToolDead = True
311312 print ('Tools Died' )
312313 self .currentToolDuration = 0
313314 Pen .setDashPattern ([0 , 0 , 0 , 0 ])
314315 self .drawing = False
315316 else :
317+ self .ToolDead = False
316318 self .currentToolDuration -= 0.01
317319 # print(self.currentToolDuration)
318320
@@ -329,11 +331,15 @@ def mouseMoveEvent(self, event):
329331 Pen .setJoinStyle (Qt .MiterJoin )
330332 Pen .setColor (self .currentBrushColor )
331333 Pen .setWidth (self .currentBrushSize )
332- painter .setPen (Pen )
333- if event .pos ().y () > 53 and self .currentToolName is not None :
334- painter .drawLine (self .lastPoint , event .pos ())
335- self .lastPoint = event .pos ()
336- self .update ()
334+ self .painter .setPen (Pen )
335+ if self .ToolDead is True :
336+ if self .currentToolName == "Pointy Pen" :
337+ self .setCursor (QCursor (
338+ QPixmap ("Design/icons/Pointy Pen Broken.png" )))
339+ # if event.pos().y() > 53 and self.currentToolName is not None:
340+ self .painter .drawLine (self .lastPoint , event .pos ())
341+ self .lastPoint = event .pos ()
342+ self .update ()
337343
338344 def mouseRealeaseEvent (self , event ):
339345 if event .button () == Qt .LeftButton :
@@ -346,7 +352,12 @@ def paintEvent(self, event):
346352
347353 def newCanvas (self ):
348354 # TODO: Add New Canvas
349- self .canvasPainter .resetTransform ()
355+ Pen = QPen ()
356+ Pen .setWidth (5000 )
357+ Pen .setColor (Qt .white )
358+ self .painter .setPen (Pen )
359+ self .painter .drawLine (0 , 0 , 1000 , 500 )
360+ self .update ()
350361 print ('new canvas' )
351362
352363 def openFile (self ):
0 commit comments