diff --git a/src/Config/_GrampsConfigKeys.py b/src/Config/_GrampsConfigKeys.py index 7596528e3..e2d422845 100644 --- a/src/Config/_GrampsConfigKeys.py +++ b/src/Config/_GrampsConfigKeys.py @@ -177,6 +177,11 @@ PRIVATE_RECORD_TEXT = ('preferences', 'private-record-text', 2) RELATION_DISPLAY_THEME= ('preferences', 'relation-display-theme', 2) INVALID_DATE_FORMAT = ('preferences', 'invalid-date-format', 2) FULLSCREEN = ('interface', 'fullscreen', 0) +GEOVIEW = ('preferences', 'geoview', 0) +GEOVIEW_GOOGLEMAPS = ('preferences', 'googlemap', 0) +GEOVIEW_OPENLAYERS = ('preferences', 'openlayers', 0) +GEOVIEW_YAHOO = ('preferences', 'yahoo', 0) +GEOVIEW_MICROSOFT = ('preferences', 'microsoft', 0) default_value = { DEFAULT_SOURCE : False, @@ -306,4 +311,9 @@ default_value = { RELATION_DISPLAY_THEME: "CLASSIC", INVALID_DATE_FORMAT : "%s", FULLSCREEN : False, + GEOVIEW : False, + GEOVIEW_GOOGLEMAPS : True, + GEOVIEW_OPENLAYERS : False, + GEOVIEW_YAHOO : False, + GEOVIEW_MICROSOFT : False, } diff --git a/src/DataViews/__init__.py b/src/DataViews/__init__.py index 3bd25696e..578916172 100644 --- a/src/DataViews/__init__.py +++ b/src/DataViews/__init__.py @@ -22,7 +22,7 @@ """ Package init for the DataViews package. """ - +print 'start' from GrampletView import GrampletView, register, Gramplet from PersonView import PersonView from RelationView import RelationshipView @@ -35,10 +35,32 @@ from MediaView import MediaView from RepositoryView import RepositoryView from NoteView import NoteView +geopresent = True +try: + from GeoView import GeoView +except: + geopresent = False + try: import Config DATA_VIEWS = eval("["+Config.get(Config.DATA_VIEWS)+"]") -except: + #add GeoView if in config and present + if geopresent and Config.get(Config.GEOVIEW) and \ + not GeoView in DATA_VIEWS: + DATA_VIEWS.append(GeoView) + Config.set(Config.DATA_VIEWS, + Config.get(Config.DATA_VIEWS)+",GeoView") + elif geopresent and not Config.get(Config.GEOVIEW) and \ + GeoView in DATA_VIEWS: + DATA_VIEWS.remove(GeoView) + newval = Config.get(Config.DATA_VIEWS).replace('GeoView','')\ + .replace(',,',',') + if newval[-1] == ',': + newval = newval[:-1] + Config.set(Config.DATA_VIEWS, newval) + print Config.get(Config.DATA_VIEWS) +except AttributeError: + print 'exep' # Fallback if bad config line, or if no Config system DATA_VIEWS = [ GrampletView, @@ -50,10 +72,11 @@ except: SourceView, PlaceView, MediaView, - #MapView, RepositoryView, NoteView, ] + if geopresent: + DATA_VIEWS.append(GeoView) def get_views(): """ diff --git a/src/GrampsCfg.py b/src/GrampsCfg.py index 16a540ef7..a8d59b817 100644 --- a/src/GrampsCfg.py +++ b/src/GrampsCfg.py @@ -56,6 +56,15 @@ from widgets import MarkupLabel, BasicLabel from QuestionDialog import ErrorDialog, QuestionDialog2 from Errors import NameDisplayError +geopresent = True +try: + import DataViews.GeoView +except: + geopresent = False +#experimental feature, don't show in release +if not const.VERSION.find('SVN') == -1: + gepresent = False + #------------------------------------------------------------------------- # # Constants @@ -161,6 +170,9 @@ class GrampsPreferences(ManagedWindow.ManagedWindow): MarkupLabel(_('Researcher'))) panel.append_page(self.add_color_panel(), MarkupLabel(_('Marker Colors'))) + if geopresent: + panel.append_page(self.add_geoview_panel(), + MarkupLabel(_('GeoView'))) self.window.show_all() self.show() @@ -266,6 +278,50 @@ class GrampsPreferences(ManagedWindow.ManagedWindow): for widget in [self.comp_color, self.todo_color, self.custom_color]: widget.emit('color-set') + def add_geoview_panel(self): + table = gtk.Table(3, 8) + table.set_border_width(12) + table.set_col_spacings(12) + table.set_row_spacings(6) + + self.add_text( + table, _('You need a broadband internet connection to use GeoView') + , 0) + + self.add_checkbox( + table, _('Add the GeoView view.'), + 1, Config.GEOVIEW) + + self.add_text( + table, _('GeoView uses OpenStreetMap and one other map provider.'), + 2) + + self.add_text( + table, _('Choose one of the following map providers'), + 3) + + maps=self.add_radiobox( + table, _('Google Maps'), + 4, Config.GEOVIEW_GOOGLEMAPS, None, 1) + + self.add_radiobox( + table, _('OpenLayers'), + 4, Config.GEOVIEW_OPENLAYERS, maps, 2) + + self.add_radiobox( + table, _('Yahoo! Maps'), + 4, Config.GEOVIEW_YAHOO, maps, 3) + + self.add_radiobox( + table, _('Microsoft Maps'), + 4, Config.GEOVIEW_MICROSOFT, maps, 4) + + self.add_text( + table, _('You need to restart GRAMPS for above settings to take' + 'effect'), 6) + + return table + def add_name_panel(self): """ Name format settings panel @@ -769,7 +825,22 @@ class GrampsPreferences(ManagedWindow.ManagedWindow): checkbox = gtk.CheckButton(label) checkbox.set_active(Config.get(constant)) checkbox.connect('toggled', self.update_checkbox, constant) - table.attach(checkbox, 1, 3, index, index+1, yoptions=0) + table.attach(checkbox, 1, 9, index, index+1, yoptions=0) + + def add_radiobox(self, table, label, index, constant, group, column): + radiobox = gtk.RadioButton(group,label) + if Config.get(constant) == True: + radiobox.set_active(True) + radiobox.connect('toggled', self.update_radiobox, constant) + table.attach(radiobox, column, column+1, index, index+1, yoptions=0) + return radiobox + + def add_text(self, table, label, index): + text = gtk.Label() + text.set_line_wrap(True) + text.set_alignment(0.,0.) + text.set_text(label) + table.attach(text, 1, 9, index, index+1, yoptions=0) def add_path_box(self, table, label, index, entry, path, callback_label, callback_sel): @@ -902,6 +973,9 @@ class GrampsPreferences(ManagedWindow.ManagedWindow): def update_checkbox(self, obj, constant): Config.set(constant, obj.get_active()) + def update_radiobox(self, obj, constant): + Config.set(constant, obj.get_active()) + def build_menu_names(self, obj): return (_('Preferences'), None) diff --git a/src/gramps_main.py b/src/gramps_main.py index 989a89fb7..e535bb0fd 100644 --- a/src/gramps_main.py +++ b/src/gramps_main.py @@ -108,6 +108,7 @@ def register_stock_icons (): ('gramps-font-color', _('Font Color'), gtk.gdk.CONTROL_MASK, 0, ''), ('gramps-font-bgcolor', _('Font Background Color'), gtk.gdk.CONTROL_MASK, 0, ''), ('gramps-gramplet', _('Gramplets'), gtk.gdk.CONTROL_MASK, 0, ''), + ('gramps-geo', _('GeoView'), gtk.gdk.CONTROL_MASK, 0, ''), ('gramps-lock', _('Public'), gtk.gdk.CONTROL_MASK, 0, ''), ('gramps-media', _('Media'), gtk.gdk.CONTROL_MASK, 0, ''), ('gramps-notes', _('Notes'), gtk.gdk.CONTROL_MASK, 0, ''), diff --git a/src/images/16x16/Makefile.am b/src/images/16x16/Makefile.am index 7659dd556..a1ea857e8 100644 --- a/src/images/16x16/Makefile.am +++ b/src/images/16x16/Makefile.am @@ -18,6 +18,7 @@ dist_pkgdata_DATA = \ gramps-font-bgcolor.png \ gramps-font-color.png \ gramps-font.png \ + gramps-geo.png \ gramps-gramplet.png \ gramps-lock.png \ gramps-media.png \ diff --git a/src/images/16x16/gramps-geo.png b/src/images/16x16/gramps-geo.png new file mode 100644 index 000000000..a5889683a Binary files /dev/null and b/src/images/16x16/gramps-geo.png differ diff --git a/src/images/22x22/Makefile.am b/src/images/22x22/Makefile.am index c3e8425bd..9e49fca82 100644 --- a/src/images/22x22/Makefile.am +++ b/src/images/22x22/Makefile.am @@ -18,6 +18,7 @@ dist_pkgdata_DATA = \ gramps-font-bgcolor.png \ gramps-font-color.png \ gramps-font.png \ + gramps-geo.png \ gramps-gramplet.png \ gramps-lock.png \ gramps-media.png \ diff --git a/src/images/22x22/gramps-geo.png b/src/images/22x22/gramps-geo.png new file mode 100644 index 000000000..d4bfb82bf Binary files /dev/null and b/src/images/22x22/gramps-geo.png differ diff --git a/src/images/48x48/Makefile.am b/src/images/48x48/Makefile.am index c3947834c..eb2de7cd6 100644 --- a/src/images/48x48/Makefile.am +++ b/src/images/48x48/Makefile.am @@ -18,6 +18,7 @@ dist_pkgdata_DATA = \ gramps-font-bgcolor.png \ gramps-font-color.png \ gramps-font.png \ + gramps-geo.png \ gramps-gramplet.png \ gramps-lock.png \ gramps-media.png \ diff --git a/src/images/48x48/gramps_geo.png b/src/images/48x48/gramps_geo.png new file mode 100644 index 000000000..63c113889 Binary files /dev/null and b/src/images/48x48/gramps_geo.png differ diff --git a/src/images/scalable/Makefile.am b/src/images/scalable/Makefile.am index 439146cd2..543d02908 100644 --- a/src/images/scalable/Makefile.am +++ b/src/images/scalable/Makefile.am @@ -18,6 +18,7 @@ dist_pkgdata_DATA = \ gramps-font-bgcolor.svg \ gramps-font-color.svg \ gramps-font.svg \ + gramps-geo.svg \ gramps-gramplet.svg \ gramps-lock.svg \ gramps-media.svg \ diff --git a/src/images/scalable/gramps-geo.svg b/src/images/scalable/gramps-geo.svg new file mode 100644 index 000000000..571780737 --- /dev/null +++ b/src/images/scalable/gramps-geo.svg @@ -0,0 +1,621 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + Internet Category + + + Jakub Steiner + + + + + Tuomas Kuosmanen + + + + http://jimmac.musichall.cz + + + internet + tools + applications + category + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +