Merge pull request #474 from jralls/primary_intent

This commit is contained in:
Nick Hall
2017-10-15 17:28:03 +01:00
35 changed files with 90 additions and 78 deletions

View File

@@ -60,7 +60,7 @@ from gramps.gen.constfunc import mac
from .glade import Glade from .glade import Glade
from .ddtargets import DdTargets from .ddtargets import DdTargets
from .makefilter import make_filter from .makefilter import make_filter
from .utils import is_right_click from .utils import is_right_click, get_primary_mask
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@@ -1598,7 +1598,7 @@ class MultiTreeView(Gtk.TreeView):
# otherwise: # otherwise:
if (target if (target
and event.type == Gdk.EventType.BUTTON_PRESS and event.type == Gdk.EventType.BUTTON_PRESS
and not (event.get_state() & (Gdk.ModifierType.CONTROL_MASK|Gdk.ModifierType.SHIFT_MASK)) and not (event.get_state() & get_primary_mask(Gdk.ModifierType.SHIFT_MASK))
and self.get_selection().path_is_selected(target[0])): and self.get_selection().path_is_selected(target[0])):
# disable selection # disable selection
self.get_selection().set_select_function(lambda *ignore: False, None) self.get_selection().set_select_function(lambda *ignore: False, None)

View File

@@ -43,6 +43,7 @@ _ = glocale.translation.gettext
from ...widgets import SimpleButton from ...widgets import SimpleButton
from .grampstab import GrampsTab from .grampstab import GrampsTab
from gramps.gen.errors import WindowActiveError from gramps.gen.errors import WindowActiveError
from ...utils import get_primary_mask
_KP_ENTER = Gdk.keyval_from_name("KP_Enter") _KP_ENTER = Gdk.keyval_from_name("KP_Enter")
_RETURN = Gdk.keyval_from_name("Return") _RETURN = Gdk.keyval_from_name("Return")
@@ -219,7 +220,7 @@ class ButtonTab(GrampsTab):
return return
self.add_button_clicked(obj) self.add_button_clicked(obj)
elif event.keyval in (_OPEN,) and self.share_btn and \ elif event.keyval in (_OPEN,) and self.share_btn and \
(event.get_state() & Gdk.ModifierType.CONTROL_MASK): (event.get_state() & get_primary_mask()):
self.share_button_clicked(obj) self.share_button_clicked(obj)
elif event.keyval in (_LEFT,) and \ elif event.keyval in (_LEFT,) and \
(event.get_state() & Gdk.ModifierType.MOD1_MASK): (event.get_state() & Gdk.ModifierType.MOD1_MASK):

View File

@@ -48,6 +48,7 @@ from .surnamemodel import SurnameModel
from .embeddedlist import EmbeddedList, TEXT_COL, MARKUP_COL, ICON_COL from .embeddedlist import EmbeddedList, TEXT_COL, MARKUP_COL, ICON_COL
from ...ddtargets import DdTargets from ...ddtargets import DdTargets
from gramps.gen.lib import Surname, NameOriginType from gramps.gen.lib import Surname, NameOriginType
from ...utils import get_primary_mask
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@@ -322,11 +323,11 @@ class SurnameTab(EmbeddedList):
""" """
if not EmbeddedList.key_pressed(self, obj, event): if not EmbeddedList.key_pressed(self, obj, event):
if event.type == Gdk.EventType.KEY_PRESS and event.keyval in (_TAB,): if event.type == Gdk.EventType.KEY_PRESS and event.keyval in (_TAB,):
if not (event.get_state() & (Gdk.ModifierType.SHIFT_MASK | if not (event.get_state() &
Gdk.ModifierType.CONTROL_MASK)): get_primary_mask(Gdk.ModifierType.SHIFT_MASK)):
return self.next_cell() return self.next_cell()
elif (event.get_state() & (Gdk.ModifierType.SHIFT_MASK | elif (event.get_state() &
Gdk.ModifierType.CONTROL_MASK)): get_primary_mask(Gdk.ModifierType.SHIFT_MASK)):
return self.prev_cell() return self.prev_cell()
else: else:
return return

View File

@@ -32,7 +32,7 @@ from gi.repository import Gdk
from gi.repository import Gtk from gi.repository import Gtk
from gramps.gen.const import GRAMPS_LOCALE as glocale from gramps.gen.const import GRAMPS_LOCALE as glocale
_ = glocale.translation.gettext _ = glocale.translation.gettext
from ..utils import get_primary_mask
_RETURN = Gdk.keyval_from_name("Return") _RETURN = Gdk.keyval_from_name("Return")
_KP_ENTER = Gdk.keyval_from_name("KP_Enter") _KP_ENTER = Gdk.keyval_from_name("KP_Enter")
@@ -139,7 +139,7 @@ class SearchBar:
self.clear_button.set_sensitive(True) self.clear_button.set_sensitive(True)
def key_press(self, obj, event): def key_press(self, obj, event):
if not (event.get_state() & Gdk.ModifierType.CONTROL_MASK): if not (event.get_state() & get_primary_mask()):
if event.keyval in (_RETURN, _KP_ENTER): if event.keyval in (_RETURN, _KP_ENTER):
self.filter_button.set_sensitive(False) self.filter_button.set_sensitive(False)
self.clear_button.set_sensitive(True) self.clear_button.set_sensitive(True)

View File

@@ -29,6 +29,7 @@ from gi.repository import Pango
from ... import widgets from ... import widgets
from ...dbguielement import DbGUIElement from ...dbguielement import DbGUIElement
from gramps.gen.config import config from gramps.gen.config import config
from ...utils import get_primary_mask
_RETURN = Gdk.keyval_from_name("Return") _RETURN = Gdk.keyval_from_name("Return")
_KP_ENTER = Gdk.keyval_from_name("KP_Enter") _KP_ENTER = Gdk.keyval_from_name("KP_Enter")
@@ -129,7 +130,7 @@ class SidebarFilter(DbGUIElement):
widget.set_tooltip_text(tooltip) widget.set_tooltip_text(tooltip)
def key_press(self, obj, event): def key_press(self, obj, event):
if not (event.get_state() & Gdk.ModifierType.CONTROL_MASK): if not (event.get_state() & get_primary_mask()):
if event.keyval in (_RETURN, _KP_ENTER): if event.keyval in (_RETURN, _KP_ENTER):
self.clicked(obj) self.clicked(obj)
return False return False

View File

@@ -118,7 +118,7 @@
<property name="icon_name">document-save</property> <property name="icon_name">document-save</property>
</object> </object>
</child> </child>
<accelerator key="r" signal="activate" modifiers="GDK_CONTROL_MASK"/> <accelerator key="r" signal="activate" modifiers="primary"/>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
@@ -163,7 +163,7 @@
<property name="icon_name">gtk-index</property> <property name="icon_name">gtk-index</property>
</object> </object>
</child> </child>
<accelerator key="s" signal="activate" modifiers="GDK_CONTROL_MASK"/> <accelerator key="s" signal="activate" modifiers="primary"/>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
@@ -333,7 +333,7 @@
<property name="icon_name">list-add</property> <property name="icon_name">list-add</property>
</object> </object>
</child> </child>
<accelerator key="a" signal="activate" modifiers="GDK_CONTROL_MASK"/> <accelerator key="a" signal="activate" modifiers="primary"/>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>

View File

@@ -297,7 +297,7 @@ Note: Use Residence Event for genealogical address data.</property>
<property name="AtkObject::accessible-name" translatable="yes">Private</property> <property name="AtkObject::accessible-name" translatable="yes">Private</property>
</object> </object>
</child> </child>
<accelerator key="p" signal="activate" modifiers="GDK_CONTROL_MASK"/> <accelerator key="p" signal="activate" modifiers="primary"/>
</object> </object>
<packing> <packing>
<property name="left_attach">5</property> <property name="left_attach">5</property>
@@ -332,7 +332,7 @@ Note: Use Residence Event for genealogical address data.</property>
<property name="AtkObject::accessible-name" translatable="yes">Date</property> <property name="AtkObject::accessible-name" translatable="yes">Date</property>
</object> </object>
</child> </child>
<accelerator key="d" signal="activate" modifiers="GDK_CONTROL_MASK"/> <accelerator key="d" signal="activate" modifiers="primary"/>
</object> </object>
<packing> <packing>
<property name="left_attach">5</property> <property name="left_attach">5</property>

View File

@@ -153,7 +153,7 @@
<property name="AtkObject::accessible-name" translatable="yes">Private</property> <property name="AtkObject::accessible-name" translatable="yes">Private</property>
</object> </object>
</child> </child>
<accelerator key="p" signal="activate" modifiers="GDK_CONTROL_MASK"/> <accelerator key="p" signal="activate" modifiers="primary"/>
</object> </object>
<packing> <packing>
<property name="left_attach">2</property> <property name="left_attach">2</property>

View File

@@ -180,7 +180,7 @@
<property name="AtkObject::accessible-name" translatable="yes">Private</property> <property name="AtkObject::accessible-name" translatable="yes">Private</property>
</object> </object>
</child> </child>
<accelerator key="p" signal="activate" modifiers="GDK_CONTROL_MASK"/> <accelerator key="p" signal="activate" modifiers="primary"/>
</object> </object>
<packing> <packing>
<property name="left_attach">2</property> <property name="left_attach">2</property>
@@ -250,7 +250,7 @@
<property name="AtkObject::accessible-name" translatable="yes">Child</property> <property name="AtkObject::accessible-name" translatable="yes">Child</property>
</object> </object>
</child> </child>
<accelerator key="e" signal="activate" modifiers="GDK_CONTROL_MASK"/> <accelerator key="e" signal="activate" modifiers="primary"/>
</object> </object>
<packing> <packing>
<property name="left_attach">2</property> <property name="left_attach">2</property>

View File

@@ -122,7 +122,7 @@
<property name="AtkObject::accessible-name" translatable="yes">Date</property> <property name="AtkObject::accessible-name" translatable="yes">Date</property>
</object> </object>
</child> </child>
<accelerator key="d" signal="activate" modifiers="GDK_CONTROL_MASK"/> <accelerator key="d" signal="activate" modifiers="primary"/>
</object> </object>
<packing> <packing>
<property name="left_attach">2</property> <property name="left_attach">2</property>
@@ -345,7 +345,7 @@ Very High =Direct and primary evidence used, or by dominance of the evidence </p
<property name="AtkObject::accessible-name" translatable="yes">Private</property> <property name="AtkObject::accessible-name" translatable="yes">Private</property>
</object> </object>
</child> </child>
<accelerator key="p" signal="activate" modifiers="GDK_CONTROL_MASK"/> <accelerator key="p" signal="activate" modifiers="primary"/>
</object> </object>
<packing> <packing>
<property name="left_attach">2</property> <property name="left_attach">2</property>

View File

@@ -148,7 +148,7 @@
<property name="AtkObject::accessible-name" translatable="yes">Date</property> <property name="AtkObject::accessible-name" translatable="yes">Date</property>
</object> </object>
</child> </child>
<accelerator key="d" signal="activate" modifiers="GDK_CONTROL_MASK"/> <accelerator key="d" signal="activate" modifiers="primary"/>
</object> </object>
<packing> <packing>
<property name="left_attach">4</property> <property name="left_attach">4</property>
@@ -213,7 +213,7 @@
<property name="can_focus">False</property> <property name="can_focus">False</property>
</object> </object>
</child> </child>
<accelerator key="a" signal="activate" modifiers="GDK_CONTROL_MASK"/> <accelerator key="a" signal="activate" modifiers="primary"/>
</object> </object>
<packing> <packing>
<property name="left_attach">4</property> <property name="left_attach">4</property>
@@ -270,7 +270,7 @@
<property name="AtkObject::accessible-name" translatable="yes">Place</property> <property name="AtkObject::accessible-name" translatable="yes">Place</property>
</object> </object>
</child> </child>
<accelerator key="s" signal="activate" modifiers="GDK_CONTROL_MASK"/> <accelerator key="s" signal="activate" modifiers="primary"/>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
@@ -355,7 +355,7 @@
<property name="AtkObject::accessible-name" translatable="yes">Private</property> <property name="AtkObject::accessible-name" translatable="yes">Private</property>
</object> </object>
</child> </child>
<accelerator key="p" signal="activate" modifiers="GDK_CONTROL_MASK"/> <accelerator key="p" signal="activate" modifiers="primary"/>
</object> </object>
<packing> <packing>
<property name="left_attach">4</property> <property name="left_attach">4</property>

View File

@@ -149,7 +149,7 @@
<property name="AtkObject::accessible-name" translatable="yes">Private</property> <property name="AtkObject::accessible-name" translatable="yes">Private</property>
</object> </object>
</child> </child>
<accelerator key="p" signal="activate" modifiers="GDK_CONTROL_MASK"/> <accelerator key="p" signal="activate" modifiers="primary"/>
</object> </object>
<packing> <packing>
<property name="left_attach">2</property> <property name="left_attach">2</property>
@@ -388,7 +388,7 @@
<property name="AtkObject::accessible-name" translatable="yes">Date</property> <property name="AtkObject::accessible-name" translatable="yes">Date</property>
</object> </object>
</child> </child>
<accelerator key="d" signal="activate" modifiers="GDK_CONTROL_MASK"/> <accelerator key="d" signal="activate" modifiers="primary"/>
</object> </object>
<packing> <packing>
<property name="left_attach">2</property> <property name="left_attach">2</property>

View File

@@ -286,7 +286,7 @@
<property name="AtkObject::accessible-name" translatable="yes">Edit</property> <property name="AtkObject::accessible-name" translatable="yes">Edit</property>
</object> </object>
</child> </child>
<accelerator key="f" signal="activate" modifiers="GDK_CONTROL_MASK"/> <accelerator key="f" signal="activate" modifiers="primary"/>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
@@ -530,7 +530,7 @@
</child> </child>
</object> </object>
</child> </child>
<accelerator key="p" signal="activate" modifiers="GDK_CONTROL_MASK"/> <accelerator key="p" signal="activate" modifiers="primary"/>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
@@ -594,7 +594,7 @@
<property name="AtkObject::accessible-name" translatable="yes">Edit</property> <property name="AtkObject::accessible-name" translatable="yes">Edit</property>
</object> </object>
</child> </child>
<accelerator key="m" signal="activate" modifiers="GDK_CONTROL_MASK"/> <accelerator key="m" signal="activate" modifiers="primary"/>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>

View File

@@ -165,7 +165,7 @@
<property name="AtkObject::accessible-name" translatable="yes">Date</property> <property name="AtkObject::accessible-name" translatable="yes">Date</property>
</object> </object>
</child> </child>
<accelerator key="d" signal="activate" modifiers="GDK_CONTROL_MASK"/> <accelerator key="d" signal="activate" modifiers="primary"/>
</object> </object>
<packing> <packing>
<property name="left_attach">2</property> <property name="left_attach">2</property>
@@ -267,7 +267,7 @@
<property name="AtkObject::accessible-name" translatable="yes">Family</property> <property name="AtkObject::accessible-name" translatable="yes">Family</property>
</object> </object>
</child> </child>
<accelerator key="s" signal="activate" modifiers="GDK_CONTROL_MASK"/> <accelerator key="s" signal="activate" modifiers="primary"/>
</object> </object>
<packing> <packing>
<property name="left_attach">2</property> <property name="left_attach">2</property>
@@ -381,7 +381,7 @@
<property name="AtkObject::accessible-name" translatable="yes">Private</property> <property name="AtkObject::accessible-name" translatable="yes">Private</property>
</object> </object>
</child> </child>
<accelerator key="p" signal="activate" modifiers="GDK_CONTROL_MASK"/> <accelerator key="p" signal="activate" modifiers="primary"/>
</object> </object>
<packing> <packing>
<property name="left_attach">2</property> <property name="left_attach">2</property>

View File

@@ -171,7 +171,7 @@
<property name="AtkObject::accessible-name" translatable="yes">Link</property> <property name="AtkObject::accessible-name" translatable="yes">Link</property>
</object> </object>
</child> </child>
<accelerator key="s" signal="activate" modifiers="GDK_CONTROL_MASK"/> <accelerator key="s" signal="activate" modifiers="primary"/>
</object> </object>
<packing> <packing>
<property name="left_attach">2</property> <property name="left_attach">2</property>

View File

@@ -254,7 +254,7 @@ Gramps does not store the media internally, it only stores the path! Set the 'Re
<property name="AtkObject::accessible-name" translatable="yes">Date</property> <property name="AtkObject::accessible-name" translatable="yes">Date</property>
</object> </object>
</child> </child>
<accelerator key="d" signal="activate" modifiers="GDK_CONTROL_MASK"/> <accelerator key="d" signal="activate" modifiers="primary"/>
</object> </object>
<packing> <packing>
<property name="left_attach">3</property> <property name="left_attach">3</property>
@@ -332,7 +332,7 @@ Gramps does not store the media internally, it only stores the path! Set the 'Re
<property name="AtkObject::accessible-name" translatable="yes">Private</property> <property name="AtkObject::accessible-name" translatable="yes">Private</property>
</object> </object>
</child> </child>
<accelerator key="p" signal="activate" modifiers="GDK_CONTROL_MASK"/> <accelerator key="p" signal="activate" modifiers="primary"/>
</object> </object>
<packing> <packing>
<property name="left_attach">3</property> <property name="left_attach">3</property>

View File

@@ -301,7 +301,7 @@ You can use the mouse on the picture to select a region, or use these spinbutton
<property name="AtkObject::accessible-name" translatable="yes">Private</property> <property name="AtkObject::accessible-name" translatable="yes">Private</property>
</object> </object>
</child> </child>
<accelerator key="p" signal="activate" modifiers="GDK_CONTROL_MASK"/> <accelerator key="p" signal="activate" modifiers="primary"/>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
@@ -592,7 +592,7 @@ You can use the mouse on the picture to select a region, or use these spinbutton
<property name="AtkObject::accessible-name" translatable="yes">Date</property> <property name="AtkObject::accessible-name" translatable="yes">Date</property>
</object> </object>
</child> </child>
<accelerator key="d" signal="activate" modifiers="GDK_CONTROL_MASK"/> <accelerator key="d" signal="activate" modifiers="primary"/>
</object> </object>
<packing> <packing>
<property name="left_attach">3</property> <property name="left_attach">3</property>

View File

@@ -155,7 +155,7 @@
<property name="AtkObject::accessible-name" translatable="yes">Private</property> <property name="AtkObject::accessible-name" translatable="yes">Private</property>
</object> </object>
</child> </child>
<accelerator key="p" signal="activate" modifiers="GDK_CONTROL_MASK"/> <accelerator key="p" signal="activate" modifiers="primary"/>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
@@ -581,7 +581,7 @@ Here you can make sure this person is sorted according to a custom name format (
<property name="AtkObject::accessible-name" translatable="yes">Date</property> <property name="AtkObject::accessible-name" translatable="yes">Date</property>
</object> </object>
</child> </child>
<accelerator key="d" signal="activate" modifiers="GDK_CONTROL_MASK"/> <accelerator key="d" signal="activate" modifiers="primary"/>
</object> </object>
<packing> <packing>
<property name="left_attach">2</property> <property name="left_attach">2</property>

View File

@@ -233,7 +233,7 @@ Use monospace font to keep preformatting.</property>
<property name="AtkObject::accessible-name" translatable="yes">Private</property> <property name="AtkObject::accessible-name" translatable="yes">Private</property>
</object> </object>
</child> </child>
<accelerator key="p" signal="activate" modifiers="GDK_CONTROL_MASK"/> <accelerator key="p" signal="activate" modifiers="primary"/>
</object> </object>
<packing> <packing>
<property name="left_attach">4</property> <property name="left_attach">4</property>

View File

@@ -361,7 +361,7 @@ Indicate that the surname consists of different parts. Every surname has its own
<property name="AtkObject::accessible-name" translatable="yes">Add</property> <property name="AtkObject::accessible-name" translatable="yes">Add</property>
</object> </object>
</child> </child>
<accelerator key="a" signal="activate" modifiers="GDK_CONTROL_MASK"/> <accelerator key="a" signal="activate" modifiers="primary"/>
</object> </object>
<packing> <packing>
<property name="left_attach">8</property> <property name="left_attach">8</property>
@@ -417,7 +417,7 @@ Indicate that the surname consists of different parts. Every surname has its own
<property name="AtkObject::accessible-name" translatable="yes">Private</property> <property name="AtkObject::accessible-name" translatable="yes">Private</property>
</object> </object>
</child> </child>
<accelerator key="p" signal="activate" modifiers="GDK_CONTROL_MASK"/> <accelerator key="p" signal="activate" modifiers="primary"/>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
@@ -516,7 +516,7 @@ Indicate that the surname consists of different parts. Every surname has its own
<property name="AtkObject::accessible-name" translatable="yes">Edit</property> <property name="AtkObject::accessible-name" translatable="yes">Edit</property>
</object> </object>
</child> </child>
<accelerator key="e" signal="activate" modifiers="GDK_CONTROL_MASK"/> <accelerator key="e" signal="activate" modifiers="primary"/>
</object> </object>
<packing> <packing>
<property name="left_attach">8</property> <property name="left_attach">8</property>

View File

@@ -158,7 +158,7 @@ Note: Use Events instead for relations connected to specific time frames or occa
<property name="AtkObject::accessible-name" translatable="yes">Private</property> <property name="AtkObject::accessible-name" translatable="yes">Private</property>
</object> </object>
</child> </child>
<accelerator key="p" signal="activate" modifiers="GDK_CONTROL_MASK"/> <accelerator key="p" signal="activate" modifiers="primary"/>
</object> </object>
<packing> <packing>
<property name="left_attach">2</property> <property name="left_attach">2</property>
@@ -211,7 +211,7 @@ Note: Use Events instead for relations connected to specific time frames or occa
<property name="AtkObject::accessible-name" translatable="yes">Person</property> <property name="AtkObject::accessible-name" translatable="yes">Person</property>
</object> </object>
</child> </child>
<accelerator key="s" signal="activate" modifiers="GDK_CONTROL_MASK"/> <accelerator key="s" signal="activate" modifiers="primary"/>
</object> </object>
<packing> <packing>
<property name="left_attach">2</property> <property name="left_attach">2</property>

View File

@@ -328,7 +328,7 @@ You can set these values via the Geography View by searching the place, or via a
<property name="AtkObject::accessible-name" translatable="yes">Private</property> <property name="AtkObject::accessible-name" translatable="yes">Private</property>
</object> </object>
</child> </child>
<accelerator key="p" signal="activate" modifiers="GDK_CONTROL_MASK"/> <accelerator key="p" signal="activate" modifiers="primary"/>
</object> </object>
<packing> <packing>
<property name="left_attach">4</property> <property name="left_attach">4</property>

View File

@@ -142,7 +142,7 @@
<property name="AtkObject::accessible-name" translatable="yes">Date</property> <property name="AtkObject::accessible-name" translatable="yes">Date</property>
</object> </object>
</child> </child>
<accelerator key="d" signal="activate" modifiers="GDK_CONTROL_MASK"/> <accelerator key="d" signal="activate" modifiers="primary"/>
</object> </object>
<packing> <packing>
<property name="left_attach">2</property> <property name="left_attach">2</property>

View File

@@ -431,7 +431,7 @@
<property name="AtkObject::accessible-name" translatable="yes">Private</property> <property name="AtkObject::accessible-name" translatable="yes">Private</property>
</object> </object>
</child> </child>
<accelerator key="p" signal="activate" modifiers="GDK_CONTROL_MASK"/> <accelerator key="p" signal="activate" modifiers="primary"/>
</object> </object>
<packing> <packing>
<property name="left_attach">4</property> <property name="left_attach">4</property>

View File

@@ -195,7 +195,7 @@
<property name="AtkObject::accessible-name" translatable="yes">Private</property> <property name="AtkObject::accessible-name" translatable="yes">Private</property>
</object> </object>
</child> </child>
<accelerator key="p" signal="activate" modifiers="GDK_CONTROL_MASK"/> <accelerator key="p" signal="activate" modifiers="primary"/>
</object> </object>
<packing> <packing>
<property name="left_attach">2</property> <property name="left_attach">2</property>

View File

@@ -212,7 +212,7 @@
<property name="AtkObject::accessible-name" translatable="yes">Private</property> <property name="AtkObject::accessible-name" translatable="yes">Private</property>
</object> </object>
</child> </child>
<accelerator key="p" signal="activate" modifiers="GDK_CONTROL_MASK"/> <accelerator key="p" signal="activate" modifiers="primary"/>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>

View File

@@ -295,7 +295,7 @@
<property name="AtkObject::accessible-name" translatable="yes">Private</property> <property name="AtkObject::accessible-name" translatable="yes">Private</property>
</object> </object>
</child> </child>
<accelerator key="p" signal="activate" modifiers="GDK_CONTROL_MASK"/> <accelerator key="p" signal="activate" modifiers="primary"/>
</object> </object>
<packing> <packing>
<property name="left_attach">2</property> <property name="left_attach">2</property>

View File

@@ -156,7 +156,7 @@
<property name="AtkObject::accessible-name" translatable="yes">Private</property> <property name="AtkObject::accessible-name" translatable="yes">Private</property>
</object> </object>
</child> </child>
<accelerator key="p" signal="activate" modifiers="GDK_CONTROL_MASK"/> <accelerator key="p" signal="activate" modifiers="primary"/>
</object> </object>
<packing> <packing>
<property name="left_attach">2</property> <property name="left_attach">2</property>

View File

@@ -44,6 +44,7 @@ import gi
gi.require_version('PangoCairo', '1.0') gi.require_version('PangoCairo', '1.0')
from gi.repository import PangoCairo from gi.repository import PangoCairo
from gi.repository import GLib from gi.repository import GLib
from gi.repository import Gdk
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@@ -466,18 +467,11 @@ def process_pending_events(max_count=10):
def is_right_click(event): def is_right_click(event):
""" """
Returns True if the event is a button-3 or equivalent Returns True if the event is to open the context menu.
""" """
from gi.repository import Gdk from gi.repository import Gdk
if Gdk.Event.triggers_context_menu(event):
if event.type == Gdk.EventType.BUTTON_PRESS: return True
if is_quartz():
if (event.button == 3
or (event.button == 1 and event.get_state() & Gdk.ModifierType.CONTROL_MASK)):
return True
if event.button == 3:
return True
def color_graph_box(alive=False, gender=Person.MALE): def color_graph_box(alive=False, gender=Person.MALE):
""" """
@@ -685,3 +679,12 @@ def text_to_clipboard(text):
clipboard = Gtk.Clipboard.get_for_display(Gdk.Display.get_default(), clipboard = Gtk.Clipboard.get_for_display(Gdk.Display.get_default(),
Gdk.SELECTION_CLIPBOARD) Gdk.SELECTION_CLIPBOARD)
clipboard.set_text(text, -1) clipboard.set_text(text, -1)
def get_primary_mask(addl_mask=0):
"""
Obtain the IntentPrimary mask for the platform bitwise-ored with a
passed-in additional mask.
"""
keymap = Gdk.Keymap.get_default()
primary = keymap.get_modifier_mask(Gdk.ModifierIntent.PRIMARY_ACCELERATOR)
return primary | addl_mask

View File

@@ -52,6 +52,7 @@ from .pageview import PageView
from ..actiongroup import ActionGroup from ..actiongroup import ActionGroup
from gramps.gen.utils.db import navigation_label from gramps.gen.utils.db import navigation_label
from gramps.gen.constfunc import mod_key from gramps.gen.constfunc import mod_key
from ..utils import get_primary_mask
DISABLED = -1 DISABLED = -1
MRU_SIZE = 10 MRU_SIZE = 10
@@ -480,7 +481,7 @@ class NavigationView(PageView):
if self.active: if self.active:
if event.type == Gdk.EventType.KEY_PRESS: if event.type == Gdk.EventType.KEY_PRESS:
if (event.keyval == Gdk.KEY_c and if (event.keyval == Gdk.KEY_c and
(event.get_state() & Gdk.ModifierType.CONTROL_MASK)): (event.get_state() & get_primary_mask())):
self.call_copy() self.call_copy()
return True return True
return super(NavigationView, self).key_press_handler(widget, event) return super(NavigationView, self).key_press_handler(widget, event)

View File

@@ -48,7 +48,7 @@ from gramps.gen.errors import WindowActiveError
from gramps.gen.const import URL_MANUAL_PAGE, VERSION_DIR, COLON from gramps.gen.const import URL_MANUAL_PAGE, VERSION_DIR, COLON
from ..editors import EditPerson, EditFamily from ..editors import EditPerson, EditFamily
from ..managedwindow import ManagedWindow from ..managedwindow import ManagedWindow
from ..utils import is_right_click, rgb_to_hex from ..utils import is_right_click, rgb_to_hex, get_primary_mask
from .menuitem import add_menuitem from .menuitem import add_menuitem
from ..plug import make_gui_option from ..plug import make_gui_option
from ..plug.quick import run_quick_report_by_name from ..plug.quick import run_quick_report_by_name
@@ -405,12 +405,12 @@ class GuiGramplet:
""" """
if ((Gdk.keyval_name(event.keyval) == 'Z') and if ((Gdk.keyval_name(event.keyval) == 'Z') and
(event.get_state() & Gdk.ModifierType.CONTROL_MASK) and (event.get_state() &
(event.get_state() & Gdk.ModifierType.SHIFT_MASK)): get_primary_mask(Gdk.ModifierType.SHIFT_MASK))):
self.redo() self.redo()
return True return True
elif ((Gdk.keyval_name(event.keyval) == 'z') and elif ((Gdk.keyval_name(event.keyval) == 'z') and
(event.get_state() & Gdk.ModifierType.CONTROL_MASK)): (event.get_state() & get_primary_mask())):
self.undo() self.undo()
return True return True

View File

@@ -38,6 +38,12 @@ _LOG = logging.getLogger(".widgets.interactivesearch")
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from gi.repository import Gtk, Gdk, GLib from gi.repository import Gtk, Gdk, GLib
#-------------------------------------------------------------------------
#
# Gramps modules
#
#-------------------------------------------------------------------------
from ..utils import get_primary_mask
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# InteractiveSearchBox class # InteractiveSearchBox class
@@ -100,10 +106,7 @@ class InteractiveSearchBox:
self._search_entry.disconnect(popup_menu_id) self._search_entry.disconnect(popup_menu_id)
# Intercept CTRL+F keybinding because Gtk do not allow to _replace_ it. # Intercept CTRL+F keybinding because Gtk do not allow to _replace_ it.
default_accel = obj.get_modifier_mask( if ((event.state & get_primary_mask())
Gdk.ModifierIntent.PRIMARY_ACCELERATOR)
if ((event.state & (default_accel | Gdk.ModifierType.CONTROL_MASK))
== (default_accel | Gdk.ModifierType.CONTROL_MASK)
and event.keyval in [Gdk.KEY_f, Gdk.KEY_F]): and event.keyval in [Gdk.KEY_f, Gdk.KEY_F]):
self.__imcontext_changed = True self.__imcontext_changed = True
# self.real_start_interactive_search(event.get_device(), True) # self.real_start_interactive_search(event.get_device(), True)

View File

@@ -24,6 +24,7 @@ An override to allow easy multiselections.
from gi.repository import Gdk from gi.repository import Gdk
from gi.repository import Gtk from gi.repository import Gtk
from ..utils import get_primary_mask
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@@ -65,7 +66,8 @@ class MultiTreeView(Gtk.TreeView):
target = self.get_path_at_pos(int(event.x), int(event.y)) target = self.get_path_at_pos(int(event.x), int(event.y))
if (target if (target
and event.type == Gdk.EventType.BUTTON_PRESS and event.type == Gdk.EventType.BUTTON_PRESS
and not (event.get_state() & (Gdk.ModifierType.CONTROL_MASK|Gdk.ModifierType.SHIFT_MASK)) and not (event.get_state() &
get_primary_mask(Gdk.ModifierType.SHIFT_MASK))
and self.get_selection().path_is_selected(target[0])): and self.get_selection().path_is_selected(target[0])):
# disable selection # disable selection
self.get_selection().set_select_function(lambda *ignore: False, None) self.get_selection().set_select_function(lambda *ignore: False, None)

View File

@@ -60,7 +60,7 @@ from .toolcomboentry import ToolComboEntry
from .springseparator import SpringSeparatorAction from .springseparator import SpringSeparatorAction
from ..spell import Spell from ..spell import Spell
from ..display import display_url from ..display import display_url
from ..utils import SystemFonts, rgb_to_hex from ..utils import SystemFonts, rgb_to_hex, get_primary_mask
from gramps.gen.config import config from gramps.gen.config import config
from gramps.gen.constfunc import has_display from gramps.gen.constfunc import has_display
from ..actiongroup import ActionGroup from ..actiongroup import ActionGroup
@@ -247,12 +247,12 @@ class StyledTextEditor(Gtk.TextView):
""" """
if ((Gdk.keyval_name(event.keyval) == 'Z') and if ((Gdk.keyval_name(event.keyval) == 'Z') and
(event.get_state() & Gdk.ModifierType.CONTROL_MASK) and (event.get_state() &
(event.get_state() & Gdk.ModifierType.SHIFT_MASK)): get_primary_mask(Gdk.ModifierType.SHIFT_MASK))):
self.redo() self.redo()
return True return True
elif ((Gdk.keyval_name(event.keyval) == 'z') and elif ((Gdk.keyval_name(event.keyval) == 'z') and
(event.get_state() & Gdk.ModifierType.CONTROL_MASK)): (event.get_state() & get_primary_mask())):
self.undo() self.undo()
return True return True
else: else:
@@ -344,7 +344,7 @@ class StyledTextEditor(Gtk.TextView):
self.selclick=False self.selclick=False
if ((event.type == Gdk.EventType.BUTTON_PRESS) and if ((event.type == Gdk.EventType.BUTTON_PRESS) and
(event.button == 1) and (event.button == 1) and
(event.get_state() and Gdk.ModifierType.CONTROL_MASK) and (event.get_state() and get_primary_mask()) and
(self.url_match)): (self.url_match)):
flavor = self.url_match[MATCH_FLAVOR] flavor = self.url_match[MATCH_FLAVOR]

View File

@@ -504,7 +504,7 @@ class OsmGps:
elif event.button == 2 and event.type == Gdk.EventType.BUTTON_RELEASE: elif event.button == 2 and event.type == Gdk.EventType.BUTTON_RELEASE:
self.end_selection = current self.end_selection = current
self.zone_selection = False self.zone_selection = False
elif event.button == 3 and event.type == Gdk.EventType.BUTTON_PRESS: elif Gdk.Event.triggers_context_menu():
self.build_nav_menu(osm, event, lat, lon) self.build_nav_menu(osm, event, lat, lon)
else: else:
self.save_center(lat, lon) self.save_center(lat, lon)