33import time
44from threading import Thread , Lock
55
6- from PyQt5 .QtCore import QObject , Qt , QThread , QLineF , pyqtSignal
7- from PyQt5 .QtGui import QColor , QFont , QPainter , QPen , QPixmap
8- from PyQt5 .QtWidgets import (
6+ from PyQt6 .QtCore import QObject , Qt , QThread , QLineF , pyqtSignal
7+ from PyQt6 .QtGui import QColor , QFont , QPainter , QPen , QPixmap
8+ from PyQt6 .QtWidgets import (
99 QGraphicsLineItem ,
1010 QGraphicsPixmapItem ,
1111 QGraphicsScene ,
@@ -89,7 +89,7 @@ def __init__(self, type, hash, os="", privilege="", hostname="", parent=None):
8989 else :
9090 pixmap = self .addImageNode (WindowsSessionImage , hostname )
9191 else :
92- pixmap = QPixmap (LinuxSessionImage ).scaled (64 , 64 , Qt .KeepAspectRatio , Qt .SmoothTransformation )
92+ pixmap = QPixmap (LinuxSessionImage ).scaled (64 , 64 , Qt .AspectRatioMode . KeepAspectRatio , Qt . TransformationMode .SmoothTransformation )
9393 self .beaconHash = hash
9494 self .hostname = hostname
9595 self .connectedListenerHash = ""
@@ -112,21 +112,21 @@ def mouseMoveEvent(self, event):
112112
113113 def mousePressEvent (self , event ):
114114 super ().mousePressEvent (event )
115- self .setCursor (Qt .ClosedHandCursor )
115+ self .setCursor (Qt .CursorShape . ClosedHandCursor )
116116
117117 def mouseReleaseEvent (self , event ):
118118 super ().mouseReleaseEvent (event )
119- self .setCursor (Qt .ArrowCursor )
119+ self .setCursor (Qt .CursorShape . ArrowCursor )
120120
121- def addImageNode (self , image_path , legend_text , font_size = 9 , padding = 5 , text_color = Qt .white ):
121+ def addImageNode (self , image_path , legend_text , font_size = 9 , padding = 5 , text_color = Qt .GlobalColor . white ):
122122 # Load and scale the image
123- pixmap = QPixmap (image_path ).scaled (64 , 64 , Qt .KeepAspectRatio , Qt .SmoothTransformation )
123+ pixmap = QPixmap (image_path ).scaled (64 , 64 , Qt .AspectRatioMode . KeepAspectRatio , Qt . TransformationMode .SmoothTransformation )
124124
125125 # Create a new QPixmap larger than the original for the image and text
126126 legend_height = font_size + padding * 2
127127 legend_width = len (legend_text ) * font_size + padding * 2
128128 combined_pixmap = QPixmap (max (legend_width , pixmap .width ()), pixmap .height () + legend_height )
129- combined_pixmap .fill (Qt .transparent ) # Transparent background
129+ combined_pixmap .fill (Qt .GlobalColor . transparent ) # Transparent background
130130
131131 # Paint the image and the legend onto the combined pixmap
132132 painter = QPainter (combined_pixmap )
@@ -143,9 +143,9 @@ def addImageNode(self, image_path, legend_text, font_size=9, padding=5, text_col
143143
144144 # Draw the legend text centered below the image
145145 text_rect = painter .boundingRect (
146- 0 , pixmap .height (), combined_pixmap .width (), legend_height , Qt .AlignCenter , legend_text
146+ 0 , pixmap .height (), combined_pixmap .width (), legend_height , Qt .AlignmentFlag . AlignCenter , legend_text
147147 )
148- painter .drawText (text_rect , Qt .AlignCenter , legend_text )
148+ painter .drawText (text_rect , Qt .AlignmentFlag . AlignCenter , legend_text )
149149
150150 painter .end ()
151151 return combined_pixmap
@@ -189,7 +189,7 @@ def __init__(self, parent, grpcClient):
189189 self .scene = QGraphicsScene ()
190190
191191 self .view = QGraphicsView (self .scene )
192- self .view .setRenderHint (QPainter .Antialiasing )
192+ self .view .setRenderHint (QPainter .RenderHint . Antialiasing )
193193
194194 self .vbox = QVBoxLayout ()
195195 self .vbox .setContentsMargins (0 , 0 , 0 , 0 )
@@ -336,8 +336,8 @@ def updateGraph(self):
336336 print ("[+] add connector listener:" , listenerHash , "beacon" , beaconHash )
337337
338338 for item in self .listNodeItem :
339- item .setFlag (QGraphicsItem .ItemIsMovable )
340- item .setFlag (QGraphicsItem .ItemIsSelectable )
339+ item .setFlag (QGraphicsItem .GraphicsItemFlag . ItemIsMovable )
340+ item .setFlag (QGraphicsItem .GraphicsItemFlag . ItemIsSelectable )
341341
342342
343343class GetGraphInfoWorker (QObject ):
0 commit comments