HIG improvements
svn: r1319
This commit is contained in:
parent
b3baca9985
commit
072c64eb5e
@ -1201,10 +1201,11 @@ class EditPerson:
|
||||
else:
|
||||
n = GrampsCfg.nameof(m[idval])
|
||||
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,
|
||||
'person' : n }
|
||||
WarningDialog("%s\n%s" % (msg1,msg2))
|
||||
WarningDialog(msg1,msg2)
|
||||
|
||||
if suffix != name.getSuffix():
|
||||
name.setSuffix(suffix)
|
||||
|
@ -586,8 +586,8 @@ class FamilyView:
|
||||
list.insert(row,obj)
|
||||
|
||||
if (birth_dates_in_order(list) == 0):
|
||||
msg = _("Invalid move. Children must be ordered by birth date.")
|
||||
WarningDialog(msg)
|
||||
WarningDialog(_("Attempt to Reorder Children Failed"),
|
||||
_("Children must be ordered by their birth dates."))
|
||||
return
|
||||
self.family.setChildList(list)
|
||||
self.load_family()
|
||||
|
@ -68,7 +68,7 @@ class QuestionDialog:
|
||||
self.top.destroy()
|
||||
|
||||
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.top = self.xml.get_widget('optiondialog')
|
||||
self.top.set_title('')
|
||||
@ -81,9 +81,12 @@ class OptionDialog:
|
||||
label2.set_text(msg2)
|
||||
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()
|
||||
if response == gtk.RESPONSE_NO:
|
||||
task1()
|
||||
if task1:
|
||||
task1()
|
||||
else:
|
||||
task2()
|
||||
self.top.destroy()
|
||||
@ -103,24 +106,16 @@ class ErrorDialog:
|
||||
self.top.destroy()
|
||||
|
||||
class WarningDialog:
|
||||
def __init__(self,msg):
|
||||
title = '%s - GRAMPS' % _('Warning')
|
||||
def __init__(self,msg1,msg2=""):
|
||||
|
||||
self.top = gtk.Dialog()
|
||||
self.top.set_title(title)
|
||||
label = gtk.Label(msg)
|
||||
label.show()
|
||||
hbox = gtk.HBox()
|
||||
image = gtk.Image()
|
||||
image.set_from_stock(gtk.STOCK_DIALOG_WARNING,gtk.ICON_SIZE_DIALOG)
|
||||
hbox.set_spacing(10)
|
||||
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.xml = gtk.glade.XML(const.errdialogsFile,"warndialog")
|
||||
self.top = self.xml.get_widget('warndialog')
|
||||
|
||||
label1 = self.xml.get_widget('label1')
|
||||
label2 = self.xml.get_widget('label2')
|
||||
label1.set_text('<span weight="bold" size="larger">%s</span>' % msg1)
|
||||
label1.set_use_markup(gtk.TRUE)
|
||||
label2.set_text(msg2)
|
||||
self.top.run()
|
||||
self.top.destroy()
|
||||
|
||||
|
@ -104,7 +104,9 @@ def scale_image(path,size):
|
||||
try:
|
||||
image1 = gtk.gdk.pixbuf_new_from_file(path)
|
||||
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)
|
||||
|
||||
width = image1.get_width()
|
||||
@ -114,7 +116,9 @@ def scale_image(path,size):
|
||||
try:
|
||||
return image1.scale_simple(int(scale*width), int(scale*height), gtk.gdk.INTERP_BILINEAR)
|
||||
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)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
|
@ -568,4 +568,134 @@
|
||||
</child>
|
||||
</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>
|
||||
|
@ -57,5 +57,5 @@ try:
|
||||
except:
|
||||
import DisplayTrace
|
||||
DisplayTrace.DisplayTrace()
|
||||
|
||||
|
||||
gtk.mainloop()
|
||||
|
@ -57,7 +57,7 @@ import PlaceView
|
||||
import FamilyView
|
||||
import SourceView
|
||||
|
||||
from QuestionDialog import QuestionDialog, ErrorDialog, WarningDialog, SaveDialog
|
||||
from QuestionDialog import QuestionDialog, ErrorDialog, WarningDialog, SaveDialog, OptionDialog
|
||||
|
||||
import DisplayTrace
|
||||
import Filter
|
||||
@ -115,9 +115,11 @@ class Gramps:
|
||||
gtk.rc_parse(const.gtkrcFile)
|
||||
|
||||
if os.getuid() == 0:
|
||||
msg = _("You are running GRAMPS as the 'root' user.\n"
|
||||
"This account is not meant for normal application use.")
|
||||
WarningDialog(msg)
|
||||
WarningDialog(_("GRAMPS is being run as the 'root' user."),
|
||||
_("This account is not meant for normal appication use. "
|
||||
"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
|
||||
# a GrampsXML or GrampsZODB
|
||||
@ -533,7 +535,11 @@ class Gramps:
|
||||
def on_contents_activate(self,obj):
|
||||
"""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,
|
||||
# "",
|
||||
# "gramps-manual.sgml",
|
||||
@ -544,7 +550,10 @@ class Gramps:
|
||||
|
||||
def on_writing_extensions_activate(self,obj):
|
||||
"""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
|
||||
# url = gnome.help.file_find_file("extending-gramps","extending-gramps.sgml")
|
||||
# if url:
|
||||
@ -996,7 +1005,9 @@ class Gramps:
|
||||
else:
|
||||
msg = _("Cannot revert to a previous database, since "
|
||||
"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):
|
||||
const.personalEvents = const.init_personal_event_list()
|
||||
@ -1402,7 +1413,7 @@ class Gramps:
|
||||
self.status_text(_("%s has been bookmarked") % name)
|
||||
gtk.timeout_add(5000,self.modify_statusbar)
|
||||
else:
|
||||
WarningDialog(_("Could not set bookmark."),
|
||||
WarningDialog(_("Could Not Set a Bookmark."),
|
||||
_("A bookmark could not be set because no one was selected."))
|
||||
|
||||
def on_edit_bookmarks_activate(self,obj):
|
||||
@ -1492,7 +1503,6 @@ def set_panel(obj):
|
||||
#-------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
import gnome
|
||||
import sys
|
||||
|
||||
Gramps(None)
|
||||
gtk.mainloop()
|
||||
|
Loading…
Reference in New Issue
Block a user