Ejemplo n.º 1
0
class CherryPickDialogWrapper(QDialog):
    def __init__(self, commit, parent=None):
        QDialog.__init__(self)
        self.commit = commit
        self.parent = parent
        self.ui = Ui_DeleteBranchDialog()
        self.ui.setupUi(self)
        self.setWindowTitle('Cherry pick')
        self.list_branches()
        QObject.connect(self, SIGNAL('accepted()'), self.cherry_pick)

    def list_branches(self):
        branches = get_local_branches()
        for branch in branches:
            QListWidgetItem(branch, self.ui.branches2delListWidget)

    def cherry_pick(self):
        item = self.ui.branches2delListWidget.currentItem()
        if item == None:
            QMessageBox.critical(self, "Error", "You must choose branch to cherry pick on!", QMessageBox.Ok)
        elif get_current_branch() == item.text():
            QMessageBox.critical(self, "Error", "You can't cherry pick on currently used branch! You must choose another branch.", QMessageBox.Ok)
        else:
            QMessageBox.information(self, 'Cherry pick', cherry_pick(self.parent, item.text(), self.commit), QMessageBox.Ok)
            self.parent.refresh_graph()
Ejemplo n.º 2
0
class DeleteBranchDialogWrapper(QDialog):
    def __init__(self, parent=None):
        QDialog.__init__(self)
        self.parent = parent
        self.ui = Ui_DeleteBranchDialog()
        self.ui.setupUi(self)
        self.list_branches()
        QObject.connect(self, SIGNAL('accepted()'), self.delete_branch)

    def list_branches(self):
        branches = get_local_branches()
        for branch in branches:
            QListWidgetItem(branch, self.ui.branches2delListWidget)

    def delete_branch(self):
        item = self.ui.branches2delListWidget.currentItem()
        print(get_current_branch())
        print(item.text())
        print(get_current_branch() == item.text())
        if item == None:
            QMessageBox.critical(self, "Error", "You must choose branch to delete!", QMessageBox.Ok)
        elif get_current_branch() == item.text():
            QMessageBox.critical(self, "Error", "You can't delete currently used branch! If you want to delete it, you must change branch first.", QMessageBox.Ok)
        else:
            delete_branch(item.text())