2002-10-20 19:55:16 +05:30
|
|
|
#
|
|
|
|
# Gramps - a GTK+/GNOME based genealogy program
|
|
|
|
#
|
2006-04-24 03:48:01 +05:30
|
|
|
# Copyright (C) 2000-2006 Donald N. Allingham
|
2002-10-20 19:55:16 +05:30
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
#
|
|
|
|
|
2003-11-19 07:59:41 +05:30
|
|
|
# $Id$
|
|
|
|
|
2005-05-11 19:34:47 +05:30
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# python modules
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
2006-04-07 03:32:46 +05:30
|
|
|
from gettext import gettext as _
|
2005-05-11 19:34:47 +05:30
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# GTK/Gnome modules
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
2008-02-19 01:37:09 +05:30
|
|
|
from gtk import glade
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# gramps modules
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
import const
|
2006-11-26 10:09:34 +05:30
|
|
|
import Config
|
2006-03-04 12:04:48 +05:30
|
|
|
from _EditSecondary import EditSecondary
|
2008-02-19 01:37:09 +05:30
|
|
|
from GrampsWidgets import MonitoredEntry, PrivacyButton, MonitoredDataType
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
2006-03-03 09:59:02 +05:30
|
|
|
# EditUrl class
|
2002-10-20 19:55:16 +05:30
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
2006-03-04 12:04:48 +05:30
|
|
|
class EditUrl(EditSecondary):
|
2005-12-24 05:39:04 +05:30
|
|
|
|
2006-11-26 10:09:34 +05:30
|
|
|
WIDTH_KEY = Config.URL_WIDTH
|
|
|
|
HEIGHT_KEY = Config.URL_HEIGHT
|
|
|
|
|
2005-12-24 05:39:04 +05:30
|
|
|
def __init__(self, dbstate, uistate, track, name, url, callback):
|
|
|
|
|
2006-03-04 12:04:48 +05:30
|
|
|
EditSecondary.__init__(self, dbstate, uistate, track,
|
|
|
|
url, callback)
|
2005-12-24 05:39:04 +05:30
|
|
|
|
2006-03-02 10:02:37 +05:30
|
|
|
def _local_init(self):
|
2008-02-19 01:37:09 +05:30
|
|
|
self.top = glade.XML(const.GLADE_FILE, "url_edit", "gramps")
|
2007-06-24 05:04:40 +05:30
|
|
|
self.jump = self.top.get_widget('jump')
|
2006-02-02 03:27:11 +05:30
|
|
|
|
2006-04-24 03:48:01 +05:30
|
|
|
self.set_window(self.top.get_widget("url_edit"),
|
|
|
|
self.top.get_widget("title"),
|
|
|
|
_('Internet Address Editor'))
|
2003-06-03 08:24:56 +05:30
|
|
|
|
2006-02-22 10:03:34 +05:30
|
|
|
def _connect_signals(self):
|
2007-06-24 05:04:40 +05:30
|
|
|
self.jump.connect('clicked', self.jump_to)
|
2006-03-02 10:02:37 +05:30
|
|
|
self.define_cancel_button(self.top.get_widget('button125'))
|
2007-06-24 05:04:40 +05:30
|
|
|
self.define_ok_button(self.top.get_widget('button124'), self.save)
|
|
|
|
self.define_help_button(self.top.get_widget('button130'), 'gramps-edit_complete')
|
2006-02-22 10:03:34 +05:30
|
|
|
|
2007-06-24 05:04:40 +05:30
|
|
|
def jump_to(self, obj):
|
|
|
|
if self.obj.get_path():
|
|
|
|
import GrampsDisplay
|
|
|
|
GrampsDisplay.url(self.obj.get_path())
|
|
|
|
|
2006-02-22 10:03:34 +05:30
|
|
|
def _setup_fields(self):
|
2008-02-19 01:37:09 +05:30
|
|
|
self.des = MonitoredEntry(self.top.get_widget("url_des"),
|
|
|
|
self.obj.set_description,
|
|
|
|
self.obj.get_description, self.db.readonly)
|
2006-02-22 10:03:34 +05:30
|
|
|
|
2008-02-19 01:37:09 +05:30
|
|
|
self.addr = MonitoredEntry(self.top.get_widget("url_addr"),
|
|
|
|
self.obj.set_path, self.obj.get_path,
|
|
|
|
self.db.readonly)
|
2006-02-22 10:03:34 +05:30
|
|
|
|
|
|
|
self.priv = PrivacyButton(self.top.get_widget("priv"),
|
2006-03-02 10:02:37 +05:30
|
|
|
self.obj, self.db.readonly)
|
2006-02-22 10:03:34 +05:30
|
|
|
|
2008-02-19 01:37:09 +05:30
|
|
|
self.type_sel = MonitoredDataType(self.top.get_widget("type"),
|
|
|
|
self.obj.set_type,
|
|
|
|
self.obj.get_type, self.db.readonly)
|
2006-02-22 10:03:34 +05:30
|
|
|
|
2008-02-24 19:25:55 +05:30
|
|
|
def build_menu_names(self, obj):
|
2006-03-02 10:02:37 +05:30
|
|
|
etitle =_('Internet Address Editor')
|
|
|
|
return (etitle, etitle)
|
2003-11-19 07:59:41 +05:30
|
|
|
|
2006-03-02 10:02:37 +05:30
|
|
|
def save(self,*obj):
|
|
|
|
self.callback(self.obj)
|
2006-04-24 04:13:36 +05:30
|
|
|
self.close()
|