Beispiel #1
0
 def is_project_drag(self, info):
     """Return True if only projects are being dropped else False"""
     pb = info.draggingPasteboard()
     t = pb.availableTypeFromArray_(self.supported_drag_types)
     if t == const.DOC_ID_LIST_PBOARD_TYPE:
         items = self.iter_dropped_id_list(pb)
         return all(isinstance(item, Project) for item in items)
     elif t == ak.NSFilenamesPboardType:
         paths = pb.propertyListForType_(ak.NSFilenamesPboardType)
         return all(Project.is_project_path(path) for path in paths)
     return False
Beispiel #2
0
 def iter_dropped_paths(self, pasteboard):
     from editxt.document import TextDocument
     if not pasteboard.types().containsObject_(ak.NSFilenamesPboardType):
         raise StopIteration()
     for path in pasteboard.propertyListForType_(ak.NSFilenamesPboardType):
         if Project.is_project_path(path):
             proj = self.app.find_project_with_path(path)
             if proj is None:
                 proj = Project.create_with_path(path)
             yield proj
         else:
             yield TextDocument.get_with_path(path)
Beispiel #3
0
 def test(path, expected):
     result = Project.is_project_path(path)
     eq_(result, expected, "Project.is_project_path(%r) returned wrong value: %s" % (path, result))
Beispiel #4
0
 def test(path, expected):
     result = Project.is_project_path(path)
     eq_(
         result, expected,
         "Project.is_project_path(%r) returned wrong value: %s" %
         (path, result))