本文整理汇总了Python中rabbitvcs.ui.main函数的典型用法代码示例。如果您正苦于以下问题:Python main函数的具体用法?Python main怎么用?Python main使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了main函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _
self.action.append(self.action.set_status, _("Running Switch Command..."))
self.action.append(rabbitvcs.util.helper.save_repository_path, url)
self.action.append(
self.svn.switch,
self.path,
url,
revision=revision
)
self.action.append(self.action.set_status, _("Completed Switch"))
self.action.append(self.action.finish)
self.action.start()
classes_map = {
rabbitvcs.vcs.VCS_SVN: SVNSwitch
}
def switch_factory(path, revision=None):
guess = rabbitvcs.vcs.guess(path)
return classes_map[guess["vcs"]](path, revision)
if __name__ == "__main__":
from rabbitvcs.ui import main, REVISION_OPT
(options, args) = main(
[REVISION_OPT],
usage="Usage: rabbitvcs switch [url]"
)
window = switch_factory(args[0], revision=options.revision)
window.register_gtk_quit()
gtk.main()
示例2: MessageBox
if not from_url or not to_url:
MessageBox(_("The from and to url fields are both required."))
return
self.hide()
self.action = SVNAction(
self.svn,
register_gtk_quit=self.gtk_quit_is_set()
)
self.action.append(self.action.set_header, _("Relocate"))
self.action.append(self.action.set_status, _("Running Relocate Command..."))
self.action.append(
self.svn.relocate,
from_url,
to_url,
self.path
)
self.action.append(self.action.set_status, _("Completed Relocate"))
self.action.append(self.action.finish)
self.action.start()
if __name__ == "__main__":
from rabbitvcs.ui import main
(options, paths) = main(usage="Usage: rabbitvcs relocate [path]")
window = Relocate(paths[0])
window.register_gtk_quit()
gtk.main()
示例3: _
self.path,
url,
self.message.get_text(),
ignore=ignore
)
self.action.append(self.action.set_status, _("Completed Import"))
self.action.append(self.action.finish)
self.action.start()
def on_previous_messages_clicked(self, widget, data=None):
dialog = rabbitvcs.ui.dialog.PreviousMessages()
message = dialog.run()
if message is not None:
self.message.set_text(message)
classes_map = {
rabbitvcs.vcs.VCS_SVN: SVNImport
}
def import_factory(path):
vcs = rabbitvcs.vcs.VCS_SVN
return classes_map[vcs](path)
if __name__ == "__main__":
from rabbitvcs.ui import main
(options, paths) = main(usage="Usage: rabbitvcs import [path]")
window = import_factory(paths[0])
window.register_gtk_quit()
gtk.main()
示例4: push_factory
rabbitvcs.util.helper.format_long_text(item.message.rstrip("\n"))
])
has_commits = True
else:
break
except IndexError:
break
if not has_commits:
self.get_widget("ok").set_sensitive(False)
self.get_widget("status").set_text(_("No commits found"))
classes_map = {
rabbitvcs.vcs.VCS_GIT: GitPush
}
def push_factory(path):
guess = rabbitvcs.vcs.guess(path)
return classes_map[guess["vcs"]](path)
if __name__ == "__main__":
from rabbitvcs.ui import main
(options, paths) = main(
usage="Usage: rabbitvcs push [path]"
)
window = push_factory(paths[0])
window.register_gtk_quit()
gtk.main()
示例5: diff_factory
classes_map = {
rabbitvcs.vcs.VCS_SVN: SVNDiff,
rabbitvcs.vcs.VCS_GIT: GitDiff
}
def diff_factory(vcs, path1, revision_obj1, path2=None, revision_obj2=None, sidebyside=False):
if not vcs:
guess = rabbitvcs.vcs.guess(path1)
vcs = guess["vcs"]
return classes_map[vcs](path1, revision_obj1, path2, revision_obj2, sidebyside)
if __name__ == "__main__":
from rabbitvcs.ui import main, VCS_OPT
(options, args) = main([
(["-s", "--sidebyside"], {
"help": _("View diff as side-by-side comparison"),
"action": "store_true",
"default": False
}), VCS_OPT],
usage="Usage: rabbitvcs diff [[email protected]] [[email protected]]"
)
pathrev1 = rabbitvcs.util.helper.parse_path_revision_string(args.pop(0))
pathrev2 = (None, None)
if len(args) > 0:
pathrev2 = rabbitvcs.util.helper.parse_path_revision_string(args.pop(0))
diff_factory(options.vcs, pathrev1[0], pathrev1[1], pathrev2[0], pathrev2[1], sidebyside=options.sidebyside)
示例6: main
row[1],
self.revision_obj,
force=True
)
for row in self.table.get_items():
self.action.append(
self.svn.revpropset,
row[1],
row[2],
self.path,
self.revision_obj,
force=True
)
self.action.schedule()
self.close()
if __name__ == "__main__":
from rabbitvcs.ui import main, VCS_OPT
(options, args) = main(
[VCS_OPT],
usage="Usage: rabbitvcs revprops [[email protected]]"
)
pathrev = rabbitvcs.util.helper.parse_path_revision_string(args.pop(0))
window = SVNRevisionProperties(pathrev[0], pathrev[1])
window.register_gtk_quit()
Gtk.main()
示例7: on_treeview_cell_edited_event
self.on_treeview_event(treeview, data)
def on_treeview_cell_edited_event(self, cell, row, data, column):
self.items_treeview.set_row_item(row, column, data)
self.save(row, column, data)
def on_treeview_event(self, treeview, data):
selected = self.items_treeview.get_selected_row_items(0)
if len(selected) > 0:
if len(selected) == 1:
self.show_edit(selected[0])
self.get_widget("delete").set_sensitive(True)
def show_add(self):
self.state = STATE_ADD
self.items_treeview.unselect_all()
self.items_treeview.append(["", ""])
self.items_treeview.focus(1, 0)
def show_edit(self, remote_name):
self.state = STATE_EDIT
if __name__ == "__main__":
from rabbitvcs.ui import main
(options, paths) = main(usage="Usage: rabbitvcs branch-manager path")
window = GitRemotes(paths[0])
window.register_gtk_quit()
gtk.main()
示例8: _
)
self.action.append(self.action.set_status, _("Completed Reset"))
self.action.append(self.action.finish)
self.action.schedule()
def on_browse_clicked(self, widget, data=None):
chooser = rabbitvcs.ui.dialog.FolderChooser()
path = chooser.run()
if path is not None:
self.get_widget("path").set_text(path)
def on_path_changed(self, widget, data=None):
self.check_path()
def check_path(self):
path = self.get_widget("path").get_text()
root = self.git.find_repository_path(path)
if root != path:
self.get_widget("none_opt").set_active(True)
if __name__ == "__main__":
from rabbitvcs.ui import main, REVISION_OPT, VCS_OPT
(options, paths) = main(
[REVISION_OPT, VCS_OPT],
usage="Usage: rabbitvcs reset [-r REVISION] path"
)
window = GitReset(paths[0], options.revision)
window.register_gtk_quit()
Gtk.main()
示例9: _
if fetch_all:
git_function_params.append ("all")
repository = ""
branch = ""
self.action.append(self.git.pull, repository, branch, git_function_params)
self.action.append(self.action.set_status, _("Completed Update"))
self.action.append(self.action.finish)
self.action.start()
classes_map = {
rabbitvcs.vcs.VCS_SVN: SVNUpdate,
rabbitvcs.vcs.VCS_GIT: GitUpdate
}
def update_factory(paths):
guess = rabbitvcs.vcs.guess(paths[0])
return classes_map[guess["vcs"]](paths)
if __name__ == "__main__":
from rabbitvcs.ui import main
(options, paths) = main(usage="Usage: rabbitvcs update [path1] [path2] ...")
window = update_factory(paths)
window.register_gtk_quit()
if isinstance(window, SVNUpdate):
window.start()
gtk.main()
示例10: _
# Note: if we don't want to ignore errors here, we could define a
# function that logs failures.
shutil.rmtree(temp_dir, ignore_errors = True)
self.action.append(create_patch_action, path, items, self.common)
self.action.append(self.action.set_status, _("Patch File Created"))
self.action.append(self.action.finish)
self.action.start()
classes_map = {
rabbitvcs.vcs.VCS_SVN: SVNCreatePatch,
rabbitvcs.vcs.VCS_GIT: GitCreatePatch
}
def createpatch_factory(paths, base_dir):
guess = rabbitvcs.vcs.guess(paths[0])
return classes_map[guess["vcs"]](paths, base_dir)
if __name__ == "__main__":
from rabbitvcs.ui import main, BASEDIR_OPT
(options, paths) = main(
[BASEDIR_OPT],
usage="Usage: rabbitvcs createpatch [path1] [path2] ..."
)
window = createpatch_factory(paths, options.base_dir)
window.register_gtk_quit()
gtk.main()
示例11: __init__
def __init__(self, path, propdetails):
self.path = path
self.propdetails = propdetails
def all_modified(self):
return all([detail["status"] != "unchanged"
for (propname, detail) in self.propdetails.items()])
def all_not_deleted(self):
return all([detail["status"] != "deleted"
for (propname, detail) in self.propdetails.items()])
def property_revert(self):
return False
# return self.all_modified()
def property_delete(self):
return self.all_not_deleted()
def property_edit(self):
return len(self.propdetails.keys()) == 1
if __name__ == "__main__":
# These are some dumb tests before I add any functionality.
from rabbitvcs.ui import main
(options, paths) = main(usage="Usage: rabbitvcs propedit [url_or_path]")
window = PropEditor(paths[0])
window.register_gtk_quit()
gtk.main()
示例12: _
self.action = rabbitvcs.ui.action.GitAction(
self.git,
register_gtk_quit=self.gtk_quit_is_set()
)
self.action.set_pbar_ticks(ticks)
self.action.append(self.action.set_header, _("Apply Patch"))
self.action.append(self.action.set_status, _("Applying Patch File..."))
self.action.append(self.git.apply_patch, path, base_dir)
self.action.append(self.action.set_status, _("Patch File Applied"))
self.action.append(self.action.finish)
self.action.start()
classes_map = {
rabbitvcs.vcs.VCS_SVN: SVNApplyPatch,
rabbitvcs.vcs.VCS_GIT: GitApplyPatch
}
def applypatch_factory(paths):
guess = rabbitvcs.vcs.guess(paths[0])
return classes_map[guess["vcs"]](paths)
if __name__ == "__main__":
from rabbitvcs.ui import main
(options, paths) = main(usage="Usage: rabbitvcs applypatch [path1] [path2] ...")
window = applypatch_factory(paths)
window.register_gtk_quit()
window.start()
gtk.main()
示例13: on_repo_browser_clicked
def on_repo_browser_clicked(self, widget, data=None):
from rabbitvcs.ui.browser import BrowserDialog
BrowserDialog(self.from_urls.get_active_text(),
callback=self.on_repo_browser_closed)
def on_repo_browser_closed(self, new_url):
self.from_urls.set_child_text(new_url)
classes_map = {
rabbitvcs.vcs.VCS_SVN: SVNBranch
}
def branch_factory(vcs, path, revision=None):
if not vcs:
guess = rabbitvcs.vcs.guess(path)
vcs = guess["vcs"]
return classes_map[vcs](path, revision)
if __name__ == "__main__":
from rabbitvcs.ui import main, REVISION_OPT, VCS_OPT
(options, args) = main(
[REVISION_OPT, VCS_OPT],
usage="Usage: rabbitvcs branch [url_or_path]"
)
window = branch_factory(options.vcs, args[0], options.revision)
window.register_gtk_quit()
gtk.main()
示例14: show
(MenuCompare, None),
(MenuSeparator, None),
(MenuUpdate, None)
]
def show(self):
if len(self.paths) == 0:
return
context_menu = GtkContextMenu(self.structure, self.conditions, self.callbacks)
context_menu.show(self.event)
classes_map = {
rabbitvcs.vcs.VCS_SVN: SVNCheckForModifications
}
def checkmods_factory(paths, base_dir):
guess = rabbitvcs.vcs.guess(paths[0])
return classes_map[guess["vcs"]](paths, base_dir)
if __name__ == "__main__":
from rabbitvcs.ui import main, BASEDIR_OPT
(options, paths) = main(
[BASEDIR_OPT],
usage="Usage: rabbitvcs checkmods [url_or_path]"
)
window = checkmods_factory(paths, options.base_dir)
window.register_gtk_quit()
gtk.main()
示例15: SystemExit
relative_path = path[len(repo_path)+1:]
dest_path = "%s/%s" % (dest_dir, relative_path)
rabbitvcs.util.helper.open_item(dest_path)
raise SystemExit()
classes_map = {
rabbitvcs.vcs.VCS_SVN: SVNOpen,
rabbitvcs.vcs.VCS_GIT: GitOpen
}
def open_factory(vcs, path, revision):
if not vcs:
guess = rabbitvcs.vcs.guess(path)
vcs = guess["vcs"]
return classes_map[vcs](path, revision)
if __name__ == "__main__":
from rabbitvcs.ui import main, REVISION_OPT, VCS_OPT
(options, paths) = main(
[REVISION_OPT, VCS_OPT],
usage="Usage: rabbitvcs open path [-r REVISION]"
)
window = open_factory(options.vcs, paths[0], options.revision)
window.register_gtk_quit()
gtk.main()