From 82c627489ab9e7894740fc1c73c0e578bd4a5585 Mon Sep 17 00:00:00 2001
From: wolfwiddra <wolf.widdra@physik.uni-halle.de>
Date: Tue, 5 May 2020 11:53:50 +0200
Subject: [PATCH] V 1.0.5   (elog comments html strip)

---
 libhreels/expLogbook.py | 20 +++++++-------------
 pyproject.toml          |  7 ++++---
 2 files changed, 11 insertions(+), 16 deletions(-)

diff --git a/libhreels/expLogbook.py b/libhreels/expLogbook.py
index 568dcba..68eb2e9 100644
--- a/libhreels/expLogbook.py
+++ b/libhreels/expLogbook.py
@@ -5,7 +5,7 @@ import urllib.parse
 import os
 import builtins
 import re
-from elog.logbook_exceptions import *
+# from elog.logbook_exceptions import *
 from datetime import datetime
 from time import localtime
 
@@ -499,17 +499,11 @@ class myLogbook(object):
 
     def getShortMessage4File(self,filename):
         stuff = self.getMessage4File(filename)
-        replacements = [
-            ('<\/p>', ''),
-            ('<p>', ''),
-            ('&gt;', '>'),
-            ('&lt;', '<')
-        ]
-        if isinstance(stuff,str):
-            for old, new in replacements:
-                stuff = re.sub(old, new, stuff)
-            return stuff[:min(60,len(stuff))]
-        return ''
+        import html2text
+        h = html2text.HTML2Text()
+        # Ignore converting links from HTML
+        h.ignore_links = True
+        return h.handle(stuff)
 
 def _remove_reserved_attributes(attributes):
     """
@@ -605,7 +599,7 @@ def _handle_pswd(password, encrypt=True):
 ##########################################################################################################
 # ogf settings:
 try:
-    from eLogCredentials import user, password, dummy, unsafe    # Defines User credentials
+    from libhreels.eLogCredentials import user, password, dummy, unsafe    # Defines User credentials
     logbook = myLogbook('https://labor-ep3.physik.uni-halle.de/HREELS/', user=dummy, password=unsafe)
     print('eLog available!')
     available = True
diff --git a/pyproject.toml b/pyproject.toml
index b6761ef..416c1d1 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,6 @@
 [tool.poetry]
 name = "libhreels"
-version = "1.0.3"
+version = "1.0.5"
 description = "Handling, simulating, and plotting HREELS and Auger spectroscopy data"
 authors = ["Wolf Widdra <wolf.widdra@physik.uni-halle.de>"]
 include = ["*.*"]
@@ -17,7 +17,7 @@ scipy = "^1.4"
 requests = "^2.23.0"
 argparse = "^1.4.0"
 PyQt5 = "^5.13"
-numpy = "^1.18.3"
+numpy = "^1.18.2"
 
 [tool.poetry.dev-dependencies]
 pytest = "^5.2"
@@ -26,10 +26,11 @@ pytest = "^5.2"
 [tool.poetry.scripts]
 dielectrics = "libhreels.dielectrics:myMain"
 calchreels = "libhreels.calcHREELS:myMain"
+viewhreelstest = "libhreels.ViewHREELS:myMain"
 
 [tool.poetry.plugins."gui_scripts"]
-viewhreels = "libhreels.ViewHREELS:myMain"
 viewauger = "libhreels.ViewAuger:myMain"
+viewhreels = "libhreels.ViewHREELS:myMain"
 
 [build-system]
 requires = ["poetry>=0.12"]
-- 
GitLab