本文整理匯總了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):