mirror of
https://github.com/marcriera/ddgo-converter.git
synced 2025-05-15 03:17:05 +02:00
Tests with configs
This commit is contained in:
parent
25ba4cdbc0
commit
8c875d3b8d
5 changed files with 48 additions and 27 deletions
|
@ -1,4 +1,3 @@
|
|||
from hashlib import sha1
|
||||
from PyQt5.QtCore import Qt, QVariant, QAbstractTableModel
|
||||
from handlers.gamepad import Gamepad
|
||||
|
||||
|
@ -13,7 +12,7 @@ class GamepadModel(QAbstractTableModel):
|
|||
if role == Qt.DisplayRole:
|
||||
match index.column():
|
||||
case 0:
|
||||
return self.get_gamepad_id(index)
|
||||
return self.gamepads[index.row()].id
|
||||
case 1:
|
||||
return self.gamepads[index.row()].name
|
||||
case 2:
|
||||
|
@ -35,14 +34,3 @@ class GamepadModel(QAbstractTableModel):
|
|||
return QVariant()
|
||||
return headers[section]
|
||||
|
||||
def get_gamepad_id(self, index):
|
||||
vid = format(self.gamepads[index.row()].vid, "x").zfill(4)
|
||||
pid = format(self.gamepads[index.row()].pid, "x").zfill(4)
|
||||
id = str(vid + ":" + pid)
|
||||
return id
|
||||
|
||||
def get_gamepad_hash(self, index):
|
||||
id = self.get_gamepad_id(index)
|
||||
name = self.gamepads[index.row()].name
|
||||
hash = sha1(str(id + ":" + name).encode('utf-8')).hexdigest()
|
||||
return hash
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue