Beispiel #1
0
class Dialog(QtGui.QDialog):
    def __init__(self):
        QtGui.QDialog.__init__(self)
        self.settings = Storage()
        self.ui = MainDlg()
        self.ui.setupUi(self)
        self.resize(self.settings.size)
        self.move(self.settings.pos)

        self.file_filter = ''
        self.modelCommits = CommitModel(self.ui.listCommit, self._on_select_commit)
        self.modelFiles = DirFileModel(self.ui.listFiles, self._on_select_file)
        self.modelFileHistory = FileHistoryModel(self.ui.listFileHistory)
        self.ui.edtFindFile.textChanged.connect(self.set_file_filter)
        self.ui.btnCleanFltr.pressed.connect(lambda: self.ui.edtFindFile.clear())
        self.ui.btnSettings.pressed.connect(self._show_settings)

        self._fill_commits()

    def closeEvent(self, e):
        self.settings.Save(self)
        e.accept()

    def done(self, p_int):
        self.settings.Save(self)
        QtGui.QDialog.done(self, p_int)


    def set_file_filter(self, word):
        self.file_filter = word.upper()
        self._fill_commits()

    def _fill_commits(self):
        self.modelCommits.set_commits([])
        try:
            self.git_repo = Git2Repo(self.settings.workdir)
            commits = self.git_repo.get_commits(self.file_filter)
            self.modelCommits.set_commits(commits)
        except Exception as e:
            QtGui.QMessageBox.critical(self, "workdir", "[%s] no working dir" % e)

    def _on_select_commit(self, commit):
        self.modelFiles.set_files(commit, self.git_repo, self.file_filter)
        self.modelFileHistory.set_commits(None, [], None)

    def _on_select_file(self, file_oid, file_name):
        commits = self.git_repo.get_file_history_commits(file_oid, file_name)
        self.modelFileHistory.set_commits(self.git_repo.repo, commits, file_name)

    def _show_settings(self):
        if(self.settings.ShowDlg()):
            self._fill_commits()
Beispiel #2
0
    def __init__(self):
        QtGui.QDialog.__init__(self)
        self.settings = Storage()
        self.ui = MainDlg()
        self.ui.setupUi(self)
        self.resize(self.settings.size)
        self.move(self.settings.pos)

        self.file_filter = ''
        self.modelCommits = CommitModel(self.ui.listCommit, self._on_select_commit)
        self.modelFiles = DirFileModel(self.ui.listFiles, self._on_select_file)
        self.modelFileHistory = FileHistoryModel(self.ui.listFileHistory)
        self.ui.edtFindFile.textChanged.connect(self.set_file_filter)
        self.ui.btnCleanFltr.pressed.connect(lambda: self.ui.edtFindFile.clear())
        self.ui.btnSettings.pressed.connect(self._show_settings)

        self._fill_commits()