This repository has been 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
/
Copy pathmain.py
46 lines (37 loc) · 1.47 KB
/
main.py
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
import sys
from PyQt4 import QtCore, QtGui, uic
from snapshot import Snapshot
class SnapshotThread(QtCore.QThread):
def run(self):
s = Snapshot()
print(len(s.values))
class MainWindow(QtGui.QMainWindow):
def __init__(self, parent=None):
super().__init__(parent)
uic.loadUi('main.ui', self)
self.snapshotButton.clicked.connect(self.make_snapshot)
self.snapshots_list = []
self.commits_list = []
self.commitsModel = QtGui.QStringListModel([])
self.commitsView.setModel(self.commitsModel)
self.snapshots_list.append(Snapshot())
self.commitsView.clicked.connect(self.commit_clicked)
def make_snapshot(self):
# self.st = SnapshotThread()
# self.st.start()
s = Snapshot()
commit = s.compare_to(self.snapshots_list[-1])
self.commits_list.append(commit)
self.commitsModel.setStringList(self.commitsModel.stringList() + [commit.name])
# self.statusBar().showMessage('Pressed')
# self.progressBar.setValue(self.progressBar.value() + 1)
def commit_clicked(self, index):
commit = self.commits_list[index.row()]
self.createdTreeView.setModel(commit.created_model())
self.modifiedTreeView.setModel(commit.modified_model())
self.deletedTreeView.setModel(commit.deleted_model())
if __name__ == "__main__":
app = QtGui.QApplication(sys.argv)
myapp = MainWindow()
myapp.show()
sys.exit(app.exec_())