Import directly from other modules in the same package. Documentation.
svn: r10718
This commit is contained in:
parent
c67fec4d9e
commit
1019bfa2df
@ -47,10 +47,10 @@ from pango import UNDERLINE_SINGLE
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
from gen.lib import StyledTextTagType
|
from gen.lib import StyledTextTagType
|
||||||
from widgets import (StyledTextBuffer, ALLOWED_STYLES,
|
from widgets.styledtextbuffer import (StyledTextBuffer, ALLOWED_STYLES,
|
||||||
MATCH_START, MATCH_END,
|
MATCH_START, MATCH_END,
|
||||||
MATCH_FLAVOR, MATCH_STRING,
|
MATCH_FLAVOR, MATCH_STRING)
|
||||||
ComboToolAction, SpringSeparatorAction)
|
from widgets.toolbarwidgets import (ComboToolAction, SpringSeparatorAction)
|
||||||
from Spell import Spell
|
from Spell import Spell
|
||||||
from GrampsDisplay import url as display_url
|
from GrampsDisplay import url as display_url
|
||||||
|
|
||||||
@ -116,9 +116,11 @@ class StyledTextEditor(gtk.TextView):
|
|||||||
|
|
||||||
StyledTextEdit defines a new signal: 'match-changed', which is raised
|
StyledTextEdit defines a new signal: 'match-changed', which is raised
|
||||||
whenever the mouse cursor reaches or leaves a matched string in the text.
|
whenever the mouse cursor reaches or leaves a matched string in the text.
|
||||||
The feature uses the regexp pattern mathing mechanism L{StyledTextBuffer}.
|
The feature uses the regexp pattern mathing mechanism of
|
||||||
|
L{StyledTextBuffer}.
|
||||||
The signal's default handler highlights the URL strings. URL's can be
|
The signal's default handler highlights the URL strings. URL's can be
|
||||||
followed from the editor's popup menu.
|
followed from the editor's popup menu or by pressing the <CTRL>Left
|
||||||
|
mouse button.
|
||||||
|
|
||||||
@ivar last_match: previously matched string, used for generating the
|
@ivar last_match: previously matched string, used for generating the
|
||||||
'match-changed' signal.
|
'match-changed' signal.
|
||||||
@ -459,7 +461,7 @@ class StyledTextEditor(gtk.TextView):
|
|||||||
self.textbuffer.apply_style(style, value)
|
self.textbuffer.apply_style(style, value)
|
||||||
|
|
||||||
def _on_action_activate(self, action):
|
def _on_action_activate(self, action):
|
||||||
"""Apply a format."""
|
"""Apply a format set from a gtk.Action type of action."""
|
||||||
style = int(action.get_name())
|
style = int(action.get_name())
|
||||||
current_value = self.textbuffer.get_style_at_cursor(style)
|
current_value = self.textbuffer.get_style_at_cursor(style)
|
||||||
|
|
||||||
@ -487,6 +489,7 @@ class StyledTextEditor(gtk.TextView):
|
|||||||
self.textbuffer.apply_style(style, value)
|
self.textbuffer.apply_style(style, value)
|
||||||
|
|
||||||
def _on_comboaction_activate(self, action):
|
def _on_comboaction_activate(self, action):
|
||||||
|
"""Apply a format set by a ComboToolAction type of action."""
|
||||||
if self._internal_style_change:
|
if self._internal_style_change:
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -513,7 +516,7 @@ class StyledTextEditor(gtk.TextView):
|
|||||||
self.textbuffer.remove_style(style)
|
self.textbuffer.remove_style(style)
|
||||||
|
|
||||||
def _on_buffer_style_changed(self, buffer, changed_styles):
|
def _on_buffer_style_changed(self, buffer, changed_styles):
|
||||||
# update action values
|
"""Synchronize actions as the format changes at the buffer's cursor."""
|
||||||
for style in changed_styles.keys():
|
for style in changed_styles.keys():
|
||||||
if str(style) in self.toggle_actions:
|
if str(style) in self.toggle_actions:
|
||||||
action = self.action_group.get_action(str(style))
|
action = self.action_group.get_action(str(style))
|
||||||
@ -608,6 +611,7 @@ def hex_to_color(hex):
|
|||||||
return color
|
return color
|
||||||
|
|
||||||
def is_valid_fontsize(text):
|
def is_valid_fontsize(text):
|
||||||
|
"""Validator function for font size selector widget."""
|
||||||
try:
|
try:
|
||||||
size = int(text)
|
size = int(text)
|
||||||
return (size > 0) and (size < 73)
|
return (size > 0) and (size < 73)
|
||||||
|
Loading…
Reference in New Issue
Block a user