From 60293011cae008a463e9cccca13561953b645fbb Mon Sep 17 00:00:00 2001
From: wolfwiddra <wolf.widdra@physik.uni-halle.de>
Date: Thu, 7 May 2020 20:10:01 +0200
Subject: [PATCH] V 1.0.6

---
 libhreels/ViewHREELS.py | 19 ++++++----
 libhreels/__init__.py   |  2 +-
 libhreels/expLogbook.py |  6 ++-
 poetry.lock             | 82 ++++++++++++++++++++++++-----------------
 pyproject.toml          |  5 ++-
 5 files changed, 67 insertions(+), 47 deletions(-)

diff --git a/libhreels/ViewHREELS.py b/libhreels/ViewHREELS.py
index 91f7270..800ada1 100644
--- a/libhreels/ViewHREELS.py
+++ b/libhreels/ViewHREELS.py
@@ -15,8 +15,8 @@ hhPath = os.path.dirname(__file__)
 from libhreels.HREELS import HREELS, myPath
 from datetime import datetime  
 import argparse
-# import libhreels.expLogbook as lgb
-import libhreels.NoExpLogbook as lgb
+import libhreels.expLogbook as lgb
+# import libhreels.NoExpLogbook as lgb
 
 # fix HighRes Displays
 QtWidgets.QApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling, True)
@@ -240,11 +240,12 @@ class HREELS_Window(QtWidgets.QMainWindow):
         self.showComment =  self.ui.checkBoxComment.isChecked()
         # print('onCommentSet:', lgb.available, self.showComment, self.ui.listWidget.selectedItems()[0].text())
         if self.showComment:
-            if lgb.available:
+            if lgb.available:                
                 text = lgb.logbook.getShortMessage4File(self.d.fname)
                 ids = lgb.logbook.search({'file':self.d.fname})
-                _, attributes, _ = lgb.logbook.read(ids[0])
-                print(self.d.fname, ids[0],':\t\t', attributes['Date'],'\t',text)
+                if len(ids) > 0:
+                    _, attributes, _ = lgb.logbook.read(ids[0])
+                    print(self.d.fname, ids[0],': ', attributes['Date'],'\t',text[:-2])
             else:
                 text = self.comment if self.comment else ''
                 self.comment = None
@@ -446,15 +447,17 @@ def myMain():
             return False
         else:
             return string
-    # parser.add_argument("-s", "--start", help="Start date (2018-01-01)", default='2019-01-01', type=validDate)
-    parser.add_argument("-f", "--file", help="Start viewer with this datafile", type=is_valid_file)
-    # parser.add_argument("-f", "--file", help="Start viewer with this datafile")
+    parser.add_argument("file", nargs='?', help="Start viewer with this datafile", type=is_valid_file)
+    parser.add_argument("-f", "--file2", help="Start viewer with this datafile")
     parser.add_argument("-c", "--comment", default=None, help="Text comment")
     args = parser.parse_args()
 
     if args.file:
         fPath,fName = os.path.split(args.file)
         # print(">>> ", fPath, " <<< ", fName)
+    elif args.file2:
+        fPath,fName = os.path.split(args.file2)
+        # print(">>> ", fPath, " <<< ", fName)
     else:
         if os.name == 'nt':
             fPath = "D:\\Data\\Python\\HREELS\\expHREELS\\data"
diff --git a/libhreels/__init__.py b/libhreels/__init__.py
index 5c4105c..382021f 100644
--- a/libhreels/__init__.py
+++ b/libhreels/__init__.py
@@ -1 +1 @@
-__version__ = "1.0.1"
+__version__ = "1.0.6"
diff --git a/libhreels/expLogbook.py b/libhreels/expLogbook.py
index e95ca40..0fba0f4 100644
--- a/libhreels/expLogbook.py
+++ b/libhreels/expLogbook.py
@@ -495,6 +495,7 @@ class myLogbook(object):
             message, _ , _ = self.read(ids[0])
             return message
         else:
+            print("File {} in eLog not found!".format(filename))
             return None
 
     def getShortMessage4File(self,filename):
@@ -503,7 +504,8 @@ class myLogbook(object):
         h = html2text.HTML2Text()
         # Ignore converting links from HTML
         h.ignore_links = True
-        return h.handle(stuff)
+        if stuff: return h.handle(stuff)
+        return
 
 def _remove_reserved_attributes(attributes):
     """
@@ -599,7 +601,7 @@ def _handle_pswd(password, encrypt=True):
 ##########################################################################################################
 # ogf settings:
 try:
-    from libhreels.eLogCredentials import user, password, dummy, unsafe    # Defines User credentials
+    from libhreels.eLogCredentials import 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/poetry.lock b/poetry.lock
index 9bd03ae..33cffd8 100644
--- a/poetry.lock
+++ b/poetry.lock
@@ -13,7 +13,7 @@ marker = "sys_platform == \"win32\""
 name = "atomicwrites"
 optional = false
 python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
-version = "1.3.0"
+version = "1.4.0"
 
 [[package]]
 category = "dev"
@@ -65,6 +65,18 @@ version = "0.10.0"
 [package.dependencies]
 six = "*"
 
+[[package]]
+category = "main"
+description = ""
+name = "elog"
+optional = false
+python-versions = "*"
+version = "1.3.5"
+
+[package.source]
+reference = ""
+type = "url"
+url = "https://github.com/paulscherrerinstitute/py_elog/archive/master.zip"
 [[package]]
 category = "main"
 description = "Internationalized Domain Names in Applications (IDNA)"
@@ -126,7 +138,7 @@ description = "NumPy is the fundamental package for array computing with Python.
 name = "numpy"
 optional = false
 python-versions = ">=3.5"
-version = "1.18.3"
+version = "1.18.4"
 
 [[package]]
 category = "dev"
@@ -174,14 +186,14 @@ version = "2.4.7"
 
 [[package]]
 category = "main"
-description = "Python bindings for the Qt cross platform UI and application toolkit"
+description = "Python bindings for the Qt cross platform application toolkit"
 name = "pyqt5"
 optional = false
-python-versions = "*"
-version = "5.13.0"
+python-versions = ">=3.5"
+version = "5.14.2"
 
 [package.dependencies]
-PyQt5_sip = ">=4.19.14,<13"
+PyQt5-sip = ">=12.7,<13"
 
 [[package]]
 category = "main"
@@ -300,7 +312,7 @@ docs = ["sphinx", "jaraco.packaging (>=3.2)", "rst.linker (>=1.9)"]
 testing = ["jaraco.itertools", "func-timeout"]
 
 [metadata]
-content-hash = "857d306c5ec96c3a5b083b34aa086e8c7e1fae7b28fcab04d293ac4c1938dae7"
+content-hash = "ab2440425657768cdf50a6b47e447622d9899d1704fd51c1f319514b3dddef0d"
 python-versions = "^3.6"
 
 [metadata.files]
@@ -309,8 +321,8 @@ argparse = [
     {file = "argparse-1.4.0.tar.gz", hash = "sha256:62b089a55be1d8949cd2bc7e0df0bddb9e028faefc8c32038cc84862aefdd6e4"},
 ]
 atomicwrites = [
-    {file = "atomicwrites-1.3.0-py2.py3-none-any.whl", hash = "sha256:03472c30eb2c5d1ba9227e4c2ca66ab8287fbfbbda3888aa93dc2e28fc6811b4"},
-    {file = "atomicwrites-1.3.0.tar.gz", hash = "sha256:75a9445bac02d8d058d5e1fe689654ba5a6556a1dfd8ce6ec55a0ed79866cfa6"},
+    {file = "atomicwrites-1.4.0-py2.py3-none-any.whl", hash = "sha256:6d1784dea7c0c8d4a5172b6c620f40b6e4cbfdf96d783691f2e1302a7b88e197"},
+    {file = "atomicwrites-1.4.0.tar.gz", hash = "sha256:ae70396ad1a434f9c7046fd2dd196fc04b12f9e91ffb859164193be8b6168a7a"},
 ]
 attrs = [
     {file = "attrs-19.3.0-py2.py3-none-any.whl", hash = "sha256:08a96c641c3a74e44eb59afb61a24f2cb9f4d7188748e76ba4bb5edfa3cb7d1c"},
@@ -332,6 +344,7 @@ cycler = [
     {file = "cycler-0.10.0-py2.py3-none-any.whl", hash = "sha256:1d8a5ae1ff6c5cf9b93e8811e581232ad8920aeec647c37316ceac982b08cb2d"},
     {file = "cycler-0.10.0.tar.gz", hash = "sha256:cd7b2d1018258d7247a71425e9f26463dfb444d411c39569972f4ce586b0c9d8"},
 ]
+elog = []
 idna = [
     {file = "idna-2.9-py2.py3-none-any.whl", hash = "sha256:a068a21ceac8a4d63dbfd964670474107f541babbd2250d61922f029858365fa"},
     {file = "idna-2.9.tar.gz", hash = "sha256:7588d1c14ae4c77d74036e8c22ff447b26d0fde8f007354fd48a7814db15b7cb"},
@@ -379,27 +392,27 @@ more-itertools = [
     {file = "more_itertools-8.2.0-py3-none-any.whl", hash = "sha256:5dd8bcf33e5f9513ffa06d5ad33d78f31e1931ac9a18f33d37e77a180d393a7c"},
 ]
 numpy = [
-    {file = "numpy-1.18.3-cp35-cp35m-macosx_10_9_intel.whl", hash = "sha256:a6bc9432c2640b008d5f29bad737714eb3e14bb8854878eacf3d7955c4e91c36"},
-    {file = "numpy-1.18.3-cp35-cp35m-manylinux1_i686.whl", hash = "sha256:48e15612a8357393d176638c8f68a19273676877caea983f8baf188bad430379"},
-    {file = "numpy-1.18.3-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:eb2286249ebfe8fcb5b425e5ec77e4736d53ee56d3ad296f8947f67150f495e3"},
-    {file = "numpy-1.18.3-cp35-cp35m-win32.whl", hash = "sha256:1e37626bcb8895c4b3873fcfd54e9bfc5ffec8d0f525651d6985fcc5c6b6003c"},
-    {file = "numpy-1.18.3-cp35-cp35m-win_amd64.whl", hash = "sha256:163c78c04f47f26ca1b21068cea25ed7c5ecafe5f5ab2ea4895656a750582b56"},
-    {file = "numpy-1.18.3-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:3d9e1554cd9b5999070c467b18e5ae3ebd7369f02706a8850816f576a954295f"},
-    {file = "numpy-1.18.3-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:40c24960cd5cec55222963f255858a1c47c6fa50a65a5b03fd7de75e3700eaaa"},
-    {file = "numpy-1.18.3-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:a551d8cc267c634774830086da42e4ba157fa41dd3b93982bc9501b284b0c689"},
-    {file = "numpy-1.18.3-cp36-cp36m-win32.whl", hash = "sha256:0aa2b318cf81eb1693fcfcbb8007e95e231d7e1aa24288137f3b19905736c3ee"},
-    {file = "numpy-1.18.3-cp36-cp36m-win_amd64.whl", hash = "sha256:a41f303b3f9157a31ce7203e3ca757a0c40c96669e72d9b6ee1bce8507638970"},
-    {file = "numpy-1.18.3-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:e607b8cdc2ae5d5a63cd1bec30a15b5ed583ac6a39f04b7ba0f03fcfbf29c05b"},
-    {file = "numpy-1.18.3-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:fdee7540d12519865b423af411bd60ddb513d2eb2cd921149b732854995bbf8b"},
-    {file = "numpy-1.18.3-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:6725d2797c65598778409aba8cd67077bb089d5b7d3d87c2719b206dc84ec05e"},
-    {file = "numpy-1.18.3-cp37-cp37m-win32.whl", hash = "sha256:4847f0c993298b82fad809ea2916d857d0073dc17b0510fbbced663b3265929d"},
-    {file = "numpy-1.18.3-cp37-cp37m-win_amd64.whl", hash = "sha256:46f404314dbec78cb342904f9596f25f9b16e7cf304030f1339e553c8e77f51c"},
-    {file = "numpy-1.18.3-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:264fd15590b3f02a1fbc095e7e1f37cdac698ff3829e12ffdcffdce3772f9d44"},
-    {file = "numpy-1.18.3-cp38-cp38-manylinux1_i686.whl", hash = "sha256:e94a39d5c40fffe7696009dbd11bc14a349b377e03a384ed011e03d698787dd3"},
-    {file = "numpy-1.18.3-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:a4305564e93f5c4584f6758149fd446df39fd1e0a8c89ca0deb3cce56106a027"},
-    {file = "numpy-1.18.3-cp38-cp38-win32.whl", hash = "sha256:99f0ba97e369f02a21bb95faa3a0de55991fd5f0ece2e30a9e2eaebeac238921"},
-    {file = "numpy-1.18.3-cp38-cp38-win_amd64.whl", hash = "sha256:c60175d011a2e551a2f74c84e21e7c982489b96b6a5e4b030ecdeacf2914da68"},
-    {file = "numpy-1.18.3.zip", hash = "sha256:e46e2384209c91996d5ec16744234d1c906ab79a701ce1a26155c9ec890b8dc8"},
+    {file = "numpy-1.18.4-cp35-cp35m-macosx_10_9_intel.whl", hash = "sha256:efdba339fffb0e80fcc19524e4fdbda2e2b5772ea46720c44eaac28096d60720"},
+    {file = "numpy-1.18.4-cp35-cp35m-manylinux1_i686.whl", hash = "sha256:2b573fcf6f9863ce746e4ad00ac18a948978bb3781cffa4305134d31801f3e26"},
+    {file = "numpy-1.18.4-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:3f0dae97e1126f529ebb66f3c63514a0f72a177b90d56e4bce8a0b5def34627a"},
+    {file = "numpy-1.18.4-cp35-cp35m-win32.whl", hash = "sha256:dccd380d8e025c867ddcb2f84b439722cf1f23f3a319381eac45fd077dee7170"},
+    {file = "numpy-1.18.4-cp35-cp35m-win_amd64.whl", hash = "sha256:02ec9582808c4e48be4e93cd629c855e644882faf704bc2bd6bbf58c08a2a897"},
+    {file = "numpy-1.18.4-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:904b513ab8fbcbdb062bed1ce2f794ab20208a1b01ce9bd90776c6c7e7257032"},
+    {file = "numpy-1.18.4-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:e22cd0f72fc931d6abc69dc7764484ee20c6a60b0d0fee9ce0426029b1c1bdae"},
+    {file = "numpy-1.18.4-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:2466fbcf23711ebc5daa61d28ced319a6159b260a18839993d871096d66b93f7"},
+    {file = "numpy-1.18.4-cp36-cp36m-win32.whl", hash = "sha256:00d7b54c025601e28f468953d065b9b121ddca7fff30bed7be082d3656dd798d"},
+    {file = "numpy-1.18.4-cp36-cp36m-win_amd64.whl", hash = "sha256:7d59f21e43bbfd9a10953a7e26b35b6849d888fc5a331fa84a2d9c37bd9fe2a2"},
+    {file = "numpy-1.18.4-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:efb7ac5572c9a57159cf92c508aad9f856f1cb8e8302d7fdb99061dbe52d712c"},
+    {file = "numpy-1.18.4-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:0e6f72f7bb08f2f350ed4408bb7acdc0daba637e73bce9f5ea2b207039f3af88"},
+    {file = "numpy-1.18.4-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:9933b81fecbe935e6a7dc89cbd2b99fea1bf362f2790daf9422a7bb1dc3c3085"},
+    {file = "numpy-1.18.4-cp37-cp37m-win32.whl", hash = "sha256:96dd36f5cdde152fd6977d1bbc0f0561bccffecfde63cd397c8e6033eb66baba"},
+    {file = "numpy-1.18.4-cp37-cp37m-win_amd64.whl", hash = "sha256:57aea170fb23b1fd54fa537359d90d383d9bf5937ee54ae8045a723caa5e0961"},
+    {file = "numpy-1.18.4-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:ed722aefb0ebffd10b32e67f48e8ac4c5c4cf5d3a785024fdf0e9eb17529cd9d"},
+    {file = "numpy-1.18.4-cp38-cp38-manylinux1_i686.whl", hash = "sha256:50fb72bcbc2cf11e066579cb53c4ca8ac0227abb512b6cbc1faa02d1595a2a5d"},
+    {file = "numpy-1.18.4-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:709c2999b6bd36cdaf85cf888d8512da7433529f14a3689d6e37ab5242e7add5"},
+    {file = "numpy-1.18.4-cp38-cp38-win32.whl", hash = "sha256:f22273dd6a403ed870207b853a856ff6327d5cbce7a835dfa0645b3fc00273ec"},
+    {file = "numpy-1.18.4-cp38-cp38-win_amd64.whl", hash = "sha256:1be2e96314a66f5f1ce7764274327fd4fb9da58584eaff00b5a5221edefee7d6"},
+    {file = "numpy-1.18.4.zip", hash = "sha256:bbcc85aaf4cd84ba057decaead058f43191cc0e30d6bc5d44fe336dc3d3f4509"},
 ]
 packaging = [
     {file = "packaging-20.3-py2.py3-none-any.whl", hash = "sha256:82f77b9bee21c1bafbf35a84905d604d5d1223801d639cf3ed140bd651c08752"},
@@ -418,10 +431,11 @@ pyparsing = [
     {file = "pyparsing-2.4.7.tar.gz", hash = "sha256:c203ec8783bf771a155b207279b9bccb8dea02d8f0c9e5f8ead507bc3246ecc1"},
 ]
 pyqt5 = [
-    {file = "PyQt5-5.13.0-5.13.0-cp35.cp36.cp37.cp38-abi3-macosx_10_6_intel.whl", hash = "sha256:aa75b829cd977ca796262fcfe0dc8fc72f8413da4e5e2795e63897e1abfd2258"},
-    {file = "PyQt5-5.13.0-5.13.0-cp35.cp36.cp37.cp38-abi3-manylinux1_x86_64.whl", hash = "sha256:70954a2d182c8634e3b5f9deeb4230f186b59ec1166f3142cb523b74876c0d98"},
-    {file = "PyQt5-5.13.0-5.13.0-cp35.cp36.cp37.cp38-none-win32.whl", hash = "sha256:4d51a245d64fbd85c77ba3dee12b8fe018a440ccb49fd1cb0e4587c360655d3c"},
-    {file = "PyQt5-5.13.0-5.13.0-cp35.cp36.cp37.cp38-none-win_amd64.whl", hash = "sha256:afbee0925439124b5c52dacaf9a6d8d4e160e36b636a6f9023832a696e15e3e9"},
+    {file = "PyQt5-5.14.2-5.14.2-cp35.cp36.cp37.cp38-abi3-macosx_10_6_intel.whl", hash = "sha256:a9bdc46ab1f6397770e6b8dca84ac07a0250d26b1a31587f25619cf31a075532"},
+    {file = "PyQt5-5.14.2-5.14.2-cp35.cp36.cp37.cp38-abi3-manylinux2014_x86_64.whl", hash = "sha256:ee168a486c9a758511568147815e2959652cd0aabea832fa5e87cf6b241d2180"},
+    {file = "PyQt5-5.14.2-5.14.2-cp35.cp36.cp37.cp38-none-win32.whl", hash = "sha256:f61ddc78547d6ca763323ccd4a9e374c71b29feda1f5ce2d3e91e4f8d2cf1942"},
+    {file = "PyQt5-5.14.2-5.14.2-cp35.cp36.cp37.cp38-none-win_amd64.whl", hash = "sha256:3b91dd1d0cbfaea85ad057247ba621187e511434b0c9d6d40de69fd5e833b109"},
+    {file = "PyQt5-5.14.2.tar.gz", hash = "sha256:bd230c6fd699eabf1ceb51e13a8b79b74c00a80272c622427b80141a22269eb0"},
 ]
 pyqt5-sip = [
     {file = "PyQt5_sip-12.7.2-cp35-cp35m-macosx_10_6_intel.whl", hash = "sha256:df4f5cdb86f47df5f6fc35be29cc45df7b5a2c171d07dbf377d558b226554ea3"},
diff --git a/pyproject.toml b/pyproject.toml
index 416c1d1..6ad3a17 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,9 +1,9 @@
 [tool.poetry]
 name = "libhreels"
-version = "1.0.5"
+version = "1.0.6"
 description = "Handling, simulating, and plotting HREELS and Auger spectroscopy data"
 authors = ["Wolf Widdra <wolf.widdra@physik.uni-halle.de>"]
-include = ["*.*"]
+include = ["*./libhreels/*"]
 exclude = ["./libhreels/eLog*"]
 readme = "README.md"
 homepage = "https://gitlab.informatik.uni-halle.de/e3fm8/libhreels"
@@ -18,6 +18,7 @@ requests = "^2.23.0"
 argparse = "^1.4.0"
 PyQt5 = "^5.13"
 numpy = "^1.18.2"
+elog = {url = "https://github.com/paulscherrerinstitute/py_elog/archive/master.zip"}
 
 [tool.poetry.dev-dependencies]
 pytest = "^5.2"
-- 
GitLab