HIG improvements

svn: r1319
This commit is contained in:
Don Allingham 2003-02-27 00:29:37 +00:00
parent b70d9bb856
commit 7f70415166
7 changed files with 175 additions and 35 deletions

View File

@ -1201,10 +1201,11 @@ class EditPerson:
else: else:
n = GrampsCfg.nameof(m[idval]) n = GrampsCfg.nameof(m[idval])
msg1 = _("GRAMPS ID value was not changed.") msg1 = _("GRAMPS ID value was not changed.")
msg2 = _("%(grampsid)s is already used by %(person)s") % { msg2 = _("You have attempted to change the GRAMPS ID to a value "
"of %(grampsid)s. This value is already used by %(person)s.") % {
'grampsid' : idval, 'grampsid' : idval,
'person' : n } 'person' : n }
WarningDialog("%s\n%s" % (msg1,msg2)) WarningDialog(msg1,msg2)
if suffix != name.getSuffix(): if suffix != name.getSuffix():
name.setSuffix(suffix) name.setSuffix(suffix)

View File

@ -586,8 +586,8 @@ class FamilyView:
list.insert(row,obj) list.insert(row,obj)
if (birth_dates_in_order(list) == 0): if (birth_dates_in_order(list) == 0):
msg = _("Invalid move. Children must be ordered by birth date.") WarningDialog(_("Attempt to Reorder Children Failed"),
WarningDialog(msg) _("Children must be ordered by their birth dates."))
return return
self.family.setChildList(list) self.family.setChildList(list)
self.load_family() self.load_family()

View File

@ -68,7 +68,7 @@ class QuestionDialog:
self.top.destroy() self.top.destroy()
class OptionDialog: class OptionDialog:
def __init__(self,msg1,msg2,label1,task1,label2,task2): def __init__(self,msg1,msg2,btnmsg1,task1,btnmsg2,task2):
self.xml = gtk.glade.XML(const.errdialogsFile,"optiondialog") self.xml = gtk.glade.XML(const.errdialogsFile,"optiondialog")
self.top = self.xml.get_widget('optiondialog') self.top = self.xml.get_widget('optiondialog')
self.top.set_title('') self.top.set_title('')
@ -81,9 +81,12 @@ class OptionDialog:
label2.set_text(msg2) label2.set_text(msg2)
label2.set_use_markup(gtk.TRUE) label2.set_use_markup(gtk.TRUE)
self.xml.get_widget('option1').set_label(btnmsg1)
self.xml.get_widget('option2').set_label(btnmsg2)
response = self.top.run() response = self.top.run()
if response == gtk.RESPONSE_NO: if response == gtk.RESPONSE_NO:
task1() if task1:
task1()
else: else:
task2() task2()
self.top.destroy() self.top.destroy()
@ -103,24 +106,16 @@ class ErrorDialog:
self.top.destroy() self.top.destroy()
class WarningDialog: class WarningDialog:
def __init__(self,msg): def __init__(self,msg1,msg2=""):
title = '%s - GRAMPS' % _('Warning')
self.top = gtk.Dialog() self.xml = gtk.glade.XML(const.errdialogsFile,"warndialog")
self.top.set_title(title) self.top = self.xml.get_widget('warndialog')
label = gtk.Label(msg)
label.show() label1 = self.xml.get_widget('label1')
hbox = gtk.HBox() label2 = self.xml.get_widget('label2')
image = gtk.Image() label1.set_text('<span weight="bold" size="larger">%s</span>' % msg1)
image.set_from_stock(gtk.STOCK_DIALOG_WARNING,gtk.ICON_SIZE_DIALOG) label1.set_use_markup(gtk.TRUE)
hbox.set_spacing(10) label2.set_text(msg2)
hbox.pack_start(image)
hbox.add(label)
self.top.vbox.pack_start(hbox)
self.top.set_default_size(300,150)
self.top.add_button(gtk.STOCK_OK,0)
self.top.set_response_sensitive(0,gtk.TRUE)
self.top.show_all()
self.top.run() self.top.run()
self.top.destroy() self.top.destroy()

View File

@ -104,7 +104,9 @@ def scale_image(path,size):
try: try:
image1 = gtk.gdk.pixbuf_new_from_file(path) image1 = gtk.gdk.pixbuf_new_from_file(path)
except: except:
WarningDialog(_("Could not load image file %s") % path) WarningDialog(_("Cannot display %s") % path,
_('GRAMPS is not able to display the image file. '
'This may be cause by a corrupt file.'))
return gtk.gdk.pixbuf_new_from_file(const.icon) return gtk.gdk.pixbuf_new_from_file(const.icon)
width = image1.get_width() width = image1.get_width()
@ -114,7 +116,9 @@ def scale_image(path,size):
try: try:
return image1.scale_simple(int(scale*width), int(scale*height), gtk.gdk.INTERP_BILINEAR) return image1.scale_simple(int(scale*width), int(scale*height), gtk.gdk.INTERP_BILINEAR)
except: except:
WarningDialog(_("Could not load image file %s") % path) WarningDialog(_("Cannot display %s") % path,
_('GRAMPS is not able to display the image file. '
'This may be cause by a corrupt file.'))
return gtk.gdk.pixbuf_new_from_file(const.icon) return gtk.gdk.pixbuf_new_from_file(const.icon)
#------------------------------------------------------------------------- #-------------------------------------------------------------------------

View File

@ -568,4 +568,134 @@
</child> </child>
</widget> </widget>
<widget class="GtkDialog" id="warndialog">
<property name="visible">True</property>
<property name="title" translatable="yes"></property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">False</property>
<property name="default_width">450</property>
<property name="resizable">True</property>
<property name="destroy_with_parent">False</property>
<property name="has_separator">True</property>
<child internal-child="vbox">
<widget class="GtkVBox" id="vbox3">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child internal-child="action_area">
<widget class="GtkHButtonBox" id="hbuttonbox3">
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<child>
<widget class="GtkButton" id="button5">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-close</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="response_id">-7</property>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
<child>
<widget class="GtkTable" id="table5">
<property name="border_width">12</property>
<property name="visible">True</property>
<property name="n_rows">2</property>
<property name="n_columns">3</property>
<property name="homogeneous">False</property>
<property name="row_spacing">0</property>
<property name="column_spacing">0</property>
<child>
<widget class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="label" translatable="yes">label2</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">True</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">6</property>
<property name="ypad">24</property>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkImage" id="image5">
<property name="visible">True</property>
<property name="stock">gtk-dialog-warning</property>
<property name="icon_size">6</property>
<property name="xalign">0.5</property>
<property name="yalign">0</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">0</property>
<property name="bottom_attach">2</property>
<property name="x_options">fill</property>
<property name="y_options">fill</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="label" translatable="yes">label1</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">6</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="x_options">expand|shrink|fill</property>
<property name="y_options"></property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
</child>
</widget>
</glade-interface> </glade-interface>

View File

@ -57,5 +57,5 @@ try:
except: except:
import DisplayTrace import DisplayTrace
DisplayTrace.DisplayTrace() DisplayTrace.DisplayTrace()
gtk.mainloop() gtk.mainloop()

View File

@ -57,7 +57,7 @@ import PlaceView
import FamilyView import FamilyView
import SourceView import SourceView
from QuestionDialog import QuestionDialog, ErrorDialog, WarningDialog, SaveDialog from QuestionDialog import QuestionDialog, ErrorDialog, WarningDialog, SaveDialog, OptionDialog
import DisplayTrace import DisplayTrace
import Filter import Filter
@ -115,9 +115,11 @@ class Gramps:
gtk.rc_parse(const.gtkrcFile) gtk.rc_parse(const.gtkrcFile)
if os.getuid() == 0: if os.getuid() == 0:
msg = _("You are running GRAMPS as the 'root' user.\n" WarningDialog(_("GRAMPS is being run as the 'root' user."),
"This account is not meant for normal application use.") _("This account is not meant for normal appication use. "
WarningDialog(msg) "Running user applications in the administrative account "
"is rarely a wise idea, and can open up potential "
"security risks."))
# This will never contain data - It will be replaced by either # This will never contain data - It will be replaced by either
# a GrampsXML or GrampsZODB # a GrampsXML or GrampsZODB
@ -533,7 +535,11 @@ class Gramps:
def on_contents_activate(self,obj): def on_contents_activate(self,obj):
"""Display the GRAMPS manual""" """Display the GRAMPS manual"""
WarningDialog('HELP currently not available') WarningDialog(_('HELP is currently not available'),
_('Documentation for GRAMPS is currently being '
'developed, but is not yet available for this '
'version.'))
# url = gnome.help_display_with_doc_id(self.program, # url = gnome.help_display_with_doc_id(self.program,
# "", # "",
# "gramps-manual.sgml", # "gramps-manual.sgml",
@ -544,7 +550,10 @@ class Gramps:
def on_writing_extensions_activate(self,obj): def on_writing_extensions_activate(self,obj):
"""Display the Extending GRAMPS manual""" """Display the Extending GRAMPS manual"""
WarningDialog('HELP currently not available') WarningDialog(_('HELP is currently not available'),
_('Documentation for GRAMPS is currently being '
'developed, but is not yet available for this '
'version.'))
# import gnome.help # import gnome.help
# url = gnome.help.file_find_file("extending-gramps","extending-gramps.sgml") # url = gnome.help.file_find_file("extending-gramps","extending-gramps.sgml")
# if url: # if url:
@ -996,7 +1005,9 @@ class Gramps:
else: else:
msg = _("Cannot revert to a previous database, since " msg = _("Cannot revert to a previous database, since "
"one does not exist") "one does not exist")
WarningDialog(msg) WarningDialog(_('Could Not Revert to the Previous Database.'),
_('GRAMPS could not find a previous version of '
'the database'))
def revert_query(self): def revert_query(self):
const.personalEvents = const.init_personal_event_list() const.personalEvents = const.init_personal_event_list()
@ -1402,7 +1413,7 @@ class Gramps:
self.status_text(_("%s has been bookmarked") % name) self.status_text(_("%s has been bookmarked") % name)
gtk.timeout_add(5000,self.modify_statusbar) gtk.timeout_add(5000,self.modify_statusbar)
else: else:
WarningDialog(_("Could not set bookmark."), WarningDialog(_("Could Not Set a Bookmark."),
_("A bookmark could not be set because no one was selected.")) _("A bookmark could not be set because no one was selected."))
def on_edit_bookmarks_activate(self,obj): def on_edit_bookmarks_activate(self,obj):
@ -1492,7 +1503,6 @@ def set_panel(obj):
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
import gnome import gnome
import sys
Gramps(None) Gramps(None)
gtk.mainloop() gtk.mainloop()