本文整理汇总了Python中cola.widgets.status.StatusWidget.refresh方法的典型用法代码示例。如果您正苦于以下问题:Python StatusWidget.refresh方法的具体用法?Python StatusWidget.refresh怎么用?Python StatusWidget.refresh使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cola.widgets.status.StatusWidget
的用法示例。
在下文中一共展示了StatusWidget.refresh方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MainView
# 需要导入模块: from cola.widgets.status import StatusWidget [as 别名]
# 或者: from cola.widgets.status.StatusWidget import refresh [as 别名]
#.........这里部分代码省略.........
if utils.is_darwin():
optkey = 'Meta'
else:
optkey = 'Ctrl'
dockwidgets = (
(optkey + '+0', self.logdockwidget),
(optkey + '+1', self.commitdockwidget),
(optkey + '+2', self.statusdockwidget),
(optkey + '+3', self.diffdockwidget),
(optkey + '+4', self.actionsdockwidget),
(optkey + '+5', self.bookmarksdockwidget),
)
for shortcut, dockwidget in dockwidgets:
# Associate the action with the shortcut
toggleview = dockwidget.toggleViewAction()
toggleview.setShortcut('Shift+' + shortcut)
self.view_menu.addAction(toggleview)
def showdock(show, dockwidget=dockwidget):
if show:
dockwidget.raise_()
dockwidget.widget().setFocus()
else:
self.setFocus()
self.addAction(toggleview)
connect_action_bool(toggleview, showdock)
# Create a new shortcut Shift+<shortcut> that gives focus
toggleview = QtGui.QAction(self)
toggleview.setShortcut(shortcut)
def focusdock(dockwidget=dockwidget, showdock=showdock):
if dockwidget.toggleViewAction().isChecked():
showdock(True)
else:
dockwidget.toggleViewAction().trigger()
self.addAction(toggleview)
connect_action(toggleview, focusdock)
def _update_diff_opts(self):
space_at_eol = self.diff_ignore_space_at_eol_action.isChecked()
space_change = self.diff_ignore_space_change_action.isChecked()
all_space = self.diff_ignore_all_space_action.isChecked()
function_context = self.diff_function_context_action.isChecked()
gitcmds.update_diff_overrides(space_at_eol,
space_change,
all_space,
function_context)
self.statuswidget.refresh()
def preferences(self):
return preferences(model=self.prefs_model, parent=self)
def save_archive(self):
ref = git.rev_parse('HEAD')[STDOUT]
shortref = ref[:7]
GitArchiveDialog.save(ref, shortref, self)
def show_cursor_position(self, rows, cols):
display = ' %02d:%02d ' % (rows, cols)
if cols > 78:
display = ('<span style="color: white; '
' background-color: red;"'
'>%s</span>' % display)
elif cols > 72:
display = ('<span style="color: black; '
' background-color: orange;"'
'>%s</span>' % display)
elif cols > 64:
display = ('<span style="color: black; '
' background-color: yellow;"'
'>%s</span>' % display)
else:
display = ('<span style="color: grey;">%s</span>' % display)
self.position_label.setText(display)
def manage_bookmarks(self):
manage_bookmarks()
self.bookmarkswidget.refresh()
def rebase_start(self):
branch = guicmds.choose_ref(N_('Select New Upstream'),
N_('Interactive Rebase'))
if not branch:
return None
self.model.is_rebasing = True
self._update_callback()
cmds.do(cmds.Rebase, branch)
def rebase_edit_todo(self):
cmds.do(cmds.RebaseEditTodo)
def rebase_continue(self):
cmds.do(cmds.RebaseContinue)
def rebase_skip(self):
cmds.do(cmds.RebaseSkip)
def rebase_abort(self):
cmds.do(cmds.RebaseAbort)
示例2: MainView
# 需要导入模块: from cola.widgets.status import StatusWidget [as 别名]
# 或者: from cola.widgets.status.StatusWidget import refresh [as 别名]
#.........这里部分代码省略.........
optkey = 'Meta'
else:
optkey = 'Ctrl'
dockwidgets = (
(optkey + '+0', self.logdockwidget),
(optkey + '+1', self.commitdockwidget),
(optkey + '+2', self.statusdockwidget),
(optkey + '+3', self.diffdockwidget),
(optkey + '+4', self.actionsdockwidget),
)
for shortcut, dockwidget in dockwidgets:
# Associate the action with the shortcut
toggleview = dockwidget.toggleViewAction()
toggleview.setShortcut(shortcut)
self.tools_menu.addAction(toggleview)
def showdock(show, dockwidget=dockwidget):
if show:
dockwidget.raise_()
dockwidget.widget().setFocus()
else:
self.setFocus()
self.addAction(toggleview)
connect_action_bool(toggleview, showdock)
# Create a new shortcut Shift+<shortcut> that gives focus
toggleview = QtGui.QAction(self)
toggleview.setShortcut('Shift+' + shortcut)
def focusdock(dockwidget=dockwidget, showdock=showdock):
if dockwidget.toggleViewAction().isChecked():
showdock(True)
else:
dockwidget.toggleViewAction().trigger()
self.addAction(toggleview)
connect_action(toggleview, focusdock)
def _update_diff_opts(self):
space_at_eol = self.diff_ignore_space_at_eol_action.isChecked()
space_change = self.diff_ignore_space_change_action.isChecked()
all_space = self.diff_ignore_all_space_action.isChecked()
function_context = self.diff_function_context_action.isChecked()
gitcmds.update_diff_overrides(space_at_eol,
space_change,
all_space,
function_context)
self.statuswidget.refresh()
def preferences(self):
return prefs.preferences(model=self.prefs_model, parent=self)
def save_archive(self):
ref = git.rev_parse('HEAD')
shortref = ref[:7]
GitArchiveDialog.save(ref, shortref, self)
def dragEnterEvent(self, event):
"""Accepts drops"""
MainWindow.dragEnterEvent(self, event)
event.acceptProposedAction()
def dropEvent(self, event):
"""Apply dropped patches with git-am"""
event.accept()
urls = event.mimeData().urls()
if not urls:
return
paths = map(lambda x: unicode(x.path()), urls)
patches = [p for p in paths if p.endswith('.patch')]
dirs = [p for p in paths if os.path.isdir(p)]
dirs.sort()
for d in dirs:
patches.extend(self._gather_patches(d))
cmds.do(cmds.ApplyPatches, patches)
def _gather_patches(self, path):
"""Find patches in a subdirectory"""
patches = []
for root, subdirs, files in os.walk(path):
for name in [f for f in files if f.endswith('.patch')]:
patches.append(os.path.join(root, name))
return patches
def show_cursor_position(self, rows, cols):
display = ' %02d:%02d ' % (rows, cols)
if cols > 78:
display = ('<span style="color: white; '
' background-color: red;"'
'>%s</span>' % display)
elif cols > 72:
display = ('<span style="color: black; '
' background-color: orange;"'
'>%s</span>' % display)
elif cols > 64:
display = ('<span style="color: black; '
' background-color: yellow;"'
'>%s</span>' % display)
else:
display = ('<span style="color: grey;">%s</span>' % display)
self.position_label.setText(display)