本文整理汇总了Python中cola.widgets.diff.DiffEditor.setFont方法的典型用法代码示例。如果您正苦于以下问题:Python DiffEditor.setFont方法的具体用法?Python DiffEditor.setFont怎么用?Python DiffEditor.setFont使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cola.widgets.diff.DiffEditor
的用法示例。
在下文中一共展示了DiffEditor.setFont方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MainView
# 需要导入模块: from cola.widgets.diff import DiffEditor [as 别名]
# 或者: from cola.widgets.diff.DiffEditor import setFont [as 别名]
class MainView(MainWindow):
def __init__(self, model, parent):
MainWindow.__init__(self, parent)
# Default size; this is thrown out when save/restore is used
self.resize(987, 610)
self.model = model
self.prefs_model = prefs_model = prefs.PreferencesModel()
# Internal field used by import/export_state().
# Change this whenever dockwidgets are removed.
self.widget_version = 2
# Keeps track of merge messages we've seen
self.merge_message_hash = ''
self.setAcceptDrops(True)
self.setAttribute(Qt.WA_MacMetalStyle)
# Dockwidget options
qtcompat.set_common_dock_options(self)
cfg = gitcfg.instance()
self.classic_dockable = (cfg.get('cola.browserdockable') or
cfg.get('cola.classicdockable'))
if self.classic_dockable:
self.classicdockwidget = create_dock(N_('Browser'), self)
self.classicwidget = classic_widget(self)
self.classicdockwidget.setWidget(self.classicwidget)
# "Actions" widget
self.actionsdockwidget = create_dock(N_('Action'), self)
self.actionsdockwidgetcontents = action.ActionButtons(self)
self.actionsdockwidget.setWidget(self.actionsdockwidgetcontents)
self.actionsdockwidget.toggleViewAction().setChecked(False)
self.actionsdockwidget.hide()
# "Repository Status" widget
self.statuswidget = StatusWidget(self)
self.statusdockwidget = create_dock(N_('Status'), self)
self.statusdockwidget.setWidget(self.statuswidget)
# "Commit Message Editor" widget
self.position_label = QtGui.QLabel()
font = qtutils.default_monospace_font()
font.setPointSize(int(font.pointSize() * 0.8))
self.position_label.setFont(font)
self.commitdockwidget = create_dock(N_('Commit'), self)
titlebar = self.commitdockwidget.titleBarWidget()
titlebar.add_corner_widget(self.position_label)
self.commitmsgeditor = CommitMessageEditor(model, self)
self.commitdockwidget.setWidget(self.commitmsgeditor)
# "Console" widget
self.logwidget = LogWidget()
self.logdockwidget = create_dock(N_('Console'), self)
self.logdockwidget.setWidget(self.logwidget)
self.logdockwidget.toggleViewAction().setChecked(False)
self.logdockwidget.hide()
# "Diff Viewer" widget
self.diffdockwidget = create_dock(N_('Diff'), self)
self.diffeditor = DiffEditor(self.diffdockwidget)
self.diffdockwidget.setWidget(self.diffeditor)
# "Diff Options" tool menu
self.diff_ignore_space_at_eol_action = add_action(self,
N_('Ignore changes in whitespace at EOL'),
self._update_diff_opts)
self.diff_ignore_space_at_eol_action.setCheckable(True)
self.diff_ignore_space_change_action = add_action(self,
N_('Ignore changes in amount of whitespace'),
self._update_diff_opts)
self.diff_ignore_space_change_action.setCheckable(True)
self.diff_ignore_all_space_action = add_action(self,
N_('Ignore all whitespace'),
self._update_diff_opts)
self.diff_ignore_all_space_action.setCheckable(True)
self.diff_function_context_action = add_action(self,
N_('Show whole surrounding functions of changes'),
self._update_diff_opts)
self.diff_function_context_action.setCheckable(True)
self.diffopts_button = create_toolbutton(text=N_('Options'),
icon=options_icon(),
tooltip=N_('Diff Options'))
self.diffopts_menu = create_menu(N_('Diff Options'),
self.diffopts_button)
self.diffopts_menu.addAction(self.diff_ignore_space_at_eol_action)
self.diffopts_menu.addAction(self.diff_ignore_space_change_action)
self.diffopts_menu.addAction(self.diff_ignore_all_space_action)
self.diffopts_menu.addAction(self.diff_function_context_action)
self.diffopts_button.setMenu(self.diffopts_menu)
self.diffopts_button.setPopupMode(QtGui.QToolButton.InstantPopup)
titlebar = self.diffdockwidget.titleBarWidget()
#.........这里部分代码省略.........
示例2: MainView
# 需要导入模块: from cola.widgets.diff import DiffEditor [as 别名]
# 或者: from cola.widgets.diff.DiffEditor import setFont [as 别名]
class MainView(MainWindow):
def __init__(self, model, parent=None):
MainWindow.__init__(self, parent)
self.setAttribute(Qt.WA_MacMetalStyle)
# Default size; this is thrown out when save/restore is used
self.resize(987, 610)
self.model = model
self.prefs_model = prefs_model = prefs.PreferencesModel()
# The widget version is used by import/export_state().
# Change this whenever dockwidgets are removed.
self.widget_version = 2
# Keeps track of merge messages we've seen
self.merge_message_hash = ''
cfg = gitcfg.instance()
self.browser_dockable = (cfg.get('cola.browserdockable') or
cfg.get('cola.classicdockable'))
if self.browser_dockable:
self.browserdockwidget = create_dock(N_('Browser'), self)
self.browserwidget = worktree_browser_widget(self)
self.browserdockwidget.setWidget(self.browserwidget)
# "Actions" widget
self.actionsdockwidget = create_dock(N_('Actions'), self)
self.actionsdockwidgetcontents = action.ActionButtons(self)
self.actionsdockwidget.setWidget(self.actionsdockwidgetcontents)
self.actionsdockwidget.toggleViewAction().setChecked(False)
self.actionsdockwidget.hide()
# "Repository Status" widget
self.statuswidget = StatusWidget(self)
self.statusdockwidget = create_dock(N_('Status'), self)
self.statusdockwidget.setWidget(self.statuswidget)
# "Switch Repository" widget
self.bookmarksdockwidget = create_dock(N_('Bookmarks'), self)
self.bookmarkswidget = BookmarksWidget(parent=self.bookmarksdockwidget)
self.bookmarksdockwidget.setWidget(self.bookmarkswidget)
# "Commit Message Editor" widget
self.position_label = QtGui.QLabel()
font = qtutils.default_monospace_font()
font.setPointSize(int(font.pointSize() * 0.8))
self.position_label.setFont(font)
self.commitdockwidget = create_dock(N_('Commit'), self)
titlebar = self.commitdockwidget.titleBarWidget()
titlebar.add_corner_widget(self.position_label)
self.commitmsgeditor = CommitMessageEditor(model, self)
self.commitdockwidget.setWidget(self.commitmsgeditor)
# "Console" widget
self.logwidget = LogWidget()
self.logdockwidget = create_dock(N_('Console'), self)
self.logdockwidget.setWidget(self.logwidget)
self.logdockwidget.toggleViewAction().setChecked(False)
self.logdockwidget.hide()
# "Diff Viewer" widget
self.diffdockwidget = create_dock(N_('Diff'), self)
self.diffeditor = DiffEditor(self.diffdockwidget)
self.diffdockwidget.setWidget(self.diffeditor)
# "Diff Options" tool menu
self.diff_ignore_space_at_eol_action = add_action(self,
N_('Ignore changes in whitespace at EOL'),
self._update_diff_opts)
self.diff_ignore_space_at_eol_action.setCheckable(True)
self.diff_ignore_space_change_action = add_action(self,
N_('Ignore changes in amount of whitespace'),
self._update_diff_opts)
self.diff_ignore_space_change_action.setCheckable(True)
self.diff_ignore_all_space_action = add_action(self,
N_('Ignore all whitespace'),
self._update_diff_opts)
self.diff_ignore_all_space_action.setCheckable(True)
self.diff_function_context_action = add_action(self,
N_('Show whole surrounding functions of changes'),
self._update_diff_opts)
self.diff_function_context_action.setCheckable(True)
self.diffopts_button = create_action_button(
N_('Diff Options'), options_icon())
self.diffopts_menu = create_menu(N_('Diff Options'),
self.diffopts_button)
self.diffopts_menu.addAction(self.diff_ignore_space_at_eol_action)
self.diffopts_menu.addAction(self.diff_ignore_space_change_action)
self.diffopts_menu.addAction(self.diff_ignore_all_space_action)
self.diffopts_menu.addAction(self.diff_function_context_action)
self.diffopts_button.setMenu(self.diffopts_menu)
titlebar = self.diffdockwidget.titleBarWidget()
#.........这里部分代码省略.........
示例3: MainView
# 需要导入模块: from cola.widgets.diff import DiffEditor [as 别名]
# 或者: from cola.widgets.diff.DiffEditor import setFont [as 别名]
class MainView(standard.MainWindow):
def __init__(self, model, parent):
super(MainView, self).__init__(parent)
# Default size; this is thrown out when save/restore is used
self.resize(987, 610)
self.model = model
self.prefs_model = prefs_model = PreferencesModel()
# Internal field used by import/export_state().
# Change this whenever dockwidgets are removed.
self.widget_version = 1
# Keeps track of merge messages we've seen
self.merge_message_hash = ''
self.setAcceptDrops(True)
self.setAttribute(Qt.WA_MacMetalStyle)
# Dockwidget options
qtcompat.set_common_dock_options(self)
cfg = gitcfg.instance()
self.classic_dockable = (cfg.get('cola.browserdockable') or
cfg.get('cola.classicdockable'))
if self.classic_dockable:
self.classicdockwidget = create_dock('Browser', self)
self.classicwidget = classic_widget(self)
self.classicdockwidget.setWidget(self.classicwidget)
# "Actions" widget
self.actionsdockwidget = create_dock('Action', self)
self.actionsdockwidgetcontents = qt.QFlowLayoutWidget(self)
layout = self.actionsdockwidgetcontents.layout()
self.stage_button = create_button(text='Stage', layout=layout)
self.unstage_button = create_button(text='Unstage', layout=layout)
self.rescan_button = create_button(text='Rescan', layout=layout)
self.fetch_button = create_button(text='Fetch...', layout=layout)
self.push_button = create_button(text='Push...', layout=layout)
self.pull_button = create_button(text='Pull...', layout=layout)
self.stash_button = create_button(text='Stash...', layout=layout)
layout.addStretch()
self.actionsdockwidget.setWidget(self.actionsdockwidgetcontents)
# "Repository Status" widget
self.statusdockwidget = create_dock('Status', self)
self.statusdockwidget.setWidget(StatusWidget(self))
# "Commit Message Editor" widget
self.position_label = QtGui.QLabel()
font = qtutils.default_monospace_font()
font.setPointSize(int(font.pointSize() * 0.8))
self.position_label.setFont(font)
self.commitdockwidget = create_dock('Commit', self)
titlebar = self.commitdockwidget.titleBarWidget()
titlebar.add_corner_widget(self.position_label)
self.commitmsgeditor = CommitMessageEditor(model, self)
relay_signal(self, self.commitmsgeditor, SIGNAL(signals.amend_mode))
relay_signal(self, self.commitmsgeditor, SIGNAL(signals.signoff))
relay_signal(self, self.commitmsgeditor,
SIGNAL(signals.load_previous_message))
self.commitdockwidget.setWidget(self.commitmsgeditor)
# "Console" widget
logwidget = qtutils.logger()
logwidget.setFont(diff_font())
self.logdockwidget = create_dock('Console', self)
self.logdockwidget.setWidget(logwidget)
# "Diff Viewer" widget
self.diffdockwidget = create_dock('Diff', self)
self.diff_editor = DiffEditor(self.diffdockwidget)
self.diffdockwidget.setWidget(self.diff_editor)
# All Actions
self.menu_unstage_all = add_action(self,
'Unstage All', emit(self, signals.unstage_all))
self.menu_unstage_all.setIcon(qtutils.icon('remove.svg'))
self.menu_unstage_selected = add_action(self,
'Unstage From Commit', emit(self, signals.unstage_selected))
self.menu_unstage_selected.setIcon(qtutils.icon('remove.svg'))
self.menu_show_diffstat = add_action(self,
'Diffstat', emit(self, signals.diffstat), 'Alt+D')
self.menu_stage_modified = add_action(self,
'Stage Changed Files To Commit',
emit(self, signals.stage_modified), 'Alt+A')
self.menu_stage_modified.setIcon(qtutils.icon('add.svg'))
self.menu_stage_untracked = add_action(self,
'Stage All Untracked', emit(self, signals.stage_untracked), 'Alt+U')
self.menu_stage_untracked.setIcon(qtutils.icon('add.svg'))
self.menu_export_patches = add_action(self,
'Export Patches...', guicmds.export_patches, 'Alt+E')
self.menu_preferences = add_action(self,
'Preferences', lambda: preferences(model=prefs_model),
QtGui.QKeySequence.Preferences, 'Ctrl+O')
#.........这里部分代码省略.........