geography - new feature (8327) Moving around the map using arrow keys and possibility to zoom from keyboard/keypad with the +/- keys
This commit is contained in:
parent
4ff5d6460e
commit
66b0d389c7
@ -169,6 +169,7 @@ register('geography.zoom', 0)
|
|||||||
register('geography.zoom_when_center', 12)
|
register('geography.zoom_when_center', 12)
|
||||||
register('geography.show_cross', False)
|
register('geography.show_cross', False)
|
||||||
register('geography.path', "")
|
register('geography.path', "")
|
||||||
|
register('geography.use-keypad', True)
|
||||||
|
|
||||||
register('htmlview.start-url', "http://gramps-project.org")
|
register('htmlview.start-url', "http://gramps-project.org")
|
||||||
register('htmlview.url-handler', False)
|
register('htmlview.url-handler', False)
|
||||||
|
@ -123,6 +123,7 @@ class GeoGraphyView(OsmGps, NavigationView):
|
|||||||
|
|
||||||
('geography.map_service', constants.OPENSTREETMAP),
|
('geography.map_service', constants.OPENSTREETMAP),
|
||||||
('geography.max_places', 5000),
|
('geography.max_places', 5000),
|
||||||
|
('geography.use-keypad', True),
|
||||||
)
|
)
|
||||||
|
|
||||||
def __init__(self, title, pdata, dbstate, uistate,
|
def __init__(self, title, pdata, dbstate, uistate,
|
||||||
@ -198,6 +199,7 @@ class GeoGraphyView(OsmGps, NavigationView):
|
|||||||
NavigationView.change_page(self)
|
NavigationView.change_page(self)
|
||||||
self.uistate.clear_filter_results()
|
self.uistate.clear_filter_results()
|
||||||
self.end_selection = None
|
self.end_selection = None
|
||||||
|
self.osm.grab_focus()
|
||||||
|
|
||||||
def do_size_request(self, requisition):
|
def do_size_request(self, requisition):
|
||||||
"""
|
"""
|
||||||
@ -240,6 +242,7 @@ class GeoGraphyView(OsmGps, NavigationView):
|
|||||||
if self.active:
|
if self.active:
|
||||||
self.bookmarks.redraw()
|
self.bookmarks.redraw()
|
||||||
self.build_tree()
|
self.build_tree()
|
||||||
|
self.osm.grab_focus()
|
||||||
|
|
||||||
def can_configure(self):
|
def can_configure(self):
|
||||||
"""
|
"""
|
||||||
@ -1076,4 +1079,11 @@ class GeoGraphyView(OsmGps, NavigationView):
|
|||||||
_('The maximum number of places to show'),
|
_('The maximum number of places to show'),
|
||||||
4, 'geography.max_places',
|
4, 'geography.max_places',
|
||||||
(1000, 10000))
|
(1000, 10000))
|
||||||
|
configdialog.add_checkbox(table,
|
||||||
|
_('Use keypad for shortcuts :\n'
|
||||||
|
'Either we choose the + and - from the keypad if we select this,\n'
|
||||||
|
'or we use the characters from the keyboard.'),
|
||||||
|
5, 'geography.use-keypad',
|
||||||
|
extra_callback=self.update_shortcuts)
|
||||||
|
|
||||||
return _('The map'), table
|
return _('The map'), table
|
||||||
|
@ -163,10 +163,35 @@ class OsmGps():
|
|||||||
self.osm.connect('button_press_event', self.map_clicked)
|
self.osm.connect('button_press_event', self.map_clicked)
|
||||||
self.osm.connect("motion-notify-event", self.motion_event)
|
self.osm.connect("motion-notify-event", self.motion_event)
|
||||||
self.osm.connect('changed', self.zoom_changed)
|
self.osm.connect('changed', self.zoom_changed)
|
||||||
|
self.update_shortcuts(True)
|
||||||
self.osm.show()
|
self.osm.show()
|
||||||
self.vbox.pack_start(self.osm, True, True, 0)
|
self.vbox.pack_start(self.osm, True, True, 0)
|
||||||
self.goto_handle(handle=None)
|
self.goto_handle(handle=None)
|
||||||
|
|
||||||
|
def update_shortcuts(self, arg):
|
||||||
|
"""
|
||||||
|
connect the keyboard or the keypad for shortcuts
|
||||||
|
arg is mandatory because this function is also called by the checkbox button
|
||||||
|
"""
|
||||||
|
config.set('geography.use-keypad',
|
||||||
|
self._config.get('geography.use-keypad'))
|
||||||
|
if config.get('geography.use-keypad'):
|
||||||
|
print "use keypad", config.get('geography.use-keypad')
|
||||||
|
self.osm.set_keyboard_shortcut(osmgpsmap.MapKey_t.ZOOMIN, Gdk.keyval_from_name("KP_Add"))
|
||||||
|
self.osm.set_keyboard_shortcut(osmgpsmap.MapKey_t.ZOOMOUT, Gdk.keyval_from_name("KP_Subtract"))
|
||||||
|
else:
|
||||||
|
print "use keyboard", config.get('geography.use-keypad')
|
||||||
|
self.osm.set_keyboard_shortcut(osmgpsmap.MapKey_t.ZOOMIN, Gdk.keyval_from_name("plus"))
|
||||||
|
self.osm.set_keyboard_shortcut(osmgpsmap.MapKey_t.ZOOMOUT, Gdk.keyval_from_name("minus"))
|
||||||
|
|
||||||
|
self.osm.set_keyboard_shortcut(osmgpsmap.MapKey_t.UP, Gdk.keyval_from_name("Up"))
|
||||||
|
self.osm.set_keyboard_shortcut(osmgpsmap.MapKey_t.DOWN, Gdk.keyval_from_name("Down"))
|
||||||
|
self.osm.set_keyboard_shortcut(osmgpsmap.MapKey_t.LEFT, Gdk.keyval_from_name("Left"))
|
||||||
|
self.osm.set_keyboard_shortcut(osmgpsmap.MapKey_t.RIGHT, Gdk.keyval_from_name("Right"))
|
||||||
|
|
||||||
|
# For shortcuts work, we must grab the focus
|
||||||
|
self.osm.grab_focus()
|
||||||
|
|
||||||
def add_selection_layer(self):
|
def add_selection_layer(self):
|
||||||
"""
|
"""
|
||||||
add the selection layer
|
add the selection layer
|
||||||
@ -309,6 +334,7 @@ class OsmGps():
|
|||||||
mouse button 2 : begin zone selection
|
mouse button 2 : begin zone selection
|
||||||
mouse button 3 : call the menu
|
mouse button 3 : call the menu
|
||||||
"""
|
"""
|
||||||
|
self.osm.grab_focus()
|
||||||
lat, lon = self.osm.get_event_location(event).get_degrees()
|
lat, lon = self.osm.get_event_location(event).get_degrees()
|
||||||
current = osm.convert_screen_to_geographic(int(event.x), int(event.y))
|
current = osm.convert_screen_to_geographic(int(event.x), int(event.y))
|
||||||
lat, lon = current.get_degrees()
|
lat, lon = current.get_degrees()
|
||||||
|
@ -123,6 +123,7 @@ class GeoClose(GeoGraphyView):
|
|||||||
('geography.lock', False),
|
('geography.lock', False),
|
||||||
('geography.center-lat', 0.0),
|
('geography.center-lat', 0.0),
|
||||||
('geography.center-lon', 0.0),
|
('geography.center-lon', 0.0),
|
||||||
|
('geography.use-keypad', True),
|
||||||
|
|
||||||
('geography.map_service', constants.OPENSTREETMAP),
|
('geography.map_service', constants.OPENSTREETMAP),
|
||||||
('geography.max_places', 5000),
|
('geography.max_places', 5000),
|
||||||
|
@ -121,6 +121,7 @@ class GeoFamClose(GeoGraphyView):
|
|||||||
('geography.lock', False),
|
('geography.lock', False),
|
||||||
('geography.center-lat', 0.0),
|
('geography.center-lat', 0.0),
|
||||||
('geography.center-lon', 0.0),
|
('geography.center-lon', 0.0),
|
||||||
|
('geography.use-keypad', True),
|
||||||
|
|
||||||
('geography.map_service', constants.OPENSTREETMAP),
|
('geography.map_service', constants.OPENSTREETMAP),
|
||||||
('geography.max_places', 5000),
|
('geography.max_places', 5000),
|
||||||
|
@ -125,6 +125,7 @@ class GeoMoves(GeoGraphyView):
|
|||||||
('geography.lock', True),
|
('geography.lock', True),
|
||||||
('geography.center-lat', 0.0),
|
('geography.center-lat', 0.0),
|
||||||
('geography.center-lon', 0.0),
|
('geography.center-lon', 0.0),
|
||||||
|
('geography.use-keypad', True),
|
||||||
|
|
||||||
('geography.map_service', constants.OPENSTREETMAP),
|
('geography.map_service', constants.OPENSTREETMAP),
|
||||||
('geography.max_places', 5000),
|
('geography.max_places', 5000),
|
||||||
|
@ -129,6 +129,7 @@ class GeoPerson(GeoGraphyView):
|
|||||||
('geography.lock', False),
|
('geography.lock', False),
|
||||||
('geography.center-lat', 0.0),
|
('geography.center-lat', 0.0),
|
||||||
('geography.center-lon', 0.0),
|
('geography.center-lon', 0.0),
|
||||||
|
('geography.use-keypad', True),
|
||||||
|
|
||||||
#('geography.gps_mode', GPS_DISABLED),
|
#('geography.gps_mode', GPS_DISABLED),
|
||||||
#('geography.gps_update_rate', float(1.0)),
|
#('geography.gps_update_rate', float(1.0)),
|
||||||
|
@ -863,6 +863,7 @@ INSERT INTO "grampsdb_config" VALUES(197,'geography.map_service',NULL,'int','1')
|
|||||||
INSERT INTO "grampsdb_config" VALUES(198,'geography.lock',NULL,'bool','False');
|
INSERT INTO "grampsdb_config" VALUES(198,'geography.lock',NULL,'bool','False');
|
||||||
INSERT INTO "grampsdb_config" VALUES(199,'geography.path',NULL,'str','');
|
INSERT INTO "grampsdb_config" VALUES(199,'geography.path',NULL,'str','');
|
||||||
INSERT INTO "grampsdb_config" VALUES(200,'geography.center-lat',NULL,'float','0.0');
|
INSERT INTO "grampsdb_config" VALUES(200,'geography.center-lat',NULL,'float','0.0');
|
||||||
|
INSERT INTO "grampsdb_config" VALUES(201,'geography.use-keypad',NULL,'bool','False');
|
||||||
CREATE TABLE "grampsdb_tag" (
|
CREATE TABLE "grampsdb_tag" (
|
||||||
"id" integer NOT NULL PRIMARY KEY,
|
"id" integer NOT NULL PRIMARY KEY,
|
||||||
"handle" varchar(19) NOT NULL UNIQUE,
|
"handle" varchar(19) NOT NULL UNIQUE,
|
||||||
|
@ -840,6 +840,7 @@ INSERT INTO "grampsdb_config" VALUES(177,'geography.map_service',NULL,'int','1')
|
|||||||
INSERT INTO "grampsdb_config" VALUES(178,'geography.lock',NULL,'bool','False');
|
INSERT INTO "grampsdb_config" VALUES(178,'geography.lock',NULL,'bool','False');
|
||||||
INSERT INTO "grampsdb_config" VALUES(179,'geography.path',NULL,'str','');
|
INSERT INTO "grampsdb_config" VALUES(179,'geography.path',NULL,'str','');
|
||||||
INSERT INTO "grampsdb_config" VALUES(180,'geography.center-lat',NULL,'float','0.0');
|
INSERT INTO "grampsdb_config" VALUES(180,'geography.center-lat',NULL,'float','0.0');
|
||||||
|
INSERT INTO "grampsdb_config" VALUES(181,'geography.use-keypad',NULL,'bool','False');
|
||||||
CREATE TABLE "grampsdb_tag" (
|
CREATE TABLE "grampsdb_tag" (
|
||||||
"id" integer NOT NULL PRIMARY KEY,
|
"id" integer NOT NULL PRIMARY KEY,
|
||||||
"handle" varchar(19) NOT NULL UNIQUE,
|
"handle" varchar(19) NOT NULL UNIQUE,
|
||||||
|
Loading…
Reference in New Issue
Block a user