cleanup (reordering alphabetically of DnD types)

svn: r12977
This commit is contained in:
Raphael Ackermann 2009-08-12 10:01:28 +00:00
parent 3c070fb0a6
commit 9e4df3ec96

View File

@ -56,7 +56,7 @@ log = logging.getLogger(".DdTargets")
class _DdType: class _DdType:
"""Represents the fields needed by a drag and drop traget.""" """Represents the fields needed by a drag and drop target."""
_APP_ID_OFFSET = 40 # Starting value of app_ids _APP_ID_OFFSET = 40 # Starting value of app_ids
@ -81,7 +81,8 @@ class _DdType:
return idval return idval
def target(self): def target(self):
"""Return the full target information in the format required by the """
Return the full target information in the format required by the
Gtk functions. Gtk functions.
""" """
@ -108,66 +109,63 @@ class _DdTargets(object):
self._type_map = {} self._type_map = {}
self._app_id_map = {} self._app_id_map = {}
self.URL = _DdType(self, 'url') self.ADDRESS = _DdType(self, 'paddr')
self.EVENT = _DdType(self, 'pevent') self.ATTRIBUTE = _DdType(self, 'pattr')
self.EVENTREF = _DdType(self, 'eventref') self.DATA = _DdType(self, 'data_tuple')
self.ATTRIBUTE = _DdType(self, 'pattr') self.EVENT = _DdType(self, 'pevent')
self.ADDRESS = _DdType(self, 'paddr') self.EVENTREF = _DdType(self, 'eventref')
self.LOCATION = _DdType(self, 'location') self.FAMILY_ATTRIBUTE = _DdType(self, 'fattr')
self.SOURCEREF = _DdType(self, 'srcref') self.FAMILY_EVENT = _DdType(self, 'fevent')
self.REPOREF = _DdType(self, 'reporef') self.LOCATION = _DdType(self, 'location')
self.REPO_LINK = _DdType(self, 'repo-link') self.MEDIAOBJ = _DdType(self, 'mediaobj')
self.PLACE_LINK = _DdType(self, 'place-link') self.MEDIAREF = _DdType(self, 'mediaref')
self.NAME = _DdType(self, 'name') self.NAME = _DdType(self, 'name')
self.MEDIAOBJ = _DdType(self, 'mediaobj') self.NOTE_LINK = _DdType(self, 'note-link')
self.MEDIAREF = _DdType(self, 'mediaref') self.PLACE_LINK = _DdType(self, 'place-link')
self.DATA = _DdType(self, 'data_tuple') self.REPO_LINK = _DdType(self, 'repo-link')
self.NOTE_LINK = _DdType(self, 'note-link') self.REPOREF = _DdType(self, 'reporef')
self.PERSON_LINK = _DdType(self, 'person-link')
self.PERSON_LINK = _DdType(self, 'person-link') self.PERSON_LINK_LIST = _DdType(self, 'person-link-list')
self.PERSON_LINK_LIST = _DdType(self, 'person-link-list') self.PERSONREF = _DdType(self, 'personref')
self.PERSONREF = _DdType(self, 'personref') self.SOURCEREF = _DdType(self, 'srcref')
self.SOURCE_LINK = _DdType(self, 'source-link')
self.SOURCE_LINK = _DdType(self, 'source-link') self.URL = _DdType(self, 'url')
self.FAMILY_EVENT = _DdType(self, 'fevent')
self.FAMILY_ATTRIBUTE = _DdType(self, 'fattr')
# List of all types that are used between # List of all types that are used between
# gramps widgets but should not be exported # gramps widgets but should not be exported
# to non gramps widgets. # to non gramps widgets.
self._all_gramps_types = [ self._all_gramps_types = [
self.URL,
self.EVENT,
self.ATTRIBUTE,
self.ADDRESS, self.ADDRESS,
self.LOCATION, self.ATTRIBUTE,
self.SOURCEREF, self.EVENT,
self.EVENTREF, self.EVENTREF,
self.NAME, self.LOCATION,
self.REPOREF,
self.MEDIAOBJ, self.MEDIAOBJ,
self.MEDIAREF, self.MEDIAREF,
self.REPO_LINK, self.NAME,
self.NOTE_LINK,
self.PLACE_LINK, self.PLACE_LINK,
self.SOURCE_LINK,
self.PERSON_LINK, self.PERSON_LINK,
self.PERSON_LINK_LIST, self.PERSON_LINK_LIST,
self.PERSONREF, self.PERSONREF,
self.NOTE_LINK, self.REPO_LINK,
self.REPOREF,
self.SOURCEREF,
self.SOURCE_LINK,
self.URL,
] ]
self.CHILD = _DdType(self, 'child') self.CHILD = _DdType(self, 'child')
self.SPOUSE = _DdType(self, 'spouse') self.SPOUSE = _DdType(self, 'spouse')
self.TEXT = _DdType(self, 'TEXT', 0, 1)
self.TEXT_MIME = _DdType(self, 'text/plain', 0, 0) self.TEXT_MIME = _DdType(self, 'text/plain', 0, 0)
self.TEXT = _DdType(self, 'TEXT', 0, 1)
self.STRING = _DdType(self, 'STRING', 0, 2) self.STRING = _DdType(self, 'STRING', 0, 2)
self.COMPOUND_TEXT = _DdType(self, 'COMPOUND_TEXT', 0, 3) self.COMPOUND_TEXT = _DdType(self, 'COMPOUND_TEXT', 0, 3)
self.UTF8_STRING = _DdType(self, 'UTF8_STRING', 0, 4) self.UTF8_STRING = _DdType(self, 'UTF8_STRING', 0, 4)
self.URI_LIST = _DdType(self, 'text/uri-list', 0, 5) self.URI_LIST = _DdType(self, 'text/uri-list', 0, 5)
self.APP_ROOT = _DdType(self, 'application/x-rootwin-drop', 0, 6) self.APP_ROOT = _DdType(self, 'application/x-rootwin-drop', 0, 6)
# List of all the test types. These are types # List of all the text types. These are types
# that can be interpreted as text. # that can be interpreted as text.
self._all_text_types = (self.UTF8_STRING, self._all_text_types = (self.UTF8_STRING,
self.TEXT, self.TEXT,
@ -176,8 +174,10 @@ class _DdTargets(object):
self.COMPOUND_TEXT) self.COMPOUND_TEXT)
def insert(self, dd_type): def insert(self, dd_type):
"""Add a target to the lookup lists. These lists are """
used purely for performance reasons.""" Add a target to the lookup lists. These lists are
used purely for performance reasons.
"""
self._type_map[dd_type.drag_type] = dd_type self._type_map[dd_type.drag_type] = dd_type
self._app_id_map[dd_type.app_id] = dd_type self._app_id_map[dd_type.app_id] = dd_type
@ -195,8 +195,10 @@ class _DdTargets(object):
return self._all_text_types return self._all_text_types
def all_text_types(self): def all_text_types(self):
"""return a list of all the type names that could be """
used as the type of a string.""" Return a list of all the type names that could be
used as the type of a string.
"""
return tuple([t.drag_type for t in self._all_text_types]) return tuple([t.drag_type for t in self._all_text_types])
@ -204,25 +206,23 @@ class _DdTargets(object):
return type_name in self.all_gramps_types() return type_name in self.all_gramps_types()
def all_gramps_types(self): def all_gramps_types(self):
"""return a list of all the type names that are internal """Return a list of all the type names that are internal to gramps."""
to gramps."""
return tuple([t.drag_type for t in self._all_gramps_types]) return tuple([t.drag_type for t in self._all_gramps_types])
def all_text_targets(self): def all_text_targets(self):
"""return a list of all the targets that could be used """Return a list of all the targets that could be used for text."""
for text."""
return tuple([t.target() for t in self._all_text_types]) return tuple([t.target() for t in self._all_text_types])
def all_gramps_targets(self): def all_gramps_targets(self):
"""return a list off the internal gramps targets.""" """Return a list off the internal gramps targets."""
return tuple([t.target() for t in self._all_gramps_types]) return tuple([t.target() for t in self._all_gramps_types])
def all_targets(self): def all_targets(self):
"""return a list of all the known targets.""" """Return a list of all the known targets."""
return self.all_gramps_targets() + self.all_text_targets() return self.all_gramps_targets() + self.all_text_targets()
# Create the singleton instance. # Create the singleton instance.