本文整理匯總了Python中cola.widgets.commitmsg.CommitMessageEditor.commit_message方法的典型用法代碼示例。如果您正苦於以下問題:Python CommitMessageEditor.commit_message方法的具體用法?Python CommitMessageEditor.commit_message怎麽用?Python CommitMessageEditor.commit_message使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類cola.widgets.commitmsg.CommitMessageEditor
的用法示例。
在下文中一共展示了CommitMessageEditor.commit_message方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: MainView
# 需要導入模塊: from cola.widgets.commitmsg import CommitMessageEditor [as 別名]
# 或者: from cola.widgets.commitmsg.CommitMessageEditor import commit_message [as 別名]
#.........這裏部分代碼省略.........
self.install_config_actions()
self.dockwidgets = (
self.logdockwidget,
self.commitdockwidget,
self.statusdockwidget,
self.diffdockwidget,
self.actionsdockwidget,
)
# Restore saved settings
if not qtutils.apply_state(self):
self.set_initial_size()
self.statusdockwidget.widget().setFocus()
# Route command output here
Interaction.log_status = self.logwidget.log_status
Interaction.log = self.logwidget.log
Interaction.log(version.git_version_str() + '\n' +
N_('git cola version %s') % version.version())
def set_initial_size(self):
self.statuswidget.set_initial_size()
self.commitmsgeditor.set_initial_size()
# Qt overrides
def closeEvent(self, event):
"""Save state in the settings manager."""
s = settings.Settings()
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)
示例2: MainView
# 需要導入模塊: from cola.widgets.commitmsg import CommitMessageEditor [as 別名]
# 或者: from cola.widgets.commitmsg.CommitMessageEditor import commit_message [as 別名]
#.........這裏部分代碼省略.........
self.statuswidget.refresh)
self.connect(self, SIGNAL('update'), self._update_callback)
self.connect(self, SIGNAL('install_config_actions'),
self._install_config_actions)
# Install .git-config-defined actions
self._config_task = None
self.install_config_actions()
# Restore saved settings
if not self.restore_state(settings=settings):
self.resize(987, 610)
self.set_initial_size()
self.statusdockwidget.widget().setFocus()
# Route command output here
Interaction.log_status = self.logwidget.log_status
Interaction.log = self.logwidget.log
Interaction.log(version.git_version_str() + '\n' +
N_('git cola version %s') % version.version())
def set_initial_size(self):
self.statuswidget.set_initial_size()
self.commitmsgeditor.set_initial_size()
def set_filter(self, txt):
self.statuswidget.set_filter(txt)
# 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):
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)
示例3: MainView
# 需要導入模塊: from cola.widgets.commitmsg import CommitMessageEditor [as 別名]
# 或者: from cola.widgets.commitmsg.CommitMessageEditor import commit_message [as 別名]
#.........這裏部分代碼省略.........
prefs_model.add_observer(prefs_model.message_config_updated, self._config_updated)
# Set a default value
self.show_cursor_position(1, 0)
self.connect(self.open_recent_action, SIGNAL("aboutToShow()"), self.build_recent_menu)
self.connect(self.commitmsgeditor, SIGNAL("cursorPosition(int,int)"), self.show_cursor_position)
self.connect(self, SIGNAL("update"), self._update_callback)
self.connect(self, SIGNAL("install_config_actions"), self._install_config_actions)
# Install .git-config-defined actions
self._config_task = None
self.install_config_actions()
# Restore saved settings
if not qtutils.apply_state(self):
self.set_initial_size()
self.statusdockwidget.widget().setFocus()
# Route command output here
Interaction.log_status = self.logwidget.log_status
Interaction.log = self.logwidget.log
Interaction.log(version.git_version_str() + "\n" + N_("git cola version %s") % version.version())
def set_initial_size(self):
self.statuswidget.set_initial_size()
self.commitmsgeditor.set_initial_size()
# 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: