コード例 #1
0
ファイル: selectcommits.py プロジェクト: SecuraPaWn/git-cola
def select_commits(title, revs, summaries, multiselect=True):
    """Use the SelectCommitsDialog to select commits from a list."""
    model = Model(revs, summaries)
    parent = qtutils.active_window()
    dialog = SelectCommitsDialog(model, parent, qtutils.tr(title),
                                 multiselect=multiselect)
    return dialog.select_commits()
コード例 #2
0
def diff_revision():
    """Diff an arbitrary revision against the worktree"""
    ref = choose_ref('Select Revision to Diff', 'Diff',
                     default='HEAD^')
    if not ref:
        return
    difftool.diff_commits(qtutils.active_window(), ref, None)
コード例 #3
0
def create_tag(name='', ref='', sign=False):
    """Entry point for external callers."""
    view = new_create_tag(name=name, ref=ref, sign=sign,
                          parent=qtutils.active_window())
    view.show()
    view.raise_()
    return view
コード例 #4
0
ファイル: guicmds.py プロジェクト: kensholiu/git-cola
def review_branch():
    """Diff against an arbitrary revision, branch, tag, etc."""
    branch = choose_ref(N_('Select Branch to Review'), N_('Review'))
    if not branch:
        return
    merge_base = gitcmds.merge_base_parent(branch)
    difftool.diff_commits(qtutils.active_window(), merge_base, branch)
コード例 #5
0
ファイル: selectcommits.py プロジェクト: gdebure/git-cola
def select_commits(title, revs, summaries, multiselect=True):
    """Use the SelectCommitsDialog to select commits from a list."""
    model = Model(revs, summaries)
    parent = qtutils.active_window()
    dialog = SelectCommitsDialog(model, parent, qtutils.tr(title),
                                 multiselect=multiselect)
    return dialog.select_commits()
コード例 #6
0
ファイル: selectcommits.py プロジェクト: dcfrancisco/git-cola
def select_commits(title, revs, summaries, multiselect=True):
    """Use the SelectCommitsView to select commits from a list."""
    model = MainModel()
    parent = qtutils.active_window()
    view = SelectCommitsView(parent, qtutils.tr(title), multiselect=multiselect)
    ctl = SelectCommitsController(model, view, revs, summaries)
    return ctl.select_commits()
コード例 #7
0
ファイル: about.py プロジェクト: 1234-/git-cola
def show_shortcuts():
    try:
        from PyQt4 import QtWebKit
    except ImportError:
        # redhat disabled QtWebKit in their qt build but don't punish the
        # users
        qtutils.critical(N_('This PyQt4 does not include QtWebKit.\n'
                            'The keyboard shortcuts feature is unavailable.'))
        return

    try:
        html = show_shortcuts.html
    except AttributeError:
        hotkeys_html = resources.doc(N_('hotkeys.html'))
        html = show_shortcuts.html = core.read(hotkeys_html)

    try:
        widget = show_shortcuts.widget
    except AttributeError:
        parent = qtutils.active_window()
        widget = show_shortcuts.widget = QtGui.QDialog(parent)
        widget.setWindowModality(Qt.WindowModal)
        widget.setWindowTitle(N_('Shortcuts'))

        web = QtWebKit.QWebView(parent)
        web.setHtml(html)

        layout = qtutils.hbox(defs.no_margin, defs.spacing, web)
        widget.setLayout(layout)
        widget.resize(800, min(parent.height(), 600))
        qtutils.add_action(widget, N_('Close'), widget.accept,
                           hotkeys.QUESTION, *hotkeys.ACCEPT)
    widget.show()
    return widget
コード例 #8
0
def local_merge():
    """Provides a dialog for merging branches"""
    model = main.model()
    view = MergeView(model, qtutils.active_window())
    view.show()
    view.raise_()
    return view
コード例 #9
0
ファイル: guicmds.py プロジェクト: ciaravero/git-cola
def diff_revision():
    """Diff an arbitrary revision against the worktree"""
    ref = choose_ref('Select Revision to Diff', 'Diff',
                     default='HEAD^')
    if not ref:
        return
    difftool.diff_commits(qtutils.active_window(), ref, None)
コード例 #10
0
ファイル: compare.py プロジェクト: mwh/git-cola
def branch_compare():
    """Launches a dialog for comparing a pair of branches"""
    model = BranchCompareModel()
    view = BranchCompareView(qtutils.active_window())
    ctl = BranchCompareController(model, view)
    view.show()
    return ctl
コード例 #11
0
ファイル: compare.py プロジェクト: mwh/git-cola
def compare(filename=None):
    """Launches a dialog for comparing a pair of commits"""
    model = CompareModel()
    view = CompareView(qtutils.active_window())
    ctl = CompareController(model, view, filename)
    view.show()
    return ctl
コード例 #12
0
ファイル: about.py プロジェクト: ttimz1313/git-cola
def show_shortcuts():
    try:
        from PyQt4 import QtWebKit
    except ImportError:
        # redhat disabled QtWebKit in their qt build but don't punish the
        # users
        qtutils.critical(
            N_('This PyQt4 does not include QtWebKit.\n'
               'The keyboard shortcuts feature is unavailable.'))
        return

    try:
        html = show_shortcuts.html
    except AttributeError:
        hotkeys_html = resources.doc(N_('hotkeys.html'))
        html = show_shortcuts.html = core.read(hotkeys_html)

    try:
        widget = show_shortcuts.widget
    except AttributeError:
        parent = qtutils.active_window()
        widget = show_shortcuts.widget = QtGui.QDialog(parent)
        widget.setWindowModality(Qt.WindowModal)
        widget.setWindowTitle(N_('Shortcuts'))

        web = QtWebKit.QWebView(parent)
        web.setHtml(html)

        layout = qtutils.hbox(defs.no_margin, defs.spacing, web)
        widget.setLayout(layout)
        widget.resize(800, min(parent.height(), 600))
        qtutils.add_action(widget, N_('Close'), widget.accept,
                           hotkeys.QUESTION, *hotkeys.ACCEPT)
    widget.show()
    return widget
コード例 #13
0
ファイル: merge.py プロジェクト: Acidburn0zzz/git-cola
def local_merge():
    """Provides a dialog for merging branches"""
    model = main.model()
    view = MergeView(model, qtutils.active_window())
    view.show()
    view.raise_()
    return view
コード例 #14
0
def local_merge():
    """Provides a dialog for merging branches"""
    model = MergeModel()
    view = MergeView(model, qtutils.active_window())
    ctl = MergeController(model, view)
    view.show()
    view.raise_()
    return ctl
コード例 #15
0
ファイル: guicmds.py プロジェクト: SecuraPaWn/git-cola
def grep():
    """Prompt and use 'git grep' to find the content."""
    from cola.widgets.grep import run_grep

    widget = run_grep(parent=qtutils.active_window())
    widget.show()
    widget.raise_()
    return widget
コード例 #16
0
ファイル: __init__.py プロジェクト: SecuraPaWn/git-cola
def local_merge():
    """Provides a dialog for merging branches"""
    model = MergeModel()
    view = MergeView(model, qtutils.active_window())
    ctl = MergeController(model, view)
    view.show()
    view.raise_()
    return ctl
コード例 #17
0
ファイル: stash.py プロジェクト: jmdcal/git-cola
def stash():
    """Launches a stash dialog using the provided model + view
    """
    model = StashModel()
    view = StashView(model, qtutils.active_window())
    view.show()
    view.raise_()
    return view
コード例 #18
0
def stash():
    """Launches a stash dialog using the provided model + view
    """
    model = StashModel()
    view = StashView(model, qtutils.active_window())
    view.show()
    view.raise_()
    return view
コード例 #19
0
def stash():
    """Launches a stash dialog using the provided model + view
    """
    model = StashModel()
    view = StashView(model, qtutils.active_window())
    ctl = StashController(model, view)
    view.show()
    return ctl
コード例 #20
0
ファイル: guicmds.py プロジェクト: kensholiu/git-cola
def diff_expression():
    """Diff using an arbitrary expression."""
    tracked = gitcmds.tracked_branch()
    current = gitcmds.current_branch()
    if tracked and current:
        ref = tracked + '..' + current
    else:
        ref = 'origin/master..'
    difftool.diff_expression(qtutils.active_window(), ref)
コード例 #21
0
ファイル: createtag.py プロジェクト: dcfrancisco/git-cola
def create_tag(revision=''):
    """Entry point for external callers."""
    model = tag.TagModel()
    if revision:
        model.revision = [revision]
    view = createtag.CreateTag(qtutils.active_window())
    ctl = CreateTagController(model, view)
    view.show()
    return ctl
コード例 #22
0
def run_command(title, command):
    """Show a command widget"""
    view = GitCommandWidget(title, qtutils.active_window())
    view.set_command(command)
    view.show()
    view.raise_()
    view.run()
    view.exec_()
    return (view.exitstatus, view.out, view.err)
コード例 #23
0
ファイル: cfgactions.py プロジェクト: Acidburn0zzz/git-cola
def run_command(title, command):
    """Show a command widget"""
    view = GitCommandWidget(title, qtutils.active_window())
    view.set_command(command)
    view.show()
    view.raise_()
    view.run()
    view.exec_()
    return (view.exitstatus, view.out, view.err)
コード例 #24
0
def create_new_branch(revision=''):
    """Launches a dialog for creating a new branch"""
    model = main.MainModel()
    model.update_status()
    view = CreateBranchDialog(model, qtutils.active_window())
    if revision:
        view.set_revision(revision)
    view.show()
    return view
コード例 #25
0
ファイル: cfgactions.py プロジェクト: dcfrancisco/git-cola
def run_command(title, command):
    """Show a command widget"""
    view = GitCommandWidget(qtutils.active_window())
    view.setWindowModality(QtCore.Qt.ApplicationModal)
    view.set_command(command)
    view.setWindowTitle(title)
    view.show()
    view.raise_()
    view.run()
    view.exec_()
    return (view.exitstatus, view.out, view.err)
コード例 #26
0
def confirm_config_action(name, opts):
    dlg = ActionDialog(qtutils.active_window(), name, opts)
    dlg.show()
    if dlg.exec_() != QtGui.QDialog.Accepted:
        return False
    rev = unicode(dlg.revision())
    if rev:
        opts['revision'] = rev
    args = unicode(dlg.args())
    if args:
        opts['args'] = args
    return True
コード例 #27
0
ファイル: __init__.py プロジェクト: dcfrancisco/git-cola
def git_dag(model, opts=None, args=None):
    """Return a pre-populated git DAG widget."""
    dag = DAG(model.currentbranch, 1000)
    dag.set_options(opts, args)

    view = DAGView(model, dag, qtutils.active_window())
    ctl = DAGController(dag, view)
    view.show()
    view.raise_()
    if dag.ref:
        view.thread.start(QtCore.QThread.LowPriority)
    return ctl
コード例 #28
0
ファイル: cfgactions.py プロジェクト: Acidburn0zzz/git-cola
def confirm_config_action(name, opts):
    dlg = ActionDialog(qtutils.active_window(), name, opts)
    dlg.show()
    if dlg.exec_() != QtGui.QDialog.Accepted:
        return False
    rev = ustr(dlg.revision())
    if rev:
        opts['revision'] = rev
    args = ustr(dlg.args())
    if args:
        opts['args'] = args
    return True
コード例 #29
0
ファイル: guicmds.py プロジェクト: moreati/git-cola
def diff_expression():
    """Diff using an arbitrary expression."""
    tracked = gitcmds.tracked_branch()
    current = gitcmds.current_branch()
    if tracked and current:
        default = tracked + '..' + current
    else:
        default = 'origin/master..'
    ref = choose_ref('Enter Diff Expression', 'Diff', default=default)
    if not ref:
        return
    difftool.diff_expression(qtutils.active_window(), ref)
コード例 #30
0
ファイル: browse.py プロジェクト: jmdcal/git-cola
 def select_file(ref):
     parent = qtutils.active_window()
     model = BrowseModel(ref)
     dlg = BrowseDialog(model, select_file=True, parent=parent)
     dlg_model = GitTreeModel(ref, dlg)
     dlg.setModel(dlg_model)
     dlg.setWindowTitle(N_('Select file from "%s"') % model.ref)
     dlg.resize(parent.width()*3//4, 333)
     dlg.show()
     dlg.raise_()
     if dlg.exec_() != dlg.Accepted:
         return None
     return model.filename
コード例 #31
0
 def select_file(ref):
     parent = qtutils.active_window()
     model = BrowseModel(ref)
     dlg = BrowseDialog(model, select_file=True, parent=parent)
     dlg_model = GitTreeModel(ref, dlg)
     dlg.setModel(dlg_model)
     dlg.setWindowTitle(N_('Select file from "%s"') % model.ref)
     dlg.resize(parent.width() * 3 // 4, 333)
     dlg.show()
     dlg.raise_()
     if dlg.exec_() != dlg.Accepted:
         return None
     return model.filename
コード例 #32
0
ファイル: guicmds.py プロジェクト: ciaravero/git-cola
def diff_expression():
    """Diff using an arbitrary expression."""
    tracked = gitcmds.tracked_branch()
    current = gitcmds.current_branch()
    if tracked and current:
        default = tracked + '..' + current
    else:
        default = 'origin/master..'
    ref = choose_ref('Enter Diff Expression', 'Diff',
                     default=default)
    if not ref:
        return
    difftool.diff_expression(qtutils.active_window(), ref)
コード例 #33
0
ファイル: createbranch.py プロジェクト: dcfrancisco/git-cola
def create_new_branch(revision=''):
    """Launches a dialog for creating a new branch"""
    model = MainModel()
    model.update_status()

    model.revision = revision
    model.local_branch = ''

    view = createbranch.CreateBranchView(qtutils.active_window())
    ctl = CreateBranchController(model, view)
    model.set_revision(revision)
    view.show()
    return ctl
コード例 #34
0
ファイル: browse.py プロジェクト: ciaravero/git-cola
 def browse(ref):
     parent = qtutils.active_window()
     model = BrowseModel(ref)
     dlg = BrowseDialog(model, parent=parent)
     dlg_model = GitTreeModel(ref, dlg)
     dlg.setModel(dlg_model)
     dlg.setWindowTitle('Browsing %s' % model.ref)
     ctrl = BrowseDialogController(model, dlg)
     dlg.resize(parent.width()*3/4, 333)
     dlg.show()
     dlg.raise_()
     if dlg.exec_() != dlg.Accepted:
         return None
     return ctrl
コード例 #35
0
def run(RemoteDialog):
    """Launches fetch/push/pull dialogs."""
    # Copy global stuff over to speedup startup
    model = main.MainModel()
    global_model = main.model()
    model.currentbranch = global_model.currentbranch
    model.local_branches = global_model.local_branches
    model.remote_branches = global_model.remote_branches
    model.tags = global_model.tags
    model.remotes = global_model.remotes
    parent = qtutils.active_window()
    view = RemoteDialog(model, parent=parent)
    view.show()
    return view
コード例 #36
0
ファイル: remote.py プロジェクト: Complex501/git-cola
def run(RemoteDialog):
    """Launches fetch/push/pull dialogs."""
    # Copy global stuff over to speedup startup
    model = main.MainModel()
    global_model = main.model()
    model.currentbranch = global_model.currentbranch
    model.local_branches = global_model.local_branches
    model.remote_branches = global_model.remote_branches
    model.tags = global_model.tags
    model.remotes = global_model.remotes
    parent = qtutils.active_window()
    view = RemoteDialog(model, parent=parent)
    view.show()
    return view
コード例 #37
0
 def select_file_from_list(file_list, title=N_('Select File')):
     parent = qtutils.active_window()
     model = BrowseModel(None)
     dlg = BrowseDialog(model, select_file=True, parent=parent)
     dlg_model = GitFileTreeModel(dlg)
     dlg_model.add_files(file_list)
     dlg.setModel(dlg_model)
     dlg.expandAll()
     dlg.setWindowTitle(title)
     dlg.resize(parent.width() * 3 // 4, 333)
     dlg.show()
     dlg.raise_()
     if dlg.exec_() != dlg.Accepted:
         return None
     return model.filename
コード例 #38
0
ファイル: browse.py プロジェクト: jmdcal/git-cola
 def select_file_from_list(file_list, title=N_('Select File')):
     parent = qtutils.active_window()
     model = BrowseModel(None)
     dlg = BrowseDialog(model, select_file=True, parent=parent)
     dlg_model = GitFileTreeModel(dlg)
     dlg_model.add_files(file_list)
     dlg.setModel(dlg_model)
     dlg.expandAll()
     dlg.setWindowTitle(title)
     dlg.resize(parent.width()*3//4, 333)
     dlg.show()
     dlg.raise_()
     if dlg.exec_() != dlg.Accepted:
         return None
     return model.filename
コード例 #39
0
ファイル: browse.py プロジェクト: jmdcal/git-cola
 def browse(ref):
     parent = qtutils.active_window()
     model = BrowseModel(ref)
     dlg = BrowseDialog(model, parent=parent)
     dlg_model = GitTreeModel(ref, dlg)
     dlg.setModel(dlg_model)
     dlg.setWindowTitle(N_('Browsing %s') % model.ref)
     if hasattr(parent, 'width'):
         dlg.resize(parent.width()*3//4, 333)
     else:
         dlg.resize(420, 333)
     dlg.show()
     dlg.raise_()
     if dlg.exec_() != dlg.Accepted:
         return None
     return dlg
コード例 #40
0
 def browse(ref):
     parent = qtutils.active_window()
     model = BrowseModel(ref)
     dlg = BrowseDialog(model, parent=parent)
     dlg_model = GitTreeModel(ref, dlg)
     dlg.setModel(dlg_model)
     dlg.setWindowTitle(N_('Browsing %s') % model.ref)
     if hasattr(parent, 'width'):
         dlg.resize(parent.width() * 3 // 4, 333)
     else:
         dlg.resize(420, 333)
     dlg.show()
     dlg.raise_()
     if dlg.exec_() != dlg.Accepted:
         return None
     return dlg
コード例 #41
0
ファイル: text.py プロジェクト: kensholiu/git-cola
def text_dialog(text, title):
    """Show a wall of text in a dialog"""
    parent = qtutils.active_window()
    label = QtGui.QLabel(parent)
    label.setFont(qtutils.diff_font())
    label.setText(text)
    label.setTextInteractionFlags(Qt.NoTextInteraction)

    widget = QtGui.QDialog(parent)
    widget.setWindowModality(Qt.WindowModal)
    widget.setWindowTitle(title)

    layout = qtutils.hbox(defs.margin, defs.spacing, label)
    widget.setLayout(layout)

    qtutils.add_action(widget, N_("Close"), widget.accept, Qt.Key_Question, Qt.Key_Enter, Qt.Key_Return)
    widget.show()
    return widget
コード例 #42
0
def text_dialog(text, title):
    """Show a wall of text in a dialog"""
    parent = qtutils.active_window()
    label = QtGui.QLabel(parent)
    label.setFont(qtutils.diff_font())
    label.setText(text)
    label.setTextInteractionFlags(Qt.NoTextInteraction)

    widget = QtGui.QDialog(parent)
    widget.setWindowModality(Qt.WindowModal)
    widget.setWindowTitle(title)

    layout = qtutils.hbox(defs.margin, defs.spacing, label)
    widget.setLayout(layout)

    qtutils.add_action(widget, N_('Close'), widget.accept, Qt.Key_Question,
                       Qt.Key_Enter, Qt.Key_Return)
    widget.show()
    return widget
コード例 #43
0
def show_shortcuts():
    try:
        from PyQt4 import QtWebKit
    except ImportError:
        # redhat disabled QtWebKit in their qt build but don't punish the
        # users
        qtutils.critical(N_('This PyQt4 does not include QtWebKit.\n'
                            'The keyboard shortcuts feature is unavailable.'))
        return

    try:
        html = show_shortcuts.html
    except AttributeError:
        hotkeys = resources.doc(N_('hotkeys.html'))
        html = show_shortcuts.html = utils.slurp(hotkeys)

    try:
        widget = show_shortcuts.widget
    except AttributeError:
        parent = qtutils.active_window()
        widget = show_shortcuts.widget = QtGui.QDialog(parent)
        widget.setWindowModality(Qt.WindowModal)

        web = QtWebKit.QWebView(parent)
        web.setHtml(html)

        layout = QtGui.QHBoxLayout()
        layout.setMargin(0)
        layout.setSpacing(0)
        layout.addWidget(web)

        widget.setWindowTitle(N_('Shortcuts'))
        widget.setLayout(layout)
        widget.resize(800, min(parent.height(), 600))

        qtutils.add_action(widget, N_('Close'), widget.accept,
                           Qt.Key_Question,
                           Qt.Key_Enter,
                           Qt.Key_Return)
    widget.show()
    return widget
コード例 #44
0
ファイル: remote.py プロジェクト: dcfrancisco/git-cola
def remote_action(action):
    """Launches fetch/push/pull dialogs."""
    # TODO: subclass model
    model = MainModel()

    global_model = cola.model()
    model.currentbranch = global_model.currentbranch
    model.local_branches = global_model.local_branches
    model.remote_branches = global_model.remote_branches
    model.tags = global_model.tags
    model.remotes = global_model.remotes

    model.local_branch = ''
    model.remote_branch = ''
    model.remotename = ''
    model.tags_checkbox = False
    model.rebase_checkbox = False
    model.ffwd_only_checkbox = True

    view = remote.RemoteView(qtutils.active_window(), action)
    ctl = RemoteController(model, view, action)
    view.show()
    return ctl
コード例 #45
0
ファイル: search.py プロジェクト: yjpark/git-cola
def search():
    """Return a callback to handle various search actions."""
    return search_commits(qtutils.active_window())
コード例 #46
0
ファイル: grep.py プロジェクト: jmcabandara/git-cola
def grep():
    """Prompt and use 'git grep' to find the content."""
    widget = new_grep(parent=qtutils.active_window())
    widget.show()
    widget.raise_()
    return widget
コード例 #47
0
ファイル: editremotes.py プロジェクト: sbabrass/git-cola
def remote_editor():
    view = new_remote_editor(parent=qtutils.active_window())
    view.show()
    view.raise_()
    return view
コード例 #48
0
def browse_recent_files():
    parent = qtutils.active_window()
    dialog = RecentFileDialog(parent)
    dialog.resize(parent.width(), min(parent.height(), 420))
    dialog.show()
コード例 #49
0
def compare_branches():
    """Launches a dialog for comparing a pair of branches"""
    view = CompareBranchesDialog(qtutils.active_window())
    view.show()
    return view
コード例 #50
0
ファイル: guicmds.py プロジェクト: kensholiu/git-cola
def choose_from_dialog(get, title, button_text, default, icon=None):
    parent = qtutils.active_window()
    return get(title, button_text, parent, default=default, icon=icon)
コード例 #51
0
def launch_about_dialog():
    """Launches the Help -> About dialog"""
    view = AboutView(qtutils.active_window())
    view.set_version(version.version())
    view.show()
コード例 #52
0
ファイル: bookmarks.py プロジェクト: wmwong/git-cola
def manage_bookmarks():
    dlg = BookmarksDialog(qtutils.active_window())
    dlg.show()
    dlg.exec_()
    return dlg
コード例 #53
0
ファイル: app.py プロジェクト: yjpark/git-cola
def main(context):
    """Parses the command-line arguments and starts git-cola
    """
    setup_environment()
    opts, args, context = parse_args(context)
    repo = process_args(opts, args)

    # Allow Ctrl-C to exit
    signal.signal(signal.SIGINT, signal.SIG_DFL)

    # Initialize the app
    app = ColaApplication(sys.argv)

    # Ensure that we're working in a valid git repository.
    # If not, try to find one.  When found, chdir there.
    model = cola.model()
    valid = model.set_worktree(repo) and not opts.prompt
    while not valid:
        startup_dlg = startup.StartupDialog(app.activeWindow())
        gitdir = startup_dlg.find_git_repo()
        if not gitdir:
            sys.exit(-1)
        valid = model.set_worktree(gitdir)

    # Finally, go to the root of the git repo
    os.chdir(model.git.worktree())

    # Show the GUI
    if context == 'archive':
        from cola.widgets.archive import GitArchiveDialog
        model.update_status()
        view = GitArchiveDialog(model.currentbranch)
    elif context == 'branch':
        from cola.widgets.createbranch import create_new_branch
        view = create_new_branch()
    elif context in ('git-dag', 'dag'):
        from cola.dag import git_dag
        view = git_dag(model, opts=opts, args=args)
    elif context in ('classic', 'browse'):
        from cola.classic import cola_classic
        view = cola_classic(update=False)
    elif context == 'config':
        from cola.prefs import preferences
        view = preferences()
    elif context == 'diff':
        from cola.difftool import diff_expression
        while args and args[0] == '--':
            args.pop(0)
        expr = subprocess.list2cmdline(map(core.decode, args))
        view = diff_expression(None, expr, create_widget=True)
    elif context == 'fetch':
        # TODO: the calls to update_status() can be done asynchronously
        # by hooking into the message_updated notification.
        from cola.widgets import remote
        model.update_status()
        view = remote.fetch()
    elif context == 'grep':
        from cola.widgets import grep
        view = grep.run_grep(parent=None)
    elif context == 'merge':
        from cola.merge import view
        model.update_status()
        view = view.MergeView(model, parent=None)
    elif context == 'pull':
        from cola.widgets import remote
        model.update_status()
        view = remote.pull()
    elif context == 'push':
        from cola.widgets import remote
        model.update_status()
        view = remote.push()
    elif context == 'remote':
        from cola.widgets import editremotes
        view = editremotes.edit()
    elif context == 'search':
        from cola.widgets.search import search
        view = search()
    elif context == 'stash':
        from cola.stash import stash
        model.update_status()
        view = stash()
    elif context == 'tag':
        from cola.widgets.createtag import create_tag
        view = create_tag()
    else:
        view = MainView(model, qtutils.active_window())

    # Make sure that we start out on top
    view.show()
    view.raise_()

    # Scan for the first time
    task = _start_update_thread(model)

    # Start the inotify thread
    inotify.start()

    msg_timer = QtCore.QTimer()
    msg_timer.setSingleShot(True)
    msg_timer.connect(msg_timer, SIGNAL('timeout()'), _send_msg)
    msg_timer.start(0)

    # Start the event loop
    result = app.exec_()

    # All done, cleanup
    inotify.stop()
    QtCore.QThreadPool.globalInstance().waitForDone()

    pattern = utils.tmp_file_pattern()
    for filename in glob.glob(pattern):
        os.unlink(filename)
    sys.exit(result)

    return view, task
コード例 #54
0
def apply_patches():
    parent = qtutils.active_window()
    dlg = new_apply_patches(parent=parent)
    dlg.show()
    dlg.raise_()
    return dlg