This repository was archived by the owner on Aug 4, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommit.py
More file actions
56 lines (46 loc) · 1.64 KB
/
commit.py
File metadata and controls
56 lines (46 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
from PyQt4 import QtGui
class Commit():
def __init__(self, created, modified, deleted):
self.created = created
self.modified = modified
self.deleted = deleted
def created_model(self):
model = QtGui.QStandardItemModel()
for item in self.created:
value_path, value_type_data = item
value_type, value_data = value_type_data
row = [
QtGui.QStandardItem('{}'.format(value_path)),
QtGui.QStandardItem('{}'.format(value_data))
]
model.appendRow(row)
return model
def modified_model(self):
model = QtGui.QStandardItemModel()
for item in self.modified:
value_path, old_value, new_value = item
value_type, value_data = new_value
row = [
QtGui.QStandardItem('{}'.format(value_path)),
QtGui.QStandardItem('{}'.format(value_data))
]
model.appendRow(row)
return model
def deleted_model(self):
model = QtGui.QStandardItemModel()
for item in self.deleted:
value_path, value_type_data = item
value_type, value_data = value_type_data
row = [
QtGui.QStandardItem('{}'.format(value_path)),
QtGui.QStandardItem('{}'.format(value_data))
]
model.appendRow(row)
return model
@property
def name(self):
return 'Created {}, modified {}, deleted {}'.format(len(self.created), len(self.modified), len(self.deleted))
def merge(self, other):
pass
def rollback(self):
return