beremiz

WIP adding searching capabilities in python files. was done :
search_in_CTN
2019-03-20, Edouard Tisserant
c80b0d864475
WIP adding searching capabilities in python files. was done :
- fixed stub CTN search results so that they can be accepted by search result panel
- worked on search result panel so that it can display those CTN results
- made search result panel display correctly stub search result, for variables and body matches
- EditProjectElement now opens CTN node as well as PlcOpen project nodes
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# See COPYING file for copyrights details.
from __future__ import absolute_import
import md5
class ConnectorBase(object):
chuncksize = 1024*1024
def BlobFromFile(self, filepath, seed):
s = md5.new()
s.update(seed)
blobID = self.SeedBlob(seed)
with open(filepath, "rb") as f:
while blobID == s.digest():
chunk = f.read(self.chuncksize)
if len(chunk) == 0:
return blobID
blobID = self.AppendChunkToBlob(chunk, blobID)
s.update(chunk)