本文整理汇总了Python中cola.widgets.commitmsg.CommitMessageEditor.set_tabwidth方法的典型用法代码示例。如果您正苦于以下问题:Python CommitMessageEditor.set_tabwidth方法的具体用法?Python CommitMessageEditor.set_tabwidth怎么用?Python CommitMessageEditor.set_tabwidth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cola.widgets.commitmsg.CommitMessageEditor
的用法示例。
在下文中一共展示了CommitMessageEditor.set_tabwidth方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MainView
# 需要导入模块: from cola.widgets.commitmsg import CommitMessageEditor [as 别名]
# 或者: from cola.widgets.commitmsg.CommitMessageEditor import set_tabwidth [as 别名]
#.........这里部分代码省略.........
s.add_recent(core.decode(os.getcwd()))
qtutils.save_state(self, handler=s)
commit_msg = self.commitmsgeditor.commit_message(raw=True)
self.model.save_commitmsg(commit_msg)
MainWindow.closeEvent(self, event)
def build_recent_menu(self):
recent = settings.Settings().recent
menu = self.menu_open_recent
menu.clear()
for r in recent:
name = os.path.basename(r)
directory = os.path.dirname(r)
text = '%s %s %s' % (name, unichr(0x2192), directory)
menu.addAction(text, cmds.run(cmds.OpenRepo, r))
# Accessors
mode = property(lambda self: self.model.mode)
def _config_updated(self, source, config, value):
if config == 'cola.fontdiff':
# The diff font
font = QtGui.QFont()
if not font.fromString(value):
return
self.logwidget.setFont(font)
self.diffeditor.setFont(font)
self.commitmsgeditor.setFont(font)
elif config == 'cola.tabwidth':
# variable-tab-width setting
self.diffeditor.set_tabwidth(value)
self.commitmsgeditor.set_tabwidth(value)
elif config == 'cola.linebreak':
# enables automatic line breaks
self.commitmsgeditor.set_linebreak(value)
elif config == 'cola.textwidth':
# text width used for line wrapping
self.commitmsgeditor.set_textwidth(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
示例2: MainView
# 需要导入模块: from cola.widgets.commitmsg import CommitMessageEditor [as 别名]
# 或者: from cola.widgets.commitmsg.CommitMessageEditor import set_tabwidth [as 别名]
#.........这里部分代码省略.........
"""Save state in the settings manager."""
commit_msg = self.commitmsgeditor.commit_message(raw=True)
self.model.save_commitmsg(commit_msg)
MainWindow.closeEvent(self, event)
def build_recent_menu(self):
settings = Settings()
settings.load()
recent = settings.recent
cmd = cmds.OpenRepo
menu = self.open_recent_menu
menu.clear()
for r in recent:
name = os.path.basename(r)
directory = os.path.dirname(r)
text = '%s %s %s' % (name, unichr(0x2192), directory)
menu.addAction(text, cmds.run(cmd, r))
# Accessors
mode = property(lambda self: self.model.mode)
def _config_updated(self, source, config, value):
if config == prefs.FONTDIFF:
# The diff font
font = QtGui.QFont()
if not font.fromString(value):
return
self.logwidget.setFont(font)
self.diffeditor.setFont(font)
self.commitmsgeditor.setFont(font)
elif config == prefs.TABWIDTH:
# variable-tab-width setting
self.diffeditor.set_tabwidth(value)
self.commitmsgeditor.set_tabwidth(value)
elif config == prefs.LINEBREAK:
# enables automatic line breaks
self.commitmsgeditor.set_linebreak(value)
elif config == prefs.TEXTWIDTH:
# text width used for line wrapping
self.commitmsgeditor.set_textwidth(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
示例3: MainView
# 需要导入模块: from cola.widgets.commitmsg import CommitMessageEditor [as 别名]
# 或者: from cola.widgets.commitmsg.CommitMessageEditor import set_tabwidth [as 别名]
#.........这里部分代码省略.........
# Qt overrides
def closeEvent(self, event):
"""Save state in the settings manager."""
commit_msg = self.commitmsgeditor.commit_message(raw=True)
self.model.save_commitmsg(commit_msg)
MainWindow.closeEvent(self, event)
def build_recent_menu(self):
recent = settings.Settings().recent
menu = self.open_recent_action
menu.clear()
for r in recent:
name = os.path.basename(r)
directory = os.path.dirname(r)
text = "%s %s %s" % (name, unichr(0x2192), directory)
menu.addAction(text, cmds.run(cmds.OpenRepo, r))
# Accessors
mode = property(lambda self: self.model.mode)
def _config_updated(self, source, config, value):
if config == prefs.FONTDIFF:
# The diff font
font = QtGui.QFont()
if not font.fromString(value):
return
self.logwidget.setFont(font)
self.diffeditor.setFont(font)
self.commitmsgeditor.setFont(font)
elif config == prefs.TABWIDTH:
# variable-tab-width setting
self.diffeditor.set_tabwidth(value)
self.commitmsgeditor.set_tabwidth(value)
elif config == prefs.LINEBREAK:
# enables automatic line breaks
self.commitmsgeditor.set_linebreak(value)
elif config == prefs.TEXTWIDTH:
# text width used for line wrapping
self.commitmsgeditor.set_textwidth(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"""