本文整理汇总了Python中cola.widgets.diff.DiffEditor.set_tab_width方法的典型用法代码示例。如果您正苦于以下问题:Python DiffEditor.set_tab_width方法的具体用法?Python DiffEditor.set_tab_width怎么用?Python DiffEditor.set_tab_width使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cola.widgets.diff.DiffEditor
的用法示例。
在下文中一共展示了DiffEditor.set_tab_width方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MainView
# 需要导入模块: from cola.widgets.diff import DiffEditor [as 别名]
# 或者: from cola.widgets.diff.DiffEditor import set_tab_width [as 别名]
#.........这里部分代码省略.........
self._install_config_actions)
# Install .git-config-defined actions
self._config_task = None
self.install_config_actions()
# Restore saved settings
qtutils.apply_state(self)
self.statusdockwidget.widget().setFocus()
log(0, version.git_version_str() + '\ncola version ' + version.version())
# Qt overrides
def closeEvent(self, event):
"""Save state in the settings manager."""
qtutils.save_state(self)
standard.MainWindow.closeEvent(self, event)
# Accessors
mode = property(lambda self: self.model.mode)
def _config_updated(self, source, config, value):
if config == 'cola.fontdiff':
font = QtGui.QFont()
if not font.fromString(value):
return
qtutils.logger().setFont(font)
self.diff_editor.setFont(font)
self.commitmsgeditor.setFont(font)
elif config == 'cola.tabwidth':
# variable-tab-width setting
self.diff_editor.set_tab_width(value)
def install_config_actions(self):
"""Install .gitconfig-defined actions"""
self._config_task = self._start_config_actions_task()
def _start_config_actions_task(self):
"""Do the expensive "get_config_actions()" call in the background"""
class ConfigActionsTask(QtCore.QRunnable):
def __init__(self, sender):
QtCore.QRunnable.__init__(self)
self._sender = sender
def run(self):
names = cfgactions.get_config_actions()
self._sender.emit(SIGNAL('install_config_actions'), names)
task = ConfigActionsTask(self)
QtCore.QThreadPool.globalInstance().start(task)
return task
def _install_config_actions(self, names):
"""Install .gitconfig-defined actions"""
if not names:
return
menu = self.actions_menu
menu.addSeparator()
for name in names:
menu.addAction(name, emit(self, signals.run_config_action, name))
def _update_view(self):
self.emit(SIGNAL('update'))
def _update_callback(self):