2007-02-13 Zsolt Foldvari <zfoldvar@users.sourceforge.net>

* src/GrampsWidgets.py: Merge trunk changes r7950:8105
	* src/MarkupText.py: cleanup



svn: r8106
This commit is contained in:
Zsolt Foldvari 2007-02-13 15:47:56 +00:00
parent 1d7e22bcca
commit f0dfca7041
3 changed files with 31 additions and 18 deletions

View File

@ -1,3 +1,7 @@
2007-02-13 Zsolt Foldvari <zfoldvar@users.sourceforge.net>
* src/GrampsWidgets.py: Merge trunk changes r7950:8105
* src/MarkupText.py: cleanup
2007-02-12 Don Allingham <don@gramps-project.org> 2007-02-12 Don Allingham <don@gramps-project.org>
* src/GrampsDbUtils/_GedcomParse.py: cleanup * src/GrampsDbUtils/_GedcomParse.py: cleanup

View File

@ -68,6 +68,11 @@ from DdTargets import DdTargets
_lock_path = os.path.join(const.image_dir, 'stock_lock.png') _lock_path = os.path.join(const.image_dir, 'stock_lock.png')
_lock_open_path = os.path.join(const.image_dir, 'stock_lock-open.png') _lock_open_path = os.path.join(const.image_dir, 'stock_lock-open.png')
# STOCK_INFO was added only in Gtk 2.8
try:
INFO_ICON = gtk.STOCK_INFO
except:
INFO_ICON = gtk.STOCK_DIALOG_INFO
hand_cursor = gtk.gdk.Cursor(gtk.gdk.HAND2) hand_cursor = gtk.gdk.Cursor(gtk.gdk.HAND2)
def realize_cb(widget): def realize_cb(widget):
@ -135,16 +140,12 @@ class IconButton(gtk.Button):
class WarnButton(gtk.Button): class WarnButton(gtk.Button):
def __init__(self): def __init__(self):
gtk.Button.__init__(self) gtk.Button.__init__(self)
image = gtk.Image()
# Some versions of FreeBSD don't seem to have STOCK_INFO image = gtk.Image()
try: image.set_from_stock(INFO_ICON, gtk.ICON_SIZE_MENU)
image.set_from_stock(gtk.STOCK_INFO, gtk.ICON_SIZE_MENU)
except:
image.set_from_stock(gtk.STOCK_DIALOG_INFO, gtk.ICON_SIZE_MENU)
image.show() image.show()
self.add(image) self.add(image)
self.set_relief(gtk.RELIEF_NONE) self.set_relief(gtk.RELIEF_NONE)
self.show() self.show()
self.func = None self.func = None
@ -2007,7 +2008,7 @@ if gtk.pygtk_version < (2,8,0):
#number = (int, float, long) #number = (int, float, long)
VALIDATION_ICON_WIDTH = 16 VALIDATION_ICON_WIDTH = 16
MANDATORY_ICON = gtk.STOCK_INFO MANDATORY_ICON = INFO_ICON
ERROR_ICON = gtk.STOCK_STOP ERROR_ICON = gtk.STOCK_STOP
class ValidatableMaskedEntry(MaskedEntry): class ValidatableMaskedEntry(MaskedEntry):
@ -2320,8 +2321,8 @@ def main(args):
widget1 = ValidatableMaskedEntry(str) widget1 = ValidatableMaskedEntry(str)
widget1.set_completion_mode(inline=True, popup=False) widget1.set_completion_mode(inline=True, popup=False)
#widget1.set_default_error_msg("'%s' is not a default Event") widget1.set_default_error_msg("'%s' is not a default Event")
widget1.set_default_error_msg(widget1) #widget1.set_default_error_msg(widget1)
widget1.prefill(('Birth', 'Death', 'Conseption')) widget1.prefill(('Birth', 'Death', 'Conseption'))
#widget1.set_exact_completion(True) #widget1.set_exact_completion(True)
vbox.pack_start(widget1, fill=False) vbox.pack_start(widget1, fill=False)

View File

@ -20,9 +20,14 @@
# $Id$ # $Id$
"Handling formatted ('rich text') strings"
__revision__ = "$Revision$"
__author__ = "Zsolt Foldvari"
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# Python classes # Python modules
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from xml.sax import saxutils, xmlreader, ContentHandler from xml.sax import saxutils, xmlreader, ContentHandler
@ -35,7 +40,7 @@ except:
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# set up logging # Set up logging
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import logging import logging
@ -43,11 +48,12 @@ log = logging.getLogger(".MarkupText")
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# GTK libraries # GTK modules
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import gtk import gtk
class MarkupParser(ContentHandler): class MarkupParser(ContentHandler):
"""A simple ContentHandler class to parse Gramps markup'ed text. """A simple ContentHandler class to parse Gramps markup'ed text.
@ -247,6 +253,8 @@ class MarkupBuffer(gtk.TextBuffer):
It implements MarkupParser and MarkupWriter on the input/output interface. It implements MarkupParser and MarkupWriter on the input/output interface.
Also translates Gramps XML markup language to gtk.TextTag's and vice versa. Also translates Gramps XML markup language to gtk.TextTag's and vice versa.
Based on 'gourmet-0.13.3', http://grecipe-manager.sourceforge.net/
""" """
texttag_to_xml = { texttag_to_xml = {
'weight700': 'b', 'weight700': 'b',
@ -421,10 +429,10 @@ class EditorBuffer(MarkupBuffer):
"""An interactive interface to allow markup a gtk.TextBuffer. """An interactive interface to allow markup a gtk.TextBuffer.
normal_button is a widget whose clicked signal will make us normal normal_button is a widget whose clicked signal will make us normal
toggle_widget_alist is a list that looks like this: toggle_widget_alist is a list that looks like this: [(widget, tag_name),]
[(widget, (font,attr)),
(widget2, (font,attr))]
Based on 'gourmet-0.13.3', http://grecipe-manager.sourceforge.net/
""" """
__gtype_name__ = 'EditorBuffer' __gtype_name__ = 'EditorBuffer'
@ -435,8 +443,8 @@ class EditorBuffer(MarkupBuffer):
self.tag_widgets = {} self.tag_widgets = {}
self.internal_toggle = False self.internal_toggle = False
self.insert = self.get_insert() self.insert = self.get_insert()
for w, tup in toggle_widget_alist: for widg, name in toggle_widget_alist:
self.setup_widget(w, *tup) self.setup_widget(widg, name)
# Virtual methods # Virtual methods