55
66import mobase
77
8- try :
9- from PyQt6 .QtCore import (QAbstractItemModel , QByteArray , QDataStream , QDir , QFileInfo , QMimeData , QModelIndex , QObject , Qt , QVariant )
10- from PyQt6 .QtWidgets import QWidget
11- except :
12- from PyQt5 .QtCore import (QAbstractItemModel , QByteArray , QDataStream , QDir , QFileInfo , QMimeData , QModelIndex , QObject , Qt , QVariant )
13- from PyQt5 .QtWidgets import QWidget
8+ from PyQt6 .QtCore import (QAbstractItemModel , QByteArray , QDataStream , QDir , QFileInfo , QMimeData , QModelIndex , QObject , Qt , QVariant )
9+ from PyQt6 .QtWidgets import QWidget
1410
1511_PakInfo : TypeAlias = tuple [str , str , str , str ]
1612
@@ -61,12 +57,16 @@ def flags(self, index: QModelIndex) -> Qt.ItemFlag:
6157 | Qt .ItemFlag .ItemIsDropEnabled & Qt .ItemFlag .ItemIsEditable
6258 )
6359
64- def columnCount (self , parent : QModelIndex = QModelIndex ()) -> int :
60+ def columnCount (self , parent : QModelIndex ) -> int :
61+ if parent is None :
62+ parent = QModelIndex ()
6563 return len (PaksColumns )
6664
6765 def index (
68- self , row : int , column : int , parent : QModelIndex = QModelIndex ()
66+ self , row : int , column : int , parent : QModelIndex
6967 ) -> QModelIndex :
68+ if parent is None :
69+ parent = QModelIndex ()
7070 if (
7171 row < 0
7272 or row >= self .rowCount ()
@@ -86,7 +86,9 @@ def parent(self, child: QModelIndex | None = None) -> QModelIndex | QObject | No
8686 return super ().parent ()
8787 return QModelIndex ()
8888
89- def rowCount (self , parent : QModelIndex = QModelIndex ()) -> int :
89+ def rowCount (self , parent : QModelIndex ) -> int :
90+ if parent is None :
91+ parent = QModelIndex ()
9092 return len (self .paks )
9193
9294 def setData (
0 commit comments