Bladeren bron

prejmenovani

Honza 5 jaren geleden
bovenliggende
commit
2fcbf19d1f
100 gewijzigde bestanden met toevoegingen van 9183 en 51 verwijderingen
  1. 1 1
      QGIS_Installer.sln
  2. 6 12
      QGIS_Installer/Form1.Designer.cs
  3. 9 9
      QGIS_Installer/Form1.cs
  4. 84 0
      QGIS_Installer/Layman_QGIS_Installer.csproj
  5. BIN
      QGIS_Installer/bin/Debug.zip
  6. BIN
      QGIS_Installer/bin/Debug/QGIS_Installer.exe
  7. BIN
      QGIS_Installer/bin/Debug/QGIS_Installer.pdb
  8. BIN
      QGIS_Installer/bin/Debug/atlas.zip
  9. 2499 0
      QGIS_Installer/bin/Debug/atlas/Layman.py
  10. 50 0
      QGIS_Installer/bin/Debug/atlas/Layman_dockwidget.py
  11. 51 0
      QGIS_Installer/bin/Debug/atlas/Layman_dockwidget_base.ui
  12. 5 5
      QGIS_Installer/bin/Debug/atlas/__init__.py
  13. BIN
      QGIS_Installer/bin/Debug/atlas/__pycache__/Atlas.cpython-37.pyc
  14. BIN
      QGIS_Installer/bin/Debug/atlas/__pycache__/Layman.cpython-37.pyc
  15. BIN
      QGIS_Installer/bin/Debug/atlas/__pycache__/Layman_dockwidget.cpython-37.pyc
  16. BIN
      QGIS_Installer/bin/Debug/atlas/__pycache__/__init__.cpython-37.pyc
  17. 38 21
      QGIS_Installer/bin/Debug/atlas/dlg_importMap.ui
  18. 3 3
      QGIS_Installer/bin/Debug/atlas/metadata.txt
  19. BIN
      QGIS_Installer/bin/Debug/layman.zip
  20. 2499 0
      QGIS_Installer/bin/Debug/layman/Layman.py
  21. 50 0
      QGIS_Installer/bin/Debug/layman/Layman_dockwidget.py
  22. 51 0
      QGIS_Installer/bin/Debug/layman/Layman_dockwidget_base.ui
  23. 244 0
      QGIS_Installer/bin/Debug/layman/Makefile
  24. 42 0
      QGIS_Installer/bin/Debug/layman/README.html
  25. 32 0
      QGIS_Installer/bin/Debug/layman/README.md
  26. 32 0
      QGIS_Installer/bin/Debug/layman/README.txt
  27. 36 0
      QGIS_Installer/bin/Debug/layman/__init__.py
  28. BIN
      QGIS_Installer/bin/Debug/layman/__pycache__/Atlas.cpython-37.pyc
  29. BIN
      QGIS_Installer/bin/Debug/layman/__pycache__/Atlas_dockwidget.cpython-37.pyc
  30. BIN
      QGIS_Installer/bin/Debug/layman/__pycache__/Layman.cpython-37.pyc
  31. BIN
      QGIS_Installer/bin/Debug/layman/__pycache__/Layman_dockwidget.cpython-37.pyc
  32. BIN
      QGIS_Installer/bin/Debug/layman/__pycache__/__init__.cpython-37.pyc
  33. BIN
      QGIS_Installer/bin/Debug/layman/__pycache__/dlg_ConnectionManager.cpython-37.pyc
  34. BIN
      QGIS_Installer/bin/Debug/layman/__pycache__/dlg_GetLayers.cpython-37.pyc
  35. BIN
      QGIS_Installer/bin/Debug/layman/__pycache__/dlg_addLayer.cpython-37.pyc
  36. BIN
      QGIS_Installer/bin/Debug/layman/__pycache__/dlg_addMap.cpython-37.pyc
  37. BIN
      QGIS_Installer/bin/Debug/layman/__pycache__/dlg_createComposite.cpython-37.pyc
  38. BIN
      QGIS_Installer/bin/Debug/layman/__pycache__/dlg_deleteLayerFromMap.cpython-37.pyc
  39. BIN
      QGIS_Installer/bin/Debug/layman/__pycache__/dlg_deleteMap.cpython-37.pyc
  40. BIN
      QGIS_Installer/bin/Debug/layman/__pycache__/dlg_editMap.cpython-37.pyc
  41. BIN
      QGIS_Installer/bin/Debug/layman/__pycache__/dlg_importLayer.cpython-37.pyc
  42. BIN
      QGIS_Installer/bin/Debug/layman/__pycache__/dlg_importMap.cpython-37.pyc
  43. BIN
      QGIS_Installer/bin/Debug/layman/__pycache__/dlg_userInfo.cpython-37.pyc
  44. BIN
      QGIS_Installer/bin/Debug/layman/__pycache__/flaskServer.cpython-37.pyc
  45. BIN
      QGIS_Installer/bin/Debug/layman/__pycache__/flaskServer2.cpython-37.pyc
  46. BIN
      QGIS_Installer/bin/Debug/layman/__pycache__/ogr2ogr.cpython-37.pyc
  47. BIN
      QGIS_Installer/bin/Debug/layman/__pycache__/resources.cpython-37.pyc
  48. 44 0
      QGIS_Installer/bin/Debug/layman/dlg_ConnectionManager.py
  49. 208 0
      QGIS_Installer/bin/Debug/layman/dlg_ConnectionManager.ui
  50. 44 0
      QGIS_Installer/bin/Debug/layman/dlg_GetLayers.py
  51. 94 0
      QGIS_Installer/bin/Debug/layman/dlg_GetLayers.ui
  52. 44 0
      QGIS_Installer/bin/Debug/layman/dlg_addLayer.py
  53. 149 0
      QGIS_Installer/bin/Debug/layman/dlg_addLayer.ui
  54. 44 0
      QGIS_Installer/bin/Debug/layman/dlg_addMap.py
  55. 136 0
      QGIS_Installer/bin/Debug/layman/dlg_addMap.ui
  56. 44 0
      QGIS_Installer/bin/Debug/layman/dlg_createComposite.py
  57. 306 0
      QGIS_Installer/bin/Debug/layman/dlg_createComposite.ui
  58. 44 0
      QGIS_Installer/bin/Debug/layman/dlg_deleteLayerFromMap.py
  59. 120 0
      QGIS_Installer/bin/Debug/layman/dlg_deleteLayerFromMap.ui
  60. 44 0
      QGIS_Installer/bin/Debug/layman/dlg_deleteMap.py
  61. 60 0
      QGIS_Installer/bin/Debug/layman/dlg_deleteMap.ui
  62. 44 0
      QGIS_Installer/bin/Debug/layman/dlg_editMap.py
  63. 335 0
      QGIS_Installer/bin/Debug/layman/dlg_editMap.ui
  64. 44 0
      QGIS_Installer/bin/Debug/layman/dlg_importLayer.py
  65. 102 0
      QGIS_Installer/bin/Debug/layman/dlg_importLayer.ui
  66. 44 0
      QGIS_Installer/bin/Debug/layman/dlg_importMap (2).py
  67. 55 0
      QGIS_Installer/bin/Debug/layman/dlg_importMap (2).ui
  68. 44 0
      QGIS_Installer/bin/Debug/layman/dlg_importMap.py
  69. 430 0
      QGIS_Installer/bin/Debug/layman/dlg_importMap.ui
  70. 44 0
      QGIS_Installer/bin/Debug/layman/dlg_userInfo.py
  71. 87 0
      QGIS_Installer/bin/Debug/layman/dlg_userInfo.ui
  72. 47 0
      QGIS_Installer/bin/Debug/layman/flask/flask.py
  73. 94 0
      QGIS_Installer/bin/Debug/layman/flaskServer.py
  74. 72 0
      QGIS_Installer/bin/Debug/layman/flaskServer2.py
  75. BIN
      QGIS_Installer/bin/Debug/layman/flask_listener/__pycache__/flask.cpython-37.pyc
  76. 36 0
      QGIS_Installer/bin/Debug/layman/flask_listener/flask_listener.py
  77. 47 0
      QGIS_Installer/bin/Debug/layman/flask_listener/flask_test.py
  78. 130 0
      QGIS_Installer/bin/Debug/layman/help/Makefile
  79. 155 0
      QGIS_Installer/bin/Debug/layman/help/make.bat
  80. 216 0
      QGIS_Installer/bin/Debug/layman/help/source/conf.py
  81. 20 0
      QGIS_Installer/bin/Debug/layman/help/source/index.rst
  82. 11 0
      QGIS_Installer/bin/Debug/layman/i18n/af.ts
  83. BIN
      QGIS_Installer/bin/Debug/layman/icon.png
  84. 13 0
      QGIS_Installer/bin/Debug/layman/icons/account.svg
  85. BIN
      QGIS_Installer/bin/Debug/layman/icons/cloud.png
  86. BIN
      QGIS_Installer/bin/Debug/layman/icons/delete.png
  87. BIN
      QGIS_Installer/bin/Debug/layman/icons/download_map.png
  88. BIN
      QGIS_Installer/bin/Debug/layman/icons/edit.png
  89. BIN
      QGIS_Installer/bin/Debug/layman/icons/file.png
  90. BIN
      QGIS_Installer/bin/Debug/layman/icons/globus.png
  91. BIN
      QGIS_Installer/bin/Debug/layman/icons/layers-down.png
  92. BIN
      QGIS_Installer/bin/Debug/layman/icons/layers-up.png
  93. BIN
      QGIS_Installer/bin/Debug/layman/icons/layers.png
  94. BIN
      QGIS_Installer/bin/Debug/layman/icons/load.png
  95. BIN
      QGIS_Installer/bin/Debug/layman/icons/login.png
  96. BIN
      QGIS_Installer/bin/Debug/layman/icons/map_download.png
  97. BIN
      QGIS_Installer/bin/Debug/layman/icons/map_upload.png
  98. BIN
      QGIS_Installer/bin/Debug/layman/icons/minus.png
  99. BIN
      QGIS_Installer/bin/Debug/layman/icons/plus.png
  100. BIN
      QGIS_Installer/bin/Debug/layman/icons/save.png

+ 1 - 1
QGIS_Installer.sln

@@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
 # Visual Studio Version 16
 VisualStudioVersion = 16.0.29613.14
 MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QGIS_Installer", "QGIS_Installer\QGIS_Installer.csproj", "{257E8CB8-125D-4FD6-96C8-197A00754A1B}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Layman_QGIS_Installer", "QGIS_Installer\Layman_QGIS_Installer.csproj", "{257E8CB8-125D-4FD6-96C8-197A00754A1B}"
 EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution

+ 6 - 12
QGIS_Installer/Form1.Designer.cs

@@ -77,45 +77,40 @@
             this.label2.AutoSize = true;
             this.label2.Location = new System.Drawing.Point(669, 133);
             this.label2.Name = "label2";
-            this.label2.Size = new System.Drawing.Size(46, 17);
+            this.label2.Size = new System.Drawing.Size(0, 17);
             this.label2.TabIndex = 4;
-            this.label2.Text = "label2";
             // 
             // label3
             // 
             this.label3.AutoSize = true;
             this.label3.Location = new System.Drawing.Point(669, 169);
             this.label3.Name = "label3";
-            this.label3.Size = new System.Drawing.Size(46, 17);
+            this.label3.Size = new System.Drawing.Size(0, 17);
             this.label3.TabIndex = 5;
-            this.label3.Text = "label3";
             // 
             // label4
             // 
             this.label4.AutoSize = true;
             this.label4.Location = new System.Drawing.Point(669, 206);
             this.label4.Name = "label4";
-            this.label4.Size = new System.Drawing.Size(46, 17);
+            this.label4.Size = new System.Drawing.Size(0, 17);
             this.label4.TabIndex = 6;
-            this.label4.Text = "label4";
             // 
             // label5
             // 
             this.label5.AutoSize = true;
             this.label5.Location = new System.Drawing.Point(669, 241);
             this.label5.Name = "label5";
-            this.label5.Size = new System.Drawing.Size(46, 17);
+            this.label5.Size = new System.Drawing.Size(0, 17);
             this.label5.TabIndex = 7;
-            this.label5.Text = "label5";
             // 
             // label6
             // 
             this.label6.AutoSize = true;
             this.label6.Location = new System.Drawing.Point(669, 278);
             this.label6.Name = "label6";
-            this.label6.Size = new System.Drawing.Size(46, 17);
+            this.label6.Size = new System.Drawing.Size(0, 17);
             this.label6.TabIndex = 8;
-            this.label6.Text = "label6";
             // 
             // label7
             // 
@@ -192,9 +187,8 @@
             this.label13.ForeColor = System.Drawing.Color.Green;
             this.label13.Location = new System.Drawing.Point(94, 171);
             this.label13.Name = "label13";
-            this.label13.Size = new System.Drawing.Size(22, 18);
+            this.label13.Size = new System.Drawing.Size(0, 18);
             this.label13.TabIndex = 17;
-            this.label13.Text = "xx";
             // 
             // comboBox1
             // 

+ 9 - 9
QGIS_Installer/Form1.cs

@@ -88,16 +88,16 @@ namespace QGIS_Installer
                 string input = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "\\packages";
                 copyFiles(input, out1.ToString());
                 string input2 = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "\\flask.exe";
-                try
-                {
-                    File.Copy(input2, out2);
-                }
-                catch (Exception ex)
-                {
-                    label1.ForeColor = System.Drawing.Color.Red;
+            try
+            {
+                File.Copy(input2, out2);
+            }
+            catch (Exception ex)
+            {
+                label1.ForeColor = System.Drawing.Color.Red;
                     label1.Text = "You must run program as administrator!";
-                }
-                if (isPluginInstalled(o))
+            }
+            if (isPluginInstalled(o))
                     {
                   
                        

+ 84 - 0
QGIS_Installer/Layman_QGIS_Installer.csproj

@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{257E8CB8-125D-4FD6-96C8-197A00754A1B}</ProjectGuid>
+    <OutputType>WinExe</OutputType>
+    <RootNamespace>QGIS_Installer</RootNamespace>
+    <AssemblyName>QGIS_Installer</AssemblyName>
+    <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
+    <Deterministic>true</Deterministic>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.IO.Compression.FileSystem" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Deployment" />
+    <Reference Include="System.Drawing" />
+    <Reference Include="System.Net.Http" />
+    <Reference Include="System.Windows.Forms" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Form1.cs">
+      <SubType>Form</SubType>
+    </Compile>
+    <Compile Include="Form1.Designer.cs">
+      <DependentUpon>Form1.cs</DependentUpon>
+    </Compile>
+    <Compile Include="Program.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+    <EmbeddedResource Include="Form1.resx">
+      <DependentUpon>Form1.cs</DependentUpon>
+    </EmbeddedResource>
+    <EmbeddedResource Include="Properties\Resources.resx">
+      <Generator>ResXFileCodeGenerator</Generator>
+      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
+      <SubType>Designer</SubType>
+    </EmbeddedResource>
+    <Compile Include="Properties\Resources.Designer.cs">
+      <AutoGen>True</AutoGen>
+      <DependentUpon>Resources.resx</DependentUpon>
+    </Compile>
+    <None Include="Properties\Settings.settings">
+      <Generator>SettingsSingleFileGenerator</Generator>
+      <LastGenOutput>Settings.Designer.cs</LastGenOutput>
+    </None>
+    <Compile Include="Properties\Settings.Designer.cs">
+      <AutoGen>True</AutoGen>
+      <DependentUpon>Settings.settings</DependentUpon>
+      <DesignTimeSharedInput>True</DesignTimeSharedInput>
+    </Compile>
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="App.config" />
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+</Project>

BIN
QGIS_Installer/bin/Debug.zip


BIN
QGIS_Installer/bin/Debug/QGIS_Installer.exe


BIN
QGIS_Installer/bin/Debug/QGIS_Installer.pdb


BIN
QGIS_Installer/bin/Debug/atlas.zip


+ 2499 - 0
QGIS_Installer/bin/Debug/atlas/Layman.py

@@ -0,0 +1,2499 @@
+ # -*- coding: utf-8 -*-
+"""
+/***************************************************************************
+ Layman
+                                 A QGIS plugin
+ Layman
+ Generated by Plugin Builder: http://g-sherman.github.io/Qgis-Plugin-Builder/
+                              -------------------
+        begin                : 2019-02-15
+        git sha              : $Format:%H$
+        copyright            : (C) 2019 by jan vrobel
+        email                : vrobel.jan@seznam.cz
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ ***************************************************************************/
+"""
+from PyQt5.QtCore import QSettings, QTranslator, qVersion, QCoreApplication, Qt, QFileSystemWatcher, QRegExp,QDir
+from PyQt5.QtGui import QIcon, QPixmap, QRegExpValidator, QDoubleValidator
+from PyQt5.QtWidgets import QAction, QTreeWidget, QTreeWidgetItem, QMessageBox, QLabel, QProgressDialog, QDialog, QProgressBar,QListWidgetItem
+# Initialize Qt resources from file resources.py
+from .resources import *
+import re
+#from .flaskServer import *
+from multiprocessing import Process
+from pathlib import Path 
+# Import the code for the DockWidget
+from builtins import str
+from builtins import range
+from builtins import object
+import json
+import zipfile
+import tempfile
+import configparser
+import shutil
+import uuid
+import copy
+import webbrowser
+from .Layman_dockwidget import LaymanDockWidget
+import os.path
+import tempfile
+import qgis.core
+from qgis.core import *
+import platform
+import os
+import qgis.utils
+import qgis.gui
+from qgis.gui import QgsMapCanvas
+from qgis.core import QgsApplication
+from qgis.utils import iface
+from PyQt5.QtWidgets import QApplication, QWidget, QPushButton, QMessageBox, QWidget, QInputDialog, QLineEdit, QFileDialog
+import requests
+import tempfile
+import time
+from urllib.request import urlopen
+import subprocess
+import threading
+#from flask import Flask, request, jsonify
+import base64
+import hashlib
+import html
+import re
+import urllib.parse
+from .ogr2ogr import main
+## forms
+from .dlg_GetLayers import GetLayersDialog
+from .dlg_importMap import ImportMapDialog
+from .dlg_deleteMap import DeleteMapDialog
+from .dlg_importLayer import ImportLayerDialog
+from .dlg_addLayer import AddLayerDialog
+from .dlg_addMap import AddMapDialog
+from .dlg_createComposite import CreateCompositeDialog
+from .dlg_deleteLayerFromMap import DeleteLayerFromMapDialog
+from .dlg_editMap import EditMapDialog
+from .dlg_ConnectionManager import ConnectionManagerDialog
+from .dlg_userInfo import UserInfoDialog
+
+
+
+class Layman:
+    """QGIS Plugin Implementation."""
+
+    def __init__(self, iface):
+        """Constructor.
+        
+        :param iface: An interface instance that will be passed to this class
+            which provides the hook by which you can manipulate the QGIS
+            application at run time.
+        :type iface: QgsInterface
+        """
+        # Save reference to the QGIS interface
+        self.iface = iface
+
+        # initialize plugin directory
+        self.plugin_dir = os.path.dirname(__file__) 
+        
+        ## init global variables
+      #  global filename 
+        self.client_id = None
+        self.filename = None
+        self.layerName = None
+        self.username = 'browser'
+        self.EPSG = 'EPSG:3857'
+        self.composite = None
+        self.thread1 = None
+        self.compositeList = []
+        self.compositeListOld = []
+        self.CHUNK_SIZE = 1048576 ## s touto hodnotou pracuje layman klient (cca 1MB soubor)
+        self.URI = "http://layman.lesprojekt.cz"
+        self.access_token = None
+        self.expires_in = None
+        self.refresh_token = None
+        self.laymanUsername = ""
+        self.authHeader = None
+        self.code_verifier = None
+        self.code_challenge = None
+        self.Agrimail = None
+        self.loadedInMemory = False
+        self.liferayServer = None
+        self.laymanServer = None
+        self.mapsChanged = set()
+        self.uri = 'http://layman.lesprojekt.cz/rest/'
+        self.iface.layerTreeView().currentLayerChanged.connect(lambda: self.layerChanged())
+        
+        
+     #   global dlgGetLayers 
+        self.dlgGetLayers= GetLayersDialog()
+        # initialize locale
+        locale = QSettings().value('locale/userLocale')[0:2]
+        locale_path = os.path.join(
+            self.plugin_dir,
+            'i18n',
+            'Layman_{}.qm'.format(locale))
+
+        if os.path.exists(locale_path):
+            self.translator = QTranslator()
+            self.translator.load(locale_path)
+
+            if qVersion() > '4.3.3':
+                QCoreApplication.installTranslator(self.translator)
+
+        # Declare instance attributes
+        self.actions = []
+        self.menu = self.tr(u'&Layman')
+        # TODO: We are going to let the user set this up in a future iteration
+        self.toolbar = self.iface.addToolBar(u'Layman')
+        self.toolbar.setObjectName(u'Layman')
+
+        #print "** INITIALIZING Atlas"
+
+        self.pluginIsActive = False
+        self.dockwidget = None
+        ## prepare temp dir
+        tempDir = tempfile.gettempdir() + os.sep + "atlas" 
+        try:
+            os.mkdir(tempDir)
+            print("Directory " , tempDir ,  " Created ") 
+        except FileExistsError:
+            print("Directory " , tempDir ,  " already exists")
+
+
+    # noinspection PyMethodMayBeStatic
+    def tr(self, message):
+        """Get the translation for a string using Qt translation API.
+
+        We implement this ourselves since we do not inherit QObject.
+
+        :param message: String for translation.
+        :type message: str, QString
+
+        :returns: Translated version of message.
+        :rtype: QString
+        """
+        # noinspection PyTypeChecker,PyArgumentList,PyCallByClass
+        return QCoreApplication.translate('Layman', message)
+
+
+    def add_action(
+        self,
+        icon_path,
+        text,
+        callback,
+        enabled_flag=True,
+        add_to_menu=True,
+        add_to_toolbar=True,
+        status_tip=None,
+        whats_this=None,
+        parent=None):
+        
+
+        icon = QIcon(icon_path)
+        action = QAction(icon, text, parent)
+        action.triggered.connect(callback)
+        action.setEnabled(enabled_flag)
+
+        if status_tip is not None:
+            action.setStatusTip(status_tip)
+
+        if whats_this is not None:
+            action.setWhatsThis(whats_this)
+
+        if add_to_toolbar:
+            self.toolbar.addAction(action)
+
+        if add_to_menu:
+            self.iface.addPluginToMenu(
+                self.menu,
+                action)
+
+        self.actions.append(action)
+
+        return action
+
+
+    def initGui(self):
+        """Create the menu entries and toolbar icons inside the QGIS GUI."""
+
+        #icon_path = ':/plugins/Atlas/icon.png'
+        #self.add_action(
+        #    icon_path,
+        #    text=self.tr(u''),
+        #    callback=self.run,
+        #    parent=self.iface.mainWindow())
+        #self.first_start = True
+
+        ################## user
+        self.textbox = QLabel(self.iface.mainWindow())
+        # Set width
+        self.textbox.setFixedWidth(140)
+        # Add textbox to toolbar
+        self.txtAction = self.toolbar.addWidget(self.textbox)
+        # Set tooltip
+        self.txtAction.setToolTip(self.tr(u'Current Row Number'))
+        # Set callback
+        self.textbox.setText("Layman")
+
+        ################ end usericon_path = self.plugin_dir + os.sep + 'icons' + os.sep + 'login.png'
+        icon_path = self.plugin_dir + os.sep + 'icons' + os.sep + 'login.png'
+        self.menu_Connection = self.add_action(
+            icon_path,
+            text=self.tr(u'Login'),
+            callback=self.run_login,
+            enabled_flag=True,
+            parent=self.iface.mainWindow())
+
+
+        icon_path = self.plugin_dir + os.sep + 'icons' + os.sep + 'save.png'
+        self.menu_saveLocalFile = self.add_action(
+            icon_path,
+            text=self.tr(u'Save as to JSON and SLD'),
+            callback=self.saveLocalFile,
+            enabled_flag=False,
+            parent=self.iface.mainWindow())
+
+        self.first_start = True
+        icon_path = self.plugin_dir + os.sep + 'icons' + os.sep + 'file.png'
+        self.menu_loadJson = self.add_action(
+            icon_path,
+            text=self.tr(u'Load from JSON'),
+            callback=self.loadLocalFile,
+            enabled_flag=False,
+            parent=self.iface.mainWindow())
+        self.first_start = True
+
+        icon_path = self.plugin_dir + os.sep + 'icons' + os.sep + 'layers-up.png'
+        self.menu_ImportLayerDialog = self.add_action(
+            icon_path,
+            text=self.tr(u'Export layer to server'),
+            callback=self.run_ImportLayerDialog,
+            enabled_flag=False,
+            parent=self.iface.mainWindow())  
+        icon_path = self.plugin_dir + os.sep + 'icons' + os.sep + 'layers-down.png'
+        self.menu_AddLayerDialog = self.add_action(
+            icon_path,
+            text=self.tr(u'Load layer from server'),
+            callback=self.run_AddLayerDialog,
+            enabled_flag=False,
+            parent=self.iface.mainWindow()) 
+        icon_path = self.plugin_dir + os.sep + 'icons' + os.sep + 'upload-map.png'
+        self.menu_ImportMapDialog = self.add_action(
+            icon_path,
+            text=self.tr(u'Manage maps'),
+            callback=self.run_ImportMapDialog,
+            enabled_flag=False,
+            parent=self.iface.mainWindow())  
+        icon_path = self.plugin_dir + os.sep + 'icons' + os.sep + 'download_map.png'
+        self.menu_AddMapDialog = self.add_action(
+            icon_path,
+            text=self.tr(u'Load map from server'),
+            callback=self.run_AddMapDialog,
+            enabled_flag=False,
+            parent=self.iface.mainWindow())   
+        
+        #icon_path = self.plugin_dir + os.sep + 'icons' + os.sep + 'delete.png'
+        #self.menu_DeleteMapDialog = self.add_action(
+        #    icon_path,
+        #    text=self.tr(u'Delete map'),
+        #    callback=self.run_DeleteMapDialog,
+        #    enabled_flag=False,
+        #    parent=self.iface.mainWindow())  
+        #icon_path = self.plugin_dir + os.sep + 'icons' + os.sep + 'globus.png'
+        #self.menu_CreateCompositeDialog = self.add_action(
+        #    icon_path,
+        #    text=self.tr(u'Create map'),
+        #    callback=self.run_CreateCompositeDialog,
+        #    enabled_flag=False,
+        #    parent=self.iface.mainWindow())
+        icon_path = self.plugin_dir + os.sep + 'icons' + os.sep + 'account.svg'
+        self.menu_UserInfoDialog = self.add_action(
+            icon_path,
+            text=self.tr(u'User info'),
+            callback=self.run_UserInfoDialog,
+            enabled_flag=False,
+            parent=self.iface.mainWindow())
+    #--------------------------------------------------------------------------
+    def run_UserInfoDialog(self):
+        self.dlg = UserInfoDialog() 
+        self.dlg.show()
+        self.dlg.pushButton_logout.setStyleSheet("#pushButton_logout {color: #fff !important;text-transform: uppercase;  text-decoration: none;   background: #72c02c;   padding: 20px;  border-radius: 50px;    display: inline-block; border: none;transition: all 0.4s ease 0s;} #pushButton_logout:hover{background: #66ab27 ;}")
+        self.dlg.setStyleSheet("#DialogBase {background: #f0f0f0 ;}")
+        userEndpoint = "http://layman.lesprojekt.cz/rest/current-user"
+        r = requests.get(url = userEndpoint,  headers = self.authHeader)
+        res = r.text
+        res = self.fromByteToJson(r.content)
+        self.dlg.pushButton_logout.clicked.connect(lambda: self.logout())
+        print(res['claims'])
+        self.dlg.label_layman.setText(res['claims']['preferred_username'])
+        self.dlg.label_agrihub.setText(res['claims']['email'])
+        self.dlg.setStyleSheet("#DialogBase {background: #f0f0f0 ;}")
+
+    def run_EditMap(self, x):
+        self.dlg = EditMapDialog()      
+        self.dlg.pushButton_save.setStyleSheet("#pushButton_save {color: #fff !important;text-transform: uppercase;  text-decoration: none;   background: #72c02c;   padding: 20px;  border-radius: 50px;    display: inline-block; border: none;transition: all 0.4s ease 0s;} #pushButton_save:hover{background: #66ab27 ;}#pushButton_save:disabled{background: #64818b ;}")
+        self.dlg.pushButton_close.setStyleSheet("#pushButton_close {color: #fff !important;text-transform: uppercase;  text-decoration: none;   background: #72c02c;   padding: 20px;  border-radius: 50px;    display: inline-block; border: none;transition: all 0.4s ease 0s;} #pushButton_close:hover{background: #66ab27 ;}")
+        self.dlg.setStyleSheet("#DialogBase {background: #f0f0f0 ;}")
+        
+       
+        self.dlg.lineEdit_name.hide()
+        self.dlg.label_2.hide()
+        self.dlg.pushButton_close.clicked.connect(lambda: self.dlg.close())
+        self.dlg.lineEdit_name.setText(self.compositeList[x]['name'])
+        self.dlg.lineEdit_abstract.setText(self.compositeList[x]['abstract'])
+        self.dlg.lineEdit_title.setText(self.compositeList[x]['title'])
+        self.dlg.lineEdit_units.setText(self.compositeList[x]['units'])
+        self.dlg.lineEdit_scale.setText(str(self.compositeList[x]['scale']))
+        self.dlg.lineEdit_user.setText(self.compositeList[x]['user']['name'])
+        self.dlg.lineEdit_xmin.setText(self.compositeList[x]['extent'][0])
+        self.dlg.lineEdit_xmax.setText(self.compositeList[x]['extent'][2])
+        self.dlg.lineEdit_ymin.setText(self.compositeList[x]['extent'][1])
+        self.dlg.lineEdit_ymax.setText(self.compositeList[x]['extent'][3])
+        self.dlg.rejected.connect(lambda: self.afterCloseEditMapDialog()) 
+        self.dlg.pushButton_save.clicked.connect(lambda: self.modifyMap(x))
+        self.dlg.rejected.connect(lambda: self.afterCloseCompositeDialog())
+        self.dlg.show()
+        result = self.dlg.exec_()
+
+    def run_DeleteLayerFromMap(self):
+        self.dlg = DeleteLayerFromMapDialog()
+        self.dlg.pushButton.clicked.connect(lambda: self.deteteLayerFromComposite(self.dlg.listWidget.currentRow(),self.compositeList[self.dlg.listWidget.currentRow()]['layers'][self.dlg.listWidget_listLayers2.currentRow()]['params']['LAYERS']))
+        #self.dlg.pushButton.clicked.connect(lambda: print(self.dlg.listWidget_2.currentRow()))
+       
+        layers = QgsProject.instance().mapLayers().values()
+        
+        for i in range (0, len(self.compositeList)):
+            self.dlg.listWidget.addItem(self.compositeList[i]['name'])
+       # self.dlg.pushButton.setEnabled(False)
+        self.dlg.listWidget.itemClicked.connect(self.listCompositeLayers)
+        self.dlg.listWidget_listLayers2.itemClicked.connect(self.showThumbnail)   
+        
+
+       # self.dlg.listWidget_listMaps.itemClicked.connect(self.enableButton)    
+        self.dlg.show()
+        self.dlg.pushButton_close.clicked.connect(lambda: self.dlg.close())
+        result = self.dlg.exec_()
+
+    def run_CreateCompositeDialog(self, fromImport = False):
+        self.dlg = CreateCompositeDialog()
+        self.dlg.label_info.hide()
+        self.dlg.label_2.hide()
+        self.dlg.lineEdit.hide()
+        self.dlg.pushButton_CreateComposition.clicked.connect(lambda: self.createComposite(self.dlg.lineEdit.text(),self.dlg.lineEdit_2.text()))              
+        layers = QgsProject.instance().mapLayers().values()
+        self.dlg.treeWidget.itemClicked.connect(self.setExtent)
+        for layer in layers:
+           # self.dlg.listWidget_listLayers.addItem(layer.name())
+            if (layer.type() == QgsMapLayer.VectorLayer):
+                item = QTreeWidgetItem([layer.name()]) 
+            
+                    
+                self.dlg.treeWidget.addTopLevelItem(item)
+        ext = iface.mapCanvas().extent()
+        self.dlg.lineEdit.setValidator(QRegExpValidator(QRegExp("[a-z]{1}[a-z0-9]{1,30}")))      
+        self.dlg.lineEdit_2.editingFinished.connect(self.checkNameCreateMap)
+        self.dlg.lineEdit_3.setText(str(ext.xMinimum()))
+        self.dlg.lineEdit_4.setText(str(ext.xMaximum()))
+        self.dlg.lineEdit_5.setText(str(ext.yMinimum()))
+        self.dlg.lineEdit_6.setText(str(ext.yMaximum()))
+        self.dlg.pushButton_defaultExtent.clicked.connect(lambda: self.setDefaultExtent(ext))              
+        self.dlg.pushButton_defaultExtent.setStyleSheet("#pushButton_defaultExtent {color: #fff !important;text-transform: uppercase;  text-decoration: none;   background: #72c02c;   padding: 20px;  border-radius: 50px;    display: inline-block; border: none;transition: all 0.4s ease 0s;} #pushButton_defaultExtent:hover{background: #66ab27 ;}#pushButton_defaultExtent:disabled{background: #64818b ;}")
+        self.dlg.pushButton_CreateComposition.setStyleSheet("#pushButton_CreateComposition {color: #fff !important;text-transform: uppercase;  text-decoration: none;   background: #72c02c;   padding: 20px;  border-radius: 50px;    display: inline-block; border: none;transition: all 0.4s ease 0s;} #pushButton_CreateComposition:hover{background: #66ab27 ;}#pushButton_CreateComposition:disabled{background: #64818b ;}")
+        self.dlg.pushButton_close.setStyleSheet("#pushButton_close {color: #fff !important;text-transform: uppercase;  text-decoration: none;   background: #72c02c;   padding: 20px;  border-radius: 50px;    display: inline-block; border: none;transition: all 0.4s ease 0s;} #pushButton_close:hover{background: #66ab27 ;}")
+        
+        self.dlg.setStyleSheet("#DialogBase {background: #f0f0f0 ;}")
+
+        self.dlg.show()
+        self.dlg.pushButton_close.clicked.connect(lambda: self.dlg.close())
+        if (fromImport):
+            self.dlg.rejected.connect(lambda: self.afterCloseCompositeDialog())
+        result = self.dlg.exec_()
+
+
+    def run_ImportMapDialog(self):
+        self.dlg = ImportMapDialog()
+        self.dlg.label_import.hide()
+        #self.dlg.listWidget_listLayers2.hide()
+        self.dlg.pushButton_deleteMap.setEnabled(False)
+        self.dlg.pushButton_editMeta.setEnabled(False)
+        self.dlg.pushButton_addRaster.setEnabled(False)
+        self.dlg.mMapLayerComboBox.setFilters(QgsMapLayerProxyModel.VectorLayer)
+        self.dlg.pushButton.clicked.connect(lambda: self.addLayerToComposite(self.dlg.listWidget.currentRow()))   
+        self.dlg.pushButton_deleteMap.clicked.connect(lambda: self.deleteMap(self.dlg.listWidget.currentItem().text(),self.dlg.listWidget.currentRow()))
+       # self.dlg.pushButton_deleteMap.clicked.connect(lambda: self.deleteMapFromCanvas(self.dlg.listWidget.currentRow())) 
+        self.dlg.pushButton_up.clicked.connect(lambda: self.reorderLayers(self.dlg.listWidget_listLayers.currentRow(), 1, self.dlg.listWidget.currentRow()))
+        self.dlg.pushButton_down.clicked.connect(lambda: self.reorderLayers(self.dlg.listWidget_listLayers.currentRow(), -1, self.dlg.listWidget.currentRow()))
+        self.dlg.pushButton_saveOrder.clicked.connect(lambda: self.saveReorder(self.dlg.listWidget.currentRow()))
+
+
+        if not self.loadedInMemory:
+            self.loadAllComposites()
+        self.dlg.pushButton_addMap.clicked.connect(lambda: self.showAddMapDialog())
+        layers = QgsProject.instance().mapLayers().values()     
+        for i in range (0, len(self.compositeList)):
+            print(self.compositeList[i])
+            #self.dlg.listWidget.addItem(self.compositeList[i]['name'])
+            self.dlg.listWidget.addItem(self.compositeList[i]['title'])
+        self.dlg.progressBar.hide()   
+        self.dlg.pushButton_saveOrder.hide()   
+        self.dlg.pushButton.setIcon(QIcon(self.plugin_dir + os.sep + 'icons' + os.sep + 'plus.png'))
+        self.dlg.pushButton_addMap.setIcon(QIcon(self.plugin_dir + os.sep + 'icons' + os.sep + 'plus.png'))
+        self.dlg.pushButton_addRaster.setIcon(QIcon(self.plugin_dir + os.sep + 'icons' + os.sep + 'plus.png'))
+        self.dlg.pushButton_deleteLayers.setIcon(QIcon(self.plugin_dir + os.sep + 'icons' + os.sep + 'minus.png'))
+        self.dlg.pushButton_deleteMap.setIcon(QIcon(self.plugin_dir + os.sep + 'icons' + os.sep + 'minus.png'))
+        self.dlg.pushButton_editMeta.setIcon(QIcon(self.plugin_dir + os.sep + 'icons' + os.sep + 'edit.png'))
+        self.dlg.listWidget.itemClicked.connect(self.refreshLayerList)
+        self.dlg.listWidget.itemClicked.connect(lambda: self.dlg.pushButton_deleteMap.setEnabled(True))
+        self.dlg.listWidget.itemClicked.connect(lambda: self.dlg.pushButton_editMeta.setEnabled(True))
+        self.dlg.listWidget.itemClicked.connect(lambda: self.dlg.pushButton_addRaster.setEnabled(True))
+        self.dlg.listWidget_listLayers.itemClicked.connect(lambda: self.dlg.pushButton_down.setEnabled(True))
+        self.dlg.listWidget_listLayers.itemClicked.connect(lambda: self.dlg.pushButton_up.setEnabled(True))
+        self.dlg.rejected.connect(lambda: self.saveReorder())
+        
+       
+        self.dlg.pushButton_editMeta.clicked.connect(lambda: self.showEditMapDialog(self.dlg.listWidget.currentRow()))
+     ###########nacitam vrstvy z laymana do comboboxu
+        url = self.URI+'/rest/'+self.laymanUsername+'/layers'
+        r = requests.get(url = url)
+       # print(r.content())
+        try:
+            data = r.json()
+        except:
+            QMessageBox.information(None, "Error", "Connection with server failed!.")
+        for row in range(0, len(data)):          
+            self.dlg.comboBox_raster.addItem(data[row]['name'])
+
+        self.dlg.pushButton_addRaster.clicked.connect(lambda: self.addExistingLayerToComposite(self.dlg.comboBox_raster.currentText()))
+        #### nahrát mapy ze serveru do comboboxu
+        url = self.URI+'/rest/'+self.laymanUsername+'/maps'
+        r = requests.get(url = url)
+        data = r.json()
+        for row in range(0, len(data)):            
+            self.dlg.comboBox_loadMap.addItem(data[row]['name'])
+      
+        self.dlg.pushButton_loadMap.clicked.connect(lambda: self.readMapJson(self.dlg.comboBox_loadMap.currentText(), 'WMS'))
+        self.dlg.pushButton_loadMapWFS.clicked.connect(lambda: self.readMapJson(self.dlg.comboBox_loadMap.currentText(), 'WFS'))
+        self.dlg.pushButton_loadMapWFS.hide()
+        self.dlg.pushButton_loadMap.hide()
+        self.dlg.comboBox_loadMap.hide()
+     #############
+        self.dlg.pushButton.setEnabled(False)
+        self.dlg.pushButton_deleteLayers.setEnabled(False)
+        self.dlg.listWidget_listLayers.itemClicked.connect(self.showSmallThumbnail)
+      #  self.dlg.listWidget_listLayers.itemClicked.connect(self.showThumbnail)
+        self.dlg.listWidget.itemClicked.connect(self.enableButton)          
+        self.dlg.pushButton_deleteLayers.clicked.connect(lambda: self.deteteLayerFromComposite(self.dlg.listWidget.currentRow(),self.dlg.listWidget_listLayers.currentRow(), self.dlg.listWidget_listLayers.currentItem().text()))    
+        self.dlg.show()
+        #self.dlg.pushButton_close.clicked.connect(lambda: self.saveReorder(self.dlg.listWidget.currentRow()))
+        #self.dlg.pushButton_close.clicked.connect(lambda: self.saveReorder())
+        self.dlg.pushButton_close.clicked.connect(lambda: self.dlg.close())
+        self.dlg.pushButton_saveOrder.setEnabled(False)
+        self.dlg.pushButton_down.setStyleSheet("#pushButton_down {color: #fff !important;text-transform: uppercase;  text-decoration: none;   background: #72c02c;   padding: 20px;  border-radius: 50px;    display: inline-block; border: none;transition: all 0.4s ease 0s;} #pushButton_down:hover{background: #66ab27 ;}#pushButton_down:disabled{background: #64818b ;}")
+        self.dlg.pushButton_up.setStyleSheet("#pushButton_up {color: #fff !important;text-transform: uppercase;  text-decoration: none;   background: #72c02c;   padding: 20px;  border-radius: 50px;    display: inline-block; border: none;transition: all 0.4s ease 0s;} #pushButton_up:hover{background: #66ab27 ;}#pushButton_up:disabled{background: #64818b ;}")
+        self.dlg.pushButton.setStyleSheet("#pushButton {color: #fff !important;text-transform: uppercase;  text-decoration: none;   background: #72c02c;   padding: 20px;  border-radius: 50px;    display: inline-block; border: none;transition: all 0.4s ease 0s;} #pushButton:hover{background: #66ab27 ;}#pushButton:disabled{background: #64818b ;}")
+        self.dlg.pushButton_close.setStyleSheet("#pushButton_close {color: #fff !important;text-transform: uppercase;  text-decoration: none;   background: #72c02c;   padding: 20px;  border-radius: 50px;    display: inline-block; border: none;transition: all 0.4s ease 0s;} #pushButton_close:hover{background: #66ab27 ;}#pushButton_close:disabled{background: #64818b ;}")
+        self.dlg.pushButton_deleteLayers.setStyleSheet("#pushButton_deleteLayers {color: #fff !important;text-transform: uppercase;  text-decoration: none;   background: #72c02c;   padding: 20px;  border-radius: 50px;    display: inline-block; border: none;transition: all 0.4s ease 0s;} #pushButton_deleteLayers:hover{background: #66ab27 ;}#pushButton_deleteLayers:disabled{background: #64818b ;}")
+        self.dlg.pushButton_deleteMap.setStyleSheet("#pushButton_deleteMap {color: #fff !important;text-transform: uppercase;  text-decoration: none;   background: #72c02c;   padding: 20px;  border-radius: 50px;    display: inline-block; border: none;transition: all 0.4s ease 0s;} #pushButton_deleteMap:hover{background: #66ab27 ;}#pushButton_deleteMap:disabled{background: #64818b ;}")
+        self.dlg.pushButton_addRaster.setStyleSheet("#pushButton_addRaster {color: #fff !important;text-transform: uppercase;  text-decoration: none;   background: #72c02c;   padding: 20px;  border-radius: 50px;    display: inline-block; border: none;transition: all 0.4s ease 0s;} #pushButton_addRaster:hover{background: #66ab27 ;}#pushButton_addRaster:disabled{background: #64818b ;}")
+        self.dlg.pushButton_addMap.setStyleSheet("#pushButton_addMap {color: #fff !important;text-transform: uppercase;  text-decoration: none;   background: #72c02c;   padding: 20px;  border-radius: 50px;    display: inline-block; border: none;transition: all 0.4s ease 0s;} #pushButton_addMap:hover{background: #66ab27 ;}#pushButton_addMap:disabled{background: #64818b ;}")
+        self.dlg.pushButton_editMeta.setStyleSheet("#pushButton_editMeta {color: #fff !important;text-transform: uppercase;  text-decoration: none;   background: #72c02c;   padding: 20px;  border-radius: 50px;    display: inline-block; border: none;transition: all 0.4s ease 0s;} #pushButton_editMeta:hover{background: #66ab27 ;}#pushButton_editMeta:disabled{background: #64818b ;}")
+        self.dlg.pushButton_loadMapWFS.setStyleSheet("#pushButton_loadMapWFS {color: #fff !important;text-transform: uppercase;  text-decoration: none;   background: #72c02c;   padding: 20px;  border-radius: 50px;    display: inline-block; border: none;transition: all 0.4s ease 0s;} #pushButton_loadMapWFS:hover{background: #66ab27 ;}#pushButton_loadMapWFS:disabled{background: #64818b ;}")
+        self.dlg.pushButton_loadMap.setStyleSheet("#pushButton_loadMap {color: #fff !important;text-transform: uppercase;  text-decoration: none;   background: #72c02c;   padding: 20px;  border-radius: 50px;    display: inline-block; border: none;transition: all 0.4s ease 0s;} #pushButton_loadMap:hover{background: #66ab27 ;}#pushButton_loadMap:disabled{background: #64818b ;}")
+        self.dlg.setStyleSheet("#DialogBase {background: #f0f0f0 ;}")
+        self.dlg.pushButton_saveOrder.setStyleSheet("#pushButton_saveOrder {color: #fff !important;text-transform: uppercase;  text-decoration: none;   background: #72c02c;   padding: 20px;  border-radius: 50px;    display: inline-block; border: none;transition: all 0.4s ease 0s;} #pushButton_saveOrder:hover{background: #66ab27 ;}#pushButton_saveOrder:disabled{background: #64818b ;}")
+        
+
+
+        result = self.dlg.exec_()
+    def run_DeleteMapDialog(self):
+        self.dlg = DeleteMapDialog()
+        self.refreshListWidgetMaps()
+        self.dlg.pushButton.setEnabled(False)
+        self.dlg.treeWidget.itemClicked.connect(self.enableButton) 
+        self.dlg.pushButton.clicked.connect(lambda: self.deleteMapFromServer(self.dlg.treeWidget.selectedItems()[0].text(0)))
+        self.dlg.pushButton_close.clicked.connect(lambda: self.dlg.close())
+        self.dlg.show()
+        result = self.dlg.exec_()
+    def run_ImportLayerDialog(self):
+        self.dlg = ImportLayerDialog()
+        
+      #  self.dlg.pushButton.clicked.connect(lambda: self.postRequest(self.dlg.treeWidget.currentItem().text(0)))
+
+        self.dlg.pushButton.clicked.connect(lambda: self.callPostRequest(self.dlg.treeWidget.selectedItems()))
+       
+        
+        self.dlg.pushButton.setEnabled(False)
+       # self.dlg.treeWidget.itemClicked.connect(self.enableButton)  
+        self.dlg.treeWidget.itemPressed.connect(self.enableButtonImport)
+        self.dlg.treeWidget.itemClicked.connect(self.onItemClicked)
+        layers = QgsProject.instance().mapLayers().values()
+        
+        for layer in layers:           
+            if (layer.type() == QgsMapLayer.VectorLayer):
+                layerType = 'vector layer'
+            else:
+                layerType = 'raster layer'
+            item = QTreeWidgetItem([layer.name(), layerType])    
+            if (layerType == 'vector layer'):
+                self.dlg.treeWidget.addTopLevelItem(item)
+        self.dlg.setWindowModality(Qt.ApplicationModal)
+
+        self.dlg.pushButton_close.setStyleSheet("#pushButton_close {color: #fff !important;text-transform: uppercase;  text-decoration: none;   background: #72c02c;   padding: 20px;  border-radius: 50px;    display: inline-block; border: none;transition: all 0.4s ease 0s;} #pushButton_close:hover{background: #66ab27 ;}")
+        self.dlg.pushButton.setStyleSheet("#pushButton {color: #fff !important;text-transform: uppercase;  text-decoration: none;   background: #72c02c;   padding: 20px;  border-radius: 50px;    display: inline-block; border: none;transition: all 0.4s ease 0s;} #pushButton:hover{background: #66ab27 ;}#pushButton:disabled{background: #64818b ;}")
+        self.dlg.setStyleSheet("#DialogBase {background: #f0f0f0 ;}")
+
+        self.dlg.show()
+      
+        
+        self.dlg.pushButton_close.clicked.connect(lambda: self.dlg.close())
+        result = self.dlg.exec_()
+    def run_login(self):
+        self.dlg = ConnectionManagerDialog()
+        self.dlg.show()    
+        self.dlg.pushButton_Connect.setEnabled(False) 
+        if (os.path.isfile(os.getenv("HOME") + os.sep + ".layman" + os.sep +'layman_user.INI')):
+            config = self.loadIni()
+            if len(config['DEFAULT']['login']) > 0:
+                self.Agrimail = config['DEFAULT']['login']
+                self.dlg.pushButton_Connect.setEnabled(True) 
+            self.dlg.lineEdit_userName.setText(config['DEFAULT']['login'] + "@lesprojekt.cz")  
+            try:
+                self.dlg.lineEdit_AgriID.setText(config['DEFAULT']['id']) 
+                self.dlg.lineEdit_server.setText(config['DEFAULT']['server']) 
+                self.dlg.lineEdit_serverLayman.setText(config['DEFAULT']['layman']) 
+            except:
+                print("udaj v ini nenalezen")
+        else:
+            try:
+                os.makedirs(os.getenv("HOME") + os.sep + ".layman")
+            except:
+                print("layman directory already exists")
+            self.dlg.lineEdit_userName.setText("@lesprojekt.cz")
+            self.dlg.pushButton_Connect.setEnabled(True) 
+        self.dlg.pushButton_ttt.hide()
+
+        
+        self.dlg.lineEdit_userName.textChanged.connect(self.checkUsername)
+        self.dlg.pushButton_close.clicked.connect(lambda: self.dlg.close())
+        self.dlg.pushButton_Connect.clicked.connect(lambda: self.openAuthLiferayUrl())
+        self.dlg.pushButton_Continue.clicked.connect(lambda: self.getToken())
+        self.dlg.pushButton_Continue.setEnabled(False)       
+        self.dlg.pushButton_ttt.clicked.connect(lambda: self.printVariables())
+        self.dlg.pushButton_close.setStyleSheet("#pushButton_close {color: #fff !important;text-transform: uppercase;  text-decoration: none;   background: #72c02c;   padding: 20px;  border-radius: 50px;    display: inline-block; border: none;transition: all 0.4s ease 0s;} #pushButton_close:hover{background: #66ab27 ;}")
+        self.dlg.pushButton_Connect.setStyleSheet("#pushButton_Connect {color: #fff !important;text-transform: uppercase;  text-decoration: none;   background: #72c02c;   padding: 20px;  border-radius: 50px;    display: inline-block; border: none;transition: all 0.4s ease 0s;} #pushButton_Connect:hover{background: #66ab27 ;}")
+        self.dlg.pushButton_Continue.setStyleSheet("#pushButton_Continue {color: #fff !important;text-transform: uppercase;  text-decoration: none;   background: #72c02c;   padding: 20px;  border-radius: 50px;    display: inline-block; border: none;transition: all 0.4s ease 0s;} #pushButton_Continue:hover{background: #66ab27 ;} #pushButton_Continue:disabled{background: #64818b ;}")
+        self.dlg.setStyleSheet("#DialogBase {background: #f0f0f0 ;}")
+        result = self.dlg.exec_()
+    def run_AddMapDialog(self):        
+        url = self.URI+'/rest/'+self.laymanUsername+'/maps'
+        print(url)
+        r = requests.get(url = url)
+        print(r.content)
+        data = r.json()
+        self.dlg = AddMapDialog()
+        
+        for row in range(0, len(data)):
+            url = self.URI+'/rest/'+self.laymanUsername+'/maps/'+data[row]['name']+'/file'
+            r = requests.get(url = url)
+         #   print(r.content)
+            d = r.json()
+            print(d['title'])
+         #   item = QTreeWidgetItem([data[row]['name'], data[row]['url'], data[row]['uuid']])           
+            item = QTreeWidgetItem([d['title']])            
+            self.dlg.treeWidget.addTopLevelItem(item)
+        
+        
+      
+        self.dlg.pushButton.setEnabled(False)
+        self.dlg.pushButton_mapWFS.setEnabled(False)
+        self.dlg.label_info.hide()
+     
+        self.dlg.treeWidget.itemClicked.connect(self.showThumbnailMap)
+        self.dlg.treeWidget.itemClicked.connect(self.enableButton)
+        self.dlg.treeWidget.itemClicked.connect(self.enableLoadMapButtons)
+        
+
+        self.dlg.pushButton.clicked.connect(lambda: self.readMapJson(self.dlg.treeWidget.selectedItems()[0].text(0), 'WMS'))
+        self.dlg.pushButton_mapWFS.clicked.connect(lambda: self.readMapJson(self.dlg.treeWidget.selectedItems()[0].text(0), 'WFS'))
+        
+
+        self.dlg.pushButton_close.clicked.connect(lambda: self.dlg.close())
+
+        self.dlg.pushButton_mapWFS.setStyleSheet("#pushButton_mapWFS {color: #fff !important;text-transform: uppercase;  text-decoration: none;   background: #72c02c;   padding: 20px;  border-radius: 50px;    display: inline-block; border: none;transition: all 0.4s ease 0s;} #pushButton_mapWFS:hover{background: #66ab27 ;}#pushButton_mapWFS:disabled{background: #64818b ;}")
+        self.dlg.pushButton.setStyleSheet("#pushButton {color: #fff !important;text-transform: uppercase;  text-decoration: none;   background: #72c02c;   padding: 20px;  border-radius: 50px;    display: inline-block; border: none;transition: all 0.4s ease 0s;} #pushButton:hover{background: #66ab27 ;}#pushButton:disabled{background: #64818b ;}")
+        self.dlg.pushButton_close.setStyleSheet("#pushButton_close {color: #fff !important;text-transform: uppercase;  text-decoration: none;   background: #72c02c;   padding: 20px;  border-radius: 50px;    display: inline-block; border: none;transition: all 0.4s ease 0s;} #pushButton_close:hover{background: #66ab27 ;}#pushButton_close:disabled{background: #64818b ;}")
+        self.dlg.setStyleSheet("#DialogBase {background: #f0f0f0 ;}")
+
+        self.dlg.show()
+        result = self.dlg.exec_()
+    def run_AddLayerDialog(self):
+        if not self.loadedInMemory:
+            self.loadAllComposites()
+        url = self.URI+'/rest/'+self.laymanUsername+'/layers'
+        r = requests.get(url = url)
+        data = r.json()
+        self.dlg = AddLayerDialog()
+        self.dlg.pushButton_layerRedirect.hide()
+        self.dlg.pushButton_layerRedirect.setEnabled(False)
+        self.dlg.pushButton.setEnabled(False)
+        self.dlg.pushButton_wfs.setEnabled(False)
+        self.dlg.pushButton_delete.setEnabled(False)
+        
+        for row in range(0, len(data)):            
+            item = QTreeWidgetItem([self.getLayerTitle(data[row]['name'])])
+            self.dlg.treeWidget.addTopLevelItem(item)
+        self.dlg.pushButton_delete.clicked.connect(lambda: self.layerDelete(self.dlg.treeWidget.selectedItems()[0].text(0)))    
+        self.dlg.pushButton_layerRedirect.clicked.connect(lambda: self.layerInfoRedirect(self.dlg.treeWidget.selectedItems()[0].text(0)))
+        self.dlg.pushButton.clicked.connect(lambda: self.readLayerJson(self.dlg.treeWidget.selectedItems()[0].text(0), "WMS"))
+        self.dlg.pushButton_wfs.clicked.connect(lambda: self.readLayerJson(self.dlg.treeWidget.selectedItems()[0].text(0), "WFS"))
+        self.dlg.treeWidget.itemClicked.connect(self.showThumbnail)  
+        self.dlg.treeWidget.itemClicked.connect(self.enableDeleteButton) 
+        self.dlg.pushButton_close.clicked.connect(lambda: self.dlg.close())
+        self.dlg.setWindowModality(Qt.ApplicationModal)
+
+        self.dlg.pushButton_delete.setStyleSheet("#pushButton_delete {color: #fff !important;text-transform: uppercase;  text-decoration: none;   background: #72c02c;   padding: 20px;  border-radius: 50px;    display: inline-block; border: none;transition: all 0.4s ease 0s;} #pushButton_delete:hover{background: #66ab27 ;}#pushButton_delete:disabled{background: #64818b ;}")
+        self.dlg.pushButton_close.setStyleSheet("#pushButton_close {color: #fff !important;text-transform: uppercase;  text-decoration: none;   background: #72c02c;   padding: 20px;  border-radius: 50px;    display: inline-block; border: none;transition: all 0.4s ease 0s;} #pushButton_close:hover{background: #66ab27 ;}#pushButton_close:disabled{background: #64818b ;}")
+        self.dlg.pushButton_delete.setStyleSheet("#pushButton_delete {color: #fff !important;text-transform: uppercase;  text-decoration: none;   background: #72c02c;   padding: 20px;  border-radius: 50px;    display: inline-block; border: none;transition: all 0.4s ease 0s;} #pushButton_delete:hover{background: #66ab27 ;}#pushButton_delete:disabled{background: #64818b ;}")
+        self.dlg.pushButton.setStyleSheet("#pushButton {color: #fff !important;text-transform: uppercase;  text-decoration: none;   background: #72c02c;   padding: 20px;  border-radius: 50px;    display: inline-block; border: none;transition: all 0.4s ease 0s;} #pushButton:hover{background: #66ab27 ;}#pushButton:disabled{background: #64818b ;}")
+        self.dlg.pushButton_wfs.setStyleSheet("#pushButton_wfs {color: #fff !important;text-transform: uppercase;  text-decoration: none;   background: #72c02c;   padding: 20px;  border-radius: 50px;    display: inline-block; border: none;transition: all 0.4s ease 0s;} #pushButton_wfs:hover{background: #66ab27 ;}#pushButton_wfs:disabled{background: #64818b ;}")
+        self.dlg.setStyleSheet("#DialogBase {background: #f0f0f0 ;}")
+
+
+        self.dlg.show()
+        result = self.dlg.exec_()
+    def showExistingLayers(self,x):
+ 
+        self.dlg.listWidget_listLayers.clear()    
+        for i in range (0,len(self.compositeList[self.dlg.listWidget.currentRow()]['layers'])):         
+               
+            self.dlg.listWidget_listLayers.addItem(self.compositeList[self.dlg.listWidget.currentRow()]['layers'][i]['params']['LAYERS'])
+    #--------------------------- slots---------------------
+   # @QtCore.pyqtSlot(QtWidgets.QTreeWidgetItem, int)
+    def onItemClicked(self, it, col):     
+        if (it.text(1) == 'raster layer'):
+            self.dlg.pushButton.setEnabled(False)
+        else:
+            self.dlg.pushButton.setEnabled(True)
+    def setExtent(self, it, col):
+        layer = QgsProject.instance().mapLayersByName(it.text(0))
+        ext = layer[0].extent()
+        xmin = ext.xMinimum()
+        xmax = ext.xMaximum()
+        ymin = ext.yMinimum()
+        ymax = ext.yMaximum()
+        self.dlg.lineEdit_3.setText(str(xmin))
+        self.dlg.lineEdit_4.setText(str(xmax))
+        self.dlg.lineEdit_5.setText(str(ymin))
+        self.dlg.lineEdit_6.setText(str(ymax))
+        self.dlg.label_4.setText("Extent of canvas: " + it.text(0))
+
+    def enableDeleteButton(self, item, col):
+        self.dlg.pushButton.setEnabled(True)
+        self.dlg.pushButton_wfs.setEnabled(True)
+        self.dlg.pushButton_layerRedirect.setEnabled(True)
+        self.dlg.pushButton_delete.setEnabled(True)
+
+    def enableButton(self, item, col):
+        
+        
+        self.dlg.pushButton.setEnabled(True)
+        self.dlg.pushButton_mapWFS.setEnabled(True)
+        self.dlg.pushButton_deleteLayers.setEnabled(True)
+        self.dlg.pushButton_editMeta.setEnabled(True)
+        self.dlg.pushButton_addRaster.setEnabled(True)       
+
+    def saveReorder(self):
+        for x in self.mapsChanged:
+            print(x)
+            print(self.compositeList[x]['layers'])
+            self.importMap(x, 'mod')
+        print("changes saved to server")
+        #self.dlg.pushButton_saveOrder.setEnabled(False)
+    def checkUsername(self, name):
+        n = name.split("@")
+        if(len(n[0]) > 0):
+            self.dlg.pushButton_Connect.setEnabled(True) 
+            self.Agrimail = n[0]
+        else:
+            self.dlg.pushButton_Connect.setEnabled(False) 
+
+        
+    def checkLoadedMap(self, name):
+       ## print(self.compositeList)
+        loaded = False
+        for i in range (0, len(self.compositeList)):
+            if self.compositeList[i]['name'] == name:
+                loaded = True
+            
+        return loaded 
+                   
+        
+    def logout(self):
+        self.menu_saveLocalFile.setEnabled(False)
+        self.menu_loadJson.setEnabled(False)
+        self.menu_ImportLayerDialog.setEnabled(False)
+        self.menu_AddLayerDialog.setEnabled(False) 
+        self.menu_AddMapDialog.setEnabled(False)       
+        self.menu_ImportLayerDialog.setEnabled(False)
+        self.menu_ImportMapDialog.setEnabled(False)    
+        self.menu_UserInfoDialog.setEnabled(False)
+        self.textbox.setText("Layman")
+        self.dlg.close()
+       # self.flaskThread.join()
+       # self.thread1.join() ## ukončujeme vlákno, které se stará o refresh tokenů OAUTH
+
+    def enableLoadMapButtons(self, item):
+        self.dlg.pushButton_mapWFS.setEnabled(True)
+    def enableButtonImport(self, item, column):
+        if (len(self.dlg.treeWidget.selectedItems()) > 0):
+            self.dlg.pushButton.setEnabled(True)
+        else:
+            self.dlg.pushButton.setEnabled(False)
+
+
+    def enableButton(self, item):
+        try: ## addMap nemá combobox
+            if (self.dlg.mMapLayerComboBox.count() > 0):
+                self.dlg.pushButton.setEnabled(True) 
+                self.dlg.pushButton_mapWFS.setEnabled(True)
+            else:
+                self.dlg.pushButton.setEnabled(False)
+        except:
+            self.dlg.pushButton.setEnabled(True) ## addMap nemá combobox nastavujeme funkční tlačítko
+
+        try:
+            self.dlg.pushButton_deleteLayers.setEnabled(True) # pro formulář importMap
+        except:
+            pass
+    def listCompositeLayers(self, it):    
+         self.dlg.listWidget_listLayers2.clear()    
+         for i in range (0,len(self.compositeList[self.dlg.listWidget.currentRow()]['layers'])):    
+            
+            self.dlg.listWidget_listLayers2.addItem(self.compositeList[self.dlg.listWidget.currentRow()]['layers'][i]['params']['LAYERS'])
+    def deleteLayerThrowCompositions(self, name):
+        for x in range (0,len(self.compositeList)):
+           
+            for i in range (0,len(self.compositeList[x]['layers'])): 
+                if (name == self.compositeList[x]['layers'][i]['params']['LAYERS']):
+                    inComposite = True
+                    print(self.compositeList[x]['layers'][i]['params']['LAYERS'])
+                    self.deteteLayerFromComposite(x, i, name)
+    def checkLayersInComopsitions(self, name):
+        inComposite = False
+        for x in range (0,len(self.compositeList)):
+           
+            for i in range (0,len(self.compositeList[x]['layers'])): 
+                if (name == self.compositeList[x]['layers'][i]['params']['LAYERS']):
+                    inComposite = True
+                    print(self.compositeList[x]['layers'][i]['params']['LAYERS'])
+        return inComposite
+
+
+    def refreshCompositeList(self):
+        self.dlg.listWidget.clear()
+        print (len(self.compositeList))
+        
+        for i in range (0, len(self.compositeList)):
+           # self.dlg.listWidget.addItem(self.compositeList[i]['name'])
+           self.dlg.listWidget.addItem(self.compositeList[i]['title'])
+ 
+
+    def refreshLayerList(self):
+        self.dlg.listWidget_listLayers.clear()
+        for i in range (0,len(self.compositeList[self.dlg.listWidget.currentRow()]['layers'])):
+            self.dlg.listWidget_listLayers.addItem(self.compositeList[self.dlg.listWidget.currentRow()]['layers'][i]['params']['LAYERS'])
+            print(self.compositeList[self.dlg.listWidget.currentRow()]['layers'][i]['params']['LAYERS'])
+
+
+
+    def refreshListWidgetMaps(self):
+        self.dlg.treeWidget.clear()
+        url = self.URI+'/rest/'+self.laymanUsername+'/maps'
+        print(url)
+        r = requests.get(url = url)
+        #print(r.content())
+        data = r.json()  
+       
+        for row in range(0, len(data)):                
+            item = QTreeWidgetItem([data[row]['name']])           
+            self.dlg.treeWidget.addTopLevelItem(item)
+
+    def showAddMapDialog(self):
+        self.old_dlg = self.dlg
+        self.run_CreateCompositeDialog(True)      
+        
+       
+    ### connect
+    def afterCloseCompositeDialog(self):        
+        self.dlg = self.old_dlg
+        self.refreshCompositeList()
+
+    def afterCloseEditMapDialog(self):
+        self.dlg = self.old_dlg
+
+    def showEditMapDialog(self, x):        
+        self.old_dlg = self.dlg
+        self.run_EditMap(x)
+            ############### pravdepodobne půjde smazat
+    def refreshItems(self):
+  
+         self.dlg.listWidget_listLayers.clear()    
+         for i in range (0,len(self.compositeList)):            
+           # self.dlg.listWidget_listLayers.addItem(self.compositeList[i]['name'])
+           self.dlg.listWidget_listLayers.addItem(self.compositeList[i]['title'])
+
+    def saveEditedToComposite(self,x):        
+        self.compositeList[x]['abstract'] =  self.dlg.lineEdit_abstract.text()  
+        self.compositeList[x]['title'] =  self.dlg.lineEdit_title.text() 
+
+    def layerDelete(self, name):
+        if (self.checkLayersInComopsitions(name) == True):
+            msgbox = QMessageBox(QMessageBox.Question, "Delete layer", "This layers is included in other compositions. It will be delete from every composition.")
+            msgbox.addButton(QMessageBox.Yes)
+            msgbox.addButton(QMessageBox.No)
+            msgbox.setDefaultButton(QMessageBox.No)
+            reply = msgbox.exec()
+            if (reply == QMessageBox.Yes):
+                url = self.URI+'/rest/'+self.laymanUsername+'/layers/'+name    
+                response = requests.delete(url, headers = self.authHeader)
+                print(response.content)
+                print(response)
+                self.addLayerRefresh()
+                try:
+                    self.deleteLayerThrowCompositions(name)
+                except:
+                    pass
+                
+        else:    
+            url = self.URI+'/rest/'+self.laymanUsername+'/layers/'+name    
+            response = requests.delete(url, headers = self.authHeader)
+            print(response.content)
+            print(response)
+            self.addLayerRefresh()
+    def addLayerRefresh(self):
+        self.dlg.treeWidget.clear()
+        url = self.URI+'/rest/'+self.laymanUsername+'/layers'
+        r = requests.get(url = url)
+        data = r.json()
+        for row in range(0, len(data)):            
+            item = QTreeWidgetItem([data[row]['name']])
+            self.dlg.treeWidget.addTopLevelItem(item)
+    def checkIfMapExist(self, name):
+        url = "http://layman.lesprojekt.cz/rest/"+self.laymanUsername+"/maps/"+str(name)+"/file"
+        print(url)
+        r = requests.get(url)
+        print(r.content)
+        if (r.status_code == 404):
+            return False
+        else:
+            return True
+
+    def reorderLayers(self, pos, order, x):
+        self.dlg.pushButton_saveOrder.setEnabled(True)
+        self.compositeList[x]['layers']
+        i = 0
+        compositeLength = len(self.compositeList[x]['layers'])
+        self.mapsChanged.add(x)
+        if (pos + order < 0):
+            QMessageBox.information(None, "Error", "Layer is already on the top level!")
+            
+        elif( pos + order == compositeLength):
+            QMessageBox.information(None, "Error", "Layer is already on the bottom level!")
+
+        else:
+            for lay in self.compositeList[x]['layers']:
+                #print (lay)
+                if i == pos:
+
+                    pom = self.compositeList[x]['layers'][i]
+                    self.compositeList[x]['layers'][i] = self.compositeList[x]['layers'][i + order]
+                    self.compositeList[x]['layers'][i + order] = pom     
+
+                i = i + 1
+            print(self.compositeList[x]['layers'])
+            
+            self.refreshLayerList()
+            self.dlg.listWidget_listLayers.setCurrentRow(pos + order)
+
+    def showThumbnail(self, it):
+        try:
+            layer = it.text(0) ##pro QTreeWidget
+        except:
+            layer = it.text()##pro listWidget
+        try:
+            url = self.URI+'/rest/' +self.laymanUsername+'/layers/'+str(layer).lower().replace(" ","_")+'/thumbnail'    
+            data = urlopen(url).read()
+            pixmap = QPixmap(200, 200)
+            pixmap.loadFromData(data)
+            smaller_pixmap = pixmap.scaled(200, 200, Qt.KeepAspectRatio, Qt.FastTransformation)
+            self.dlg.label_thumbnail.setPixmap(smaller_pixmap)
+            self.dlg.label_thumbnail.setAlignment(Qt.AlignCenter)
+        except:
+            self.dlg.label_thumbnail.setText('  Unable to load thumbnail.')
+    def showSmallThumbnail(self, it):
+        try:
+            layer = it.text(0) ##pro QTreeWidget
+        except:
+            layer = it.text()##pro listWidget
+        try:
+            url = self.URI+'/rest/'+self.laymanUsername+'/layers/'+str(layer).lower().replace(" ","_")+'/thumbnail'    
+            data = urlopen(url).read()
+            pixmap = QPixmap(170, 170)
+            pixmap.loadFromData(data)
+            smaller_pixmap = pixmap.scaled(170, 170, Qt.KeepAspectRatio, Qt.FastTransformation)
+            self.dlg.label_thumbnail.setPixmap(smaller_pixmap)
+            self.dlg.label_thumbnail.setAlignment(Qt.AlignCenter)
+        except:
+            self.dlg.label_thumbnail.setText('  Unable to load thumbnail.')
+
+    def showThumbnailMap(self, it):
+        try:
+            map = it.text(0) ##pro QTreeWidget
+        except:
+            map = it.text()##pro listWidget
+        
+        try:
+            map = self.removeUnacceptableChars(str(map))
+            url = self.URI+'/rest/'+self.laymanUsername+'/maps/'+str(map).lower()+'/thumbnail'    
+            print(url)
+            data = urlopen(url).read()
+            pixmap = QPixmap(100, 100)
+            pixmap.loadFromData(data)
+            smaller_pixmap = pixmap.scaled(100, 100, Qt.KeepAspectRatio, Qt.FastTransformation)
+            self.dlg.label_thumbnail.setPixmap(smaller_pixmap)
+           # self.dlg.label_thumbnail.setAlignment(Qt.AlignCenter)
+        except:
+            self.dlg.label_thumbnail.setText('       Unable to load thumbnail.')
+
+    def checkNameCreateMap(self):
+        text = self.dlg.lineEdit_2.text()
+        text = self.removeUnacceptableChars(text)
+        print(text)
+        if (self.checkIfMapExist(text)):
+            self.dlg.pushButton_CreateComposition.setEnabled(False)
+            self.dlg.label_info.show()
+            
+        else:
+            self.dlg.pushButton_CreateComposition.setEnabled(True)
+            self.dlg.label_info.hide()
+    #----------------------------------------------------------
+    def readLayerJson(self,layerName, service):
+        if self.checkLayerOnLayman(layerName):
+            layerNameTitle =layerName
+            layerName = self.removeUnacceptableChars(layerName)
+            url = self.URI+'/rest/'+self.laymanUsername+'/layers/'+layerName  
+            print (url)
+            r = requests.get(url = url)
+            data = r.json()
+            if (service == "WMS"):
+                print("loading WMS")
+                print (data['wms']['url'])
+                wmsUrl = data['wms']['url']
+                format = 'png'
+                epsg = 'EPSG:4326' 
+                self.loadWms(wmsUrl, layerName,layerNameTitle, format, epsg) 
+            if (service == "WFS"):
+                wfsUrl = data['wfs']['url']
+                print("loading WFS")
+                self.loadWfs(wfsUrl, layerName, layerNameTitle) 
+        else:
+            QMessageBox.information(None, "Layman", "Something went wrong with this layer: "+layerName)
+    def loadAllComposites(self):
+        url = self.URI+'/rest/' + self.laymanUsername + '/maps'
+        try:
+            r = requests.get(url = url)
+        except:
+            QMessageBox.information(None, "Error", "Connection with server failed!.")
+        data = r.json()  
+        print(data)
+        for i in data:
+            print(i['name'])
+            url = self.URI+'/rest/' + self.laymanUsername + '/maps/'+i['name']+'/file'  
+            r = requests.get(url = url)
+            try:
+                map = r.json()
+            except:
+                QMessageBox.information(None, "Error", "Connection with server failed!.")
+            self.compositeList.append (map)
+        self.loadedInMemory = True
+
+    def readMapJson(self,name, service):
+        nameWithDiacritics = name        
+        name = self.removeUnacceptableChars(name)
+        print(name)
+        print("readMapJson " + name)
+        if not self.checkLoadedMap(name): ## je nactena mapa?
+      #  if True:
+            print("debug in readMapJson - true")
+            print(name)
+            print(self.checkLoadedMap(name))
+            url = self.URI+'/rest/'+self.laymanUsername+'/maps/'+name   +'/file'     
+            r = requests.get(url = url)
+            data = r.json()   
+            print(data)
+        
+            self.addComposite(data,service, name)
+            try:
+                self.refreshCompositeList()        ## pouze pro import Form     
+            except:
+                pass
+        else:
+            print("debug in readMapJson - false")
+            url = self.URI+'/rest/'+self.laymanUsername+'/maps/'+name   +'/file'     
+            r = requests.get(url = url)
+            data = r.json()
+            self.loadService(data,service, name)
+
+        #    QMessageBox.information(None, "Message", "This map is already loaded in memory. Loading only layers to canvas")
+    
+
+    def deleteMapFromServer(self,name):        
+        
+        url = self.URI+'/rest/'+self.laymanUsername+'/maps/'+name    
+        response = requests.delete(url, headers = self.authHeader)
+        print(response)
+        QMessageBox.information(None, "Message", "Composition deleted sucessfully.")
+       # self.refreshMapList()            
+        self.refreshListWidgetMaps() ## pro treewidget
+        
+      
+    def deleteMap(self,name, x):      
+        name = self.removeUnacceptableChars(name)
+        url = self.URI+'/rest/'+self.laymanUsername+'/maps/'+name    
+        response = requests.delete(url, headers = self.authHeader)
+        print(response)
+        print(response.content)
+        QMessageBox.information(None, "Message", "Composition deleted sucessfully.")
+        del (self.compositeList[x])        
+        self.refreshCompositeList()## pro import map form
+        self.dlg.listWidget_listLayers.clear()
+      
+        
+        
+      
+    def deleteMapandLayers(self,name, x):        
+        try:
+            url = self.URI+'/rest/'+self.laymanUsername+'/maps/'+name    
+            response = requests.delete(url, headers = self.authHeader)
+            QMessageBox.information(None, "Message", "Composition deleted sucessfully.")
+            
+            
+      
+        except:
+            QMessageBox.information(None, "Warning", "Deleting composition failed.")
+        #self.refreshItems()
+        self.deleteMapFromCanvas(x)
+        self.dlg.listWidget_listLayers.clear()
+        self.dlg.pushButton_deleteLayers.setEnabled(False)
+        self.dlg.pushButton.setEnabled(False)
+        self.dlg.pushButton_deleteMap.setEnabled(False)
+        self.refreshCompositeList()
+
+    def deleteMapFromCanvas(self, x):
+        for i in range (0,len(self.compositeList[x]['layers'])):  #[0]['params']['LAYERS']:
+            name = self.compositeList[x]['layers'][i]['params']['LAYERS']
+            lay = QgsProject.instance().mapLayersByName(name)[0]
+            if (lay != None and lay.type() != QgsMapLayer.VectorLayer):
+                QgsProject.instance().removeMapLayer(lay.id())
+        del (self.compositeList[x])
+
+    def deleteLayerFromCanvas(self, name):        
+        lay = QgsProject.instance().mapLayersByName(name)[0]        
+        if (lay != None and lay.type() != QgsMapLayer.VectorLayer):
+            QgsProject.instance().removeMapLayer(lay.id())
+        
+        
+    def getSelectedLayers(self):
+        arr = self.dlg.listWidget_listLayers2.selectedItems()
+        layers = []
+        for a in arr:
+            layer = QgsProject.instance().mapLayersByName(a.text())
+            for lay in layer:
+
+                if (lay.type() == QgsMapLayer.VectorLayer):
+                    layers.append(lay)
+            
+        return layers
+    def run_getLayer(self):
+        """Run method that performs all the real work"""
+
+        # Create the dialog with elements (after translation) and keep reference
+        # Only create GUI ONCE in callback, so that it will only load when the plugin is started
+        if self.first_start == True:
+            self.first_start = False
+            
+            
+        self.dlgGetLayers.items.clear()
+        # show the dialog
+        self.dlgGetLayers.show()
+        data= self.getExistingLayers()
+        for x in range(len(data)):
+            print(data[x]['name'])
+            self.dlgGetLayers.items.addItem(data[x]['name'])
+        # Run the dialog event loop
+        print (self.dlgGetLayers)
+        result = self.dlgGetLayers.exec_()
+       
+        
+        # See if OK was pressed
+        if result:
+            # Do something useful here - delete the line containing pass and
+            # substitute with your code.
+           
+            print ("test tlacitka")
+   
+    def onClosePlugin(self):
+        """Cleanup necessary items here when plugin dockwidget is closed"""
+
+        #print "** CLOSING Atlas"
+
+        # disconnects
+        self.dockwidget.closingPlugin.disconnect(self.onClosePlugin)
+
+        self.flaskThread.terminate() ## killing daemons
+        self.thread1.terminate()
+        self.pluginIsActive = False
+
+
+    def unload(self):
+        """Removes the plugin menu item and icon from QGIS GUI."""
+
+        #print "** UNLOAD Atlas"
+
+        for action in self.actions:
+            self.iface.removePluginMenu(
+                self.tr(u'&Layman'),
+                action)
+            self.iface.removeToolBarIcon(action)
+        # remove the toolbar
+        del self.toolbar
+
+    #--------------------------------------------------------------------------
+    def bounds(self, layers):
+
+        extent = None
+        for layer in layers:
+            if layer.type() == 0:
+                transform = QgsCoordinateTransform(layer.crs(), QgsCoordinateReferenceSystem('EPSG:4326'), QgsProject.instance()) # WGS 84 / UTM zone 33N
+                try:
+                    layerExtent = transform.transform(layer.extent())
+                except QgsCsException:
+                    print("exception in transform layer srs")
+                    layerExtent = QgsRectangle(-180, -90, 180, 90)
+                if extent is None:
+                    extent = layerExtent
+                else:
+                    extent.combineExtentWith(layerExtent)
+
+        return (extent.xMinimum(), extent.yMinimum(), extent.xMaximum(), extent.yMaximum())
+    def copySymbols(self,symbol, tempPath, fileNames):
+        for i in range(symbol.symbolLayerCount()):
+            sl = symbol.symbolLayer(i)
+            if isinstance(sl, QgsSvgMarkerSymbolLayer):
+                symbolPath = sl.path();
+                shutil.copy(symbolPath, tempPath)
+                print("Copying " + str(sl.path()))
+                fileNames.append(tempPath + os.sep + os.path.basename(symbolPath))
+            else:
+                print("Ignoring " + str(sl))
+
+    def setDefaultExtent (self, ext):        
+        self.dlg.lineEdit_3.setText(str(ext.xMinimum()))
+        self.dlg.lineEdit_4.setText(str(ext.xMaximum()))
+        self.dlg.lineEdit_5.setText(str(ext.yMinimum()))
+        self.dlg.lineEdit_6.setText(str(ext.yMaximum()))
+
+
+    def loadJsonLayer(self, fileName):    
+        name = (os.path.splitext(os.path.basename(fileName))[0])
+        vlayer = QgsVectorLayer(fileName, name,"ogr")
+        sldPath = os.path.splitext(fileName[:-4])[0] + ".sld"
+        qmlPath = os.path.splitext(fileName[:-4])[0] + ".qml"
+        print (sldPath)
+        sldExists = os.path.isfile(sldPath)
+        qmlExists = os.path.isfile(qmlPath)
+        if (qmlExists):
+            print("qml loaded")
+            vlayer.loadNamedStyle(qmlPath)
+        elif (sldExists):
+            vlayer.loadSldStyle(os.path.splitext(fileName)[0]+ ".sld")
+            print("sld loaded")
+        QgsProject.instance().addMapLayer(vlayer)
+        vlayer.triggerRepaint()
+    def checkLoadedLayer(self):
+        layers = iface.layerTreeView().selectedLayers()
+        if (len(layers) > 0):
+            self.json_export()    
+        else:
+            QMessageBox.information(None, "Message", "You must load layer first!")
+    def getEmptyComposite(self, compositeName, compositeTitle):        
+        compositeEPSG  = "epsg:4326"        
+        if (self.dlg.lineEdit_3.text() == "" or self.dlg.lineEdit_4.text() == "" or self.dlg.lineEdit_5.text() == "" or self.dlg.lineEdit_6.text() == ""):
+           ext = iface.mapCanvas().extent() 
+           xmin = ext.xMinimum()
+           xmax = ext.xMaximum()
+           ymin = ext.yMinimum()
+           ymax = ext.yMaximum()
+        else:   
+           xmin = self.dlg.lineEdit_3.text()
+           xmax = self.dlg.lineEdit_4.text()
+           ymin = self.dlg.lineEdit_5.text()
+           ymax = self.dlg.lineEdit_6.text() 
+        
+            
+        abstract = self.dlg.lineEdit_7.text()        
+        comp = {"abstract":abstract,"center":[1672068,6568819],"current_base_layer":{"title":"Composite_base_layer"},"extent":[str(xmin),str(ymin),str(xmax),str(ymax)],"groups":{"guest":"w"},"layers":[],"name":compositeName,"projection":compositeEPSG,"scale":1,"title":compositeTitle,"units":"m","user":{"email":"","name":self.laymanUsername}}
+        self.dlg.close()
+        iface.messageBar().pushWidget(iface.messageBar().createMessage("Layman:", " Kompozice  " + compositeName + " byla úspešně vytvořena."), Qgis.Success, duration=3)
+        return comp
+    def loadLocalFile(self):
+        options = QFileDialog.Options()
+        dialog = QFileDialog()
+        dialog.setStyleSheet("QPushButton {color: #fff !important;text-transform: uppercase;  text-decoration: none;   background: #72c02c;   padding: 20px;  border-radius: 50px;    display: inline-block; border: none;transition: all 0.4s ease 0s;} QPushButton:hover{background: #66ab27 ;}QPushButton:disabled{background: #64818b ;}");
+        fileName = dialog.getOpenFileName(None,"Load file", "","GeoJson Files (*.geojson);;Json Files (*.json)", options=options)
+        print ("načítám json ze souboru:" + fileName[0])
+        self.loadJsonLayer(fileName[0])
+    def modifyMap(self, x):        
+        name = self.removeUnacceptableChars(self.dlg.lineEdit_title.text())
+        #self.compositeList[x]['name'] = self.dlg.lineEdit_name.text()
+        self.compositeList[x]['name'] = name
+        self.compositeList[x]['abstract'] = self.dlg.lineEdit_abstract.text()
+        self.compositeList[x]['title'] = self.dlg.lineEdit_title.text()
+        self.compositeList[x]['extent'][0] = self.dlg.lineEdit_xmin.text()
+        self.compositeList[x]['extent'][2] = self.dlg.lineEdit_xmax.text()
+        self.compositeList[x]['extent'][1] = self.dlg.lineEdit_ymin.text()
+        self.compositeList[x]['extent'][3] = self.dlg.lineEdit_ymax.text()
+        print(self.compositeList[x]['extent'])
+        
+        print(self.URI+'/rest/'+self.laymanUsername+'/maps/'+self.compositeList[x]['name'])       
+        oldName = self.dlg.lineEdit_name.text()
+        response = requests.delete(self.URI+'/rest/'+self.laymanUsername+'/maps/'+oldName,headers = self.authHeader)
+        print(response.content)
+        self.dlg.close()
+        self.afterCloseEditMapDialog()
+        self.importMap(x, 'mod')
+        
+        try:
+            self.refreshCompositeList()
+            iface.messageBar().pushWidget(iface.messageBar().createMessage("Import:", " Map metadata was saved successfully."), Qgis.Success, duration=3)
+        except:
+            pass
+        
+        
+    def saveLocalFile(self):
+        
+        layer = self.iface.activeLayer()       
+        print(layer.commitChanges()) ## změny uloženy
+        path = iface.activeLayer().dataProvider().dataSourceUri()
+        path = path.split("|")[0].replace("'","")
+        if (layer == None):
+            QMessageBox.information(None, "Message", "You must load layer first!")
+        else:
+           # defaultDir = QDir().home()
+            defaultDir = os.path.dirname(path)
+            print(defaultDir)
+            print(defaultDir +os.sep+ str(layer.name()) + ".geojson")
+            print(QDir().homePath() +os.sep+ str(layer.name()) + ".geojson")
+            dialog = QFileDialog()
+            dialog.setFileMode(1)
+            dialog.setDirectory(defaultDir)
+            print(dialog.directory().path())
+           # layer_name = dialog.getSaveFileName(None, "Save file", QDir().homePath() +os.sep+ str(layer.name()) + ".geojson", "*.geojson")        
+            layer_name = dialog.getSaveFileName(None, "Save file", defaultDir +os.sep+ str(layer.name()) + ".geojson", "*.geojson")   
+            
+            self.json_export_local(layer_name[0], layer)
+
+    def json_export_local(self, layer_name, lay):     
+        import shutil
+        filePath = self.getTempPath(layer_name)  
+        ogr_driver_name = "GeoJSON" 
+        project = QgsProject.instance()
+        fileNames = []
+        ## zde musí být zajištěna vektorová vrstva
+        layer = lay        
+        layerType = layer.type()
+        if layerType == QgsMapLayer.VectorLayer:
+
+            renderer = layer.renderer()
+            hasIcon = False
+            if isinstance(renderer, QgsSingleSymbolRenderer):
+
+                self.copySymbols(renderer.symbol(), tempfile.gettempdir(), fileNames)
+                hasIcon = True
+
+
+            layerCrs = qgis.utils.iface.activeLayer().crs().authid()
+            crs = QgsCoordinateReferenceSystem(layerCrs)          
+            result2 = qgis.core.QgsVectorFileWriter.writeAsVectorFormat(layer, layer_name, "utf-8", crs, ogr_driver_name) # export jsonu do souboru
+            print(result2)
+            if(result2[0] == 2): ## testujeme zda není soubor otevřený v jiném procesu / návratový kod 2
+                
+                tempFile = self.getTempPath(os.path.basename(layer_name.replace(".geojson", "") ))
+                print(tempFile)
+                #QMessageBox.information(None, "Layman", "It is not possible overwrite this file. File is already open in other process.")  
+                sld_temp_filename = tempFile.replace("geojson", "sld") 
+                qml_temp_filename = tempFile.replace("geojson", "qml")
+                layer.saveSldStyle(sld_temp_filename)
+                layer.saveNamedStyle(qml_temp_filename)
+                result2 = qgis.core.QgsVectorFileWriter.writeAsVectorFormat(layer, tempFile, "utf-8", crs, ogr_driver_name)
+                print(result2)
+                if(result2[0] == 2):
+                    QMessageBox.information(None, "Layman", "It is not possible overwrite this file. File is already open in other process.")  
+                    return
+                if os.path.basename(layer_name.replace(".geojson", "")) != '':
+                    QgsProject.instance().removeMapLayer(layer.id())
+                    print(tempFile, layer_name)
+                    shutil.copy(tempFile, layer_name)
+                    shutil.copy(sld_temp_filename, layer_name.replace(".geojson", ".sld"))
+                    shutil.copy(qml_temp_filename, layer_name.replace(".geojson", ".qml"))
+                    self.loadJsonLayer(layer_name)
+                
+            else:                
+                sld_filename = layer_name.replace("geojson", "sld")     
+                qml_filename = layer_name.replace("geojson", "qml") 
+                result3 = False
+                layer.saveSldStyle(sld_filename)
+                layer.saveNamedStyle(qml_filename)
+
+    def json_export(self, layer_name):     
+
+        filePath = self.getTempPath(layer_name.lower())  
+        ogr_driver_name = "GeoJSON"     
+        project = QgsProject.instance()
+        fileNames = []      
+        layer = QgsProject.instance().mapLayersByName(layer_name)[0]       
+        
+        layerType = layer.type()
+        if layerType == QgsMapLayer.VectorLayer:
+
+            renderer = layer.renderer()
+            hasIcon = False
+            if isinstance(renderer, QgsSingleSymbolRenderer):
+
+                self.copySymbols(renderer.symbol(), tempfile.gettempdir(), fileNames)
+                hasIcon = True
+
+
+            #layerCrs = qgis.utils.iface.activeLayer().crs().authid()
+            layerCrs = layer.crs().authid()
+            crs = QgsCoordinateReferenceSystem(layerCrs)# původně bylo
+            layer_filename = filePath       
+          #  crs = QgsCoordinateReferenceSystem(4326, QgsCoordinateReferenceSystem.EpsgCrsId)
+            ##crs = layer.crs().authid()
+         #   tempOut = layer_filename.replace(".geojson", "_2.geojson") 
+            result2 = qgis.core.QgsVectorFileWriter.writeAsVectorFormat(layer, layer_filename, "utf-8", crs, ogr_driver_name) # export jsonu do souboru
+            ##transformace
+        #    input = tempOut
+        #    out = layer_filename
+        #    try:
+        #        os.remove(layer_filename)
+        #    except:
+        #        pass
+        ##    print("","-f", "Geojson", "-s_srs", layerCrs, "-t_srs", "epsg:4326", out, input)
+        #    print("convert")
+        #    print(main(["","-f", ogr_driver_name, "-s_srs", "EPSG:5514", "-t_srs", "EPSG:4326", out, input])) ## ogr2ogr
+            ##
+            sld_filename = filePath.replace("geojson", "sld").lower()            
+            result3 = False
+            layer.saveSldStyle(sld_filename)
+
+
+    def checkValidAttributes(self, layer_name):
+        layers = QgsProject.instance().mapLayersByName(layer_name)
+        if len(layers) > 1:
+            for l in layers:
+                if (isinstance(l, QgsVectorLayer)):
+                    print("xxx")
+                    layers.clear()
+                    layers.append(l)
+                    break
+        isValid = True
+        pom =layers[0].getFeature(1)        
+        for nam in pom.fields().names():
+            if (nam == ''):
+                isValid = False
+        return isValid
+
+
+    def checkWgsExtent(self, layer):
+        WgsXmax = 180
+        WgsXmin = -180
+        WgsYmax = 90
+        WgsYmin = -90
+        extent = layer.extent()
+        if (extent.xMaximum() > WgsXmax or extent.xMinimum() < WgsXmin or extent.yMaximum() > WgsYmax or extent.yMinimum() < WgsYmin ):
+            return False
+        else:
+            return True
+
+
+    def callPostRequest(self, layers):
+        
+        for item in layers:
+            print (item.text(0))
+            
+            
+                
+
+            self.postRequest(item.text(0))
+    #def transformLayer2(self, layer):
+    #    pass
+    def setCurrentLayer(name):
+        layers = QgsProject.instance().mapLayersByName(name) 
+        if(len(layers) >1):
+            layerss = QgsProject.instance().mapLayers().values()    
+            i = 0
+            for layer in layerss:  
+                if layers[0].name == layer.name():
+                    if (i == item.currentIndex()):
+                        i = i + 1
+                        break
+                    i = i + 1
+        return i
+    def transformLayer(self, layer):
+        layer = iface.activeLayer()
+        crsSrc = layer.crs()
+        print(crsSrc.authid())
+        crsDest = QgsCoordinateReferenceSystem(4326, QgsCoordinateReferenceSystem.EpsgCrsId)
+        print(crsSrc, crsDest)
+        xform = QgsCoordinateTransform(crsSrc, crsDest, 5514, 4326)
+        feats=[]
+
+        if (layer.geometryType() == 0):
+            destLayer = QgsVectorLayer("Point?crs=EPSG:4326","lay","memory")
+        if (layer.geometryType() == 1):
+            destLayer = QgsVectorLayer("Linestring?crs=EPSG:4326","lay","memory")
+        if (layer.geometryType() == 2):
+            destLayer = QgsVectorLayer("Polygon?crs=EPSG:4326","lay","memory")
+
+        for f in layer.getFeatures():
+            g = f.geometry()
+    
+            g.transform(xform)
+            print(g)
+            f.setGeometry(g)
+            feats.append(f)
+    
+        destLayer.dataProvider().addFeatures(feats)
+        return destLayer
+    def postRequest(self, layer_name):     
+        nameCheck = True
+        validExtent = True
+        layers = QgsProject.instance().mapLayersByName(layer_name)  
+       # layer_name = self.removeUnacceptableChars(layer_name)
+        layers[0].setName(layer_name)
+        if len(layers) > 1:
+            for l in layers:
+                if (isinstance(l, QgsVectorLayer)):                   
+                    layers.clear()
+                    layers.append(l)
+                    break
+     
+        #if not (re.match('[a-zA-Z_]{1}', layer_name)): ## nesmí být nesmysl v názvu na prvním místě
+        #    QMessageBox.information(None, "Layman", "Diacritics or number in first character is not allowed.")
+        #    nameCheck = False
+        #if not (re.match('[a-zA-Z0-9]', layer_name)): ## není povolena diakritika
+        #    QMessageBox.information(None, "Layman", "Diacritics is not allowed.")
+        #    nameCheck = False
+
+        if (re.match('[0-9]{1}', layer_name)): ## nesmí být nesmysl v názvu na prvním místě
+            QMessageBox.information(None, "Layman", "Number in first character is not allowed.")
+            nameCheck = False
+        
+        print(layer_name)
+        #if (layers[0].crs().authid() != 'EPSG:4323'):
+        #    layers[0] = self.transformLayer(layers[0]) 
+
+        if not self.checkWgsExtent(layers[0]):
+            QMessageBox.information(None, "Layman", "Extent of layer is out of WGS 84 range. (EPSG: 4326)")
+            validExtent = False
+
+        if (nameCheck and validExtent):
+                     
+            crs = layers[0].crs().authid()
+            crs = "EPSG:4326"
+            data = { 'name' :  str(layer_name).lower(), 'title' : str(layer_name), 'crs' : str(crs) } 
+            
+            if (self.checkValidAttributes(layer_name)):
+                if (self.checkExistingLayer(layer_name)):
+                    
+                    print("vrstva již existuje")
+                    msgbox = QMessageBox(QMessageBox.Question, "Layman", "Layer "+layer_name+" already exists in server. Do you want overwrite it´s geometry?")
+                    msgbox.addButton(QMessageBox.Yes)
+                    msgbox.addButton(QMessageBox.No)
+                    msgbox.setDefaultButton(QMessageBox.No)
+                    reply = msgbox.exec()
+                    if (reply == QMessageBox.Yes):
+                        print("vrstva již existuje")
+                        self.json_export(layer_name)
+                        geoPath = self.getTempPath(layer_name)
+                        #try:
+                        if (os.path.getsize(geoPath) > self.CHUNK_SIZE):
+                            self.postInChunks(layer_name, "patch")
+                           # iface.messageBar().pushWidget(iface.messageBar().createMessage("Import:", " Layer  " + layer_name + " was imported successfully."), Qgis.Success, duration=3)
+                        else:
+                            self.patchLayer(layer_name, data)
+                            iface.messageBar().pushWidget(iface.messageBar().createMessage("Import:", " Layer  " + layer_name + " was imported successfully."), Qgis.Success, duration=3)
+                        #except:
+                        #    iface.messageBar().pushWidget(iface.messageBar().createMessage("Import:", " Layer  " + layer_name + " was not imported successfully."), Qgis.Warning, duration=3)
+                    else:
+                        pass
+                else:
+            
+                    self.layerName = layer_name
+                   # if (self.checkEpsg(layer_name)):
+                    if(True): ##Pravděpodobně nebude třeba testovat EPSG, pokud se detekuje, je vrstva transformována. 
+                      #  print (layer_name)
+                        self.json_export(layer_name)
+                        sldPath = self.getTempPath(self.layerName).replace("geojson", "sld")
+                        geoPath = self.getTempPath(self.layerName)
+                        if (os.path.getsize(geoPath) > self.CHUNK_SIZE):
+                            self.postInChunks(layer_name, "post")
+                        else:
+                            if(os.path.isfile(sldPath)): ## existuje sld?
+                                files = [('file', open(geoPath, 'rb')), ('sld', open(sldPath, 'rb'))]
+                            else:
+                                files = {'file': (geoPath, open(geoPath, 'rb')),} 
+
+                            print(files)
+                            response = requests.post(self.URI+'/rest/'+self.laymanUsername+'/layers', files=files, data = data, headers = self.authHeader)
+                            print(response.content)
+                            print(response.status_code)
+                            if response.status_code == 200:
+                                iface.messageBar().pushWidget(iface.messageBar().createMessage("Import:", " Layer  " + layer_name + " was imported successfully."), Qgis.Success, duration=3)
+                            else:
+                                iface.messageBar().pushWidget(iface.messageBar().createMessage("Import:", " Layer  " + layer_name + " was not imported."), Qgis.Warning, duration=3)
+                    else:
+                   
+                        QMessageBox.information(None, "Layman", "Use EPSG:4326")
+            else:
+                QMessageBox.information(None, "Layman", "Layer "+layer_name+" does not have attributes!")
+
+    def addExistingLayerToComposite(self, name):
+        x = self.dlg.listWidget.currentRow()
+        if self.checkLayerOnLayman(name):
+            inComposite = name in self.isRasterLayerInComposite(x, name)
+            if not(inComposite):
+                response = requests.get(self.URI+'/rest/'+self.laymanUsername+'/layers/'+str(name), verify=False)
+                res = self.fromByteToJson(response.content)
+                print(res)
+                wmsUrl = res['wms']['url']
+        
+            
+                self.compositeList[x]['layers'].append({"metadata":{},"visibility":True,"opacity":1,"title":str(name),"className":"HSLayers.Layer.WMS","singleTile":True,"wmsMaxScale":0,"legends":[""],"maxResolution":None,"minResolution":0,"url": wmsUrl ,"params":{"LAYERS": str(name),"INFO_FORMAT":"application/vnd.ogc.gml","FORMAT":"image/png","FROMCRS":"EPSG:3857","VERSION":"1.3.0"},"ratio":1.5,"dimensions":{}})
+                self.importMap(x, 'add', 1)
+                self.refreshLayerList()
+            else:
+                QMessageBox.information(None, "Message", "Composition already include layer "+name+"!")
+        else:
+            QMessageBox.information(None, "Layman", "Something went wrong with this layer: "+name)
+
+    def addExistingMapToMemory(self, name):
+        response = requests.get(self.URI+'/rest/'+self.laymanUsername+'/maps/'+str(name), verify=False)
+        res = self.fromByteToJson(response.content)
+        print(res)
+        wmsUrl = res['wms']['url']
+        
+        x = self.dlg.listWidget.currentRow()
+
+
+        self.compositeList[x]['layers'].append({"metadata":{},"visibility":True,"opacity":1,"title":str(name),"className":"HSLayers.Layer.WMS","singleTile":True,"wmsMaxScale":0,"legends":[""],"maxResolution":None,"minResolution":0,"url": wmsUrl ,"params":{"LAYERS": str(name),"INFO_FORMAT":"application/vnd.ogc.gml","FORMAT":"image/png","FROMCRS":"EPSG:3857","VERSION":"1.3.0"},"ratio":1.5,"dimensions":{}})
+        self.importMap(x, 'add', 1)
+        self.refreshLayerList()
+
+    def layerInfoRedirect(self, name):
+        url = self.URI+'/rest/'+self.laymanUsername+"/layers/" + name
+        print(url)
+        response = requests.get(url)
+        r = self.fromByteToJson(response.content)
+        try:
+            url = r['metadata']['record_url']
+            webbrowser.open(url, new=2) ## redirect na micku pro více info
+        except:
+            QMessageBox.information(None, "Layman", "Link is unavailable.")
+    def checkLayerOnLayman(self, layer_name):
+        url = self.URI+'/rest/'+self.laymanUsername+"/layers/"+layer_name
+        r = requests.get(url = url, verify=False)
+        #print(r.content)
+        data = r.json()
+        try:
+            if data['wms']['status'] == 'NOT_AVAILABLE' or data['wms']['status'] == 'PENDING':
+                return False
+            else:
+                return True
+        except:
+            return True # validní vrstva nemá status
+
+
+    def addLayerToComposite(self,x):
+       
+        self.compositeListOld = copy.deepcopy(self.compositeList) ## list pred upravou pro vraceni zmen
+        #layers = self.getSelectedLayers() #odkomentovat pro zapnuti nacitani vrstev z listwidgetu
+        layers = []
+        layers.append(self.dlg.mMapLayerComboBox.currentLayer())
+        successful = 0
+        print (len(layers))
+        try:
+            step = self.getProgressBarStep(len(layers))
+        except:
+            QMessageBox.information(None, "Layman", "No layer selected!")
+        
+        for i in range (0, len(layers)):
+            print(type(layers[i]))           
+            
+            print (self.isLayerInComposite(x))
+            print (layers[i].name() in self.isLayerInComposite(x))
+            inComposite = layers[i].name() in self.isLayerInComposite(x)
+            layerName = self.removeUnacceptableChars(layers[i].name())
+            if (self.checkExistingLayer(layers[i].name()) and inComposite):
+                j = self.getLayerInCompositePosition(x)
+                print("j je: " + str(j))
+                
+               # QMessageBox.information(None, "Message", "Composition already include layer "+layers[i].name()+"!")
+               # self.deteteLayerFromComposite(x, j, layers[i].name())
+             
+                self.postRequest(layers[i].name())
+                layerName = self.removeUnacceptableChars(layers[i].name())
+                wmsStatus = 'PENDING'
+                j = 0
+                while ((wmsStatus == 'PENDING') and (j < 10)):
+                    print (self.URI+'/rest/'+self.laymanUsername+'/layers/'+str(layerName))
+                    response = requests.get(self.URI+'/rest/'+self.laymanUsername+'/layers/'+str(layerName), verify=False)
+                    res = self.fromByteToJson(response.content)
+                    try:
+                        wmsStatus = res['wms']['status']
+                    except:
+                        wmsStatus = "done"
+                    time.sleep(1)
+                    j = j + 1
+            
+
+                #print(res)
+                #try:
+                #    wmsUrl = res['wms']['url']
+                #except:
+                #    wmsUrl = self.URI+'/geoserver/'+layers[i].name()+'/ows'
+                #self.compositeList[x]['layers'].append({"metadata":{},"visibility":True,"opacity":1,"title":str(layers[i].name()),"className":"HSLayers.Layer.WMS","singleTile":True,"wmsMaxScale":0,"legends":[""],"maxResolution":None,"minResolution":0,"url": wmsUrl ,"params":{"LAYERS": str(layers[i].name()),"INFO_FORMAT":"application/vnd.ogc.gml","FORMAT":"image/png","FROMCRS":"EPSG:3857","VERSION":"1.3.0"},"ratio":1.5,"dimensions":{}})
+                #successful = successful + 1
+                #self.dlg.progressBar.setValue(self.dlg.progressBar.value()+step)
+ 
+                #self.importMap(x, "add", successful) 
+
+              
+            else:
+                self.postRequest(layers[i].name())
+                wmsStatus = 'PENDING'
+                j = 0
+                while ((wmsStatus == 'PENDING') and (j < 10)):
+                    print (self.URI+'/rest/'+self.laymanUsername+'/layers/'+str(layerName))
+                    response = requests.get(self.URI+'/rest/'+self.laymanUsername+'/layers/'+str(layerName), verify=False)
+                    res = self.fromByteToJson(response.content)
+                    try:
+                        wmsStatus = res['wms']['status']
+                    except:
+                        wmsStatus = "done"
+                    time.sleep(1)
+                    j = j + 1
+            
+
+                print(res)
+                try:
+                    wmsUrl = res['wms']['url']
+                except:
+                    wmsUrl = self.URI+'/geoserver/'+layerName+'/ows'
+                self.compositeList[x]['layers'].append({"metadata":{},"visibility":True,"opacity":1,"title":str(layerName),"className":"HSLayers.Layer.WMS","singleTile":True,"wmsMaxScale":0,"legends":[""],"maxResolution":None,"minResolution":0,"url": wmsUrl ,"params":{"LAYERS": str(layers[i].name()),"INFO_FORMAT":"application/vnd.ogc.gml","FORMAT":"image/png","FROMCRS":"EPSG:3857","VERSION":"1.3.0"},"ratio":1.5,"dimensions":{}})
+                successful = successful + 1
+                self.dlg.progressBar.setValue(self.dlg.progressBar.value()+step)
+ 
+                self.importMap(x, "add", successful) 
+    def getProgressBarStep(self, count):
+        return (100/count)
+
+    def deteteLayerFromComposite(self, x, position, name):   ## pro verzi s komboboxem   
+        
+        previousLayers = self.compositeList[x]['layers']         
+        self.compositeList[x]['layers'] = []  
+        for i in range (0,len(previousLayers)):
+            if (i != position):              
+               self.compositeList[x]['layers'].append(previousLayers[i])        
+        self.importMap(x, "del")
+        done = True
+        if (len(self.compositeList[x]['layers']) != 0 and len(self.compositeList[x]['layers']) != None):
+            for i in range (0, len(self.compositeList[x]['layers'])):
+                if (self.compositeList[x]['layers'][i]['params']['LAYERS'] == name):
+                    done = False
+        if (done and QgsProject.instance().mapLayersByName(name)):    ## kompozice může mít načtené vrstvy, které nejsou v canvasu
+            self.deleteLayerFromCanvas(name)    
+        
+    def importCleanComposite(self,x):
+        tempFile = tempfile.gettempdir() + os.sep + "atlas" + os.sep + "compsite.json"
+        with open(tempFile, 'w') as outfile:  
+                    json.dump(self.compositeList[x], outfile)
+        with open(tempFile, 'rb') as f:
+                    d = json.load(f)        
+        files = {'file': (tempFile, open(tempFile, 'rb')),} 
+        data = { 'name' :  self.compositeList[x]['name'], 'title' : self.compositeList[x]['title'], 'description' : self.compositeList[x]['abstract']} 
+        print(self.URI+'/rest/'+self.laymanUsername+'/maps/')
+        #response = requests.post(self.URI+'/rest/'+self.laymanUsername+'/maps/', data = data, files=files, headers = self.authHeader, verify=False)
+        print(self.authHeader)
+        response = requests.post(self.URI+'/rest/'+self.laymanUsername+'/maps', files=files, data = data, headers = self.authHeader, verify=False)
+        
+        print(response.content)
+
+
+
+    def showProgressBar(self, bar):
+        bar = QProgressBar() 
+        bar.setRange(0,0) ## range 0,0 je nekonečný
+        self.showProgressBar(bar)
+        bar.show()
+        iface.mainWindow().statusBar().addWidget(bar)
+    def fromByteToJson(self, res):
+        pom = res
+        pom = pom.decode('utf_8')
+        pom = json.loads(pom)
+        return pom
+
+    def importMap(self, x, operation, s = 0): ##s je počet vrstev úspěšně nahraných na server   
+        if (s != 0):
+            self.dlg.progressBar.show() 
+            self.dlg.label_import.show()
+        tempFile = tempfile.gettempdir() + os.sep + "atlas" + os.sep + "compsite.json"
+        
+        try:
+            existingLayers = self.isLayerInComposite(x)
+        except:
+            existingLayers = []        
+        successful = s
+        with open(tempFile, 'w') as outfile:  
+            json.dump(self.compositeList[x], outfile)
+        jsonPath = tempfile.gettempdir() + os.sep + "atlas" + os.sep + "compsite.json"
+        with open(jsonPath, 'rb') as f:
+            d = json.load(f)
+
+        files = {'file': (jsonPath, open(jsonPath, 'rb')),} 
+        data = { 'name' :  self.compositeList[x]['name'], 'title' : self.compositeList[x]['title'], 'description' : self.compositeList[x]['abstract']} 
+        req = requests.get(self.URI+'/rest/'+self.laymanUsername+'/maps/'+self.compositeList[x]['name'])
+        mapCode = req.status_code ## test jestli vrstva na serveru existuje. Pokud ne = error 404
+        if (mapCode == 404 or operation == "mod" or operation == "del"):
+        #if(True):
+            if (operation == "add"):                
+                msgbox = QMessageBox(QMessageBox.Question, "Import Map", "Chcete přidat do kompozice "+str(successful)+" vrstev?") 
+            if (operation == "mod"): 
+                #msgbox = QMessageBox(QMessageBox.Question, "Import Map", "Do you want save changes?") 
+                
+                self.dlg.close()
+                try:
+                    self.afterCloseEditMapDialog()
+                except: 
+                    pass
+                print(self.URI+'/rest/'+self.laymanUsername+'/maps/'+self.compositeList[x]['name'])       
+              
+                response = requests.delete(self.URI+'/rest/'+self.laymanUsername+'/maps/'+self.compositeList[x]['name'],headers = self.authHeader)
+                print(response.content)
+                print("deleted")
+                response = requests.post(self.URI+'/rest/'+self.laymanUsername+'/maps', files=files, data = data, headers = self.authHeader)
+                #self.dlg.show()
+                return
+            if (operation == "del"):
+                msgbox = QMessageBox(QMessageBox.Question, "Import Map", "Chcete smazat vybranou vrstvu?")
+          
+            try: # jedná se o mod pokud je except
+                msgbox.addButton(QMessageBox.Yes)
+                msgbox.addButton(QMessageBox.No)
+                msgbox.setDefaultButton(QMessageBox.No)
+                reply = msgbox.exec()
+            except:
+                pass
+                
+            if (reply == QMessageBox.Yes):
+                response = requests.post(self.URI+'/rest/'+self.laymanUsername+'/maps', files=files, data = data, headers = self.authHeader)
+                print(response.content)
+                data = response.content
+                self.dlg.progressBar.hide() 
+               # self.refreshItems()## refresh formuláře
+                if (operation != "mod"):
+                    self.refreshLayerList()
+                
+            else:
+                if (operation == "add"):
+                    self.dlg.progressBar.setValue(0)                
+     
+        else:
+            print(self.URI+'/rest/'+self.laymanUsername+'/maps/'+self.compositeList[x]['name'])       
+            files = {'file': (jsonPath, open(jsonPath, 'rb')),} 
+            response = requests.patch(self.URI+'/rest/'+self.laymanUsername+'/maps/'+self.compositeList[x]['name'], data = data, files=files, headers = self.authHeader, verify=False)
+            try:
+                self.refreshLayerList()
+            except:
+                ## nacházíme se v jiném formuláři, není co refreshovat
+                pass
+            #if (operation == "add"):
+            #    print(len(existingLayers))
+            #    msgbox = QMessageBox(QMessageBox.Question, "Layman", "Vybraná vrstva bude přidána do kompozice.")
+            #    #if(len(existingLayers) == 0):
+                    
+            #    #    #if (successful != 0):
+            #    #    msgbox = QMessageBox(QMessageBox.Question, "Layman", "Vybraná vrstva bude přidána do kompozice.")
+            #    #else:
+            #    #  #  msgbox = QMessageBox(QMessageBox.Question, "Import Map", "Kompozice již obsauje vrstvy: "+(', '.join(existingLayers))+". Chcete vybrané vrstvy opravdu znovu přidat?.")
+            #    #     msgbox = QMessageBox(QMessageBox.Question, "Layman", "Vybraná vrstva bude přidána do kompozice.")
+            #if (operation == "del"):
+            #    msgbox = QMessageBox(QMessageBox.Question, "Import Map", "Chcete smazat vybranou vrstvu?")
+            #if (operation == "mod"):
+            #    msgbox = QMessageBox(QMessageBox.Question, "Import Map", "Chcete uložit upravenou mapu?")
+            #msgbox.addButton(QMessageBox.Yes)
+            #msgbox.addButton(QMessageBox.No)
+            #msgbox.setDefaultButton(QMessageBox.No)
+            #reply = msgbox.exec()
+            #if (reply == QMessageBox.Yes):            
+            #    print(self.URI+'/rest/'+self.laymanUsername+'/maps/'+self.compositeList[x]['name'])       
+            #    files = {'file': (jsonPath, open(jsonPath, 'rb')),} 
+            #    response = requests.patch(self.URI+'/rest/'+self.laymanUsername+'/maps/'+self.compositeList[x]['name'], data = data, files=files, headers = self.authHeader, verify=False)
+   
+            #    try:
+            #        self.refreshLayerList()
+            #    except:
+            #        ## nacházíme se v jiném formuláři, není co refreshovat
+            #        pass
+            #if (reply == QMessageBox.No):
+                
+            #    self.compositeList = copy.deepcopy(self.compositeListOld)
+            #    #self.refreshItems()##refresh formulare
+               # self.refreshLayerList()
+        try: ## některé formuláře nemají progress bar
+            self.dlg.progressBar.hide() 
+            self.dlg.label_import.hide() 
+        except:
+            pass
+    def deleteLayer(self, layerName):
+        url = self.URI+'/rest/'+self.laymanUsername+"/layers/" + layerName
+        r = requests.delete(url)
+        print (r.content)
+    def getActiveLayer(self):
+        layer = self.iface.activeLayer()
+        return layer
+    
+    def createComposite(self, name, title):
+      #  if (name == "" or title == ""):
+        if (title == ""):
+            QMessageBox.information(None, "Message", "Není vyplněn titulek!")
+        else:
+            name = self.removeUnacceptableChars(title)
+            data = self.getEmptyComposite(name,title)
+            print (data)
+            self.compositeList.append(data)   
+            x = len(self.compositeList) - 1
+            self.importCleanComposite(x)
+            try:
+                self.refreshCompositeList()
+            except:
+                pass
+
+
+    def patchLayer(self, layer_name, data):
+        print("patch layer")
+        self.json_export(layer_name)
+        self.layerName = layer_name.lower()
+        
+        sldPath = self.getTempPath(self.layerName).replace("geojson", "sld")
+        geoPath = self.getTempPath(self.layerName)
+        ##self.layerName = self.layerName
+        print(sldPath)
+        if(os.path.isfile(sldPath)): ## existuje sld?
+            files = [('file', open(geoPath, 'rb')), ('sld', open(sldPath, 'rb'))]
+            print("sld")
+        else:
+            files = {'file': (geoPath, open(geoPath, 'rb')),}  
+            print("ne sld")
+        layer_name = layer_name.lower()
+        layer_name = layer_name.replace(" ", "_")
+        url = self.URI+'/rest/'+self.laymanUsername+"/layers/" + layer_name
+        print(url)
+        r = requests.patch(url, files=files, data = data, headers = self.authHeader, verify=False)
+        print(r.content)
+
+    def getTempPath(self, name):
+
+        print (name)
+        if type(name) is tuple:
+            return (name[0] +  name[1])
+        else:
+            tempFile = tempfile.gettempdir() + os.sep + name +'.geojson'
+
+            return tempFile
+    def sendLayer(self):       
+        layer = self.getActiveLayer()      
+        if (layer == None):
+            QMessageBox.information(None, "Message", "Neexistuje žádná vrstva k uložení")
+        else:
+            self.json_export()
+            self.postRequest()
+    def getExistingLayers(self):
+        url = self.URI+'/rest/'+self.laymanUsername+"/layers"
+        r = requests.get(url = url) 
+        data = r.json()
+        for x in range(len(data)):
+            print(data[x]['name'])
+        return data
+    def checkExistingLayer(self, layerName):
+        layerName = self.removeUnacceptableChars(layerName)
+        url = self.URI+'/rest/'+self.laymanUsername+"/layers"
+        r = requests.get(url = url) 
+        data = r.json()
+        
+        pom = set()
+        for x in range(len(data)):
+            pom.add((data[x]['name']))
+        layerName = layerName.replace(" ", "_").lower()
+        print(layerName)
+        print(pom)
+        if (layerName in pom):
+            return True
+        else:
+            return False
+   
+    def removeUnacceptableChars(self, input):
+        input = input.lower()
+        input = input.replace("ř","r")
+        input = input.replace("š","s")
+        input = input.replace("ž","z")
+        input = input.replace("ů","u")
+        input = input.replace("ú","u")
+        input = input.replace(" ","_")
+        input = input.replace("é","e")
+        input = input.replace("í","i")
+        input = input.replace("ý","y")
+        input = input.replace("á","a")
+        input = input.replace("ó","o")
+        input = input.replace("č","c")
+        input = input.replace("ď","d")
+        input = input.replace("ě","e")
+        input = input.replace("ť","t")
+        input = re.sub(r'[?|$|.|!]',r'',input)
+        
+       # iface.messageBar().pushWidget(iface.messageBar().createMessage("Layman:", "Diacritics in name of layer was replaced."), Qgis.Success, duration=3)
+        return input
+    def removeUnacceptableChars2(self, input):
+        input = input.encode('utf-8')
+        input = input.hex()
+        
+       # iface.messageBar().pushWidget(iface.messageBar().createMessage("Layman:", "Diacritics in name of layer was replaced."), Qgis.Success, duration=3)
+        return input
+    def test (self):
+        item = self.dlgGetLayers.items.currentItem().text()
+        print( item)
+    
+    def isLayerInComposite(self, x):      
+        layers =[]
+        layers.append(self.dlg.mMapLayerComboBox.currentLayer())
+        print (self.URI+'/rest/'+self.laymanUsername+'/maps/'+self.compositeList[x]['name']+'/file')
+        req = requests.get (self.URI+'/rest/'+self.laymanUsername+'/maps/'+self.compositeList[x]['name']+'/file')
+        data = req.json()
+       
+        print (data['abstract'])
+        print (len(self.compositeList[x]['layers']))
+        existingLayers = []
+        for i in range (0, len(data['layers'])):
+            for j in range (0, len(layers)):
+                if (data['layers'][i]['params']['LAYERS'] in layers[j].name() ):
+                    existingLayers.append(data['layers'][i]['params']['LAYERS'])
+
+        return existingLayers
+    def getLayerInCompositePosition(self, x):      
+        layers =[]
+        layers.append(self.dlg.mMapLayerComboBox.currentLayer())
+        print (self.URI+'/rest/'+self.laymanUsername+'/maps/'+self.compositeList[x]['name']+'/file')
+        req = requests.get (self.URI+'/rest/'+self.laymanUsername+'/maps/'+self.compositeList[x]['name']+'/file')
+        data = req.json()
+       
+        print (data['abstract'])
+        print (len(self.compositeList[x]['layers']))
+        existingLayers = []
+        j = 0
+        for i in range (0, len(data['layers'])):
+            for j in range (0, len(layers)):
+                if (data['layers'][i]['params']['LAYERS'] in layers[j].name() ):
+                  #  existingLayers.append(data['layers'][i]['params']['LAYERS'])
+                   j = i
+                   print("founded")
+
+        return j
+
+    def isRasterLayerInComposite(self, x, name):
+        req = requests.get (self.URI+'/rest/'+self.laymanUsername+'/maps/'+self.compositeList[x]['name']+'/file')
+        data = req.json()
+        existingLayers = []
+        for i in range (0, len(data['layers'])):
+            if (data['layers'][i]['params']['LAYERS'] ==  name ):
+                existingLayers.append(data['layers'][i]['params']['LAYERS'])
+        return existingLayers
+    
+    def addComposite(self, data, service, groupName = ''):      
+        #self.compositeList.append (data)
+        print(len(data['layers']))
+        ##for x in range(0, len(data['layers'])): 
+        for x in range(len(data['layers'])- 1, -1, -1):          
+          #  repairUrl = self.convertUrlFromHex(data['layers'][x]['url'])  
+            repairUrl = self.URI+"/geoserver/"+self.laymanUsername+"/ows"
+            layerName = data['layers'][x]['params']['LAYERS']
+            format = data['layers'][x]['params']['FORMAT']
+           #  epsg = str(data['groups']['projection']).upper()
+            epsg = 'EPSG:4326' 
+            #abstract = data['data']['layers'][x]['params']['ABSTRACT']
+            wmsName = data['layers'][x]['params']['LAYERS']
+            
+            print("groupName " +groupName)
+            print("groupName " +layerName)
+            
+            print("groupName " +format)
+            print("groupName " +epsg)
+            layerNameTitle = self.getLayerTitle(layerName)
+            print("groupName " +layerNameTitle)
+            
+            
+            if service == 'WMS':         
+                self.loadWms(repairUrl, layerName,layerNameTitle, format,epsg, groupName)
+
+            if service == 'WFS':          
+                self.loadWfs(repairUrl, layerName,layerNameTitle, groupName)
+    def loadService(self, data, service, groupName = ''):     
+        
+        #print(len(data['layers']))
+        for x in range(len(data['layers'])- 1, -1, -1):       ## descending order 
+            #repairUrl = self.convertUrlFromHex(data['layers'][x]['url'])  
+            repairUrl = self.URI+"/geoserver/"+self.laymanUsername+"/ows"
+            layerName = data['layers'][x]['params']['LAYERS']
+            format = data['layers'][x]['params']['FORMAT']
+           #  epsg = str(data['groups']['projection']).upper()
+            epsg = 'EPSG:4326' 
+            #abstract = data['data']['layers'][x]['params']['ABSTRACT']
+            wmsName = data['layers'][x]['params']['LAYERS']  
+            layerNameTitle = data['layers'][x]['title']
+            if self.checkLayerOnLayman(layerName):
+                if service == 'WMS':         
+                    print("zzzzzzz" +layerName)
+                    self.loadWms(repairUrl, layerName,layerNameTitle, format,epsg, groupName)
+
+                if service == 'WFS':          
+                    self.loadWfs(repairUrl, layerName,layerNameTitle, groupName)
+            else:
+                QMessageBox.information(None, "Layman", "Layer: "+layerName + " is corrupted and will not be loaded.")
+    def getLayerTitle(self, layerName):
+        layerName = self.removeUnacceptableChars(layerName)
+        url = self.URI+'/rest/'+self.laymanUsername+'/layers/'+layerName
+        r = requests.get(url = url)
+        data = r.json()
+        print(data)
+        title = data['title']
+        return title
+        
+    def loadWms(self, url, layerName,layerNameTitle, format, epsg, groupName = ''):      
+        print("debug")
+        print(groupName)
+        print(layerNameTitle)
+        print(layerName)
+        
+        layerName = self.removeUnacceptableChars(layerName)
+        print(layerName)
+        epsg = "EPSG:4326"
+        urlWithParams = 'contextualWMSLegend=0&crs='+epsg+'&IgnoreReportedLayerExtents=1&dpiMode=7&featureCount=10&format=image/png&layers='+layerName+'&styles=&url=' + url
+        print(urlWithParams)
+        print("test")
+        print(layerNameTitle)
+        rlayer = QgsRasterLayer(urlWithParams, layerNameTitle, 'wms')
+        try:
+            print("extents")
+            print(rlayer.ignoreExtents())
+        except:
+            print("ignoreExtents works only with qgis 3.10 and higher")
+            pass # pro qgis 3.10 a vys
+            
+           
+        if (groupName != ''):
+            self.addWmsToGroup(groupName,rlayer)
+        else:
+            QgsProject.instance().addMapLayer(rlayer)
+
+    def loadWfs(self, url, layerName,layerNameTitle, groupName = ''):
+        layerName = self.removeUnacceptableChars(layerName)
+        epsg = 'EPSG:4326'        
+        uri = self.URI+"/geoserver/"+self.laymanUsername+"/ows?srsname="+epsg+"&typename="+self.laymanUsername+":"+layerName+"&restrictToRequestBBOX=1&pagingEnabled=True&version=auto&request=GetFeature&service=WFS"
+        
+        print(uri)        
+        vlayer = QgsVectorLayer(uri, layerNameTitle, "WFS")
+        print(vlayer.isValid())  
+        if (groupName != ''):
+            self.addWmsToGroup(groupName,vlayer)
+        else:
+            QgsProject.instance().addMapLayer(vlayer)
+    def addWmsToGroup(self, groupName, layer):
+        root = QgsProject.instance().layerTreeRoot()
+        group = root.findGroup(groupName)
+        if not(group):
+            group = root.addGroup(groupName)  
+            group = self.reorderToTop(groupName)
+        QgsProject.instance().addMapLayer(layer,False)
+        group.insertChildNode(0,QgsLayerTreeLayer(layer))         
+    def reorderToTop(self, name):
+        root = QgsProject.instance().layerTreeRoot()
+        for ch in root.children():
+            if ch.name() == name:
+                _ch = ch.clone()
+                root.insertChildNode(0, _ch)
+                root.removeChildNode(ch)
+        return _ch
+    def convertUrlFromHex(self, url):
+        url = url.replace('%3A',':')
+        url = url.replace('%2F','/')
+        url = url.replace('%3F','?')
+        url = url.replace('%3D','=')
+        url = url.replace('%26','&') 
+        return url
+
+    def checkEpsg(self, name):
+        ret = False
+        layer = QgsProject.instance().mapLayersByName(name)
+        layerCRS = layer[0].crs().authid()
+        if ((layerCRS == 'EPSG:4326') or (layerCRS == 'EPSG:3857')):
+            ret = True
+        return ret
+
+    def registerLayer(self, name):
+        sldPath = self.getTempPath(name).replace("geojson", "sld").lower()
+        geoPath = self.getTempPath(name).lower()
+
+        url = "http://layman.lesprojekt.cz/rest/"+self.laymanUsername+"/layers"
+                             
+        files = {'sld': (sldPath, open(sldPath, 'rb')),} # nahrávám sld
+        payload = {        
+            'file': name.lower()+".geojson",
+            'title': name
+            }    
+        response = requests.request("POST", url, files = files, data=payload, headers = self.authHeader)    
+        print(response.text)
+
+    def read_in_chunks(self, file_object): ## cca 1MB chunk převzato z laymana test klienta
+        chunk_size=self.CHUNK_SIZE
+        while True:
+            data = file_object.read(chunk_size)
+            if not data:
+                break
+            yield data
+    
+    def postInChunks(self, layer_name, reqType):
+        print(reqType)
+        if (reqType == "patch"):
+            url = self.URI+'/rest/'+self.laymanUsername+'/layers/'+layer_name.lower().replace(" ", "_")
+            r = requests.delete(url,headers = self.authHeader)
+           # print(r.content)
+        
+        self.registerLayer(layer_name)
+        layer_name = str(layer_name).lower() 
+        filePath = os.path.join(tempfile.gettempdir(), "atlas_chunks" ) ## chunky se ukládají do adresáře v tempu
+        
+        if not (os.path.exists(filePath)):
+            os.mkdir(filePath)
+        file = self.getTempPath(layer_name) 
+        f = open(file, 'rb')
+        arr = []
+        for piece in self.read_in_chunks(f):
+            arr.append(piece)
+        ##layer_name = layer_name.lower()
+        url = self.URI+'/rest/'+self.laymanUsername+'/layers/'+layer_name.lower().replace(" ", "_")+'/chunk'     
+        resumableFilename = layer_name+'.geojson'
+        layman_original_parameter = "file"  
+        resumableTotalChunks = len(arr)
+        try:
+            for i in range (1, len(arr)+1):  ##chunky jsou počítané od 1 proto +1  
+                print("chunk" + str(i))
+                file = arr[i-1] # rozsekaná část souboru
+                resumableChunkNumber = i  # cislo casti
+                payload = {
+                'file' : "chunk"+str(i)+".geojson",
+                'resumableFilename': resumableFilename,
+                'layman_original_parameter': layman_original_parameter,
+                'resumableChunkNumber': i,
+                'resumableTotalChunks': resumableTotalChunks
+                } 
+         
+                f = open(filePath + os.sep+"chunk"+str(i)+".geojson", "wb")
+                f.write(bytearray(arr[i-1]))
+                f.close()              
+                files = {'file': (layer_name.lower().replace(" ", "_")+".geojson", open(filePath +os.sep+ "chunk"+str(i)+".geojson", 'rb')),}              
+                response = requests.post(url, files = files, data=payload, headers = self.authHeader)
+
+                print(response.content)
+            iface.messageBar().pushWidget(iface.messageBar().createMessage("Import:", " Layer  " + layer_name + " was imported successfully."), Qgis.Success, duration=3)
+        except:
+            iface.messageBar().pushWidget(iface.messageBar().createMessage("Import:", " Layer  " + layer_name + " was not imported successfully!"), Qgis.Warning, duration=3)
+
+############################################# auth part############################
+
+    def startThread(self): 
+        self.thread1 = threading.Thread(target=self.refreshToken)
+        self.thread1.start()
+
+    def refreshToken(self):
+        #self.expires_in = 60
+        path = tempfile.gettempdir() + os.sep + "atlas" + os.sep + "tsts.txt" 
+        i = 0
+        tokenEndpoint = "https://www."+self.liferayServer+"/o/oauth2/token"
+        while (i < self.expires_in):        
+            f = open(path, "a")
+            f.write(str(i))
+
+            f.close()            
+            time.sleep(1)         
+            if i == self.expires_in - 4:
+            
+               
+                data = {'grant_type':'refresh_token',
+                        'refresh_token': self.refresh_token,
+                        'client_id': self.client_id,   ##'id-3462f94b-875c-9185-4ced-b69841f24b3', 
+                        'redirect_uri':'http://localhost:3000/client/authn/oauth2-liferay/callback', 
+                        'code_verifier':self.code_verifier  ##'test'
+                        } 
+                
+                r = requests.post(url = tokenEndpoint, data = data, headers = self.authHeader) 
+                res = self.fromByteToJson(r.content)
+                self.access_token = res['access_token']
+                self.refresh_token = res['refresh_token']
+                self.expires_in = res['expires_in']
+                print(self.access_token)
+                self.setAuthHeader()
+                i = 0
+            else:
+                i += 1
+        
+        
+        
+        
+
+
+
+    
+    def authOptained (self):        
+        self.dlg.pushButton_Continue.setEnabled(True)
+
+        self.menu_Connection.setEnabled(True)
+        self.menu_saveLocalFile.setEnabled(False)
+        self.menu_loadJson.setEnabled(True)
+        self.menu_ImportLayerDialog.setEnabled(True)
+        self.menu_AddLayerDialog.setEnabled(True) 
+        self.menu_AddMapDialog.setEnabled(True)       
+        self.menu_ImportLayerDialog.setEnabled(True)
+        self.menu_ImportMapDialog.setEnabled(True)       
+     #   self.menu_DeleteMapDialog.setEnabled(True)
+    #    self.menu_CreateCompositeDialog.setEnabled(True)
+        self.menu_UserInfoDialog.setEnabled(True)
+        self.textbox.setText("Layman: Logged user")
+
+    def getCodeVerifier(self):
+        code_verifier = base64.urlsafe_b64encode(os.urandom(40)).decode('utf-8')
+        code_verifier = re.sub('[^a-zA-Z0-9]+', '', code_verifier)
+        self.code_verifier = code_verifier
+        return (code_verifier)
+      
+    def getCodeChallenge(self, code_verifier):
+        code_challenge = hashlib.sha256(code_verifier.encode('utf-8')).digest()
+        code_challenge = base64.urlsafe_b64encode(code_challenge).decode('utf-8')
+        code_challenge = code_challenge.replace('=', '')
+        self.code_challenge = code_challenge
+        return (code_challenge)        
+
+    def printVariables(self):
+        print (self.access_token)
+        print(self.refresh_token)
+        print(self.authHeader)
+        print(self.laymanUsername)
+
+    def getAuthCode(self):
+        path = tempfile.gettempdir() + os.sep + "atlas" + os.sep + "auth.txt"        
+        f = open(path, "r")
+        ret =  f.read()
+        f.close()
+        return ret
+
+    def getToken(self):
+        self.saveIni()
+
+        tokenEndpoint = "https://www."+self.liferayServer+"/o/oauth2/token"
+        # data to be sent to api 
+        data = {'grant_type':'authorization_code', 
+                'client_id': self.client_id, 
+                'redirect_uri':'http://localhost:3000/client/authn/oauth2-liferay/callback', 
+                'code_verifier': self.code_verifier, 
+                'code': self.getAuthCode()} 
+  
+        # sending post request and saving response as response object 
+        r = requests.post(url = tokenEndpoint, data = data, headers = self.authHeader) 
+        res = self.fromByteToJson(r.content)
+        print (res)
+        try:
+            print(res['access_token'])
+            print(res['expires_in'])
+            print(res['refresh_token'])
+        except:
+            QMessageBox.information(None, "Message", "Autorization was not sucessfull! Please try it again.")
+            return
+        self.access_token = res['access_token']
+        self.refresh_token = res['refresh_token']
+        self.expires_in = res['expires_in']
+        self.setAuthHeader()
+        data ={
+            'access_token': res['access_token'], 
+            'refresh_token': res['refresh_token'],
+            'expires_in':res['expires_in']
+            }
+        path = tempfile.gettempdir() + os.sep + "atlas" + os.sep + "tokens.json"        
+        with open(path, 'w') as outfile:
+            json.dump(data, outfile)
+        self.startThread()
+        self.registerUserIfNotExists()
+        self.dlg.close()
+        
+    def setAuthHeader(self):
+        self.authHeader ={
+          "Authorization": "Bearer " + self.access_token, 
+          "AuthorizationIssUrl" : 'https://www.'+self.liferayServer+'/o/oauth2/authorize'
+        } 
+        
+    def registerUserIfNotExists(self):
+        userEndpoint = "http://layman.lesprojekt.cz/rest/current-user"
+        #self.laymanUsername = self.dlg.lineEdit_userName.text()
+        id = self.client_id.replace('-', '')
+        user = {'username':self.Agrimail}  
+        #user =  self.Agrimail        
+        print("authheader: "+ str(self.authHeader))
+        r = requests.patch(url = userEndpoint, data = user, headers = self.authHeader)
+        res = r.text
+        res = self.fromByteToJson(r.content)
+        print (res)
+        print(user)
+        print(res)
+        try:
+           # if res['message'] == 'User already reserved username.': # res['code'] == 34, code 35 je pokud již jiný uživatel má účet, který chceme registrovat
+           if res['code'] == 34: # res['code'] == 34, code 35 je pokud již jiný uživatel má účet, který chceme registrovat (code 35 pravděpodobně nemůže nastat)
+
+                print("user exists")
+                self.laymanUsername = res['detail']['username']
+            #self.laymanUsername = res['username']
+            #else:
+            #    self.laymanUsername =  user['username']
+        except:
+
+            print("creating new user: " + res['username'])
+            self.laymanUsername =  res['username']
+        #API_ENDPOINT = "http://layman.lesprojekt.cz/rest/current-user"
+        #headers ={
+        #  "Authorization": "Bearer "+ self.access_token, 
+        #  "AuthorizationIssUrl" : 'https://www.'+self.liferayServer+'/o/oauth2/authorize'
+        #} 
+
+
+    def openAuthLiferayUrl(self):
+        self.liferayServer = self.dlg.lineEdit_server.text()
+        self.URI = self.dlg.lineEdit_serverLayman.text()
+        self.getCodeChallenge(self.getCodeVerifier()) ##generování kódů
+        self.client_id = self.dlg.lineEdit_AgriID.text()
+        path = tempfile.gettempdir() + os.sep + "atlas" + os.sep + "auth.txt" 
+        self.watcher = QFileSystemWatcher()
+        self.watcher.addPath(path)
+        self.watcher.fileChanged.connect(self.authOptained)
+      
+        
+            #################       
+     
+        print ("##### flask server is starting #####")                     
+        self.flaskThread = StartFlaskDaemon()
+        self.flaskThread.daemon = True
+        self.flaskThread.start()       
+        url = 'https://www.'+self.liferayServer+'/o/oauth2/authorize?response_type=code&client_id='+self.client_id+'&redirect_uri=http%3A%2F%2Flocalhost:3000%2Fclient%2Fauthn%2Foauth2-liferay%2Fcallback&code_challenge='+self.code_challenge ##n4bQgYhMfWWaL-qgxVrQFaO_TxsrC4Is0V1sFbDwCgg'
+        webbrowser.open(url, new=2)
+
+    def saveIni(self):
+        file =  os.getenv("HOME") + os.sep + ".layman" + os.sep + 'layman_user.INI'  
+        dir = os.getenv("HOME") + os.sep + ".layman"
+        if not (os.path.isdir(dir)):
+            try:  
+                os.mkdir(dir)
+            except OSError:  
+                print ("vytváření adresáře selhalo")
+        config = configparser.ConfigParser()
+
+        config['DEFAULT']['login'] = self.Agrimail
+        config['DEFAULT']['id'] = self.client_id
+        print("saveliferay" + self.liferayServer)
+        config['DEFAULT']['server'] = self.liferayServer
+        config['DEFAULT']['layman'] = self.URI
+        
+
+        with open(file, 'w') as configfile:
+            config.write(configfile)        
+    def loadIni(self):
+        file =  os.getenv("HOME") + os.sep + ".layman" + os.sep +'layman_user.INI'        
+        config = configparser.ConfigParser()
+        config.read(file)
+        return config   
+
+    def layerChanged(self):  
+        
+        print(iface.activeLayer())
+        if (iface.activeLayer() != None):
+            self.menu_saveLocalFile.setEnabled(True)
+        else:
+            self.menu_saveLocalFile.setEnabled(False)
+
+
+    def run(self):
+        """Run method that loads and starts the plugin"""
+
+        if not self.pluginIsActive:
+            self.pluginIsActive = True
+
+            #print "** STARTING Atlas"
+
+            # dockwidget may not exist if:
+            #    first run of plugin
+            #    removed on close (see self.onClosePlugin method)
+            if self.dockwidget == None:
+                # Create the dockwidget (after translation) and keep reference
+                self.dockwidget = AtlasDockWidget()
+
+            
+            # connect to provide cleanup on closing of dockwidget
+            self.dockwidget.closingPlugin.connect(self.onClosePlugin)     
+            
+            self.dockwidget.pushButton.clicked.connect(self.sendLayer)   
+            self.dockwidget.pushButton_2.clicked.connect(self.loadLocalFile) 
+            self.dockwidget.pushButton_3.clicked.connect(self.saveLocalFile)
+            self.dockwidget.pushButton_getLayers.clicked.connect(self.run_getLayer)            
+            self.dlgGetLayers.pushButtonxx.clicked.connect(lambda: print(self.dlgGetLayers.items.currentItem().text()))          
+            
+            # show the dockwidget
+            # TODO: fix to allow choice of dock location
+            self.iface.addDockWidget(Qt.TopDockWidgetArea, self.dockwidget)
+            self.dockwidget.show()
+            
+class StartFlaskDaemon(threading.Thread):
+    def run(self):
+        from subprocess import Popen, PIPE
+        import platform
+        import sys
+        from pathlib import Path
+        d= os.path.dirname(Path(__file__).absolute()) + os.sep+"flask_listener" + os.sep + "flask_listener.py" 
+       
+        if platform.system() == 'Windows':
+            process = subprocess.Popen(["python", d],stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
+        else:
+            process = subprocess.Popen(["python " + d],stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
+        stdout, stderr = process.communicate()
+        print (stdout, stderr)  
+        '''Start your thread here'''
+        

+ 50 - 0
QGIS_Installer/bin/Debug/atlas/Layman_dockwidget.py

@@ -0,0 +1,50 @@
+# -*- coding: utf-8 -*-
+"""
+/***************************************************************************
+ LaymanDockWidget
+                                 A QGIS plugin
+ Layman
+ Generated by Plugin Builder: http://g-sherman.github.io/Qgis-Plugin-Builder/
+                             -------------------
+        begin                : 2019-02-15
+        git sha              : $Format:%H$
+        copyright            : (C) 2019 by jan vrobel
+        email                : vrobel.jan@seznam.cz
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ ***************************************************************************/
+"""
+
+import os
+
+from PyQt5 import QtGui, QtWidgets, uic
+from PyQt5.QtCore import pyqtSignal
+
+FORM_CLASS, _ = uic.loadUiType(os.path.join(
+    os.path.dirname(__file__), 'Layman_dockwidget_base.ui'))
+
+
+class LaymanDockWidget(QtWidgets.QDockWidget, FORM_CLASS):
+
+    closingPlugin = pyqtSignal()
+
+    def __init__(self, parent=None):
+        """Constructor."""
+        super(LaymanDockWidget, self).__init__(parent)
+        # Set up the user interface from Designer.
+        # After setupUI you can access any designer object by doing
+        # self.<objectname>, and you can use autoconnect slots - see
+        # http://doc.qt.io/qt-5/designer-using-a-ui-file.html
+        # #widgets-and-dialogs-with-auto-connect
+        self.setupUi(self)
+
+    def closeEvent(self, event):
+        self.closingPlugin.emit()
+        event.accept()

+ 51 - 0
QGIS_Installer/bin/Debug/atlas/Layman_dockwidget_base.ui

@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>AtlasDockWidgetBase</class>
+ <widget class="QDockWidget" name="AtlasDockWidgetBase">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>558</width>
+    <height>498</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Atlas</string>
+  </property>
+  <widget class="QWidget" name="dockWidgetContents">
+   <layout class="QGridLayout" name="gridLayout">
+    <item row="0" column="0">
+     <widget class="QPushButton" name="pushButton">
+      <property name="text">
+       <string>Export JSON</string>
+      </property>
+     </widget>
+    </item>
+    <item row="1" column="0">
+     <widget class="QPushButton" name="pushButton_2">
+      <property name="text">
+       <string>Nacti json</string>
+      </property>
+     </widget>
+    </item>
+    <item row="2" column="0">
+     <widget class="QPushButton" name="pushButton_3">
+      <property name="text">
+       <string>Do souboru</string>
+      </property>
+     </widget>
+    </item>
+    <item row="3" column="0">
+     <widget class="QPushButton" name="pushButton_getLayers">
+      <property name="text">
+       <string>Načti vzdálené vrstvy</string>
+      </property>
+     </widget>
+    </item>
+   </layout>
+  </widget>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

+ 5 - 5
QGIS_Installer/bin/Debug/atlas/__init__.py

@@ -1,9 +1,9 @@
 # -*- coding: utf-8 -*-
 """
 /***************************************************************************
- Atlas
+ Layman
                                  A QGIS plugin
- Atlas
+ Layman
  Generated by Plugin Builder: http://g-sherman.github.io/Qgis-Plugin-Builder/
                              -------------------
         begin                : 2019-02-15
@@ -26,11 +26,11 @@
 
 # noinspection PyPep8Naming
 def classFactory(iface):  # pylint: disable=invalid-name
-    """Load Atlas class from file Atlas.
+    """Load Layman class from file Layman.
 
     :param iface: A QGIS interface instance.
     :type iface: QgsInterface
     """
     #
-    from .Atlas import Atlas
-    return Atlas(iface)
+    from .Layman import Layman
+    return Layman(iface)

BIN
QGIS_Installer/bin/Debug/atlas/__pycache__/Atlas.cpython-37.pyc


BIN
QGIS_Installer/bin/Debug/atlas/__pycache__/Layman.cpython-37.pyc


BIN
QGIS_Installer/bin/Debug/atlas/__pycache__/Layman_dockwidget.cpython-37.pyc


BIN
QGIS_Installer/bin/Debug/atlas/__pycache__/__init__.cpython-37.pyc


+ 38 - 21
QGIS_Installer/bin/Debug/atlas/dlg_importMap.ui

@@ -13,7 +13,7 @@
     <x>0</x>
     <y>0</y>
     <width>1139</width>
-    <height>544</height>
+    <height>700</height>
    </rect>
   </property>
   <property name="sizePolicy">
@@ -25,13 +25,13 @@
   <property name="minimumSize">
    <size>
     <width>1139</width>
-    <height>544</height>
+    <height>700</height>
    </size>
   </property>
   <property name="maximumSize">
    <size>
     <width>1139</width>
-    <height>544</height>
+    <height>700</height>
    </size>
   </property>
   <property name="acceptDrops">
@@ -44,7 +44,7 @@
    <property name="geometry">
     <rect>
      <x>510</x>
-     <y>490</y>
+     <y>650</y>
      <width>151</width>
      <height>28</height>
     </rect>
@@ -59,7 +59,7 @@
      <x>420</x>
      <y>10</y>
      <width>701</width>
-     <height>471</height>
+     <height>621</height>
     </rect>
    </property>
    <property name="title">
@@ -71,7 +71,7 @@
       <x>22</x>
       <y>50</y>
       <width>351</width>
-      <height>191</height>
+      <height>311</height>
      </rect>
     </property>
     <property name="acceptDrops">
@@ -101,7 +101,7 @@
     <property name="geometry">
      <rect>
       <x>22</x>
-      <y>290</y>
+      <y>441</y>
       <width>161</width>
       <height>27</height>
      </rect>
@@ -118,7 +118,7 @@
     <property name="geometry">
      <rect>
       <x>200</x>
-      <y>290</y>
+      <y>420</y>
       <width>170</width>
       <height>170</height>
      </rect>
@@ -134,7 +134,7 @@
     <property name="geometry">
      <rect>
       <x>52</x>
-      <y>370</y>
+      <y>520</y>
       <width>181</width>
       <height>16</height>
      </rect>
@@ -262,7 +262,7 @@
     <property name="geometry">
      <rect>
       <x>200</x>
-      <y>250</y>
+      <y>380</y>
       <width>171</width>
       <height>28</height>
      </rect>
@@ -275,7 +275,7 @@
     <property name="geometry">
      <rect>
       <x>22</x>
-      <y>250</y>
+      <y>380</y>
       <width>161</width>
       <height>28</height>
      </rect>
@@ -284,6 +284,23 @@
      <string>Down</string>
     </property>
    </widget>
+   <widget class="QPushButton" name="pushButton_saveOrder">
+    <property name="geometry">
+     <rect>
+      <x>20</x>
+      <y>420</y>
+      <width>161</width>
+      <height>27</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>Save order</string>
+    </property>
+    <property name="icon">
+     <iconset>
+      <normaloff>../../../../../../../Users/Honza/.designer/backup/icons/minus.png</normaloff>../../../../../../../Users/Honza/.designer/backup/icons/minus.png</iconset>
+    </property>
+   </widget>
   </widget>
   <widget class="QGroupBox" name="groupBox_2">
    <property name="geometry">
@@ -291,11 +308,11 @@
      <x>7</x>
      <y>10</y>
      <width>391</width>
-     <height>471</height>
+     <height>621</height>
     </rect>
    </property>
    <property name="title">
-    <string>map compositions</string>
+    <string>Map compositions</string>
    </property>
    <widget class="QListWidget" name="listWidget">
     <property name="geometry">
@@ -303,7 +320,7 @@
       <x>20</x>
       <y>47</y>
       <width>341</width>
-      <height>191</height>
+      <height>311</height>
      </rect>
     </property>
    </widget>
@@ -317,14 +334,14 @@
      </rect>
     </property>
     <property name="text">
-     <string>Loaded map compositions:</string>
+     <string>Existing map compositions:</string>
     </property>
    </widget>
    <widget class="QPushButton" name="pushButton_deleteMap">
     <property name="geometry">
      <rect>
       <x>20</x>
-      <y>260</y>
+      <y>380</y>
       <width>161</width>
       <height>27</height>
      </rect>
@@ -341,7 +358,7 @@
     <property name="geometry">
      <rect>
       <x>200</x>
-      <y>260</y>
+      <y>380</y>
       <width>161</width>
       <height>28</height>
      </rect>
@@ -354,7 +371,7 @@
     <property name="geometry">
      <rect>
       <x>20</x>
-      <y>320</y>
+      <y>440</y>
       <width>161</width>
       <height>28</height>
      </rect>
@@ -367,7 +384,7 @@
     <property name="geometry">
      <rect>
       <x>20</x>
-      <y>380</y>
+      <y>500</y>
       <width>161</width>
       <height>28</height>
      </rect>
@@ -380,7 +397,7 @@
     <property name="geometry">
      <rect>
       <x>20</x>
-      <y>420</y>
+      <y>540</y>
       <width>231</width>
       <height>22</height>
      </rect>
@@ -390,7 +407,7 @@
     <property name="geometry">
      <rect>
       <x>200</x>
-      <y>380</y>
+      <y>500</y>
       <width>161</width>
       <height>28</height>
      </rect>

+ 3 - 3
QGIS_Installer/bin/Debug/atlas/metadata.txt

@@ -7,10 +7,10 @@
 # This file should be included when you package your plugin.# Mandatory items:
 
 [general]
-name=Atlas
+name=Layman
 qgisMinimumVersion=3.0
-description=Atlas
-version=0.1
+description=Layman
+version=0.9
 author=jan vrobel
 email=vrobel.jan@seznam.cz
 

BIN
QGIS_Installer/bin/Debug/layman.zip


+ 2499 - 0
QGIS_Installer/bin/Debug/layman/Layman.py

@@ -0,0 +1,2499 @@
+ # -*- coding: utf-8 -*-
+"""
+/***************************************************************************
+ Layman
+                                 A QGIS plugin
+ Layman
+ Generated by Plugin Builder: http://g-sherman.github.io/Qgis-Plugin-Builder/
+                              -------------------
+        begin                : 2019-02-15
+        git sha              : $Format:%H$
+        copyright            : (C) 2019 by jan vrobel
+        email                : vrobel.jan@seznam.cz
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ ***************************************************************************/
+"""
+from PyQt5.QtCore import QSettings, QTranslator, qVersion, QCoreApplication, Qt, QFileSystemWatcher, QRegExp,QDir
+from PyQt5.QtGui import QIcon, QPixmap, QRegExpValidator, QDoubleValidator
+from PyQt5.QtWidgets import QAction, QTreeWidget, QTreeWidgetItem, QMessageBox, QLabel, QProgressDialog, QDialog, QProgressBar,QListWidgetItem
+# Initialize Qt resources from file resources.py
+from .resources import *
+import re
+#from .flaskServer import *
+from multiprocessing import Process
+from pathlib import Path 
+# Import the code for the DockWidget
+from builtins import str
+from builtins import range
+from builtins import object
+import json
+import zipfile
+import tempfile
+import configparser
+import shutil
+import uuid
+import copy
+import webbrowser
+from .Layman_dockwidget import LaymanDockWidget
+import os.path
+import tempfile
+import qgis.core
+from qgis.core import *
+import platform
+import os
+import qgis.utils
+import qgis.gui
+from qgis.gui import QgsMapCanvas
+from qgis.core import QgsApplication
+from qgis.utils import iface
+from PyQt5.QtWidgets import QApplication, QWidget, QPushButton, QMessageBox, QWidget, QInputDialog, QLineEdit, QFileDialog
+import requests
+import tempfile
+import time
+from urllib.request import urlopen
+import subprocess
+import threading
+#from flask import Flask, request, jsonify
+import base64
+import hashlib
+import html
+import re
+import urllib.parse
+from .ogr2ogr import main
+## forms
+from .dlg_GetLayers import GetLayersDialog
+from .dlg_importMap import ImportMapDialog
+from .dlg_deleteMap import DeleteMapDialog
+from .dlg_importLayer import ImportLayerDialog
+from .dlg_addLayer import AddLayerDialog
+from .dlg_addMap import AddMapDialog
+from .dlg_createComposite import CreateCompositeDialog
+from .dlg_deleteLayerFromMap import DeleteLayerFromMapDialog
+from .dlg_editMap import EditMapDialog
+from .dlg_ConnectionManager import ConnectionManagerDialog
+from .dlg_userInfo import UserInfoDialog
+
+
+
+class Layman:
+    """QGIS Plugin Implementation."""
+
+    def __init__(self, iface):
+        """Constructor.
+        
+        :param iface: An interface instance that will be passed to this class
+            which provides the hook by which you can manipulate the QGIS
+            application at run time.
+        :type iface: QgsInterface
+        """
+        # Save reference to the QGIS interface
+        self.iface = iface
+
+        # initialize plugin directory
+        self.plugin_dir = os.path.dirname(__file__) 
+        
+        ## init global variables
+      #  global filename 
+        self.client_id = None
+        self.filename = None
+        self.layerName = None
+        self.username = 'browser'
+        self.EPSG = 'EPSG:3857'
+        self.composite = None
+        self.thread1 = None
+        self.compositeList = []
+        self.compositeListOld = []
+        self.CHUNK_SIZE = 1048576 ## s touto hodnotou pracuje layman klient (cca 1MB soubor)
+        self.URI = "http://layman.lesprojekt.cz"
+        self.access_token = None
+        self.expires_in = None
+        self.refresh_token = None
+        self.laymanUsername = ""
+        self.authHeader = None
+        self.code_verifier = None
+        self.code_challenge = None
+        self.Agrimail = None
+        self.loadedInMemory = False
+        self.liferayServer = None
+        self.laymanServer = None
+        self.mapsChanged = set()
+        self.uri = 'http://layman.lesprojekt.cz/rest/'
+        self.iface.layerTreeView().currentLayerChanged.connect(lambda: self.layerChanged())
+        
+        
+     #   global dlgGetLayers 
+        self.dlgGetLayers= GetLayersDialog()
+        # initialize locale
+        locale = QSettings().value('locale/userLocale')[0:2]
+        locale_path = os.path.join(
+            self.plugin_dir,
+            'i18n',
+            'Layman_{}.qm'.format(locale))
+
+        if os.path.exists(locale_path):
+            self.translator = QTranslator()
+            self.translator.load(locale_path)
+
+            if qVersion() > '4.3.3':
+                QCoreApplication.installTranslator(self.translator)
+
+        # Declare instance attributes
+        self.actions = []
+        self.menu = self.tr(u'&Layman')
+        # TODO: We are going to let the user set this up in a future iteration
+        self.toolbar = self.iface.addToolBar(u'Layman')
+        self.toolbar.setObjectName(u'Layman')
+
+        #print "** INITIALIZING Atlas"
+
+        self.pluginIsActive = False
+        self.dockwidget = None
+        ## prepare temp dir
+        tempDir = tempfile.gettempdir() + os.sep + "atlas" 
+        try:
+            os.mkdir(tempDir)
+            print("Directory " , tempDir ,  " Created ") 
+        except FileExistsError:
+            print("Directory " , tempDir ,  " already exists")
+
+
+    # noinspection PyMethodMayBeStatic
+    def tr(self, message):
+        """Get the translation for a string using Qt translation API.
+
+        We implement this ourselves since we do not inherit QObject.
+
+        :param message: String for translation.
+        :type message: str, QString
+
+        :returns: Translated version of message.
+        :rtype: QString
+        """
+        # noinspection PyTypeChecker,PyArgumentList,PyCallByClass
+        return QCoreApplication.translate('Layman', message)
+
+
+    def add_action(
+        self,
+        icon_path,
+        text,
+        callback,
+        enabled_flag=True,
+        add_to_menu=True,
+        add_to_toolbar=True,
+        status_tip=None,
+        whats_this=None,
+        parent=None):
+        
+
+        icon = QIcon(icon_path)
+        action = QAction(icon, text, parent)
+        action.triggered.connect(callback)
+        action.setEnabled(enabled_flag)
+
+        if status_tip is not None:
+            action.setStatusTip(status_tip)
+
+        if whats_this is not None:
+            action.setWhatsThis(whats_this)
+
+        if add_to_toolbar:
+            self.toolbar.addAction(action)
+
+        if add_to_menu:
+            self.iface.addPluginToMenu(
+                self.menu,
+                action)
+
+        self.actions.append(action)
+
+        return action
+
+
+    def initGui(self):
+        """Create the menu entries and toolbar icons inside the QGIS GUI."""
+
+        #icon_path = ':/plugins/Atlas/icon.png'
+        #self.add_action(
+        #    icon_path,
+        #    text=self.tr(u''),
+        #    callback=self.run,
+        #    parent=self.iface.mainWindow())
+        #self.first_start = True
+
+        ################## user
+        self.textbox = QLabel(self.iface.mainWindow())
+        # Set width
+        self.textbox.setFixedWidth(140)
+        # Add textbox to toolbar
+        self.txtAction = self.toolbar.addWidget(self.textbox)
+        # Set tooltip
+        self.txtAction.setToolTip(self.tr(u'Current Row Number'))
+        # Set callback
+        self.textbox.setText("Layman")
+
+        ################ end usericon_path = self.plugin_dir + os.sep + 'icons' + os.sep + 'login.png'
+        icon_path = self.plugin_dir + os.sep + 'icons' + os.sep + 'login.png'
+        self.menu_Connection = self.add_action(
+            icon_path,
+            text=self.tr(u'Login'),
+            callback=self.run_login,
+            enabled_flag=True,
+            parent=self.iface.mainWindow())
+
+
+        icon_path = self.plugin_dir + os.sep + 'icons' + os.sep + 'save.png'
+        self.menu_saveLocalFile = self.add_action(
+            icon_path,
+            text=self.tr(u'Save as to JSON and SLD'),
+            callback=self.saveLocalFile,
+            enabled_flag=False,
+            parent=self.iface.mainWindow())
+
+        self.first_start = True
+        icon_path = self.plugin_dir + os.sep + 'icons' + os.sep + 'file.png'
+        self.menu_loadJson = self.add_action(
+            icon_path,
+            text=self.tr(u'Load from JSON'),
+            callback=self.loadLocalFile,
+            enabled_flag=False,
+            parent=self.iface.mainWindow())
+        self.first_start = True
+
+        icon_path = self.plugin_dir + os.sep + 'icons' + os.sep + 'layers-up.png'
+        self.menu_ImportLayerDialog = self.add_action(
+            icon_path,
+            text=self.tr(u'Export layer to server'),
+            callback=self.run_ImportLayerDialog,
+            enabled_flag=False,
+            parent=self.iface.mainWindow())  
+        icon_path = self.plugin_dir + os.sep + 'icons' + os.sep + 'layers-down.png'
+        self.menu_AddLayerDialog = self.add_action(
+            icon_path,
+            text=self.tr(u'Load layer from server'),
+            callback=self.run_AddLayerDialog,
+            enabled_flag=False,
+            parent=self.iface.mainWindow()) 
+        icon_path = self.plugin_dir + os.sep + 'icons' + os.sep + 'upload-map.png'
+        self.menu_ImportMapDialog = self.add_action(
+            icon_path,
+            text=self.tr(u'Manage maps'),
+            callback=self.run_ImportMapDialog,
+            enabled_flag=False,
+            parent=self.iface.mainWindow())  
+        icon_path = self.plugin_dir + os.sep + 'icons' + os.sep + 'download_map.png'
+        self.menu_AddMapDialog = self.add_action(
+            icon_path,
+            text=self.tr(u'Load map from server'),
+            callback=self.run_AddMapDialog,
+            enabled_flag=False,
+            parent=self.iface.mainWindow())   
+        
+        #icon_path = self.plugin_dir + os.sep + 'icons' + os.sep + 'delete.png'
+        #self.menu_DeleteMapDialog = self.add_action(
+        #    icon_path,
+        #    text=self.tr(u'Delete map'),
+        #    callback=self.run_DeleteMapDialog,
+        #    enabled_flag=False,
+        #    parent=self.iface.mainWindow())  
+        #icon_path = self.plugin_dir + os.sep + 'icons' + os.sep + 'globus.png'
+        #self.menu_CreateCompositeDialog = self.add_action(
+        #    icon_path,
+        #    text=self.tr(u'Create map'),
+        #    callback=self.run_CreateCompositeDialog,
+        #    enabled_flag=False,
+        #    parent=self.iface.mainWindow())
+        icon_path = self.plugin_dir + os.sep + 'icons' + os.sep + 'account.svg'
+        self.menu_UserInfoDialog = self.add_action(
+            icon_path,
+            text=self.tr(u'User info'),
+            callback=self.run_UserInfoDialog,
+            enabled_flag=False,
+            parent=self.iface.mainWindow())
+    #--------------------------------------------------------------------------
+    def run_UserInfoDialog(self):
+        self.dlg = UserInfoDialog() 
+        self.dlg.show()
+        self.dlg.pushButton_logout.setStyleSheet("#pushButton_logout {color: #fff !important;text-transform: uppercase;  text-decoration: none;   background: #72c02c;   padding: 20px;  border-radius: 50px;    display: inline-block; border: none;transition: all 0.4s ease 0s;} #pushButton_logout:hover{background: #66ab27 ;}")
+        self.dlg.setStyleSheet("#DialogBase {background: #f0f0f0 ;}")
+        userEndpoint = "http://layman.lesprojekt.cz/rest/current-user"
+        r = requests.get(url = userEndpoint,  headers = self.authHeader)
+        res = r.text
+        res = self.fromByteToJson(r.content)
+        self.dlg.pushButton_logout.clicked.connect(lambda: self.logout())
+        print(res['claims'])
+        self.dlg.label_layman.setText(res['claims']['preferred_username'])
+        self.dlg.label_agrihub.setText(res['claims']['email'])
+        self.dlg.setStyleSheet("#DialogBase {background: #f0f0f0 ;}")
+
+    def run_EditMap(self, x):
+        self.dlg = EditMapDialog()      
+        self.dlg.pushButton_save.setStyleSheet("#pushButton_save {color: #fff !important;text-transform: uppercase;  text-decoration: none;   background: #72c02c;   padding: 20px;  border-radius: 50px;    display: inline-block; border: none;transition: all 0.4s ease 0s;} #pushButton_save:hover{background: #66ab27 ;}#pushButton_save:disabled{background: #64818b ;}")
+        self.dlg.pushButton_close.setStyleSheet("#pushButton_close {color: #fff !important;text-transform: uppercase;  text-decoration: none;   background: #72c02c;   padding: 20px;  border-radius: 50px;    display: inline-block; border: none;transition: all 0.4s ease 0s;} #pushButton_close:hover{background: #66ab27 ;}")
+        self.dlg.setStyleSheet("#DialogBase {background: #f0f0f0 ;}")
+        
+       
+        self.dlg.lineEdit_name.hide()
+        self.dlg.label_2.hide()
+        self.dlg.pushButton_close.clicked.connect(lambda: self.dlg.close())
+        self.dlg.lineEdit_name.setText(self.compositeList[x]['name'])
+        self.dlg.lineEdit_abstract.setText(self.compositeList[x]['abstract'])
+        self.dlg.lineEdit_title.setText(self.compositeList[x]['title'])
+        self.dlg.lineEdit_units.setText(self.compositeList[x]['units'])
+        self.dlg.lineEdit_scale.setText(str(self.compositeList[x]['scale']))
+        self.dlg.lineEdit_user.setText(self.compositeList[x]['user']['name'])
+        self.dlg.lineEdit_xmin.setText(self.compositeList[x]['extent'][0])
+        self.dlg.lineEdit_xmax.setText(self.compositeList[x]['extent'][2])
+        self.dlg.lineEdit_ymin.setText(self.compositeList[x]['extent'][1])
+        self.dlg.lineEdit_ymax.setText(self.compositeList[x]['extent'][3])
+        self.dlg.rejected.connect(lambda: self.afterCloseEditMapDialog()) 
+        self.dlg.pushButton_save.clicked.connect(lambda: self.modifyMap(x))
+        self.dlg.rejected.connect(lambda: self.afterCloseCompositeDialog())
+        self.dlg.show()
+        result = self.dlg.exec_()
+
+    def run_DeleteLayerFromMap(self):
+        self.dlg = DeleteLayerFromMapDialog()
+        self.dlg.pushButton.clicked.connect(lambda: self.deteteLayerFromComposite(self.dlg.listWidget.currentRow(),self.compositeList[self.dlg.listWidget.currentRow()]['layers'][self.dlg.listWidget_listLayers2.currentRow()]['params']['LAYERS']))
+        #self.dlg.pushButton.clicked.connect(lambda: print(self.dlg.listWidget_2.currentRow()))
+       
+        layers = QgsProject.instance().mapLayers().values()
+        
+        for i in range (0, len(self.compositeList)):
+            self.dlg.listWidget.addItem(self.compositeList[i]['name'])
+       # self.dlg.pushButton.setEnabled(False)
+        self.dlg.listWidget.itemClicked.connect(self.listCompositeLayers)
+        self.dlg.listWidget_listLayers2.itemClicked.connect(self.showThumbnail)   
+        
+
+       # self.dlg.listWidget_listMaps.itemClicked.connect(self.enableButton)    
+        self.dlg.show()
+        self.dlg.pushButton_close.clicked.connect(lambda: self.dlg.close())
+        result = self.dlg.exec_()
+
+    def run_CreateCompositeDialog(self, fromImport = False):
+        self.dlg = CreateCompositeDialog()
+        self.dlg.label_info.hide()
+        self.dlg.label_2.hide()
+        self.dlg.lineEdit.hide()
+        self.dlg.pushButton_CreateComposition.clicked.connect(lambda: self.createComposite(self.dlg.lineEdit.text(),self.dlg.lineEdit_2.text()))              
+        layers = QgsProject.instance().mapLayers().values()
+        self.dlg.treeWidget.itemClicked.connect(self.setExtent)
+        for layer in layers:
+           # self.dlg.listWidget_listLayers.addItem(layer.name())
+            if (layer.type() == QgsMapLayer.VectorLayer):
+                item = QTreeWidgetItem([layer.name()]) 
+            
+                    
+                self.dlg.treeWidget.addTopLevelItem(item)
+        ext = iface.mapCanvas().extent()
+        self.dlg.lineEdit.setValidator(QRegExpValidator(QRegExp("[a-z]{1}[a-z0-9]{1,30}")))      
+        self.dlg.lineEdit_2.editingFinished.connect(self.checkNameCreateMap)
+        self.dlg.lineEdit_3.setText(str(ext.xMinimum()))
+        self.dlg.lineEdit_4.setText(str(ext.xMaximum()))
+        self.dlg.lineEdit_5.setText(str(ext.yMinimum()))
+        self.dlg.lineEdit_6.setText(str(ext.yMaximum()))
+        self.dlg.pushButton_defaultExtent.clicked.connect(lambda: self.setDefaultExtent(ext))              
+        self.dlg.pushButton_defaultExtent.setStyleSheet("#pushButton_defaultExtent {color: #fff !important;text-transform: uppercase;  text-decoration: none;   background: #72c02c;   padding: 20px;  border-radius: 50px;    display: inline-block; border: none;transition: all 0.4s ease 0s;} #pushButton_defaultExtent:hover{background: #66ab27 ;}#pushButton_defaultExtent:disabled{background: #64818b ;}")
+        self.dlg.pushButton_CreateComposition.setStyleSheet("#pushButton_CreateComposition {color: #fff !important;text-transform: uppercase;  text-decoration: none;   background: #72c02c;   padding: 20px;  border-radius: 50px;    display: inline-block; border: none;transition: all 0.4s ease 0s;} #pushButton_CreateComposition:hover{background: #66ab27 ;}#pushButton_CreateComposition:disabled{background: #64818b ;}")
+        self.dlg.pushButton_close.setStyleSheet("#pushButton_close {color: #fff !important;text-transform: uppercase;  text-decoration: none;   background: #72c02c;   padding: 20px;  border-radius: 50px;    display: inline-block; border: none;transition: all 0.4s ease 0s;} #pushButton_close:hover{background: #66ab27 ;}")
+        
+        self.dlg.setStyleSheet("#DialogBase {background: #f0f0f0 ;}")
+
+        self.dlg.show()
+        self.dlg.pushButton_close.clicked.connect(lambda: self.dlg.close())
+        if (fromImport):
+            self.dlg.rejected.connect(lambda: self.afterCloseCompositeDialog())
+        result = self.dlg.exec_()
+
+
+    def run_ImportMapDialog(self):
+        self.dlg = ImportMapDialog()
+        self.dlg.label_import.hide()
+        #self.dlg.listWidget_listLayers2.hide()
+        self.dlg.pushButton_deleteMap.setEnabled(False)
+        self.dlg.pushButton_editMeta.setEnabled(False)
+        self.dlg.pushButton_addRaster.setEnabled(False)
+        self.dlg.mMapLayerComboBox.setFilters(QgsMapLayerProxyModel.VectorLayer)
+        self.dlg.pushButton.clicked.connect(lambda: self.addLayerToComposite(self.dlg.listWidget.currentRow()))   
+        self.dlg.pushButton_deleteMap.clicked.connect(lambda: self.deleteMap(self.dlg.listWidget.currentItem().text(),self.dlg.listWidget.currentRow()))
+       # self.dlg.pushButton_deleteMap.clicked.connect(lambda: self.deleteMapFromCanvas(self.dlg.listWidget.currentRow())) 
+        self.dlg.pushButton_up.clicked.connect(lambda: self.reorderLayers(self.dlg.listWidget_listLayers.currentRow(), 1, self.dlg.listWidget.currentRow()))
+        self.dlg.pushButton_down.clicked.connect(lambda: self.reorderLayers(self.dlg.listWidget_listLayers.currentRow(), -1, self.dlg.listWidget.currentRow()))
+        self.dlg.pushButton_saveOrder.clicked.connect(lambda: self.saveReorder(self.dlg.listWidget.currentRow()))
+
+
+        if not self.loadedInMemory:
+            self.loadAllComposites()
+        self.dlg.pushButton_addMap.clicked.connect(lambda: self.showAddMapDialog())
+        layers = QgsProject.instance().mapLayers().values()     
+        for i in range (0, len(self.compositeList)):
+            print(self.compositeList[i])
+            #self.dlg.listWidget.addItem(self.compositeList[i]['name'])
+            self.dlg.listWidget.addItem(self.compositeList[i]['title'])
+        self.dlg.progressBar.hide()   
+        self.dlg.pushButton_saveOrder.hide()   
+        self.dlg.pushButton.setIcon(QIcon(self.plugin_dir + os.sep + 'icons' + os.sep + 'plus.png'))
+        self.dlg.pushButton_addMap.setIcon(QIcon(self.plugin_dir + os.sep + 'icons' + os.sep + 'plus.png'))
+        self.dlg.pushButton_addRaster.setIcon(QIcon(self.plugin_dir + os.sep + 'icons' + os.sep + 'plus.png'))
+        self.dlg.pushButton_deleteLayers.setIcon(QIcon(self.plugin_dir + os.sep + 'icons' + os.sep + 'minus.png'))
+        self.dlg.pushButton_deleteMap.setIcon(QIcon(self.plugin_dir + os.sep + 'icons' + os.sep + 'minus.png'))
+        self.dlg.pushButton_editMeta.setIcon(QIcon(self.plugin_dir + os.sep + 'icons' + os.sep + 'edit.png'))
+        self.dlg.listWidget.itemClicked.connect(self.refreshLayerList)
+        self.dlg.listWidget.itemClicked.connect(lambda: self.dlg.pushButton_deleteMap.setEnabled(True))
+        self.dlg.listWidget.itemClicked.connect(lambda: self.dlg.pushButton_editMeta.setEnabled(True))
+        self.dlg.listWidget.itemClicked.connect(lambda: self.dlg.pushButton_addRaster.setEnabled(True))
+        self.dlg.listWidget_listLayers.itemClicked.connect(lambda: self.dlg.pushButton_down.setEnabled(True))
+        self.dlg.listWidget_listLayers.itemClicked.connect(lambda: self.dlg.pushButton_up.setEnabled(True))
+        self.dlg.rejected.connect(lambda: self.saveReorder())
+        
+       
+        self.dlg.pushButton_editMeta.clicked.connect(lambda: self.showEditMapDialog(self.dlg.listWidget.currentRow()))
+     ###########nacitam vrstvy z laymana do comboboxu
+        url = self.URI+'/rest/'+self.laymanUsername+'/layers'
+        r = requests.get(url = url)
+       # print(r.content())
+        try:
+            data = r.json()
+        except:
+            QMessageBox.information(None, "Error", "Connection with server failed!.")
+        for row in range(0, len(data)):          
+            self.dlg.comboBox_raster.addItem(data[row]['name'])
+
+        self.dlg.pushButton_addRaster.clicked.connect(lambda: self.addExistingLayerToComposite(self.dlg.comboBox_raster.currentText()))
+        #### nahrát mapy ze serveru do comboboxu
+        url = self.URI+'/rest/'+self.laymanUsername+'/maps'
+        r = requests.get(url = url)
+        data = r.json()
+        for row in range(0, len(data)):            
+            self.dlg.comboBox_loadMap.addItem(data[row]['name'])
+      
+        self.dlg.pushButton_loadMap.clicked.connect(lambda: self.readMapJson(self.dlg.comboBox_loadMap.currentText(), 'WMS'))
+        self.dlg.pushButton_loadMapWFS.clicked.connect(lambda: self.readMapJson(self.dlg.comboBox_loadMap.currentText(), 'WFS'))
+        self.dlg.pushButton_loadMapWFS.hide()
+        self.dlg.pushButton_loadMap.hide()
+        self.dlg.comboBox_loadMap.hide()
+     #############
+        self.dlg.pushButton.setEnabled(False)
+        self.dlg.pushButton_deleteLayers.setEnabled(False)
+        self.dlg.listWidget_listLayers.itemClicked.connect(self.showSmallThumbnail)
+      #  self.dlg.listWidget_listLayers.itemClicked.connect(self.showThumbnail)
+        self.dlg.listWidget.itemClicked.connect(self.enableButton)          
+        self.dlg.pushButton_deleteLayers.clicked.connect(lambda: self.deteteLayerFromComposite(self.dlg.listWidget.currentRow(),self.dlg.listWidget_listLayers.currentRow(), self.dlg.listWidget_listLayers.currentItem().text()))    
+        self.dlg.show()
+        #self.dlg.pushButton_close.clicked.connect(lambda: self.saveReorder(self.dlg.listWidget.currentRow()))
+        #self.dlg.pushButton_close.clicked.connect(lambda: self.saveReorder())
+        self.dlg.pushButton_close.clicked.connect(lambda: self.dlg.close())
+        self.dlg.pushButton_saveOrder.setEnabled(False)
+        self.dlg.pushButton_down.setStyleSheet("#pushButton_down {color: #fff !important;text-transform: uppercase;  text-decoration: none;   background: #72c02c;   padding: 20px;  border-radius: 50px;    display: inline-block; border: none;transition: all 0.4s ease 0s;} #pushButton_down:hover{background: #66ab27 ;}#pushButton_down:disabled{background: #64818b ;}")
+        self.dlg.pushButton_up.setStyleSheet("#pushButton_up {color: #fff !important;text-transform: uppercase;  text-decoration: none;   background: #72c02c;   padding: 20px;  border-radius: 50px;    display: inline-block; border: none;transition: all 0.4s ease 0s;} #pushButton_up:hover{background: #66ab27 ;}#pushButton_up:disabled{background: #64818b ;}")
+        self.dlg.pushButton.setStyleSheet("#pushButton {color: #fff !important;text-transform: uppercase;  text-decoration: none;   background: #72c02c;   padding: 20px;  border-radius: 50px;    display: inline-block; border: none;transition: all 0.4s ease 0s;} #pushButton:hover{background: #66ab27 ;}#pushButton:disabled{background: #64818b ;}")
+        self.dlg.pushButton_close.setStyleSheet("#pushButton_close {color: #fff !important;text-transform: uppercase;  text-decoration: none;   background: #72c02c;   padding: 20px;  border-radius: 50px;    display: inline-block; border: none;transition: all 0.4s ease 0s;} #pushButton_close:hover{background: #66ab27 ;}#pushButton_close:disabled{background: #64818b ;}")
+        self.dlg.pushButton_deleteLayers.setStyleSheet("#pushButton_deleteLayers {color: #fff !important;text-transform: uppercase;  text-decoration: none;   background: #72c02c;   padding: 20px;  border-radius: 50px;    display: inline-block; border: none;transition: all 0.4s ease 0s;} #pushButton_deleteLayers:hover{background: #66ab27 ;}#pushButton_deleteLayers:disabled{background: #64818b ;}")
+        self.dlg.pushButton_deleteMap.setStyleSheet("#pushButton_deleteMap {color: #fff !important;text-transform: uppercase;  text-decoration: none;   background: #72c02c;   padding: 20px;  border-radius: 50px;    display: inline-block; border: none;transition: all 0.4s ease 0s;} #pushButton_deleteMap:hover{background: #66ab27 ;}#pushButton_deleteMap:disabled{background: #64818b ;}")
+        self.dlg.pushButton_addRaster.setStyleSheet("#pushButton_addRaster {color: #fff !important;text-transform: uppercase;  text-decoration: none;   background: #72c02c;   padding: 20px;  border-radius: 50px;    display: inline-block; border: none;transition: all 0.4s ease 0s;} #pushButton_addRaster:hover{background: #66ab27 ;}#pushButton_addRaster:disabled{background: #64818b ;}")
+        self.dlg.pushButton_addMap.setStyleSheet("#pushButton_addMap {color: #fff !important;text-transform: uppercase;  text-decoration: none;   background: #72c02c;   padding: 20px;  border-radius: 50px;    display: inline-block; border: none;transition: all 0.4s ease 0s;} #pushButton_addMap:hover{background: #66ab27 ;}#pushButton_addMap:disabled{background: #64818b ;}")
+        self.dlg.pushButton_editMeta.setStyleSheet("#pushButton_editMeta {color: #fff !important;text-transform: uppercase;  text-decoration: none;   background: #72c02c;   padding: 20px;  border-radius: 50px;    display: inline-block; border: none;transition: all 0.4s ease 0s;} #pushButton_editMeta:hover{background: #66ab27 ;}#pushButton_editMeta:disabled{background: #64818b ;}")
+        self.dlg.pushButton_loadMapWFS.setStyleSheet("#pushButton_loadMapWFS {color: #fff !important;text-transform: uppercase;  text-decoration: none;   background: #72c02c;   padding: 20px;  border-radius: 50px;    display: inline-block; border: none;transition: all 0.4s ease 0s;} #pushButton_loadMapWFS:hover{background: #66ab27 ;}#pushButton_loadMapWFS:disabled{background: #64818b ;}")
+        self.dlg.pushButton_loadMap.setStyleSheet("#pushButton_loadMap {color: #fff !important;text-transform: uppercase;  text-decoration: none;   background: #72c02c;   padding: 20px;  border-radius: 50px;    display: inline-block; border: none;transition: all 0.4s ease 0s;} #pushButton_loadMap:hover{background: #66ab27 ;}#pushButton_loadMap:disabled{background: #64818b ;}")
+        self.dlg.setStyleSheet("#DialogBase {background: #f0f0f0 ;}")
+        self.dlg.pushButton_saveOrder.setStyleSheet("#pushButton_saveOrder {color: #fff !important;text-transform: uppercase;  text-decoration: none;   background: #72c02c;   padding: 20px;  border-radius: 50px;    display: inline-block; border: none;transition: all 0.4s ease 0s;} #pushButton_saveOrder:hover{background: #66ab27 ;}#pushButton_saveOrder:disabled{background: #64818b ;}")
+        
+
+
+        result = self.dlg.exec_()
+    def run_DeleteMapDialog(self):
+        self.dlg = DeleteMapDialog()
+        self.refreshListWidgetMaps()
+        self.dlg.pushButton.setEnabled(False)
+        self.dlg.treeWidget.itemClicked.connect(self.enableButton) 
+        self.dlg.pushButton.clicked.connect(lambda: self.deleteMapFromServer(self.dlg.treeWidget.selectedItems()[0].text(0)))
+        self.dlg.pushButton_close.clicked.connect(lambda: self.dlg.close())
+        self.dlg.show()
+        result = self.dlg.exec_()
+    def run_ImportLayerDialog(self):
+        self.dlg = ImportLayerDialog()
+        
+      #  self.dlg.pushButton.clicked.connect(lambda: self.postRequest(self.dlg.treeWidget.currentItem().text(0)))
+
+        self.dlg.pushButton.clicked.connect(lambda: self.callPostRequest(self.dlg.treeWidget.selectedItems()))
+       
+        
+        self.dlg.pushButton.setEnabled(False)
+       # self.dlg.treeWidget.itemClicked.connect(self.enableButton)  
+        self.dlg.treeWidget.itemPressed.connect(self.enableButtonImport)
+        self.dlg.treeWidget.itemClicked.connect(self.onItemClicked)
+        layers = QgsProject.instance().mapLayers().values()
+        
+        for layer in layers:           
+            if (layer.type() == QgsMapLayer.VectorLayer):
+                layerType = 'vector layer'
+            else:
+                layerType = 'raster layer'
+            item = QTreeWidgetItem([layer.name(), layerType])    
+            if (layerType == 'vector layer'):
+                self.dlg.treeWidget.addTopLevelItem(item)
+        self.dlg.setWindowModality(Qt.ApplicationModal)
+
+        self.dlg.pushButton_close.setStyleSheet("#pushButton_close {color: #fff !important;text-transform: uppercase;  text-decoration: none;   background: #72c02c;   padding: 20px;  border-radius: 50px;    display: inline-block; border: none;transition: all 0.4s ease 0s;} #pushButton_close:hover{background: #66ab27 ;}")
+        self.dlg.pushButton.setStyleSheet("#pushButton {color: #fff !important;text-transform: uppercase;  text-decoration: none;   background: #72c02c;   padding: 20px;  border-radius: 50px;    display: inline-block; border: none;transition: all 0.4s ease 0s;} #pushButton:hover{background: #66ab27 ;}#pushButton:disabled{background: #64818b ;}")
+        self.dlg.setStyleSheet("#DialogBase {background: #f0f0f0 ;}")
+
+        self.dlg.show()
+      
+        
+        self.dlg.pushButton_close.clicked.connect(lambda: self.dlg.close())
+        result = self.dlg.exec_()
+    def run_login(self):
+        self.dlg = ConnectionManagerDialog()
+        self.dlg.show()    
+        self.dlg.pushButton_Connect.setEnabled(False) 
+        if (os.path.isfile(os.getenv("HOME") + os.sep + ".layman" + os.sep +'layman_user.INI')):
+            config = self.loadIni()
+            if len(config['DEFAULT']['login']) > 0:
+                self.Agrimail = config['DEFAULT']['login']
+                self.dlg.pushButton_Connect.setEnabled(True) 
+            self.dlg.lineEdit_userName.setText(config['DEFAULT']['login'] + "@lesprojekt.cz")  
+            try:
+                self.dlg.lineEdit_AgriID.setText(config['DEFAULT']['id']) 
+                self.dlg.lineEdit_server.setText(config['DEFAULT']['server']) 
+                self.dlg.lineEdit_serverLayman.setText(config['DEFAULT']['layman']) 
+            except:
+                print("udaj v ini nenalezen")
+        else:
+            try:
+                os.makedirs(os.getenv("HOME") + os.sep + ".layman")
+            except:
+                print("layman directory already exists")
+            self.dlg.lineEdit_userName.setText("@lesprojekt.cz")
+            self.dlg.pushButton_Connect.setEnabled(True) 
+        self.dlg.pushButton_ttt.hide()
+
+        
+        self.dlg.lineEdit_userName.textChanged.connect(self.checkUsername)
+        self.dlg.pushButton_close.clicked.connect(lambda: self.dlg.close())
+        self.dlg.pushButton_Connect.clicked.connect(lambda: self.openAuthLiferayUrl())
+        self.dlg.pushButton_Continue.clicked.connect(lambda: self.getToken())
+        self.dlg.pushButton_Continue.setEnabled(False)       
+        self.dlg.pushButton_ttt.clicked.connect(lambda: self.printVariables())
+        self.dlg.pushButton_close.setStyleSheet("#pushButton_close {color: #fff !important;text-transform: uppercase;  text-decoration: none;   background: #72c02c;   padding: 20px;  border-radius: 50px;    display: inline-block; border: none;transition: all 0.4s ease 0s;} #pushButton_close:hover{background: #66ab27 ;}")
+        self.dlg.pushButton_Connect.setStyleSheet("#pushButton_Connect {color: #fff !important;text-transform: uppercase;  text-decoration: none;   background: #72c02c;   padding: 20px;  border-radius: 50px;    display: inline-block; border: none;transition: all 0.4s ease 0s;} #pushButton_Connect:hover{background: #66ab27 ;}")
+        self.dlg.pushButton_Continue.setStyleSheet("#pushButton_Continue {color: #fff !important;text-transform: uppercase;  text-decoration: none;   background: #72c02c;   padding: 20px;  border-radius: 50px;    display: inline-block; border: none;transition: all 0.4s ease 0s;} #pushButton_Continue:hover{background: #66ab27 ;} #pushButton_Continue:disabled{background: #64818b ;}")
+        self.dlg.setStyleSheet("#DialogBase {background: #f0f0f0 ;}")
+        result = self.dlg.exec_()
+    def run_AddMapDialog(self):        
+        url = self.URI+'/rest/'+self.laymanUsername+'/maps'
+        print(url)
+        r = requests.get(url = url)
+        print(r.content)
+        data = r.json()
+        self.dlg = AddMapDialog()
+        
+        for row in range(0, len(data)):
+            url = self.URI+'/rest/'+self.laymanUsername+'/maps/'+data[row]['name']+'/file'
+            r = requests.get(url = url)
+         #   print(r.content)
+            d = r.json()
+            print(d['title'])
+         #   item = QTreeWidgetItem([data[row]['name'], data[row]['url'], data[row]['uuid']])           
+            item = QTreeWidgetItem([d['title']])            
+            self.dlg.treeWidget.addTopLevelItem(item)
+        
+        
+      
+        self.dlg.pushButton.setEnabled(False)
+        self.dlg.pushButton_mapWFS.setEnabled(False)
+        self.dlg.label_info.hide()
+     
+        self.dlg.treeWidget.itemClicked.connect(self.showThumbnailMap)
+        self.dlg.treeWidget.itemClicked.connect(self.enableButton)
+        self.dlg.treeWidget.itemClicked.connect(self.enableLoadMapButtons)
+        
+
+        self.dlg.pushButton.clicked.connect(lambda: self.readMapJson(self.dlg.treeWidget.selectedItems()[0].text(0), 'WMS'))
+        self.dlg.pushButton_mapWFS.clicked.connect(lambda: self.readMapJson(self.dlg.treeWidget.selectedItems()[0].text(0), 'WFS'))
+        
+
+        self.dlg.pushButton_close.clicked.connect(lambda: self.dlg.close())
+
+        self.dlg.pushButton_mapWFS.setStyleSheet("#pushButton_mapWFS {color: #fff !important;text-transform: uppercase;  text-decoration: none;   background: #72c02c;   padding: 20px;  border-radius: 50px;    display: inline-block; border: none;transition: all 0.4s ease 0s;} #pushButton_mapWFS:hover{background: #66ab27 ;}#pushButton_mapWFS:disabled{background: #64818b ;}")
+        self.dlg.pushButton.setStyleSheet("#pushButton {color: #fff !important;text-transform: uppercase;  text-decoration: none;   background: #72c02c;   padding: 20px;  border-radius: 50px;    display: inline-block; border: none;transition: all 0.4s ease 0s;} #pushButton:hover{background: #66ab27 ;}#pushButton:disabled{background: #64818b ;}")
+        self.dlg.pushButton_close.setStyleSheet("#pushButton_close {color: #fff !important;text-transform: uppercase;  text-decoration: none;   background: #72c02c;   padding: 20px;  border-radius: 50px;    display: inline-block; border: none;transition: all 0.4s ease 0s;} #pushButton_close:hover{background: #66ab27 ;}#pushButton_close:disabled{background: #64818b ;}")
+        self.dlg.setStyleSheet("#DialogBase {background: #f0f0f0 ;}")
+
+        self.dlg.show()
+        result = self.dlg.exec_()
+    def run_AddLayerDialog(self):
+        if not self.loadedInMemory:
+            self.loadAllComposites()
+        url = self.URI+'/rest/'+self.laymanUsername+'/layers'
+        r = requests.get(url = url)
+        data = r.json()
+        self.dlg = AddLayerDialog()
+        self.dlg.pushButton_layerRedirect.hide()
+        self.dlg.pushButton_layerRedirect.setEnabled(False)
+        self.dlg.pushButton.setEnabled(False)
+        self.dlg.pushButton_wfs.setEnabled(False)
+        self.dlg.pushButton_delete.setEnabled(False)
+        
+        for row in range(0, len(data)):            
+            item = QTreeWidgetItem([self.getLayerTitle(data[row]['name'])])
+            self.dlg.treeWidget.addTopLevelItem(item)
+        self.dlg.pushButton_delete.clicked.connect(lambda: self.layerDelete(self.dlg.treeWidget.selectedItems()[0].text(0)))    
+        self.dlg.pushButton_layerRedirect.clicked.connect(lambda: self.layerInfoRedirect(self.dlg.treeWidget.selectedItems()[0].text(0)))
+        self.dlg.pushButton.clicked.connect(lambda: self.readLayerJson(self.dlg.treeWidget.selectedItems()[0].text(0), "WMS"))
+        self.dlg.pushButton_wfs.clicked.connect(lambda: self.readLayerJson(self.dlg.treeWidget.selectedItems()[0].text(0), "WFS"))
+        self.dlg.treeWidget.itemClicked.connect(self.showThumbnail)  
+        self.dlg.treeWidget.itemClicked.connect(self.enableDeleteButton) 
+        self.dlg.pushButton_close.clicked.connect(lambda: self.dlg.close())
+        self.dlg.setWindowModality(Qt.ApplicationModal)
+
+        self.dlg.pushButton_delete.setStyleSheet("#pushButton_delete {color: #fff !important;text-transform: uppercase;  text-decoration: none;   background: #72c02c;   padding: 20px;  border-radius: 50px;    display: inline-block; border: none;transition: all 0.4s ease 0s;} #pushButton_delete:hover{background: #66ab27 ;}#pushButton_delete:disabled{background: #64818b ;}")
+        self.dlg.pushButton_close.setStyleSheet("#pushButton_close {color: #fff !important;text-transform: uppercase;  text-decoration: none;   background: #72c02c;   padding: 20px;  border-radius: 50px;    display: inline-block; border: none;transition: all 0.4s ease 0s;} #pushButton_close:hover{background: #66ab27 ;}#pushButton_close:disabled{background: #64818b ;}")
+        self.dlg.pushButton_delete.setStyleSheet("#pushButton_delete {color: #fff !important;text-transform: uppercase;  text-decoration: none;   background: #72c02c;   padding: 20px;  border-radius: 50px;    display: inline-block; border: none;transition: all 0.4s ease 0s;} #pushButton_delete:hover{background: #66ab27 ;}#pushButton_delete:disabled{background: #64818b ;}")
+        self.dlg.pushButton.setStyleSheet("#pushButton {color: #fff !important;text-transform: uppercase;  text-decoration: none;   background: #72c02c;   padding: 20px;  border-radius: 50px;    display: inline-block; border: none;transition: all 0.4s ease 0s;} #pushButton:hover{background: #66ab27 ;}#pushButton:disabled{background: #64818b ;}")
+        self.dlg.pushButton_wfs.setStyleSheet("#pushButton_wfs {color: #fff !important;text-transform: uppercase;  text-decoration: none;   background: #72c02c;   padding: 20px;  border-radius: 50px;    display: inline-block; border: none;transition: all 0.4s ease 0s;} #pushButton_wfs:hover{background: #66ab27 ;}#pushButton_wfs:disabled{background: #64818b ;}")
+        self.dlg.setStyleSheet("#DialogBase {background: #f0f0f0 ;}")
+
+
+        self.dlg.show()
+        result = self.dlg.exec_()
+    def showExistingLayers(self,x):
+ 
+        self.dlg.listWidget_listLayers.clear()    
+        for i in range (0,len(self.compositeList[self.dlg.listWidget.currentRow()]['layers'])):         
+               
+            self.dlg.listWidget_listLayers.addItem(self.compositeList[self.dlg.listWidget.currentRow()]['layers'][i]['params']['LAYERS'])
+    #--------------------------- slots---------------------
+   # @QtCore.pyqtSlot(QtWidgets.QTreeWidgetItem, int)
+    def onItemClicked(self, it, col):     
+        if (it.text(1) == 'raster layer'):
+            self.dlg.pushButton.setEnabled(False)
+        else:
+            self.dlg.pushButton.setEnabled(True)
+    def setExtent(self, it, col):
+        layer = QgsProject.instance().mapLayersByName(it.text(0))
+        ext = layer[0].extent()
+        xmin = ext.xMinimum()
+        xmax = ext.xMaximum()
+        ymin = ext.yMinimum()
+        ymax = ext.yMaximum()
+        self.dlg.lineEdit_3.setText(str(xmin))
+        self.dlg.lineEdit_4.setText(str(xmax))
+        self.dlg.lineEdit_5.setText(str(ymin))
+        self.dlg.lineEdit_6.setText(str(ymax))
+        self.dlg.label_4.setText("Extent of canvas: " + it.text(0))
+
+    def enableDeleteButton(self, item, col):
+        self.dlg.pushButton.setEnabled(True)
+        self.dlg.pushButton_wfs.setEnabled(True)
+        self.dlg.pushButton_layerRedirect.setEnabled(True)
+        self.dlg.pushButton_delete.setEnabled(True)
+
+    def enableButton(self, item, col):
+        
+        
+        self.dlg.pushButton.setEnabled(True)
+        self.dlg.pushButton_mapWFS.setEnabled(True)
+        self.dlg.pushButton_deleteLayers.setEnabled(True)
+        self.dlg.pushButton_editMeta.setEnabled(True)
+        self.dlg.pushButton_addRaster.setEnabled(True)       
+
+    def saveReorder(self):
+        for x in self.mapsChanged:
+            print(x)
+            print(self.compositeList[x]['layers'])
+            self.importMap(x, 'mod')
+        print("changes saved to server")
+        #self.dlg.pushButton_saveOrder.setEnabled(False)
+    def checkUsername(self, name):
+        n = name.split("@")
+        if(len(n[0]) > 0):
+            self.dlg.pushButton_Connect.setEnabled(True) 
+            self.Agrimail = n[0]
+        else:
+            self.dlg.pushButton_Connect.setEnabled(False) 
+
+        
+    def checkLoadedMap(self, name):
+       ## print(self.compositeList)
+        loaded = False
+        for i in range (0, len(self.compositeList)):
+            if self.compositeList[i]['name'] == name:
+                loaded = True
+            
+        return loaded 
+                   
+        
+    def logout(self):
+        self.menu_saveLocalFile.setEnabled(False)
+        self.menu_loadJson.setEnabled(False)
+        self.menu_ImportLayerDialog.setEnabled(False)
+        self.menu_AddLayerDialog.setEnabled(False) 
+        self.menu_AddMapDialog.setEnabled(False)       
+        self.menu_ImportLayerDialog.setEnabled(False)
+        self.menu_ImportMapDialog.setEnabled(False)    
+        self.menu_UserInfoDialog.setEnabled(False)
+        self.textbox.setText("Layman")
+        self.dlg.close()
+       # self.flaskThread.join()
+       # self.thread1.join() ## ukončujeme vlákno, které se stará o refresh tokenů OAUTH
+
+    def enableLoadMapButtons(self, item):
+        self.dlg.pushButton_mapWFS.setEnabled(True)
+    def enableButtonImport(self, item, column):
+        if (len(self.dlg.treeWidget.selectedItems()) > 0):
+            self.dlg.pushButton.setEnabled(True)
+        else:
+            self.dlg.pushButton.setEnabled(False)
+
+
+    def enableButton(self, item):
+        try: ## addMap nemá combobox
+            if (self.dlg.mMapLayerComboBox.count() > 0):
+                self.dlg.pushButton.setEnabled(True) 
+                self.dlg.pushButton_mapWFS.setEnabled(True)
+            else:
+                self.dlg.pushButton.setEnabled(False)
+        except:
+            self.dlg.pushButton.setEnabled(True) ## addMap nemá combobox nastavujeme funkční tlačítko
+
+        try:
+            self.dlg.pushButton_deleteLayers.setEnabled(True) # pro formulář importMap
+        except:
+            pass
+    def listCompositeLayers(self, it):    
+         self.dlg.listWidget_listLayers2.clear()    
+         for i in range (0,len(self.compositeList[self.dlg.listWidget.currentRow()]['layers'])):    
+            
+            self.dlg.listWidget_listLayers2.addItem(self.compositeList[self.dlg.listWidget.currentRow()]['layers'][i]['params']['LAYERS'])
+    def deleteLayerThrowCompositions(self, name):
+        for x in range (0,len(self.compositeList)):
+           
+            for i in range (0,len(self.compositeList[x]['layers'])): 
+                if (name == self.compositeList[x]['layers'][i]['params']['LAYERS']):
+                    inComposite = True
+                    print(self.compositeList[x]['layers'][i]['params']['LAYERS'])
+                    self.deteteLayerFromComposite(x, i, name)
+    def checkLayersInComopsitions(self, name):
+        inComposite = False
+        for x in range (0,len(self.compositeList)):
+           
+            for i in range (0,len(self.compositeList[x]['layers'])): 
+                if (name == self.compositeList[x]['layers'][i]['params']['LAYERS']):
+                    inComposite = True
+                    print(self.compositeList[x]['layers'][i]['params']['LAYERS'])
+        return inComposite
+
+
+    def refreshCompositeList(self):
+        self.dlg.listWidget.clear()
+        print (len(self.compositeList))
+        
+        for i in range (0, len(self.compositeList)):
+           # self.dlg.listWidget.addItem(self.compositeList[i]['name'])
+           self.dlg.listWidget.addItem(self.compositeList[i]['title'])
+ 
+
+    def refreshLayerList(self):
+        self.dlg.listWidget_listLayers.clear()
+        for i in range (0,len(self.compositeList[self.dlg.listWidget.currentRow()]['layers'])):
+            self.dlg.listWidget_listLayers.addItem(self.compositeList[self.dlg.listWidget.currentRow()]['layers'][i]['params']['LAYERS'])
+            print(self.compositeList[self.dlg.listWidget.currentRow()]['layers'][i]['params']['LAYERS'])
+
+
+
+    def refreshListWidgetMaps(self):
+        self.dlg.treeWidget.clear()
+        url = self.URI+'/rest/'+self.laymanUsername+'/maps'
+        print(url)
+        r = requests.get(url = url)
+        #print(r.content())
+        data = r.json()  
+       
+        for row in range(0, len(data)):                
+            item = QTreeWidgetItem([data[row]['name']])           
+            self.dlg.treeWidget.addTopLevelItem(item)
+
+    def showAddMapDialog(self):
+        self.old_dlg = self.dlg
+        self.run_CreateCompositeDialog(True)      
+        
+       
+    ### connect
+    def afterCloseCompositeDialog(self):        
+        self.dlg = self.old_dlg
+        self.refreshCompositeList()
+
+    def afterCloseEditMapDialog(self):
+        self.dlg = self.old_dlg
+
+    def showEditMapDialog(self, x):        
+        self.old_dlg = self.dlg
+        self.run_EditMap(x)
+            ############### pravdepodobne půjde smazat
+    def refreshItems(self):
+  
+         self.dlg.listWidget_listLayers.clear()    
+         for i in range (0,len(self.compositeList)):            
+           # self.dlg.listWidget_listLayers.addItem(self.compositeList[i]['name'])
+           self.dlg.listWidget_listLayers.addItem(self.compositeList[i]['title'])
+
+    def saveEditedToComposite(self,x):        
+        self.compositeList[x]['abstract'] =  self.dlg.lineEdit_abstract.text()  
+        self.compositeList[x]['title'] =  self.dlg.lineEdit_title.text() 
+
+    def layerDelete(self, name):
+        if (self.checkLayersInComopsitions(name) == True):
+            msgbox = QMessageBox(QMessageBox.Question, "Delete layer", "This layers is included in other compositions. It will be delete from every composition.")
+            msgbox.addButton(QMessageBox.Yes)
+            msgbox.addButton(QMessageBox.No)
+            msgbox.setDefaultButton(QMessageBox.No)
+            reply = msgbox.exec()
+            if (reply == QMessageBox.Yes):
+                url = self.URI+'/rest/'+self.laymanUsername+'/layers/'+name    
+                response = requests.delete(url, headers = self.authHeader)
+                print(response.content)
+                print(response)
+                self.addLayerRefresh()
+                try:
+                    self.deleteLayerThrowCompositions(name)
+                except:
+                    pass
+                
+        else:    
+            url = self.URI+'/rest/'+self.laymanUsername+'/layers/'+name    
+            response = requests.delete(url, headers = self.authHeader)
+            print(response.content)
+            print(response)
+            self.addLayerRefresh()
+    def addLayerRefresh(self):
+        self.dlg.treeWidget.clear()
+        url = self.URI+'/rest/'+self.laymanUsername+'/layers'
+        r = requests.get(url = url)
+        data = r.json()
+        for row in range(0, len(data)):            
+            item = QTreeWidgetItem([data[row]['name']])
+            self.dlg.treeWidget.addTopLevelItem(item)
+    def checkIfMapExist(self, name):
+        url = "http://layman.lesprojekt.cz/rest/"+self.laymanUsername+"/maps/"+str(name)+"/file"
+        print(url)
+        r = requests.get(url)
+        print(r.content)
+        if (r.status_code == 404):
+            return False
+        else:
+            return True
+
+    def reorderLayers(self, pos, order, x):
+        self.dlg.pushButton_saveOrder.setEnabled(True)
+        self.compositeList[x]['layers']
+        i = 0
+        compositeLength = len(self.compositeList[x]['layers'])
+        self.mapsChanged.add(x)
+        if (pos + order < 0):
+            QMessageBox.information(None, "Error", "Layer is already on the top level!")
+            
+        elif( pos + order == compositeLength):
+            QMessageBox.information(None, "Error", "Layer is already on the bottom level!")
+
+        else:
+            for lay in self.compositeList[x]['layers']:
+                #print (lay)
+                if i == pos:
+
+                    pom = self.compositeList[x]['layers'][i]
+                    self.compositeList[x]['layers'][i] = self.compositeList[x]['layers'][i + order]
+                    self.compositeList[x]['layers'][i + order] = pom     
+
+                i = i + 1
+            print(self.compositeList[x]['layers'])
+            
+            self.refreshLayerList()
+            self.dlg.listWidget_listLayers.setCurrentRow(pos + order)
+
+    def showThumbnail(self, it):
+        try:
+            layer = it.text(0) ##pro QTreeWidget
+        except:
+            layer = it.text()##pro listWidget
+        try:
+            url = self.URI+'/rest/' +self.laymanUsername+'/layers/'+str(layer).lower().replace(" ","_")+'/thumbnail'    
+            data = urlopen(url).read()
+            pixmap = QPixmap(200, 200)
+            pixmap.loadFromData(data)
+            smaller_pixmap = pixmap.scaled(200, 200, Qt.KeepAspectRatio, Qt.FastTransformation)
+            self.dlg.label_thumbnail.setPixmap(smaller_pixmap)
+            self.dlg.label_thumbnail.setAlignment(Qt.AlignCenter)
+        except:
+            self.dlg.label_thumbnail.setText('  Unable to load thumbnail.')
+    def showSmallThumbnail(self, it):
+        try:
+            layer = it.text(0) ##pro QTreeWidget
+        except:
+            layer = it.text()##pro listWidget
+        try:
+            url = self.URI+'/rest/'+self.laymanUsername+'/layers/'+str(layer).lower().replace(" ","_")+'/thumbnail'    
+            data = urlopen(url).read()
+            pixmap = QPixmap(170, 170)
+            pixmap.loadFromData(data)
+            smaller_pixmap = pixmap.scaled(170, 170, Qt.KeepAspectRatio, Qt.FastTransformation)
+            self.dlg.label_thumbnail.setPixmap(smaller_pixmap)
+            self.dlg.label_thumbnail.setAlignment(Qt.AlignCenter)
+        except:
+            self.dlg.label_thumbnail.setText('  Unable to load thumbnail.')
+
+    def showThumbnailMap(self, it):
+        try:
+            map = it.text(0) ##pro QTreeWidget
+        except:
+            map = it.text()##pro listWidget
+        
+        try:
+            map = self.removeUnacceptableChars(str(map))
+            url = self.URI+'/rest/'+self.laymanUsername+'/maps/'+str(map).lower()+'/thumbnail'    
+            print(url)
+            data = urlopen(url).read()
+            pixmap = QPixmap(100, 100)
+            pixmap.loadFromData(data)
+            smaller_pixmap = pixmap.scaled(100, 100, Qt.KeepAspectRatio, Qt.FastTransformation)
+            self.dlg.label_thumbnail.setPixmap(smaller_pixmap)
+           # self.dlg.label_thumbnail.setAlignment(Qt.AlignCenter)
+        except:
+            self.dlg.label_thumbnail.setText('       Unable to load thumbnail.')
+
+    def checkNameCreateMap(self):
+        text = self.dlg.lineEdit_2.text()
+        text = self.removeUnacceptableChars(text)
+        print(text)
+        if (self.checkIfMapExist(text)):
+            self.dlg.pushButton_CreateComposition.setEnabled(False)
+            self.dlg.label_info.show()
+            
+        else:
+            self.dlg.pushButton_CreateComposition.setEnabled(True)
+            self.dlg.label_info.hide()
+    #----------------------------------------------------------
+    def readLayerJson(self,layerName, service):
+        if self.checkLayerOnLayman(layerName):
+            layerNameTitle =layerName
+            layerName = self.removeUnacceptableChars(layerName)
+            url = self.URI+'/rest/'+self.laymanUsername+'/layers/'+layerName  
+            print (url)
+            r = requests.get(url = url)
+            data = r.json()
+            if (service == "WMS"):
+                print("loading WMS")
+                print (data['wms']['url'])
+                wmsUrl = data['wms']['url']
+                format = 'png'
+                epsg = 'EPSG:4326' 
+                self.loadWms(wmsUrl, layerName,layerNameTitle, format, epsg) 
+            if (service == "WFS"):
+                wfsUrl = data['wfs']['url']
+                print("loading WFS")
+                self.loadWfs(wfsUrl, layerName, layerNameTitle) 
+        else:
+            QMessageBox.information(None, "Layman", "Something went wrong with this layer: "+layerName)
+    def loadAllComposites(self):
+        url = self.URI+'/rest/' + self.laymanUsername + '/maps'
+        try:
+            r = requests.get(url = url)
+        except:
+            QMessageBox.information(None, "Error", "Connection with server failed!.")
+        data = r.json()  
+        print(data)
+        for i in data:
+            print(i['name'])
+            url = self.URI+'/rest/' + self.laymanUsername + '/maps/'+i['name']+'/file'  
+            r = requests.get(url = url)
+            try:
+                map = r.json()
+            except:
+                QMessageBox.information(None, "Error", "Connection with server failed!.")
+            self.compositeList.append (map)
+        self.loadedInMemory = True
+
+    def readMapJson(self,name, service):
+        nameWithDiacritics = name        
+        name = self.removeUnacceptableChars(name)
+        print(name)
+        print("readMapJson " + name)
+        if not self.checkLoadedMap(name): ## je nactena mapa?
+      #  if True:
+            print("debug in readMapJson - true")
+            print(name)
+            print(self.checkLoadedMap(name))
+            url = self.URI+'/rest/'+self.laymanUsername+'/maps/'+name   +'/file'     
+            r = requests.get(url = url)
+            data = r.json()   
+            print(data)
+        
+            self.addComposite(data,service, name)
+            try:
+                self.refreshCompositeList()        ## pouze pro import Form     
+            except:
+                pass
+        else:
+            print("debug in readMapJson - false")
+            url = self.URI+'/rest/'+self.laymanUsername+'/maps/'+name   +'/file'     
+            r = requests.get(url = url)
+            data = r.json()
+            self.loadService(data,service, name)
+
+        #    QMessageBox.information(None, "Message", "This map is already loaded in memory. Loading only layers to canvas")
+    
+
+    def deleteMapFromServer(self,name):        
+        
+        url = self.URI+'/rest/'+self.laymanUsername+'/maps/'+name    
+        response = requests.delete(url, headers = self.authHeader)
+        print(response)
+        QMessageBox.information(None, "Message", "Composition deleted sucessfully.")
+       # self.refreshMapList()            
+        self.refreshListWidgetMaps() ## pro treewidget
+        
+      
+    def deleteMap(self,name, x):      
+        name = self.removeUnacceptableChars(name)
+        url = self.URI+'/rest/'+self.laymanUsername+'/maps/'+name    
+        response = requests.delete(url, headers = self.authHeader)
+        print(response)
+        print(response.content)
+        QMessageBox.information(None, "Message", "Composition deleted sucessfully.")
+        del (self.compositeList[x])        
+        self.refreshCompositeList()## pro import map form
+        self.dlg.listWidget_listLayers.clear()
+      
+        
+        
+      
+    def deleteMapandLayers(self,name, x):        
+        try:
+            url = self.URI+'/rest/'+self.laymanUsername+'/maps/'+name    
+            response = requests.delete(url, headers = self.authHeader)
+            QMessageBox.information(None, "Message", "Composition deleted sucessfully.")
+            
+            
+      
+        except:
+            QMessageBox.information(None, "Warning", "Deleting composition failed.")
+        #self.refreshItems()
+        self.deleteMapFromCanvas(x)
+        self.dlg.listWidget_listLayers.clear()
+        self.dlg.pushButton_deleteLayers.setEnabled(False)
+        self.dlg.pushButton.setEnabled(False)
+        self.dlg.pushButton_deleteMap.setEnabled(False)
+        self.refreshCompositeList()
+
+    def deleteMapFromCanvas(self, x):
+        for i in range (0,len(self.compositeList[x]['layers'])):  #[0]['params']['LAYERS']:
+            name = self.compositeList[x]['layers'][i]['params']['LAYERS']
+            lay = QgsProject.instance().mapLayersByName(name)[0]
+            if (lay != None and lay.type() != QgsMapLayer.VectorLayer):
+                QgsProject.instance().removeMapLayer(lay.id())
+        del (self.compositeList[x])
+
+    def deleteLayerFromCanvas(self, name):        
+        lay = QgsProject.instance().mapLayersByName(name)[0]        
+        if (lay != None and lay.type() != QgsMapLayer.VectorLayer):
+            QgsProject.instance().removeMapLayer(lay.id())
+        
+        
+    def getSelectedLayers(self):
+        arr = self.dlg.listWidget_listLayers2.selectedItems()
+        layers = []
+        for a in arr:
+            layer = QgsProject.instance().mapLayersByName(a.text())
+            for lay in layer:
+
+                if (lay.type() == QgsMapLayer.VectorLayer):
+                    layers.append(lay)
+            
+        return layers
+    def run_getLayer(self):
+        """Run method that performs all the real work"""
+
+        # Create the dialog with elements (after translation) and keep reference
+        # Only create GUI ONCE in callback, so that it will only load when the plugin is started
+        if self.first_start == True:
+            self.first_start = False
+            
+            
+        self.dlgGetLayers.items.clear()
+        # show the dialog
+        self.dlgGetLayers.show()
+        data= self.getExistingLayers()
+        for x in range(len(data)):
+            print(data[x]['name'])
+            self.dlgGetLayers.items.addItem(data[x]['name'])
+        # Run the dialog event loop
+        print (self.dlgGetLayers)
+        result = self.dlgGetLayers.exec_()
+       
+        
+        # See if OK was pressed
+        if result:
+            # Do something useful here - delete the line containing pass and
+            # substitute with your code.
+           
+            print ("test tlacitka")
+   
+    def onClosePlugin(self):
+        """Cleanup necessary items here when plugin dockwidget is closed"""
+
+        #print "** CLOSING Atlas"
+
+        # disconnects
+        self.dockwidget.closingPlugin.disconnect(self.onClosePlugin)
+
+        self.flaskThread.terminate() ## killing daemons
+        self.thread1.terminate()
+        self.pluginIsActive = False
+
+
+    def unload(self):
+        """Removes the plugin menu item and icon from QGIS GUI."""
+
+        #print "** UNLOAD Atlas"
+
+        for action in self.actions:
+            self.iface.removePluginMenu(
+                self.tr(u'&Layman'),
+                action)
+            self.iface.removeToolBarIcon(action)
+        # remove the toolbar
+        del self.toolbar
+
+    #--------------------------------------------------------------------------
+    def bounds(self, layers):
+
+        extent = None
+        for layer in layers:
+            if layer.type() == 0:
+                transform = QgsCoordinateTransform(layer.crs(), QgsCoordinateReferenceSystem('EPSG:4326'), QgsProject.instance()) # WGS 84 / UTM zone 33N
+                try:
+                    layerExtent = transform.transform(layer.extent())
+                except QgsCsException:
+                    print("exception in transform layer srs")
+                    layerExtent = QgsRectangle(-180, -90, 180, 90)
+                if extent is None:
+                    extent = layerExtent
+                else:
+                    extent.combineExtentWith(layerExtent)
+
+        return (extent.xMinimum(), extent.yMinimum(), extent.xMaximum(), extent.yMaximum())
+    def copySymbols(self,symbol, tempPath, fileNames):
+        for i in range(symbol.symbolLayerCount()):
+            sl = symbol.symbolLayer(i)
+            if isinstance(sl, QgsSvgMarkerSymbolLayer):
+                symbolPath = sl.path();
+                shutil.copy(symbolPath, tempPath)
+                print("Copying " + str(sl.path()))
+                fileNames.append(tempPath + os.sep + os.path.basename(symbolPath))
+            else:
+                print("Ignoring " + str(sl))
+
+    def setDefaultExtent (self, ext):        
+        self.dlg.lineEdit_3.setText(str(ext.xMinimum()))
+        self.dlg.lineEdit_4.setText(str(ext.xMaximum()))
+        self.dlg.lineEdit_5.setText(str(ext.yMinimum()))
+        self.dlg.lineEdit_6.setText(str(ext.yMaximum()))
+
+
+    def loadJsonLayer(self, fileName):    
+        name = (os.path.splitext(os.path.basename(fileName))[0])
+        vlayer = QgsVectorLayer(fileName, name,"ogr")
+        sldPath = os.path.splitext(fileName[:-4])[0] + ".sld"
+        qmlPath = os.path.splitext(fileName[:-4])[0] + ".qml"
+        print (sldPath)
+        sldExists = os.path.isfile(sldPath)
+        qmlExists = os.path.isfile(qmlPath)
+        if (qmlExists):
+            print("qml loaded")
+            vlayer.loadNamedStyle(qmlPath)
+        elif (sldExists):
+            vlayer.loadSldStyle(os.path.splitext(fileName)[0]+ ".sld")
+            print("sld loaded")
+        QgsProject.instance().addMapLayer(vlayer)
+        vlayer.triggerRepaint()
+    def checkLoadedLayer(self):
+        layers = iface.layerTreeView().selectedLayers()
+        if (len(layers) > 0):
+            self.json_export()    
+        else:
+            QMessageBox.information(None, "Message", "You must load layer first!")
+    def getEmptyComposite(self, compositeName, compositeTitle):        
+        compositeEPSG  = "epsg:4326"        
+        if (self.dlg.lineEdit_3.text() == "" or self.dlg.lineEdit_4.text() == "" or self.dlg.lineEdit_5.text() == "" or self.dlg.lineEdit_6.text() == ""):
+           ext = iface.mapCanvas().extent() 
+           xmin = ext.xMinimum()
+           xmax = ext.xMaximum()
+           ymin = ext.yMinimum()
+           ymax = ext.yMaximum()
+        else:   
+           xmin = self.dlg.lineEdit_3.text()
+           xmax = self.dlg.lineEdit_4.text()
+           ymin = self.dlg.lineEdit_5.text()
+           ymax = self.dlg.lineEdit_6.text() 
+        
+            
+        abstract = self.dlg.lineEdit_7.text()        
+        comp = {"abstract":abstract,"center":[1672068,6568819],"current_base_layer":{"title":"Composite_base_layer"},"extent":[str(xmin),str(ymin),str(xmax),str(ymax)],"groups":{"guest":"w"},"layers":[],"name":compositeName,"projection":compositeEPSG,"scale":1,"title":compositeTitle,"units":"m","user":{"email":"","name":self.laymanUsername}}
+        self.dlg.close()
+        iface.messageBar().pushWidget(iface.messageBar().createMessage("Layman:", " Kompozice  " + compositeName + " byla úspešně vytvořena."), Qgis.Success, duration=3)
+        return comp
+    def loadLocalFile(self):
+        options = QFileDialog.Options()
+        dialog = QFileDialog()
+        dialog.setStyleSheet("QPushButton {color: #fff !important;text-transform: uppercase;  text-decoration: none;   background: #72c02c;   padding: 20px;  border-radius: 50px;    display: inline-block; border: none;transition: all 0.4s ease 0s;} QPushButton:hover{background: #66ab27 ;}QPushButton:disabled{background: #64818b ;}");
+        fileName = dialog.getOpenFileName(None,"Load file", "","GeoJson Files (*.geojson);;Json Files (*.json)", options=options)
+        print ("načítám json ze souboru:" + fileName[0])
+        self.loadJsonLayer(fileName[0])
+    def modifyMap(self, x):        
+        name = self.removeUnacceptableChars(self.dlg.lineEdit_title.text())
+        #self.compositeList[x]['name'] = self.dlg.lineEdit_name.text()
+        self.compositeList[x]['name'] = name
+        self.compositeList[x]['abstract'] = self.dlg.lineEdit_abstract.text()
+        self.compositeList[x]['title'] = self.dlg.lineEdit_title.text()
+        self.compositeList[x]['extent'][0] = self.dlg.lineEdit_xmin.text()
+        self.compositeList[x]['extent'][2] = self.dlg.lineEdit_xmax.text()
+        self.compositeList[x]['extent'][1] = self.dlg.lineEdit_ymin.text()
+        self.compositeList[x]['extent'][3] = self.dlg.lineEdit_ymax.text()
+        print(self.compositeList[x]['extent'])
+        
+        print(self.URI+'/rest/'+self.laymanUsername+'/maps/'+self.compositeList[x]['name'])       
+        oldName = self.dlg.lineEdit_name.text()
+        response = requests.delete(self.URI+'/rest/'+self.laymanUsername+'/maps/'+oldName,headers = self.authHeader)
+        print(response.content)
+        self.dlg.close()
+        self.afterCloseEditMapDialog()
+        self.importMap(x, 'mod')
+        
+        try:
+            self.refreshCompositeList()
+            iface.messageBar().pushWidget(iface.messageBar().createMessage("Import:", " Map metadata was saved successfully."), Qgis.Success, duration=3)
+        except:
+            pass
+        
+        
+    def saveLocalFile(self):
+        
+        layer = self.iface.activeLayer()       
+        print(layer.commitChanges()) ## změny uloženy
+        path = iface.activeLayer().dataProvider().dataSourceUri()
+        path = path.split("|")[0].replace("'","")
+        if (layer == None):
+            QMessageBox.information(None, "Message", "You must load layer first!")
+        else:
+           # defaultDir = QDir().home()
+            defaultDir = os.path.dirname(path)
+            print(defaultDir)
+            print(defaultDir +os.sep+ str(layer.name()) + ".geojson")
+            print(QDir().homePath() +os.sep+ str(layer.name()) + ".geojson")
+            dialog = QFileDialog()
+            dialog.setFileMode(1)
+            dialog.setDirectory(defaultDir)
+            print(dialog.directory().path())
+           # layer_name = dialog.getSaveFileName(None, "Save file", QDir().homePath() +os.sep+ str(layer.name()) + ".geojson", "*.geojson")        
+            layer_name = dialog.getSaveFileName(None, "Save file", defaultDir +os.sep+ str(layer.name()) + ".geojson", "*.geojson")   
+            
+            self.json_export_local(layer_name[0], layer)
+
+    def json_export_local(self, layer_name, lay):     
+        import shutil
+        filePath = self.getTempPath(layer_name)  
+        ogr_driver_name = "GeoJSON" 
+        project = QgsProject.instance()
+        fileNames = []
+        ## zde musí být zajištěna vektorová vrstva
+        layer = lay        
+        layerType = layer.type()
+        if layerType == QgsMapLayer.VectorLayer:
+
+            renderer = layer.renderer()
+            hasIcon = False
+            if isinstance(renderer, QgsSingleSymbolRenderer):
+
+                self.copySymbols(renderer.symbol(), tempfile.gettempdir(), fileNames)
+                hasIcon = True
+
+
+            layerCrs = qgis.utils.iface.activeLayer().crs().authid()
+            crs = QgsCoordinateReferenceSystem(layerCrs)          
+            result2 = qgis.core.QgsVectorFileWriter.writeAsVectorFormat(layer, layer_name, "utf-8", crs, ogr_driver_name) # export jsonu do souboru
+            print(result2)
+            if(result2[0] == 2): ## testujeme zda není soubor otevřený v jiném procesu / návratový kod 2
+                
+                tempFile = self.getTempPath(os.path.basename(layer_name.replace(".geojson", "") ))
+                print(tempFile)
+                #QMessageBox.information(None, "Layman", "It is not possible overwrite this file. File is already open in other process.")  
+                sld_temp_filename = tempFile.replace("geojson", "sld") 
+                qml_temp_filename = tempFile.replace("geojson", "qml")
+                layer.saveSldStyle(sld_temp_filename)
+                layer.saveNamedStyle(qml_temp_filename)
+                result2 = qgis.core.QgsVectorFileWriter.writeAsVectorFormat(layer, tempFile, "utf-8", crs, ogr_driver_name)
+                print(result2)
+                if(result2[0] == 2):
+                    QMessageBox.information(None, "Layman", "It is not possible overwrite this file. File is already open in other process.")  
+                    return
+                if os.path.basename(layer_name.replace(".geojson", "")) != '':
+                    QgsProject.instance().removeMapLayer(layer.id())
+                    print(tempFile, layer_name)
+                    shutil.copy(tempFile, layer_name)
+                    shutil.copy(sld_temp_filename, layer_name.replace(".geojson", ".sld"))
+                    shutil.copy(qml_temp_filename, layer_name.replace(".geojson", ".qml"))
+                    self.loadJsonLayer(layer_name)
+                
+            else:                
+                sld_filename = layer_name.replace("geojson", "sld")     
+                qml_filename = layer_name.replace("geojson", "qml") 
+                result3 = False
+                layer.saveSldStyle(sld_filename)
+                layer.saveNamedStyle(qml_filename)
+
+    def json_export(self, layer_name):     
+
+        filePath = self.getTempPath(layer_name.lower())  
+        ogr_driver_name = "GeoJSON"     
+        project = QgsProject.instance()
+        fileNames = []      
+        layer = QgsProject.instance().mapLayersByName(layer_name)[0]       
+        
+        layerType = layer.type()
+        if layerType == QgsMapLayer.VectorLayer:
+
+            renderer = layer.renderer()
+            hasIcon = False
+            if isinstance(renderer, QgsSingleSymbolRenderer):
+
+                self.copySymbols(renderer.symbol(), tempfile.gettempdir(), fileNames)
+                hasIcon = True
+
+
+            #layerCrs = qgis.utils.iface.activeLayer().crs().authid()
+            layerCrs = layer.crs().authid()
+            crs = QgsCoordinateReferenceSystem(layerCrs)# původně bylo
+            layer_filename = filePath       
+          #  crs = QgsCoordinateReferenceSystem(4326, QgsCoordinateReferenceSystem.EpsgCrsId)
+            ##crs = layer.crs().authid()
+         #   tempOut = layer_filename.replace(".geojson", "_2.geojson") 
+            result2 = qgis.core.QgsVectorFileWriter.writeAsVectorFormat(layer, layer_filename, "utf-8", crs, ogr_driver_name) # export jsonu do souboru
+            ##transformace
+        #    input = tempOut
+        #    out = layer_filename
+        #    try:
+        #        os.remove(layer_filename)
+        #    except:
+        #        pass
+        ##    print("","-f", "Geojson", "-s_srs", layerCrs, "-t_srs", "epsg:4326", out, input)
+        #    print("convert")
+        #    print(main(["","-f", ogr_driver_name, "-s_srs", "EPSG:5514", "-t_srs", "EPSG:4326", out, input])) ## ogr2ogr
+            ##
+            sld_filename = filePath.replace("geojson", "sld").lower()            
+            result3 = False
+            layer.saveSldStyle(sld_filename)
+
+
+    def checkValidAttributes(self, layer_name):
+        layers = QgsProject.instance().mapLayersByName(layer_name)
+        if len(layers) > 1:
+            for l in layers:
+                if (isinstance(l, QgsVectorLayer)):
+                    print("xxx")
+                    layers.clear()
+                    layers.append(l)
+                    break
+        isValid = True
+        pom =layers[0].getFeature(1)        
+        for nam in pom.fields().names():
+            if (nam == ''):
+                isValid = False
+        return isValid
+
+
+    def checkWgsExtent(self, layer):
+        WgsXmax = 180
+        WgsXmin = -180
+        WgsYmax = 90
+        WgsYmin = -90
+        extent = layer.extent()
+        if (extent.xMaximum() > WgsXmax or extent.xMinimum() < WgsXmin or extent.yMaximum() > WgsYmax or extent.yMinimum() < WgsYmin ):
+            return False
+        else:
+            return True
+
+
+    def callPostRequest(self, layers):
+        
+        for item in layers:
+            print (item.text(0))
+            
+            
+                
+
+            self.postRequest(item.text(0))
+    #def transformLayer2(self, layer):
+    #    pass
+    def setCurrentLayer(name):
+        layers = QgsProject.instance().mapLayersByName(name) 
+        if(len(layers) >1):
+            layerss = QgsProject.instance().mapLayers().values()    
+            i = 0
+            for layer in layerss:  
+                if layers[0].name == layer.name():
+                    if (i == item.currentIndex()):
+                        i = i + 1
+                        break
+                    i = i + 1
+        return i
+    def transformLayer(self, layer):
+        layer = iface.activeLayer()
+        crsSrc = layer.crs()
+        print(crsSrc.authid())
+        crsDest = QgsCoordinateReferenceSystem(4326, QgsCoordinateReferenceSystem.EpsgCrsId)
+        print(crsSrc, crsDest)
+        xform = QgsCoordinateTransform(crsSrc, crsDest, 5514, 4326)
+        feats=[]
+
+        if (layer.geometryType() == 0):
+            destLayer = QgsVectorLayer("Point?crs=EPSG:4326","lay","memory")
+        if (layer.geometryType() == 1):
+            destLayer = QgsVectorLayer("Linestring?crs=EPSG:4326","lay","memory")
+        if (layer.geometryType() == 2):
+            destLayer = QgsVectorLayer("Polygon?crs=EPSG:4326","lay","memory")
+
+        for f in layer.getFeatures():
+            g = f.geometry()
+    
+            g.transform(xform)
+            print(g)
+            f.setGeometry(g)
+            feats.append(f)
+    
+        destLayer.dataProvider().addFeatures(feats)
+        return destLayer
+    def postRequest(self, layer_name):     
+        nameCheck = True
+        validExtent = True
+        layers = QgsProject.instance().mapLayersByName(layer_name)  
+       # layer_name = self.removeUnacceptableChars(layer_name)
+        layers[0].setName(layer_name)
+        if len(layers) > 1:
+            for l in layers:
+                if (isinstance(l, QgsVectorLayer)):                   
+                    layers.clear()
+                    layers.append(l)
+                    break
+     
+        #if not (re.match('[a-zA-Z_]{1}', layer_name)): ## nesmí být nesmysl v názvu na prvním místě
+        #    QMessageBox.information(None, "Layman", "Diacritics or number in first character is not allowed.")
+        #    nameCheck = False
+        #if not (re.match('[a-zA-Z0-9]', layer_name)): ## není povolena diakritika
+        #    QMessageBox.information(None, "Layman", "Diacritics is not allowed.")
+        #    nameCheck = False
+
+        if (re.match('[0-9]{1}', layer_name)): ## nesmí být nesmysl v názvu na prvním místě
+            QMessageBox.information(None, "Layman", "Number in first character is not allowed.")
+            nameCheck = False
+        
+        print(layer_name)
+        #if (layers[0].crs().authid() != 'EPSG:4323'):
+        #    layers[0] = self.transformLayer(layers[0]) 
+
+        if not self.checkWgsExtent(layers[0]):
+            QMessageBox.information(None, "Layman", "Extent of layer is out of WGS 84 range. (EPSG: 4326)")
+            validExtent = False
+
+        if (nameCheck and validExtent):
+                     
+            crs = layers[0].crs().authid()
+            crs = "EPSG:4326"
+            data = { 'name' :  str(layer_name).lower(), 'title' : str(layer_name), 'crs' : str(crs) } 
+            
+            if (self.checkValidAttributes(layer_name)):
+                if (self.checkExistingLayer(layer_name)):
+                    
+                    print("vrstva již existuje")
+                    msgbox = QMessageBox(QMessageBox.Question, "Layman", "Layer "+layer_name+" already exists in server. Do you want overwrite it´s geometry?")
+                    msgbox.addButton(QMessageBox.Yes)
+                    msgbox.addButton(QMessageBox.No)
+                    msgbox.setDefaultButton(QMessageBox.No)
+                    reply = msgbox.exec()
+                    if (reply == QMessageBox.Yes):
+                        print("vrstva již existuje")
+                        self.json_export(layer_name)
+                        geoPath = self.getTempPath(layer_name)
+                        #try:
+                        if (os.path.getsize(geoPath) > self.CHUNK_SIZE):
+                            self.postInChunks(layer_name, "patch")
+                           # iface.messageBar().pushWidget(iface.messageBar().createMessage("Import:", " Layer  " + layer_name + " was imported successfully."), Qgis.Success, duration=3)
+                        else:
+                            self.patchLayer(layer_name, data)
+                            iface.messageBar().pushWidget(iface.messageBar().createMessage("Import:", " Layer  " + layer_name + " was imported successfully."), Qgis.Success, duration=3)
+                        #except:
+                        #    iface.messageBar().pushWidget(iface.messageBar().createMessage("Import:", " Layer  " + layer_name + " was not imported successfully."), Qgis.Warning, duration=3)
+                    else:
+                        pass
+                else:
+            
+                    self.layerName = layer_name
+                   # if (self.checkEpsg(layer_name)):
+                    if(True): ##Pravděpodobně nebude třeba testovat EPSG, pokud se detekuje, je vrstva transformována. 
+                      #  print (layer_name)
+                        self.json_export(layer_name)
+                        sldPath = self.getTempPath(self.layerName).replace("geojson", "sld")
+                        geoPath = self.getTempPath(self.layerName)
+                        if (os.path.getsize(geoPath) > self.CHUNK_SIZE):
+                            self.postInChunks(layer_name, "post")
+                        else:
+                            if(os.path.isfile(sldPath)): ## existuje sld?
+                                files = [('file', open(geoPath, 'rb')), ('sld', open(sldPath, 'rb'))]
+                            else:
+                                files = {'file': (geoPath, open(geoPath, 'rb')),} 
+
+                            print(files)
+                            response = requests.post(self.URI+'/rest/'+self.laymanUsername+'/layers', files=files, data = data, headers = self.authHeader)
+                            print(response.content)
+                            print(response.status_code)
+                            if response.status_code == 200:
+                                iface.messageBar().pushWidget(iface.messageBar().createMessage("Import:", " Layer  " + layer_name + " was imported successfully."), Qgis.Success, duration=3)
+                            else:
+                                iface.messageBar().pushWidget(iface.messageBar().createMessage("Import:", " Layer  " + layer_name + " was not imported."), Qgis.Warning, duration=3)
+                    else:
+                   
+                        QMessageBox.information(None, "Layman", "Use EPSG:4326")
+            else:
+                QMessageBox.information(None, "Layman", "Layer "+layer_name+" does not have attributes!")
+
+    def addExistingLayerToComposite(self, name):
+        x = self.dlg.listWidget.currentRow()
+        if self.checkLayerOnLayman(name):
+            inComposite = name in self.isRasterLayerInComposite(x, name)
+            if not(inComposite):
+                response = requests.get(self.URI+'/rest/'+self.laymanUsername+'/layers/'+str(name), verify=False)
+                res = self.fromByteToJson(response.content)
+                print(res)
+                wmsUrl = res['wms']['url']
+        
+            
+                self.compositeList[x]['layers'].append({"metadata":{},"visibility":True,"opacity":1,"title":str(name),"className":"HSLayers.Layer.WMS","singleTile":True,"wmsMaxScale":0,"legends":[""],"maxResolution":None,"minResolution":0,"url": wmsUrl ,"params":{"LAYERS": str(name),"INFO_FORMAT":"application/vnd.ogc.gml","FORMAT":"image/png","FROMCRS":"EPSG:3857","VERSION":"1.3.0"},"ratio":1.5,"dimensions":{}})
+                self.importMap(x, 'add', 1)
+                self.refreshLayerList()
+            else:
+                QMessageBox.information(None, "Message", "Composition already include layer "+name+"!")
+        else:
+            QMessageBox.information(None, "Layman", "Something went wrong with this layer: "+name)
+
+    def addExistingMapToMemory(self, name):
+        response = requests.get(self.URI+'/rest/'+self.laymanUsername+'/maps/'+str(name), verify=False)
+        res = self.fromByteToJson(response.content)
+        print(res)
+        wmsUrl = res['wms']['url']
+        
+        x = self.dlg.listWidget.currentRow()
+
+
+        self.compositeList[x]['layers'].append({"metadata":{},"visibility":True,"opacity":1,"title":str(name),"className":"HSLayers.Layer.WMS","singleTile":True,"wmsMaxScale":0,"legends":[""],"maxResolution":None,"minResolution":0,"url": wmsUrl ,"params":{"LAYERS": str(name),"INFO_FORMAT":"application/vnd.ogc.gml","FORMAT":"image/png","FROMCRS":"EPSG:3857","VERSION":"1.3.0"},"ratio":1.5,"dimensions":{}})
+        self.importMap(x, 'add', 1)
+        self.refreshLayerList()
+
+    def layerInfoRedirect(self, name):
+        url = self.URI+'/rest/'+self.laymanUsername+"/layers/" + name
+        print(url)
+        response = requests.get(url)
+        r = self.fromByteToJson(response.content)
+        try:
+            url = r['metadata']['record_url']
+            webbrowser.open(url, new=2) ## redirect na micku pro více info
+        except:
+            QMessageBox.information(None, "Layman", "Link is unavailable.")
+    def checkLayerOnLayman(self, layer_name):
+        url = self.URI+'/rest/'+self.laymanUsername+"/layers/"+layer_name
+        r = requests.get(url = url, verify=False)
+        #print(r.content)
+        data = r.json()
+        try:
+            if data['wms']['status'] == 'NOT_AVAILABLE' or data['wms']['status'] == 'PENDING':
+                return False
+            else:
+                return True
+        except:
+            return True # validní vrstva nemá status
+
+
+    def addLayerToComposite(self,x):
+       
+        self.compositeListOld = copy.deepcopy(self.compositeList) ## list pred upravou pro vraceni zmen
+        #layers = self.getSelectedLayers() #odkomentovat pro zapnuti nacitani vrstev z listwidgetu
+        layers = []
+        layers.append(self.dlg.mMapLayerComboBox.currentLayer())
+        successful = 0
+        print (len(layers))
+        try:
+            step = self.getProgressBarStep(len(layers))
+        except:
+            QMessageBox.information(None, "Layman", "No layer selected!")
+        
+        for i in range (0, len(layers)):
+            print(type(layers[i]))           
+            
+            print (self.isLayerInComposite(x))
+            print (layers[i].name() in self.isLayerInComposite(x))
+            inComposite = layers[i].name() in self.isLayerInComposite(x)
+            layerName = self.removeUnacceptableChars(layers[i].name())
+            if (self.checkExistingLayer(layers[i].name()) and inComposite):
+                j = self.getLayerInCompositePosition(x)
+                print("j je: " + str(j))
+                
+               # QMessageBox.information(None, "Message", "Composition already include layer "+layers[i].name()+"!")
+               # self.deteteLayerFromComposite(x, j, layers[i].name())
+             
+                self.postRequest(layers[i].name())
+                layerName = self.removeUnacceptableChars(layers[i].name())
+                wmsStatus = 'PENDING'
+                j = 0
+                while ((wmsStatus == 'PENDING') and (j < 10)):
+                    print (self.URI+'/rest/'+self.laymanUsername+'/layers/'+str(layerName))
+                    response = requests.get(self.URI+'/rest/'+self.laymanUsername+'/layers/'+str(layerName), verify=False)
+                    res = self.fromByteToJson(response.content)
+                    try:
+                        wmsStatus = res['wms']['status']
+                    except:
+                        wmsStatus = "done"
+                    time.sleep(1)
+                    j = j + 1
+            
+
+                #print(res)
+                #try:
+                #    wmsUrl = res['wms']['url']
+                #except:
+                #    wmsUrl = self.URI+'/geoserver/'+layers[i].name()+'/ows'
+                #self.compositeList[x]['layers'].append({"metadata":{},"visibility":True,"opacity":1,"title":str(layers[i].name()),"className":"HSLayers.Layer.WMS","singleTile":True,"wmsMaxScale":0,"legends":[""],"maxResolution":None,"minResolution":0,"url": wmsUrl ,"params":{"LAYERS": str(layers[i].name()),"INFO_FORMAT":"application/vnd.ogc.gml","FORMAT":"image/png","FROMCRS":"EPSG:3857","VERSION":"1.3.0"},"ratio":1.5,"dimensions":{}})
+                #successful = successful + 1
+                #self.dlg.progressBar.setValue(self.dlg.progressBar.value()+step)
+ 
+                #self.importMap(x, "add", successful) 
+
+              
+            else:
+                self.postRequest(layers[i].name())
+                wmsStatus = 'PENDING'
+                j = 0
+                while ((wmsStatus == 'PENDING') and (j < 10)):
+                    print (self.URI+'/rest/'+self.laymanUsername+'/layers/'+str(layerName))
+                    response = requests.get(self.URI+'/rest/'+self.laymanUsername+'/layers/'+str(layerName), verify=False)
+                    res = self.fromByteToJson(response.content)
+                    try:
+                        wmsStatus = res['wms']['status']
+                    except:
+                        wmsStatus = "done"
+                    time.sleep(1)
+                    j = j + 1
+            
+
+                print(res)
+                try:
+                    wmsUrl = res['wms']['url']
+                except:
+                    wmsUrl = self.URI+'/geoserver/'+layerName+'/ows'
+                self.compositeList[x]['layers'].append({"metadata":{},"visibility":True,"opacity":1,"title":str(layerName),"className":"HSLayers.Layer.WMS","singleTile":True,"wmsMaxScale":0,"legends":[""],"maxResolution":None,"minResolution":0,"url": wmsUrl ,"params":{"LAYERS": str(layers[i].name()),"INFO_FORMAT":"application/vnd.ogc.gml","FORMAT":"image/png","FROMCRS":"EPSG:3857","VERSION":"1.3.0"},"ratio":1.5,"dimensions":{}})
+                successful = successful + 1
+                self.dlg.progressBar.setValue(self.dlg.progressBar.value()+step)
+ 
+                self.importMap(x, "add", successful) 
+    def getProgressBarStep(self, count):
+        return (100/count)
+
+    def deteteLayerFromComposite(self, x, position, name):   ## pro verzi s komboboxem   
+        
+        previousLayers = self.compositeList[x]['layers']         
+        self.compositeList[x]['layers'] = []  
+        for i in range (0,len(previousLayers)):
+            if (i != position):              
+               self.compositeList[x]['layers'].append(previousLayers[i])        
+        self.importMap(x, "del")
+        done = True
+        if (len(self.compositeList[x]['layers']) != 0 and len(self.compositeList[x]['layers']) != None):
+            for i in range (0, len(self.compositeList[x]['layers'])):
+                if (self.compositeList[x]['layers'][i]['params']['LAYERS'] == name):
+                    done = False
+        if (done and QgsProject.instance().mapLayersByName(name)):    ## kompozice může mít načtené vrstvy, které nejsou v canvasu
+            self.deleteLayerFromCanvas(name)    
+        
+    def importCleanComposite(self,x):
+        tempFile = tempfile.gettempdir() + os.sep + "atlas" + os.sep + "compsite.json"
+        with open(tempFile, 'w') as outfile:  
+                    json.dump(self.compositeList[x], outfile)
+        with open(tempFile, 'rb') as f:
+                    d = json.load(f)        
+        files = {'file': (tempFile, open(tempFile, 'rb')),} 
+        data = { 'name' :  self.compositeList[x]['name'], 'title' : self.compositeList[x]['title'], 'description' : self.compositeList[x]['abstract']} 
+        print(self.URI+'/rest/'+self.laymanUsername+'/maps/')
+        #response = requests.post(self.URI+'/rest/'+self.laymanUsername+'/maps/', data = data, files=files, headers = self.authHeader, verify=False)
+        print(self.authHeader)
+        response = requests.post(self.URI+'/rest/'+self.laymanUsername+'/maps', files=files, data = data, headers = self.authHeader, verify=False)
+        
+        print(response.content)
+
+
+
+    def showProgressBar(self, bar):
+        bar = QProgressBar() 
+        bar.setRange(0,0) ## range 0,0 je nekonečný
+        self.showProgressBar(bar)
+        bar.show()
+        iface.mainWindow().statusBar().addWidget(bar)
+    def fromByteToJson(self, res):
+        pom = res
+        pom = pom.decode('utf_8')
+        pom = json.loads(pom)
+        return pom
+
+    def importMap(self, x, operation, s = 0): ##s je počet vrstev úspěšně nahraných na server   
+        if (s != 0):
+            self.dlg.progressBar.show() 
+            self.dlg.label_import.show()
+        tempFile = tempfile.gettempdir() + os.sep + "atlas" + os.sep + "compsite.json"
+        
+        try:
+            existingLayers = self.isLayerInComposite(x)
+        except:
+            existingLayers = []        
+        successful = s
+        with open(tempFile, 'w') as outfile:  
+            json.dump(self.compositeList[x], outfile)
+        jsonPath = tempfile.gettempdir() + os.sep + "atlas" + os.sep + "compsite.json"
+        with open(jsonPath, 'rb') as f:
+            d = json.load(f)
+
+        files = {'file': (jsonPath, open(jsonPath, 'rb')),} 
+        data = { 'name' :  self.compositeList[x]['name'], 'title' : self.compositeList[x]['title'], 'description' : self.compositeList[x]['abstract']} 
+        req = requests.get(self.URI+'/rest/'+self.laymanUsername+'/maps/'+self.compositeList[x]['name'])
+        mapCode = req.status_code ## test jestli vrstva na serveru existuje. Pokud ne = error 404
+        if (mapCode == 404 or operation == "mod" or operation == "del"):
+        #if(True):
+            if (operation == "add"):                
+                msgbox = QMessageBox(QMessageBox.Question, "Import Map", "Chcete přidat do kompozice "+str(successful)+" vrstev?") 
+            if (operation == "mod"): 
+                #msgbox = QMessageBox(QMessageBox.Question, "Import Map", "Do you want save changes?") 
+                
+                self.dlg.close()
+                try:
+                    self.afterCloseEditMapDialog()
+                except: 
+                    pass
+                print(self.URI+'/rest/'+self.laymanUsername+'/maps/'+self.compositeList[x]['name'])       
+              
+                response = requests.delete(self.URI+'/rest/'+self.laymanUsername+'/maps/'+self.compositeList[x]['name'],headers = self.authHeader)
+                print(response.content)
+                print("deleted")
+                response = requests.post(self.URI+'/rest/'+self.laymanUsername+'/maps', files=files, data = data, headers = self.authHeader)
+                #self.dlg.show()
+                return
+            if (operation == "del"):
+                msgbox = QMessageBox(QMessageBox.Question, "Import Map", "Chcete smazat vybranou vrstvu?")
+          
+            try: # jedná se o mod pokud je except
+                msgbox.addButton(QMessageBox.Yes)
+                msgbox.addButton(QMessageBox.No)
+                msgbox.setDefaultButton(QMessageBox.No)
+                reply = msgbox.exec()
+            except:
+                pass
+                
+            if (reply == QMessageBox.Yes):
+                response = requests.post(self.URI+'/rest/'+self.laymanUsername+'/maps', files=files, data = data, headers = self.authHeader)
+                print(response.content)
+                data = response.content
+                self.dlg.progressBar.hide() 
+               # self.refreshItems()## refresh formuláře
+                if (operation != "mod"):
+                    self.refreshLayerList()
+                
+            else:
+                if (operation == "add"):
+                    self.dlg.progressBar.setValue(0)                
+     
+        else:
+            print(self.URI+'/rest/'+self.laymanUsername+'/maps/'+self.compositeList[x]['name'])       
+            files = {'file': (jsonPath, open(jsonPath, 'rb')),} 
+            response = requests.patch(self.URI+'/rest/'+self.laymanUsername+'/maps/'+self.compositeList[x]['name'], data = data, files=files, headers = self.authHeader, verify=False)
+            try:
+                self.refreshLayerList()
+            except:
+                ## nacházíme se v jiném formuláři, není co refreshovat
+                pass
+            #if (operation == "add"):
+            #    print(len(existingLayers))
+            #    msgbox = QMessageBox(QMessageBox.Question, "Layman", "Vybraná vrstva bude přidána do kompozice.")
+            #    #if(len(existingLayers) == 0):
+                    
+            #    #    #if (successful != 0):
+            #    #    msgbox = QMessageBox(QMessageBox.Question, "Layman", "Vybraná vrstva bude přidána do kompozice.")
+            #    #else:
+            #    #  #  msgbox = QMessageBox(QMessageBox.Question, "Import Map", "Kompozice již obsauje vrstvy: "+(', '.join(existingLayers))+". Chcete vybrané vrstvy opravdu znovu přidat?.")
+            #    #     msgbox = QMessageBox(QMessageBox.Question, "Layman", "Vybraná vrstva bude přidána do kompozice.")
+            #if (operation == "del"):
+            #    msgbox = QMessageBox(QMessageBox.Question, "Import Map", "Chcete smazat vybranou vrstvu?")
+            #if (operation == "mod"):
+            #    msgbox = QMessageBox(QMessageBox.Question, "Import Map", "Chcete uložit upravenou mapu?")
+            #msgbox.addButton(QMessageBox.Yes)
+            #msgbox.addButton(QMessageBox.No)
+            #msgbox.setDefaultButton(QMessageBox.No)
+            #reply = msgbox.exec()
+            #if (reply == QMessageBox.Yes):            
+            #    print(self.URI+'/rest/'+self.laymanUsername+'/maps/'+self.compositeList[x]['name'])       
+            #    files = {'file': (jsonPath, open(jsonPath, 'rb')),} 
+            #    response = requests.patch(self.URI+'/rest/'+self.laymanUsername+'/maps/'+self.compositeList[x]['name'], data = data, files=files, headers = self.authHeader, verify=False)
+   
+            #    try:
+            #        self.refreshLayerList()
+            #    except:
+            #        ## nacházíme se v jiném formuláři, není co refreshovat
+            #        pass
+            #if (reply == QMessageBox.No):
+                
+            #    self.compositeList = copy.deepcopy(self.compositeListOld)
+            #    #self.refreshItems()##refresh formulare
+               # self.refreshLayerList()
+        try: ## některé formuláře nemají progress bar
+            self.dlg.progressBar.hide() 
+            self.dlg.label_import.hide() 
+        except:
+            pass
+    def deleteLayer(self, layerName):
+        url = self.URI+'/rest/'+self.laymanUsername+"/layers/" + layerName
+        r = requests.delete(url)
+        print (r.content)
+    def getActiveLayer(self):
+        layer = self.iface.activeLayer()
+        return layer
+    
+    def createComposite(self, name, title):
+      #  if (name == "" or title == ""):
+        if (title == ""):
+            QMessageBox.information(None, "Message", "Není vyplněn titulek!")
+        else:
+            name = self.removeUnacceptableChars(title)
+            data = self.getEmptyComposite(name,title)
+            print (data)
+            self.compositeList.append(data)   
+            x = len(self.compositeList) - 1
+            self.importCleanComposite(x)
+            try:
+                self.refreshCompositeList()
+            except:
+                pass
+
+
+    def patchLayer(self, layer_name, data):
+        print("patch layer")
+        self.json_export(layer_name)
+        self.layerName = layer_name.lower()
+        
+        sldPath = self.getTempPath(self.layerName).replace("geojson", "sld")
+        geoPath = self.getTempPath(self.layerName)
+        ##self.layerName = self.layerName
+        print(sldPath)
+        if(os.path.isfile(sldPath)): ## existuje sld?
+            files = [('file', open(geoPath, 'rb')), ('sld', open(sldPath, 'rb'))]
+            print("sld")
+        else:
+            files = {'file': (geoPath, open(geoPath, 'rb')),}  
+            print("ne sld")
+        layer_name = layer_name.lower()
+        layer_name = layer_name.replace(" ", "_")
+        url = self.URI+'/rest/'+self.laymanUsername+"/layers/" + layer_name
+        print(url)
+        r = requests.patch(url, files=files, data = data, headers = self.authHeader, verify=False)
+        print(r.content)
+
+    def getTempPath(self, name):
+
+        print (name)
+        if type(name) is tuple:
+            return (name[0] +  name[1])
+        else:
+            tempFile = tempfile.gettempdir() + os.sep + name +'.geojson'
+
+            return tempFile
+    def sendLayer(self):       
+        layer = self.getActiveLayer()      
+        if (layer == None):
+            QMessageBox.information(None, "Message", "Neexistuje žádná vrstva k uložení")
+        else:
+            self.json_export()
+            self.postRequest()
+    def getExistingLayers(self):
+        url = self.URI+'/rest/'+self.laymanUsername+"/layers"
+        r = requests.get(url = url) 
+        data = r.json()
+        for x in range(len(data)):
+            print(data[x]['name'])
+        return data
+    def checkExistingLayer(self, layerName):
+        layerName = self.removeUnacceptableChars(layerName)
+        url = self.URI+'/rest/'+self.laymanUsername+"/layers"
+        r = requests.get(url = url) 
+        data = r.json()
+        
+        pom = set()
+        for x in range(len(data)):
+            pom.add((data[x]['name']))
+        layerName = layerName.replace(" ", "_").lower()
+        print(layerName)
+        print(pom)
+        if (layerName in pom):
+            return True
+        else:
+            return False
+   
+    def removeUnacceptableChars(self, input):
+        input = input.lower()
+        input = input.replace("ř","r")
+        input = input.replace("š","s")
+        input = input.replace("ž","z")
+        input = input.replace("ů","u")
+        input = input.replace("ú","u")
+        input = input.replace(" ","_")
+        input = input.replace("é","e")
+        input = input.replace("í","i")
+        input = input.replace("ý","y")
+        input = input.replace("á","a")
+        input = input.replace("ó","o")
+        input = input.replace("č","c")
+        input = input.replace("ď","d")
+        input = input.replace("ě","e")
+        input = input.replace("ť","t")
+        input = re.sub(r'[?|$|.|!]',r'',input)
+        
+       # iface.messageBar().pushWidget(iface.messageBar().createMessage("Layman:", "Diacritics in name of layer was replaced."), Qgis.Success, duration=3)
+        return input
+    def removeUnacceptableChars2(self, input):
+        input = input.encode('utf-8')
+        input = input.hex()
+        
+       # iface.messageBar().pushWidget(iface.messageBar().createMessage("Layman:", "Diacritics in name of layer was replaced."), Qgis.Success, duration=3)
+        return input
+    def test (self):
+        item = self.dlgGetLayers.items.currentItem().text()
+        print( item)
+    
+    def isLayerInComposite(self, x):      
+        layers =[]
+        layers.append(self.dlg.mMapLayerComboBox.currentLayer())
+        print (self.URI+'/rest/'+self.laymanUsername+'/maps/'+self.compositeList[x]['name']+'/file')
+        req = requests.get (self.URI+'/rest/'+self.laymanUsername+'/maps/'+self.compositeList[x]['name']+'/file')
+        data = req.json()
+       
+        print (data['abstract'])
+        print (len(self.compositeList[x]['layers']))
+        existingLayers = []
+        for i in range (0, len(data['layers'])):
+            for j in range (0, len(layers)):
+                if (data['layers'][i]['params']['LAYERS'] in layers[j].name() ):
+                    existingLayers.append(data['layers'][i]['params']['LAYERS'])
+
+        return existingLayers
+    def getLayerInCompositePosition(self, x):      
+        layers =[]
+        layers.append(self.dlg.mMapLayerComboBox.currentLayer())
+        print (self.URI+'/rest/'+self.laymanUsername+'/maps/'+self.compositeList[x]['name']+'/file')
+        req = requests.get (self.URI+'/rest/'+self.laymanUsername+'/maps/'+self.compositeList[x]['name']+'/file')
+        data = req.json()
+       
+        print (data['abstract'])
+        print (len(self.compositeList[x]['layers']))
+        existingLayers = []
+        j = 0
+        for i in range (0, len(data['layers'])):
+            for j in range (0, len(layers)):
+                if (data['layers'][i]['params']['LAYERS'] in layers[j].name() ):
+                  #  existingLayers.append(data['layers'][i]['params']['LAYERS'])
+                   j = i
+                   print("founded")
+
+        return j
+
+    def isRasterLayerInComposite(self, x, name):
+        req = requests.get (self.URI+'/rest/'+self.laymanUsername+'/maps/'+self.compositeList[x]['name']+'/file')
+        data = req.json()
+        existingLayers = []
+        for i in range (0, len(data['layers'])):
+            if (data['layers'][i]['params']['LAYERS'] ==  name ):
+                existingLayers.append(data['layers'][i]['params']['LAYERS'])
+        return existingLayers
+    
+    def addComposite(self, data, service, groupName = ''):      
+        #self.compositeList.append (data)
+        print(len(data['layers']))
+        ##for x in range(0, len(data['layers'])): 
+        for x in range(len(data['layers'])- 1, -1, -1):          
+          #  repairUrl = self.convertUrlFromHex(data['layers'][x]['url'])  
+            repairUrl = self.URI+"/geoserver/"+self.laymanUsername+"/ows"
+            layerName = data['layers'][x]['params']['LAYERS']
+            format = data['layers'][x]['params']['FORMAT']
+           #  epsg = str(data['groups']['projection']).upper()
+            epsg = 'EPSG:4326' 
+            #abstract = data['data']['layers'][x]['params']['ABSTRACT']
+            wmsName = data['layers'][x]['params']['LAYERS']
+            
+            print("groupName " +groupName)
+            print("groupName " +layerName)
+            
+            print("groupName " +format)
+            print("groupName " +epsg)
+            layerNameTitle = self.getLayerTitle(layerName)
+            print("groupName " +layerNameTitle)
+            
+            
+            if service == 'WMS':         
+                self.loadWms(repairUrl, layerName,layerNameTitle, format,epsg, groupName)
+
+            if service == 'WFS':          
+                self.loadWfs(repairUrl, layerName,layerNameTitle, groupName)
+    def loadService(self, data, service, groupName = ''):     
+        
+        #print(len(data['layers']))
+        for x in range(len(data['layers'])- 1, -1, -1):       ## descending order 
+            #repairUrl = self.convertUrlFromHex(data['layers'][x]['url'])  
+            repairUrl = self.URI+"/geoserver/"+self.laymanUsername+"/ows"
+            layerName = data['layers'][x]['params']['LAYERS']
+            format = data['layers'][x]['params']['FORMAT']
+           #  epsg = str(data['groups']['projection']).upper()
+            epsg = 'EPSG:4326' 
+            #abstract = data['data']['layers'][x]['params']['ABSTRACT']
+            wmsName = data['layers'][x]['params']['LAYERS']  
+            layerNameTitle = data['layers'][x]['title']
+            if self.checkLayerOnLayman(layerName):
+                if service == 'WMS':         
+                    print("zzzzzzz" +layerName)
+                    self.loadWms(repairUrl, layerName,layerNameTitle, format,epsg, groupName)
+
+                if service == 'WFS':          
+                    self.loadWfs(repairUrl, layerName,layerNameTitle, groupName)
+            else:
+                QMessageBox.information(None, "Layman", "Layer: "+layerName + " is corrupted and will not be loaded.")
+    def getLayerTitle(self, layerName):
+        layerName = self.removeUnacceptableChars(layerName)
+        url = self.URI+'/rest/'+self.laymanUsername+'/layers/'+layerName
+        r = requests.get(url = url)
+        data = r.json()
+        print(data)
+        title = data['title']
+        return title
+        
+    def loadWms(self, url, layerName,layerNameTitle, format, epsg, groupName = ''):      
+        print("debug")
+        print(groupName)
+        print(layerNameTitle)
+        print(layerName)
+        
+        layerName = self.removeUnacceptableChars(layerName)
+        print(layerName)
+        epsg = "EPSG:4326"
+        urlWithParams = 'contextualWMSLegend=0&crs='+epsg+'&IgnoreReportedLayerExtents=1&dpiMode=7&featureCount=10&format=image/png&layers='+layerName+'&styles=&url=' + url
+        print(urlWithParams)
+        print("test")
+        print(layerNameTitle)
+        rlayer = QgsRasterLayer(urlWithParams, layerNameTitle, 'wms')
+        try:
+            print("extents")
+            print(rlayer.ignoreExtents())
+        except:
+            print("ignoreExtents works only with qgis 3.10 and higher")
+            pass # pro qgis 3.10 a vys
+            
+           
+        if (groupName != ''):
+            self.addWmsToGroup(groupName,rlayer)
+        else:
+            QgsProject.instance().addMapLayer(rlayer)
+
+    def loadWfs(self, url, layerName,layerNameTitle, groupName = ''):
+        layerName = self.removeUnacceptableChars(layerName)
+        epsg = 'EPSG:4326'        
+        uri = self.URI+"/geoserver/"+self.laymanUsername+"/ows?srsname="+epsg+"&typename="+self.laymanUsername+":"+layerName+"&restrictToRequestBBOX=1&pagingEnabled=True&version=auto&request=GetFeature&service=WFS"
+        
+        print(uri)        
+        vlayer = QgsVectorLayer(uri, layerNameTitle, "WFS")
+        print(vlayer.isValid())  
+        if (groupName != ''):
+            self.addWmsToGroup(groupName,vlayer)
+        else:
+            QgsProject.instance().addMapLayer(vlayer)
+    def addWmsToGroup(self, groupName, layer):
+        root = QgsProject.instance().layerTreeRoot()
+        group = root.findGroup(groupName)
+        if not(group):
+            group = root.addGroup(groupName)  
+            group = self.reorderToTop(groupName)
+        QgsProject.instance().addMapLayer(layer,False)
+        group.insertChildNode(0,QgsLayerTreeLayer(layer))         
+    def reorderToTop(self, name):
+        root = QgsProject.instance().layerTreeRoot()
+        for ch in root.children():
+            if ch.name() == name:
+                _ch = ch.clone()
+                root.insertChildNode(0, _ch)
+                root.removeChildNode(ch)
+        return _ch
+    def convertUrlFromHex(self, url):
+        url = url.replace('%3A',':')
+        url = url.replace('%2F','/')
+        url = url.replace('%3F','?')
+        url = url.replace('%3D','=')
+        url = url.replace('%26','&') 
+        return url
+
+    def checkEpsg(self, name):
+        ret = False
+        layer = QgsProject.instance().mapLayersByName(name)
+        layerCRS = layer[0].crs().authid()
+        if ((layerCRS == 'EPSG:4326') or (layerCRS == 'EPSG:3857')):
+            ret = True
+        return ret
+
+    def registerLayer(self, name):
+        sldPath = self.getTempPath(name).replace("geojson", "sld").lower()
+        geoPath = self.getTempPath(name).lower()
+
+        url = "http://layman.lesprojekt.cz/rest/"+self.laymanUsername+"/layers"
+                             
+        files = {'sld': (sldPath, open(sldPath, 'rb')),} # nahrávám sld
+        payload = {        
+            'file': name.lower()+".geojson",
+            'title': name
+            }    
+        response = requests.request("POST", url, files = files, data=payload, headers = self.authHeader)    
+        print(response.text)
+
+    def read_in_chunks(self, file_object): ## cca 1MB chunk převzato z laymana test klienta
+        chunk_size=self.CHUNK_SIZE
+        while True:
+            data = file_object.read(chunk_size)
+            if not data:
+                break
+            yield data
+    
+    def postInChunks(self, layer_name, reqType):
+        print(reqType)
+        if (reqType == "patch"):
+            url = self.URI+'/rest/'+self.laymanUsername+'/layers/'+layer_name.lower().replace(" ", "_")
+            r = requests.delete(url,headers = self.authHeader)
+           # print(r.content)
+        
+        self.registerLayer(layer_name)
+        layer_name = str(layer_name).lower() 
+        filePath = os.path.join(tempfile.gettempdir(), "atlas_chunks" ) ## chunky se ukládají do adresáře v tempu
+        
+        if not (os.path.exists(filePath)):
+            os.mkdir(filePath)
+        file = self.getTempPath(layer_name) 
+        f = open(file, 'rb')
+        arr = []
+        for piece in self.read_in_chunks(f):
+            arr.append(piece)
+        ##layer_name = layer_name.lower()
+        url = self.URI+'/rest/'+self.laymanUsername+'/layers/'+layer_name.lower().replace(" ", "_")+'/chunk'     
+        resumableFilename = layer_name+'.geojson'
+        layman_original_parameter = "file"  
+        resumableTotalChunks = len(arr)
+        try:
+            for i in range (1, len(arr)+1):  ##chunky jsou počítané od 1 proto +1  
+                print("chunk" + str(i))
+                file = arr[i-1] # rozsekaná část souboru
+                resumableChunkNumber = i  # cislo casti
+                payload = {
+                'file' : "chunk"+str(i)+".geojson",
+                'resumableFilename': resumableFilename,
+                'layman_original_parameter': layman_original_parameter,
+                'resumableChunkNumber': i,
+                'resumableTotalChunks': resumableTotalChunks
+                } 
+         
+                f = open(filePath + os.sep+"chunk"+str(i)+".geojson", "wb")
+                f.write(bytearray(arr[i-1]))
+                f.close()              
+                files = {'file': (layer_name.lower().replace(" ", "_")+".geojson", open(filePath +os.sep+ "chunk"+str(i)+".geojson", 'rb')),}              
+                response = requests.post(url, files = files, data=payload, headers = self.authHeader)
+
+                print(response.content)
+            iface.messageBar().pushWidget(iface.messageBar().createMessage("Import:", " Layer  " + layer_name + " was imported successfully."), Qgis.Success, duration=3)
+        except:
+            iface.messageBar().pushWidget(iface.messageBar().createMessage("Import:", " Layer  " + layer_name + " was not imported successfully!"), Qgis.Warning, duration=3)
+
+############################################# auth part############################
+
+    def startThread(self): 
+        self.thread1 = threading.Thread(target=self.refreshToken)
+        self.thread1.start()
+
+    def refreshToken(self):
+        #self.expires_in = 60
+        path = tempfile.gettempdir() + os.sep + "atlas" + os.sep + "tsts.txt" 
+        i = 0
+        tokenEndpoint = "https://www."+self.liferayServer+"/o/oauth2/token"
+        while (i < self.expires_in):        
+            f = open(path, "a")
+            f.write(str(i))
+
+            f.close()            
+            time.sleep(1)         
+            if i == self.expires_in - 4:
+            
+               
+                data = {'grant_type':'refresh_token',
+                        'refresh_token': self.refresh_token,
+                        'client_id': self.client_id,   ##'id-3462f94b-875c-9185-4ced-b69841f24b3', 
+                        'redirect_uri':'http://localhost:3000/client/authn/oauth2-liferay/callback', 
+                        'code_verifier':self.code_verifier  ##'test'
+                        } 
+                
+                r = requests.post(url = tokenEndpoint, data = data, headers = self.authHeader) 
+                res = self.fromByteToJson(r.content)
+                self.access_token = res['access_token']
+                self.refresh_token = res['refresh_token']
+                self.expires_in = res['expires_in']
+                print(self.access_token)
+                self.setAuthHeader()
+                i = 0
+            else:
+                i += 1
+        
+        
+        
+        
+
+
+
+    
+    def authOptained (self):        
+        self.dlg.pushButton_Continue.setEnabled(True)
+
+        self.menu_Connection.setEnabled(True)
+        self.menu_saveLocalFile.setEnabled(False)
+        self.menu_loadJson.setEnabled(True)
+        self.menu_ImportLayerDialog.setEnabled(True)
+        self.menu_AddLayerDialog.setEnabled(True) 
+        self.menu_AddMapDialog.setEnabled(True)       
+        self.menu_ImportLayerDialog.setEnabled(True)
+        self.menu_ImportMapDialog.setEnabled(True)       
+     #   self.menu_DeleteMapDialog.setEnabled(True)
+    #    self.menu_CreateCompositeDialog.setEnabled(True)
+        self.menu_UserInfoDialog.setEnabled(True)
+        self.textbox.setText("Layman: Logged user")
+
+    def getCodeVerifier(self):
+        code_verifier = base64.urlsafe_b64encode(os.urandom(40)).decode('utf-8')
+        code_verifier = re.sub('[^a-zA-Z0-9]+', '', code_verifier)
+        self.code_verifier = code_verifier
+        return (code_verifier)
+      
+    def getCodeChallenge(self, code_verifier):
+        code_challenge = hashlib.sha256(code_verifier.encode('utf-8')).digest()
+        code_challenge = base64.urlsafe_b64encode(code_challenge).decode('utf-8')
+        code_challenge = code_challenge.replace('=', '')
+        self.code_challenge = code_challenge
+        return (code_challenge)        
+
+    def printVariables(self):
+        print (self.access_token)
+        print(self.refresh_token)
+        print(self.authHeader)
+        print(self.laymanUsername)
+
+    def getAuthCode(self):
+        path = tempfile.gettempdir() + os.sep + "atlas" + os.sep + "auth.txt"        
+        f = open(path, "r")
+        ret =  f.read()
+        f.close()
+        return ret
+
+    def getToken(self):
+        self.saveIni()
+
+        tokenEndpoint = "https://www."+self.liferayServer+"/o/oauth2/token"
+        # data to be sent to api 
+        data = {'grant_type':'authorization_code', 
+                'client_id': self.client_id, 
+                'redirect_uri':'http://localhost:3000/client/authn/oauth2-liferay/callback', 
+                'code_verifier': self.code_verifier, 
+                'code': self.getAuthCode()} 
+  
+        # sending post request and saving response as response object 
+        r = requests.post(url = tokenEndpoint, data = data, headers = self.authHeader) 
+        res = self.fromByteToJson(r.content)
+        print (res)
+        try:
+            print(res['access_token'])
+            print(res['expires_in'])
+            print(res['refresh_token'])
+        except:
+            QMessageBox.information(None, "Message", "Autorization was not sucessfull! Please try it again.")
+            return
+        self.access_token = res['access_token']
+        self.refresh_token = res['refresh_token']
+        self.expires_in = res['expires_in']
+        self.setAuthHeader()
+        data ={
+            'access_token': res['access_token'], 
+            'refresh_token': res['refresh_token'],
+            'expires_in':res['expires_in']
+            }
+        path = tempfile.gettempdir() + os.sep + "atlas" + os.sep + "tokens.json"        
+        with open(path, 'w') as outfile:
+            json.dump(data, outfile)
+        self.startThread()
+        self.registerUserIfNotExists()
+        self.dlg.close()
+        
+    def setAuthHeader(self):
+        self.authHeader ={
+          "Authorization": "Bearer " + self.access_token, 
+          "AuthorizationIssUrl" : 'https://www.'+self.liferayServer+'/o/oauth2/authorize'
+        } 
+        
+    def registerUserIfNotExists(self):
+        userEndpoint = "http://layman.lesprojekt.cz/rest/current-user"
+        #self.laymanUsername = self.dlg.lineEdit_userName.text()
+        id = self.client_id.replace('-', '')
+        user = {'username':self.Agrimail}  
+        #user =  self.Agrimail        
+        print("authheader: "+ str(self.authHeader))
+        r = requests.patch(url = userEndpoint, data = user, headers = self.authHeader)
+        res = r.text
+        res = self.fromByteToJson(r.content)
+        print (res)
+        print(user)
+        print(res)
+        try:
+           # if res['message'] == 'User already reserved username.': # res['code'] == 34, code 35 je pokud již jiný uživatel má účet, který chceme registrovat
+           if res['code'] == 34: # res['code'] == 34, code 35 je pokud již jiný uživatel má účet, který chceme registrovat (code 35 pravděpodobně nemůže nastat)
+
+                print("user exists")
+                self.laymanUsername = res['detail']['username']
+            #self.laymanUsername = res['username']
+            #else:
+            #    self.laymanUsername =  user['username']
+        except:
+
+            print("creating new user: " + res['username'])
+            self.laymanUsername =  res['username']
+        #API_ENDPOINT = "http://layman.lesprojekt.cz/rest/current-user"
+        #headers ={
+        #  "Authorization": "Bearer "+ self.access_token, 
+        #  "AuthorizationIssUrl" : 'https://www.'+self.liferayServer+'/o/oauth2/authorize'
+        #} 
+
+
+    def openAuthLiferayUrl(self):
+        self.liferayServer = self.dlg.lineEdit_server.text()
+        self.URI = self.dlg.lineEdit_serverLayman.text()
+        self.getCodeChallenge(self.getCodeVerifier()) ##generování kódů
+        self.client_id = self.dlg.lineEdit_AgriID.text()
+        path = tempfile.gettempdir() + os.sep + "atlas" + os.sep + "auth.txt" 
+        self.watcher = QFileSystemWatcher()
+        self.watcher.addPath(path)
+        self.watcher.fileChanged.connect(self.authOptained)
+      
+        
+            #################       
+     
+        print ("##### flask server is starting #####")                     
+        self.flaskThread = StartFlaskDaemon()
+        self.flaskThread.daemon = True
+        self.flaskThread.start()       
+        url = 'https://www.'+self.liferayServer+'/o/oauth2/authorize?response_type=code&client_id='+self.client_id+'&redirect_uri=http%3A%2F%2Flocalhost:3000%2Fclient%2Fauthn%2Foauth2-liferay%2Fcallback&code_challenge='+self.code_challenge ##n4bQgYhMfWWaL-qgxVrQFaO_TxsrC4Is0V1sFbDwCgg'
+        webbrowser.open(url, new=2)
+
+    def saveIni(self):
+        file =  os.getenv("HOME") + os.sep + ".layman" + os.sep + 'layman_user.INI'  
+        dir = os.getenv("HOME") + os.sep + ".layman"
+        if not (os.path.isdir(dir)):
+            try:  
+                os.mkdir(dir)
+            except OSError:  
+                print ("vytváření adresáře selhalo")
+        config = configparser.ConfigParser()
+
+        config['DEFAULT']['login'] = self.Agrimail
+        config['DEFAULT']['id'] = self.client_id
+        print("saveliferay" + self.liferayServer)
+        config['DEFAULT']['server'] = self.liferayServer
+        config['DEFAULT']['layman'] = self.URI
+        
+
+        with open(file, 'w') as configfile:
+            config.write(configfile)        
+    def loadIni(self):
+        file =  os.getenv("HOME") + os.sep + ".layman" + os.sep +'layman_user.INI'        
+        config = configparser.ConfigParser()
+        config.read(file)
+        return config   
+
+    def layerChanged(self):  
+        
+        print(iface.activeLayer())
+        if (iface.activeLayer() != None):
+            self.menu_saveLocalFile.setEnabled(True)
+        else:
+            self.menu_saveLocalFile.setEnabled(False)
+
+
+    def run(self):
+        """Run method that loads and starts the plugin"""
+
+        if not self.pluginIsActive:
+            self.pluginIsActive = True
+
+            #print "** STARTING Atlas"
+
+            # dockwidget may not exist if:
+            #    first run of plugin
+            #    removed on close (see self.onClosePlugin method)
+            if self.dockwidget == None:
+                # Create the dockwidget (after translation) and keep reference
+                self.dockwidget = AtlasDockWidget()
+
+            
+            # connect to provide cleanup on closing of dockwidget
+            self.dockwidget.closingPlugin.connect(self.onClosePlugin)     
+            
+            self.dockwidget.pushButton.clicked.connect(self.sendLayer)   
+            self.dockwidget.pushButton_2.clicked.connect(self.loadLocalFile) 
+            self.dockwidget.pushButton_3.clicked.connect(self.saveLocalFile)
+            self.dockwidget.pushButton_getLayers.clicked.connect(self.run_getLayer)            
+            self.dlgGetLayers.pushButtonxx.clicked.connect(lambda: print(self.dlgGetLayers.items.currentItem().text()))          
+            
+            # show the dockwidget
+            # TODO: fix to allow choice of dock location
+            self.iface.addDockWidget(Qt.TopDockWidgetArea, self.dockwidget)
+            self.dockwidget.show()
+            
+class StartFlaskDaemon(threading.Thread):
+    def run(self):
+        from subprocess import Popen, PIPE
+        import platform
+        import sys
+        from pathlib import Path
+        d= os.path.dirname(Path(__file__).absolute()) + os.sep+"flask_listener" + os.sep + "flask_listener.py" 
+       
+        if platform.system() == 'Windows':
+            process = subprocess.Popen(["python", d],stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
+        else:
+            process = subprocess.Popen(["python " + d],stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
+        stdout, stderr = process.communicate()
+        print (stdout, stderr)  
+        '''Start your thread here'''
+        

+ 50 - 0
QGIS_Installer/bin/Debug/layman/Layman_dockwidget.py

@@ -0,0 +1,50 @@
+# -*- coding: utf-8 -*-
+"""
+/***************************************************************************
+ LaymanDockWidget
+                                 A QGIS plugin
+ Layman
+ Generated by Plugin Builder: http://g-sherman.github.io/Qgis-Plugin-Builder/
+                             -------------------
+        begin                : 2019-02-15
+        git sha              : $Format:%H$
+        copyright            : (C) 2019 by jan vrobel
+        email                : vrobel.jan@seznam.cz
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ ***************************************************************************/
+"""
+
+import os
+
+from PyQt5 import QtGui, QtWidgets, uic
+from PyQt5.QtCore import pyqtSignal
+
+FORM_CLASS, _ = uic.loadUiType(os.path.join(
+    os.path.dirname(__file__), 'Layman_dockwidget_base.ui'))
+
+
+class LaymanDockWidget(QtWidgets.QDockWidget, FORM_CLASS):
+
+    closingPlugin = pyqtSignal()
+
+    def __init__(self, parent=None):
+        """Constructor."""
+        super(LaymanDockWidget, self).__init__(parent)
+        # Set up the user interface from Designer.
+        # After setupUI you can access any designer object by doing
+        # self.<objectname>, and you can use autoconnect slots - see
+        # http://doc.qt.io/qt-5/designer-using-a-ui-file.html
+        # #widgets-and-dialogs-with-auto-connect
+        self.setupUi(self)
+
+    def closeEvent(self, event):
+        self.closingPlugin.emit()
+        event.accept()

+ 51 - 0
QGIS_Installer/bin/Debug/layman/Layman_dockwidget_base.ui

@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>AtlasDockWidgetBase</class>
+ <widget class="QDockWidget" name="AtlasDockWidgetBase">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>558</width>
+    <height>498</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Atlas</string>
+  </property>
+  <widget class="QWidget" name="dockWidgetContents">
+   <layout class="QGridLayout" name="gridLayout">
+    <item row="0" column="0">
+     <widget class="QPushButton" name="pushButton">
+      <property name="text">
+       <string>Export JSON</string>
+      </property>
+     </widget>
+    </item>
+    <item row="1" column="0">
+     <widget class="QPushButton" name="pushButton_2">
+      <property name="text">
+       <string>Nacti json</string>
+      </property>
+     </widget>
+    </item>
+    <item row="2" column="0">
+     <widget class="QPushButton" name="pushButton_3">
+      <property name="text">
+       <string>Do souboru</string>
+      </property>
+     </widget>
+    </item>
+    <item row="3" column="0">
+     <widget class="QPushButton" name="pushButton_getLayers">
+      <property name="text">
+       <string>Načti vzdálené vrstvy</string>
+      </property>
+     </widget>
+    </item>
+   </layout>
+  </widget>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

+ 244 - 0
QGIS_Installer/bin/Debug/layman/Makefile

@@ -0,0 +1,244 @@
+#/***************************************************************************
+# Atlas
+#
+# Atlas
+#							 -------------------
+#		begin				: 2019-02-15
+#		git sha				: $Format:%H$
+#		copyright			: (C) 2019 by jan vrobel
+#		email				: vrobel.jan@seznam.cz
+# ***************************************************************************/
+#
+#/***************************************************************************
+# *																		 *
+# *   This program is free software; you can redistribute it and/or modify  *
+# *   it under the terms of the GNU General Public License as published by  *
+# *   the Free Software Foundation; either version 2 of the License, or	 *
+# *   (at your option) any later version.								   *
+# *																		 *
+# ***************************************************************************/
+
+#################################################
+# Edit the following to match your sources lists
+#################################################
+
+
+#Add iso code for any locales you want to support here (space separated)
+# default is no locales
+# LOCALES = af
+LOCALES =
+
+# If locales are enabled, set the name of the lrelease binary on your system. If
+# you have trouble compiling the translations, you may have to specify the full path to
+# lrelease
+#LRELEASE = lrelease
+#LRELEASE = lrelease-qt4
+
+
+# translation
+SOURCES = \
+	__init__.py \
+	Atlas.py Atlas_dockwidget.py
+
+PLUGINNAME = Atlas
+
+PY_FILES = \
+	__init__.py \
+	Atlas.py Atlas_dockwidget.py
+
+UI_FILES = Atlas_dockwidget_base.ui
+
+EXTRAS = metadata.txt icon.png
+
+EXTRA_DIRS =
+
+COMPILED_RESOURCE_FILES = resources.py
+
+PEP8EXCLUDE=pydev,resources.py,conf.py,third_party,ui
+
+# QGISDIR points to the location where your plugin should be installed.
+# This varies by platform, relative to your HOME directory:
+#	* Linux:
+#	  .local/share/QGIS/QGIS3/profiles/default/python/plugins/
+#	* Mac OS X:
+#	  Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins
+#	* Windows:
+#	  AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins'
+
+QGISDIR=C:\Users\Honza\AppData/Roaming/QGIS/QGIS3/profiles/default/python/plugins
+
+#################################################
+# Normally you would not need to edit below here
+#################################################
+
+HELP = help/build/html
+
+PLUGIN_UPLOAD = $(c)/plugin_upload.py
+
+RESOURCE_SRC=$(shell grep '^ *<file' resources.qrc | sed 's@</file>@@g;s/.*>//g' | tr '\n' ' ')
+
+.PHONY: default
+default:
+	@echo While you can use make to build and deploy your plugin, pb_tool
+	@echo is a much better solution.
+	@echo A Python script, pb_tool provides platform independent management of
+	@echo your plugins and runs anywhere.
+	@echo You can install pb_tool using: pip install pb_tool
+	@echo See https://g-sherman.github.io/plugin_build_tool/ for info. 
+
+compile: $(COMPILED_RESOURCE_FILES)
+
+%.py : %.qrc $(RESOURCES_SRC)
+	pyrcc5 -o $*.py  $<
+
+%.qm : %.ts
+	$(LRELEASE) $<
+
+test: compile transcompile
+	@echo
+	@echo "----------------------"
+	@echo "Regression Test Suite"
+	@echo "----------------------"
+
+	@# Preceding dash means that make will continue in case of errors
+	@-export PYTHONPATH=`pwd`:$(PYTHONPATH); \
+		export QGIS_DEBUG=0; \
+		export QGIS_LOG_FILE=/dev/null; \
+		nosetests -v --with-id --with-coverage --cover-package=. \
+		3>&1 1>&2 2>&3 3>&- || true
+	@echo "----------------------"
+	@echo "If you get a 'no module named qgis.core error, try sourcing"
+	@echo "the helper script we have provided first then run make test."
+	@echo "e.g. source run-env-linux.sh <path to qgis install>; make test"
+	@echo "----------------------"
+
+deploy: compile doc transcompile
+	@echo
+	@echo "------------------------------------------"
+	@echo "Deploying plugin to your .qgis2 directory."
+	@echo "------------------------------------------"
+	# The deploy  target only works on unix like operating system where
+	# the Python plugin directory is located at:
+	# $HOME/$(QGISDIR)/python/plugins
+	mkdir -p $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME)
+	cp -vf $(PY_FILES) $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME)
+	cp -vf $(UI_FILES) $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME)
+	cp -vf $(COMPILED_RESOURCE_FILES) $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME)
+	cp -vf $(EXTRAS) $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME)
+	cp -vfr i18n $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME)
+	cp -vfr $(HELP) $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME)/help
+	# Copy extra directories if any
+	(foreach EXTRA_DIR,(EXTRA_DIRS), cp -R (EXTRA_DIR) (HOME)/(QGISDIR)/python/plugins/(PLUGINNAME)/;)
+
+
+# The dclean target removes compiled python files from plugin directory
+# also deletes any .git entry
+dclean:
+	@echo
+	@echo "-----------------------------------"
+	@echo "Removing any compiled python files."
+	@echo "-----------------------------------"
+	find $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME) -iname "*.pyc" -delete
+	find $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME) -iname ".git" -prune -exec rm -Rf {} \;
+
+
+derase:
+	@echo
+	@echo "-------------------------"
+	@echo "Removing deployed plugin."
+	@echo "-------------------------"
+	rm -Rf $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME)
+
+zip: deploy dclean
+	@echo
+	@echo "---------------------------"
+	@echo "Creating plugin zip bundle."
+	@echo "---------------------------"
+	# The zip target deploys the plugin and creates a zip file with the deployed
+	# content. You can then upload the zip file on http://plugins.qgis.org
+	rm -f $(PLUGINNAME).zip
+	cd $(HOME)/$(QGISDIR)/python/plugins; zip -9r $(CURDIR)/$(PLUGINNAME).zip $(PLUGINNAME)
+
+package: compile
+	# Create a zip package of the plugin named $(PLUGINNAME).zip.
+	# This requires use of git (your plugin development directory must be a
+	# git repository).
+	# To use, pass a valid commit or tag as follows:
+	#   make package VERSION=Version_0.3.2
+	@echo
+	@echo "------------------------------------"
+	@echo "Exporting plugin to zip package.	"
+	@echo "------------------------------------"
+	rm -f $(PLUGINNAME).zip
+	git archive --prefix=$(PLUGINNAME)/ -o $(PLUGINNAME).zip $(VERSION)
+	echo "Created package: $(PLUGINNAME).zip"
+
+upload: zip
+	@echo
+	@echo "-------------------------------------"
+	@echo "Uploading plugin to QGIS Plugin repo."
+	@echo "-------------------------------------"
+	$(PLUGIN_UPLOAD) $(PLUGINNAME).zip
+
+transup:
+	@echo
+	@echo "------------------------------------------------"
+	@echo "Updating translation files with any new strings."
+	@echo "------------------------------------------------"
+	@chmod +x scripts/update-strings.sh
+	@scripts/update-strings.sh $(LOCALES)
+
+transcompile:
+	@echo
+	@echo "----------------------------------------"
+	@echo "Compiled translation files to .qm files."
+	@echo "----------------------------------------"
+	@chmod +x scripts/compile-strings.sh
+	@scripts/compile-strings.sh $(LRELEASE) $(LOCALES)
+
+transclean:
+	@echo
+	@echo "------------------------------------"
+	@echo "Removing compiled translation files."
+	@echo "------------------------------------"
+	rm -f i18n/*.qm
+
+clean:
+	@echo
+	@echo "------------------------------------"
+	@echo "Removing uic and rcc generated files"
+	@echo "------------------------------------"
+	rm $(COMPILED_UI_FILES) $(COMPILED_RESOURCE_FILES)
+
+doc:
+	@echo
+	@echo "------------------------------------"
+	@echo "Building documentation using sphinx."
+	@echo "------------------------------------"
+	cd help; make html
+
+pylint:
+	@echo
+	@echo "-----------------"
+	@echo "Pylint violations"
+	@echo "-----------------"
+	@pylint --reports=n --rcfile=pylintrc . || true
+	@echo
+	@echo "----------------------"
+	@echo "If you get a 'no module named qgis.core' error, try sourcing"
+	@echo "the helper script we have provided first then run make pylint."
+	@echo "e.g. source run-env-linux.sh <path to qgis install>; make pylint"
+	@echo "----------------------"
+
+
+# Run pep8 style checking
+#http://pypi.python.org/pypi/pep8
+pep8:
+	@echo
+	@echo "-----------"
+	@echo "PEP8 issues"
+	@echo "-----------"
+	@pep8 --repeat --ignore=E203,E121,E122,E123,E124,E125,E126,E127,E128 --exclude $(PEP8EXCLUDE) . || true
+	@echo "-----------"
+	@echo "Ignored in PEP8 check:"
+	@echo $(PEP8EXCLUDE)

+ 42 - 0
QGIS_Installer/bin/Debug/layman/README.html

@@ -0,0 +1,42 @@
+<html>
+<body>
+<h3>Plugin Builder Results</h3>
+
+Congratulations! You just built a plugin for QGIS!<br/><br />
+
+<div id='help' style='font-size:.9em;'>
+Your plugin <b>Atlas</b> was created in:<br>
+&nbsp;&nbsp;<b>C:/Program Files/QGIS 3.4/apps/qgis/python/plugins\atlas</b>
+<p>
+Your QGIS plugin directory is located at:<br>
+&nbsp;&nbsp;<b>C:/Users/Honza/AppData/Roaming/QGIS/QGIS3/profiles/default/python/plugins</b>
+<p>
+<h3>What's Next</h3>
+<ol>
+    <li>In your plugin directory, compile the resources file using pyrcc5 (simply run <b>make</b> if you have automake or use <b>pb_tool</b>)
+    <li>Test the generated sources using <b>make test</b> (or run tests from your IDE)
+    <li>Copy the entire directory containing your new plugin to the QGIS plugin directory (see Notes below)
+    <li>Test the plugin by enabling it in the QGIS plugin manager
+    <li>Customize it by editing the implementation file <b>Atlas.py</b>
+    <li>Create your own custom icon, replacing the default <b>icon.png</b>
+    <li>Modify your user interface by opening <b>Atlas_dockwidget_base.ui</b> in Qt Designer
+</ol>
+Notes:
+<ul>
+    <li>You can use the <b>Makefile</b> to compile and deploy when you
+        make changes. This requires GNU make (gmake). The Makefile is ready to use, however you 
+        will have to edit it to add addional Python source files, dialogs, and translations.
+    <li>You can also use <b>pb_tool</b> to compile and deploy your plugin. Tweak the <i>pb_tool.cfg</i> file included with your plugin as you add files. Install <b>pb_tool</b> using 
+        <i>pip</i> or <i>easy_install</i>. See <b>http://loc8.cc/pb_tool</b> for more information.
+</ul>
+</div>
+<div style='font-size:.9em;'>
+<p>
+For information on writing PyQGIS code, see <b>http://loc8.cc/pyqgis_resources</b> for a list of resources.
+</p>
+</div>
+<p>
+&copy;2011-2018 GeoApt LLC - geoapt.com 
+</p>
+</body>
+</html>

+ 32 - 0
QGIS_Installer/bin/Debug/layman/README.md

@@ -0,0 +1,32 @@
+# QGIS Client usable for importing map layers to Layman server  
+
+## OAuth2 login
+For usage of this plugin is needed account at www.agrihub.cz and agrihub ID. There is implemented OAuth2 authentification. Authentization is processed in Agrihub login form. There is user redirected.
+Email in plugin part is used as name for creating new Layman user if not exists. Authentication is valid only 10 minutes. Due this fact plugin every 10 minutes renew authentication tokens.    
+
+## After sucessfull autentization functions are unlocked and you are able to:
+### Load, Save vector layers in JSON format on local pc.    
+It provides simple forms for loading data. SLD file with symbology is also stored with same name like JSON file.
+
+### Import vector layer to Layman server. 
+In case size of layer is bigger than 1MB is layer automaticaly parted and send asynchronously. It is usable for bigger layers when importing fails. Plugin is able to establish uploading at point of failure. 
+EPSG: 4326 is allowed.
+From every layer is generated and imported SLD file, that keeps layer symbology. 
+
+### Load existing layer from Layman to QGIS.  
+Layers are loaded as WMS service to QGIS layer tree. Layer thumbnail is loaded into form. 
+
+### Create map composite and save to Layman server.   
+For creating composite is necessary fill all mandatory fields (name, title, description). This information is stored in composition file. There are also required specify the extent of the map. Extend can be automatically assumed from existing layer. 
+
+### Add, delete layers to map composite.  
+User can use new local layers and also existing layers in Layman. For working with compositions is prepaired main form with all functionalities.
+
+### Delete map composites from memory/server.  
+
+### Load all map composites to QGIS.  
+After loading existing composition from Layman are layers ordered to group in QGIS layer tree. One composition can be loaded only once. Composition name is unique. Map thumbnail is loaded into form. 
+ 
+
+ 
+

+ 32 - 0
QGIS_Installer/bin/Debug/layman/README.txt

@@ -0,0 +1,32 @@
+Plugin Builder Results
+
+Your plugin Atlas was created in:
+    C:/Program Files/QGIS 3.4/apps/qgis/python/plugins\atlas
+
+Your QGIS plugin directory is located at:
+    C:/Users/Honza/AppData/Roaming/QGIS/QGIS3/profiles/default/python/plugins
+
+What's Next:
+
+  * Copy the entire directory containing your new plugin to the QGIS plugin
+    directory
+
+  * Compile the resources file using pyrcc5
+
+  * Run the tests (``make test``)
+
+  * Test the plugin by enabling it in the QGIS plugin manager
+
+  * Customize it by editing the implementation file: ``Atlas.py``
+
+  * Create your own custom icon, replacing the default icon.png
+
+  * Modify your user interface by opening Atlas_dockwidget_base.ui in Qt Designer
+
+  * You can use the Makefile to compile your Ui and resource files when
+    you make changes. This requires GNU make (gmake)
+
+For more information, see the PyQGIS Developer Cookbook at:
+http://www.qgis.org/pyqgis-cookbook/index.html
+
+(C) 2011-2018 GeoApt LLC - geoapt.com

+ 36 - 0
QGIS_Installer/bin/Debug/layman/__init__.py

@@ -0,0 +1,36 @@
+# -*- coding: utf-8 -*-
+"""
+/***************************************************************************
+ Layman
+                                 A QGIS plugin
+ Layman
+ Generated by Plugin Builder: http://g-sherman.github.io/Qgis-Plugin-Builder/
+                             -------------------
+        begin                : 2019-02-15
+        copyright            : (C) 2019 by jan vrobel
+        email                : vrobel.jan@seznam.cz
+        git sha              : $Format:%H$
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ ***************************************************************************/
+ This script initializes the plugin, making it known to QGIS.
+"""
+
+
+# noinspection PyPep8Naming
+def classFactory(iface):  # pylint: disable=invalid-name
+    """Load Layman class from file Layman.
+
+    :param iface: A QGIS interface instance.
+    :type iface: QgsInterface
+    """
+    #
+    from .Layman import Layman
+    return Layman(iface)

BIN
QGIS_Installer/bin/Debug/layman/__pycache__/Atlas.cpython-37.pyc


BIN
QGIS_Installer/bin/Debug/layman/__pycache__/Atlas_dockwidget.cpython-37.pyc


BIN
QGIS_Installer/bin/Debug/layman/__pycache__/Layman.cpython-37.pyc


BIN
QGIS_Installer/bin/Debug/layman/__pycache__/Layman_dockwidget.cpython-37.pyc


BIN
QGIS_Installer/bin/Debug/layman/__pycache__/__init__.cpython-37.pyc


BIN
QGIS_Installer/bin/Debug/layman/__pycache__/dlg_ConnectionManager.cpython-37.pyc


BIN
QGIS_Installer/bin/Debug/layman/__pycache__/dlg_GetLayers.cpython-37.pyc


BIN
QGIS_Installer/bin/Debug/layman/__pycache__/dlg_addLayer.cpython-37.pyc


BIN
QGIS_Installer/bin/Debug/layman/__pycache__/dlg_addMap.cpython-37.pyc


BIN
QGIS_Installer/bin/Debug/layman/__pycache__/dlg_createComposite.cpython-37.pyc


BIN
QGIS_Installer/bin/Debug/layman/__pycache__/dlg_deleteLayerFromMap.cpython-37.pyc


BIN
QGIS_Installer/bin/Debug/layman/__pycache__/dlg_deleteMap.cpython-37.pyc


BIN
QGIS_Installer/bin/Debug/layman/__pycache__/dlg_editMap.cpython-37.pyc


BIN
QGIS_Installer/bin/Debug/layman/__pycache__/dlg_importLayer.cpython-37.pyc


BIN
QGIS_Installer/bin/Debug/layman/__pycache__/dlg_importMap.cpython-37.pyc


BIN
QGIS_Installer/bin/Debug/layman/__pycache__/dlg_userInfo.cpython-37.pyc


BIN
QGIS_Installer/bin/Debug/layman/__pycache__/flaskServer.cpython-37.pyc


BIN
QGIS_Installer/bin/Debug/layman/__pycache__/flaskServer2.cpython-37.pyc


BIN
QGIS_Installer/bin/Debug/layman/__pycache__/ogr2ogr.cpython-37.pyc


BIN
QGIS_Installer/bin/Debug/layman/__pycache__/resources.cpython-37.pyc


+ 44 - 0
QGIS_Installer/bin/Debug/layman/dlg_ConnectionManager.py

@@ -0,0 +1,44 @@
+# -*- coding: utf-8 -*-
+"""
+/***************************************************************************
+ CartoDBDialog
+                                 A QGIS plugin
+ CartoDB plugin
+ Generated by Plugin Builder: http://g-sherman.github.io/Qgis-Plugin-Builder/
+                             -------------------
+        begin                : 2019-03-19
+        git sha              : $Format:%H$
+        copyright            : (C) 2019 by Ondřej Tomančák, Jan Vrobel
+        email                : vrobel.jan@seznam.cz
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ ***************************************************************************/
+"""
+
+import os
+
+from PyQt5 import uic
+from PyQt5 import QtWidgets
+
+# This loads your .ui file so that PyQt can populate your plugin with the elements from Qt Designer
+FORM_CLASS, _ = uic.loadUiType(os.path.join(
+    os.path.dirname(__file__), 'dlg_ConnectionManager.ui'))
+
+
+class ConnectionManagerDialog(QtWidgets.QDialog, FORM_CLASS):
+    def __init__(self, parent=None):
+        """Constructor."""
+        super(ConnectionManagerDialog, self).__init__(parent)
+        # Set up the user interface from Designer through FORM_CLASS.
+        # After self.setupUi() you can access any designer object by doing
+        # self.<objectname>, and you can use autoconnect slots - see
+        # http://qt-project.org/doc/qt-4.8/designer-using-a-ui-file.html
+        # #widgets-and-dialogs-with-auto-connect
+        self.setupUi(self)

+ 208 - 0
QGIS_Installer/bin/Debug/layman/dlg_ConnectionManager.ui

@@ -0,0 +1,208 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>DialogBase</class>
+ <widget class="QDialog" name="DialogBase">
+  <property name="windowModality">
+   <enum>Qt::ApplicationModal</enum>
+  </property>
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>635</width>
+    <height>200</height>
+   </rect>
+  </property>
+  <property name="sizePolicy">
+   <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+    <horstretch>0</horstretch>
+    <verstretch>0</verstretch>
+   </sizepolicy>
+  </property>
+  <property name="minimumSize">
+   <size>
+    <width>635</width>
+    <height>200</height>
+   </size>
+  </property>
+  <property name="maximumSize">
+   <size>
+    <width>635</width>
+    <height>200</height>
+   </size>
+  </property>
+  <property name="windowTitle">
+   <string>Layman</string>
+  </property>
+  <widget class="QLineEdit" name="lineEdit_AgriID">
+   <property name="enabled">
+    <bool>true</bool>
+   </property>
+   <property name="geometry">
+    <rect>
+     <x>155</x>
+     <y>120</y>
+     <width>351</width>
+     <height>27</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>id-3462f94b-875c-9185-4ced-b69841f24b3</string>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_APIKey">
+   <property name="geometry">
+    <rect>
+     <x>20</x>
+     <y>120</y>
+     <width>111</width>
+     <height>19</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Liferay ID:</string>
+   </property>
+  </widget>
+  <widget class="QPushButton" name="pushButton_Connect">
+   <property name="geometry">
+    <rect>
+     <x>155</x>
+     <y>160</y>
+     <width>111</width>
+     <height>27</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Login</string>
+   </property>
+  </widget>
+  <widget class="QPushButton" name="pushButton_close">
+   <property name="geometry">
+    <rect>
+     <x>394</x>
+     <y>160</y>
+     <width>111</width>
+     <height>28</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Close</string>
+   </property>
+  </widget>
+  <widget class="QPushButton" name="pushButton_Continue">
+   <property name="geometry">
+    <rect>
+     <x>279</x>
+     <y>160</y>
+     <width>101</width>
+     <height>27</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Continue</string>
+   </property>
+  </widget>
+  <widget class="QPushButton" name="pushButton_ttt">
+   <property name="geometry">
+    <rect>
+     <x>154</x>
+     <y>180</y>
+     <width>88</width>
+     <height>27</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>test</string>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_APIKey_2">
+   <property name="geometry">
+    <rect>
+     <x>20</x>
+     <y>85</y>
+     <width>121</width>
+     <height>19</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Liferay login:</string>
+   </property>
+  </widget>
+  <widget class="QLineEdit" name="lineEdit_userName">
+   <property name="enabled">
+    <bool>true</bool>
+   </property>
+   <property name="geometry">
+    <rect>
+     <x>155</x>
+     <y>83</y>
+     <width>351</width>
+     <height>27</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>@lesprojekt.cz</string>
+   </property>
+  </widget>
+  <widget class="QLineEdit" name="lineEdit_server">
+   <property name="enabled">
+    <bool>true</bool>
+   </property>
+   <property name="geometry">
+    <rect>
+     <x>156</x>
+     <y>45</y>
+     <width>351</width>
+     <height>27</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>agrihub.cz</string>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_APIKey_3">
+   <property name="geometry">
+    <rect>
+     <x>20</x>
+     <y>50</y>
+     <width>121</width>
+     <height>19</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Liferay server:</string>
+   </property>
+  </widget>
+  <widget class="QLineEdit" name="lineEdit_serverLayman">
+   <property name="enabled">
+    <bool>true</bool>
+   </property>
+   <property name="geometry">
+    <rect>
+     <x>157</x>
+     <y>7</y>
+     <width>350</width>
+     <height>27</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>http://layman.lesprojekt.cz</string>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_APIKey_4">
+   <property name="geometry">
+    <rect>
+     <x>20</x>
+     <y>10</y>
+     <width>121</width>
+     <height>19</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Layman server:</string>
+   </property>
+  </widget>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

+ 44 - 0
QGIS_Installer/bin/Debug/layman/dlg_GetLayers.py

@@ -0,0 +1,44 @@
+# -*- coding: utf-8 -*-
+"""
+/***************************************************************************
+ CartoDBDialog
+                                 A QGIS plugin
+ CartoDB plugin
+ Generated by Plugin Builder: http://g-sherman.github.io/Qgis-Plugin-Builder/
+                             -------------------
+        begin                : 2019-03-19
+        git sha              : $Format:%H$
+        copyright            : (C) 2019 by Ondřej Tomančák, Jan Vrobel
+        email                : vrobel.jan@seznam.cz
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ ***************************************************************************/
+"""
+
+import os
+
+from PyQt5 import uic
+from PyQt5 import QtWidgets
+
+# This loads your .ui file so that PyQt can populate your plugin with the elements from Qt Designer
+FORM_CLASS, _ = uic.loadUiType(os.path.join(
+    os.path.dirname(__file__), 'dlg_GetLayers.ui'))
+
+
+class GetLayersDialog(QtWidgets.QDialog, FORM_CLASS):
+    def __init__(self, parent=None):
+        """Constructor."""
+        super(GetLayersDialog, self).__init__(parent)
+        # Set up the user interface from Designer through FORM_CLASS.
+        # After self.setupUi() you can access any designer object by doing
+        # self.<objectname>, and you can use autoconnect slots - see
+        # http://qt-project.org/doc/qt-4.8/designer-using-a-ui-file.html
+        # #widgets-and-dialogs-with-auto-connect
+        self.setupUi(self)

+ 94 - 0
QGIS_Installer/bin/Debug/layman/dlg_GetLayers.ui

@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>CartoDBDialogBase</class>
+ <widget class="QDialog" name="CartoDBDialogBase">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>400</width>
+    <height>300</height>
+   </rect>
+  </property>
+  <property name="focusPolicy">
+   <enum>Qt::ClickFocus</enum>
+  </property>
+  <property name="windowTitle">
+   <string>Atlas</string>
+  </property>
+  <widget class="QDialogButtonBox" name="button_box">
+   <property name="geometry">
+    <rect>
+     <x>30</x>
+     <y>240</y>
+     <width>341</width>
+     <height>32</height>
+    </rect>
+   </property>
+   <property name="orientation">
+    <enum>Qt::Horizontal</enum>
+   </property>
+   <property name="standardButtons">
+    <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label">
+   <property name="geometry">
+    <rect>
+     <x>30</x>
+     <y>10</y>
+     <width>111</width>
+     <height>16</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Existing layers:</string>
+   </property>
+  </widget>
+  <widget class="QListWidget" name="items">
+   <property name="geometry">
+    <rect>
+     <x>30</x>
+     <y>50</y>
+     <width>291</width>
+     <height>141</height>
+    </rect>
+   </property>
+   <property name="selectionMode">
+    <enum>QAbstractItemView::NoSelection</enum>
+   </property>
+  </widget>
+  <widget class="QPushButton" name="pushButtonxx">
+   <property name="geometry">
+    <rect>
+     <x>110</x>
+     <y>200</y>
+     <width>93</width>
+     <height>28</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>PushButton</string>
+   </property>
+  </widget>
+ </widget>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>button_box</sender>
+   <signal>rejected()</signal>
+   <receiver>CartoDBDialogBase</receiver>
+   <slot>reject()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>20</x>
+     <y>20</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>20</x>
+     <y>20</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>

+ 44 - 0
QGIS_Installer/bin/Debug/layman/dlg_addLayer.py

@@ -0,0 +1,44 @@
+# -*- coding: utf-8 -*-
+"""
+/***************************************************************************
+ CartoDBDialog
+                                 A QGIS plugin
+ CartoDB plugin
+ Generated by Plugin Builder: http://g-sherman.github.io/Qgis-Plugin-Builder/
+                             -------------------
+        begin                : 2019-03-19
+        git sha              : $Format:%H$
+        copyright            : (C) 2019 by Ondřej Tomančák, Jan Vrobel
+        email                : vrobel.jan@seznam.cz
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ ***************************************************************************/
+"""
+
+import os
+
+from PyQt5 import uic
+from PyQt5 import QtWidgets
+
+# This loads your .ui file so that PyQt can populate your plugin with the elements from Qt Designer
+FORM_CLASS, _ = uic.loadUiType(os.path.join(
+    os.path.dirname(__file__), 'dlg_addLayer.ui'))
+
+
+class AddLayerDialog(QtWidgets.QDialog, FORM_CLASS):
+    def __init__(self, parent=None):
+        """Constructor."""
+        super(AddLayerDialog, self).__init__(parent)
+        # Set up the user interface from Designer through FORM_CLASS.
+        # After self.setupUi() you can access any designer object by doing
+        # self.<objectname>, and you can use autoconnect slots - see
+        # http://qt-project.org/doc/qt-4.8/designer-using-a-ui-file.html
+        # #widgets-and-dialogs-with-auto-connect
+        self.setupUi(self)

+ 149 - 0
QGIS_Installer/bin/Debug/layman/dlg_addLayer.ui

@@ -0,0 +1,149 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>DialogBase</class>
+ <widget class="QDialog" name="DialogBase">
+  <property name="windowModality">
+   <enum>Qt::ApplicationModal</enum>
+  </property>
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>716</width>
+    <height>410</height>
+   </rect>
+  </property>
+  <property name="sizePolicy">
+   <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+    <horstretch>0</horstretch>
+    <verstretch>0</verstretch>
+   </sizepolicy>
+  </property>
+  <property name="minimumSize">
+   <size>
+    <width>716</width>
+    <height>410</height>
+   </size>
+  </property>
+  <property name="maximumSize">
+   <size>
+    <width>716</width>
+    <height>410</height>
+   </size>
+  </property>
+  <property name="windowTitle">
+   <string>Layman - Layers</string>
+  </property>
+  <widget class="QPushButton" name="pushButton">
+   <property name="geometry">
+    <rect>
+     <x>20</x>
+     <y>360</y>
+     <width>141</width>
+     <height>27</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Load WMS</string>
+   </property>
+  </widget>
+  <widget class="QTreeWidget" name="treeWidget">
+   <property name="geometry">
+    <rect>
+     <x>10</x>
+     <y>10</y>
+     <width>331</width>
+     <height>341</height>
+    </rect>
+   </property>
+   <column>
+    <property name="text">
+     <string>Layers on Layman</string>
+    </property>
+   </column>
+  </widget>
+  <widget class="QPushButton" name="pushButton_close">
+   <property name="geometry">
+    <rect>
+     <x>450</x>
+     <y>360</y>
+     <width>131</width>
+     <height>28</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Close</string>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_thumbnail">
+   <property name="geometry">
+    <rect>
+     <x>416</x>
+     <y>50</y>
+     <width>200</width>
+     <height>200</height>
+    </rect>
+   </property>
+   <property name="frameShape">
+    <enum>QFrame::Box</enum>
+   </property>
+   <property name="text">
+    <string/>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_2">
+   <property name="geometry">
+    <rect>
+     <x>416</x>
+     <y>20</y>
+     <width>141</width>
+     <height>16</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Preview:</string>
+   </property>
+  </widget>
+  <widget class="QPushButton" name="pushButton_layerRedirect">
+   <property name="geometry">
+    <rect>
+     <x>450</x>
+     <y>280</y>
+     <width>131</width>
+     <height>27</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>More info</string>
+   </property>
+  </widget>
+  <widget class="QPushButton" name="pushButton_wfs">
+   <property name="geometry">
+    <rect>
+     <x>190</x>
+     <y>360</y>
+     <width>141</width>
+     <height>27</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Load WFS</string>
+   </property>
+  </widget>
+  <widget class="QPushButton" name="pushButton_delete">
+   <property name="geometry">
+    <rect>
+     <x>450</x>
+     <y>320</y>
+     <width>131</width>
+     <height>28</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Delete layer</string>
+   </property>
+  </widget>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

+ 44 - 0
QGIS_Installer/bin/Debug/layman/dlg_addMap.py

@@ -0,0 +1,44 @@
+# -*- coding: utf-8 -*-
+"""
+/***************************************************************************
+ CartoDBDialog
+                                 A QGIS plugin
+ CartoDB plugin
+ Generated by Plugin Builder: http://g-sherman.github.io/Qgis-Plugin-Builder/
+                             -------------------
+        begin                : 2019-03-19
+        git sha              : $Format:%H$
+        copyright            : (C) 2019 by Ondřej Tomančák, Jan Vrobel
+        email                : vrobel.jan@seznam.cz
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ ***************************************************************************/
+"""
+
+import os
+
+from PyQt5 import uic
+from PyQt5 import QtWidgets
+
+# This loads your .ui file so that PyQt can populate your plugin with the elements from Qt Designer
+FORM_CLASS, _ = uic.loadUiType(os.path.join(
+    os.path.dirname(__file__), 'dlg_addMap.ui'))
+
+
+class AddMapDialog(QtWidgets.QDialog, FORM_CLASS):
+    def __init__(self, parent=None):
+        """Constructor."""
+        super(AddMapDialog, self).__init__(parent)
+        # Set up the user interface from Designer through FORM_CLASS.
+        # After self.setupUi() you can access any designer object by doing
+        # self.<objectname>, and you can use autoconnect slots - see
+        # http://qt-project.org/doc/qt-4.8/designer-using-a-ui-file.html
+        # #widgets-and-dialogs-with-auto-connect
+        self.setupUi(self)

+ 136 - 0
QGIS_Installer/bin/Debug/layman/dlg_addMap.ui

@@ -0,0 +1,136 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>DialogBase</class>
+ <widget class="QDialog" name="DialogBase">
+  <property name="windowModality">
+   <enum>Qt::ApplicationModal</enum>
+  </property>
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>780</width>
+    <height>450</height>
+   </rect>
+  </property>
+  <property name="sizePolicy">
+   <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+    <horstretch>0</horstretch>
+    <verstretch>0</verstretch>
+   </sizepolicy>
+  </property>
+  <property name="minimumSize">
+   <size>
+    <width>780</width>
+    <height>450</height>
+   </size>
+  </property>
+  <property name="maximumSize">
+   <size>
+    <width>780</width>
+    <height>450</height>
+   </size>
+  </property>
+  <property name="windowTitle">
+   <string>Layman - Add Map</string>
+  </property>
+  <widget class="QPushButton" name="pushButton">
+   <property name="geometry">
+    <rect>
+     <x>407</x>
+     <y>320</y>
+     <width>151</width>
+     <height>27</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Load map (WMS)</string>
+   </property>
+  </widget>
+  <widget class="QPushButton" name="pushButton_close">
+   <property name="geometry">
+    <rect>
+     <x>20</x>
+     <y>410</y>
+     <width>121</width>
+     <height>28</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Close</string>
+   </property>
+  </widget>
+  <widget class="QTreeWidget" name="treeWidget">
+   <property name="geometry">
+    <rect>
+     <x>20</x>
+     <y>10</y>
+     <width>331</width>
+     <height>371</height>
+    </rect>
+   </property>
+   <column>
+    <property name="text">
+     <string>Layer</string>
+    </property>
+   </column>
+  </widget>
+  <widget class="QLabel" name="label_thumbnail">
+   <property name="geometry">
+    <rect>
+     <x>460</x>
+     <y>50</y>
+     <width>200</width>
+     <height>200</height>
+    </rect>
+   </property>
+   <property name="frameShape">
+    <enum>QFrame::Box</enum>
+   </property>
+   <property name="text">
+    <string/>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_2">
+   <property name="geometry">
+    <rect>
+     <x>460</x>
+     <y>20</y>
+     <width>141</width>
+     <height>16</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Preview:</string>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_info">
+   <property name="geometry">
+    <rect>
+     <x>370</x>
+     <y>250</y>
+     <width>411</width>
+     <height>31</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-size:12pt; color:#ff0000;&quot;&gt;Unable to load already loaded composition!&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+   </property>
+  </widget>
+  <widget class="QPushButton" name="pushButton_mapWFS">
+   <property name="geometry">
+    <rect>
+     <x>570</x>
+     <y>320</y>
+     <width>151</width>
+     <height>27</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Load map (WFS)</string>
+   </property>
+  </widget>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

+ 44 - 0
QGIS_Installer/bin/Debug/layman/dlg_createComposite.py

@@ -0,0 +1,44 @@
+# -*- coding: utf-8 -*-
+"""
+/***************************************************************************
+ CartoDBDialog
+                                 A QGIS plugin
+ CartoDB plugin
+ Generated by Plugin Builder: http://g-sherman.github.io/Qgis-Plugin-Builder/
+                             -------------------
+        begin                : 2019-03-19
+        git sha              : $Format:%H$
+        copyright            : (C) 2019 by Ondřej Tomančák, Jan Vrobel
+        email                : vrobel.jan@seznam.cz
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ ***************************************************************************/
+"""
+
+import os
+
+from PyQt5 import uic
+from PyQt5 import QtWidgets
+
+# This loads your .ui file so that PyQt can populate your plugin with the elements from Qt Designer
+FORM_CLASS, _ = uic.loadUiType(os.path.join(
+    os.path.dirname(__file__), 'dlg_createComposite.ui'))
+
+
+class CreateCompositeDialog(QtWidgets.QDialog, FORM_CLASS):
+    def __init__(self, parent=None):
+        """Constructor."""
+        super(CreateCompositeDialog, self).__init__(parent)
+        # Set up the user interface from Designer through FORM_CLASS.
+        # After self.setupUi() you can access any designer object by doing
+        # self.<objectname>, and you can use autoconnect slots - see
+        # http://qt-project.org/doc/qt-4.8/designer-using-a-ui-file.html
+        # #widgets-and-dialogs-with-auto-connect
+        self.setupUi(self)

+ 306 - 0
QGIS_Installer/bin/Debug/layman/dlg_createComposite.ui

@@ -0,0 +1,306 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>DialogBase</class>
+ <widget class="QDialog" name="DialogBase">
+  <property name="windowModality">
+   <enum>Qt::ApplicationModal</enum>
+  </property>
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>650</width>
+    <height>380</height>
+   </rect>
+  </property>
+  <property name="sizePolicy">
+   <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+    <horstretch>0</horstretch>
+    <verstretch>0</verstretch>
+   </sizepolicy>
+  </property>
+  <property name="minimumSize">
+   <size>
+    <width>650</width>
+    <height>380</height>
+   </size>
+  </property>
+  <property name="maximumSize">
+   <size>
+    <width>650</width>
+    <height>380</height>
+   </size>
+  </property>
+  <property name="windowTitle">
+   <string>Layman - Create Composite</string>
+  </property>
+  <widget class="QPushButton" name="pushButton_CreateComposition">
+   <property name="geometry">
+    <rect>
+     <x>287</x>
+     <y>340</y>
+     <width>141</width>
+     <height>27</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Create </string>
+   </property>
+  </widget>
+  <widget class="QPushButton" name="pushButton_close">
+   <property name="geometry">
+    <rect>
+     <x>449</x>
+     <y>340</y>
+     <width>151</width>
+     <height>28</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Storno</string>
+   </property>
+  </widget>
+  <widget class="QTreeWidget" name="treeWidget">
+   <property name="geometry">
+    <rect>
+     <x>288</x>
+     <y>46</y>
+     <width>311</width>
+     <height>241</height>
+    </rect>
+   </property>
+   <column>
+    <property name="text">
+     <string>Layer</string>
+    </property>
+   </column>
+  </widget>
+  <widget class="QLabel" name="label">
+   <property name="geometry">
+    <rect>
+     <x>290</x>
+     <y>17</y>
+     <width>311</width>
+     <height>16</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>You can choose externt of composition from layer:</string>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_2">
+   <property name="geometry">
+    <rect>
+     <x>40</x>
+     <y>380</y>
+     <width>141</width>
+     <height>16</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Composition name:</string>
+   </property>
+  </widget>
+  <widget class="QLineEdit" name="lineEdit">
+   <property name="geometry">
+    <rect>
+     <x>30</x>
+     <y>410</y>
+     <width>201</width>
+     <height>22</height>
+    </rect>
+   </property>
+  </widget>
+  <widget class="QLineEdit" name="lineEdit_2">
+   <property name="geometry">
+    <rect>
+     <x>20</x>
+     <y>46</y>
+     <width>201</width>
+     <height>22</height>
+    </rect>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_3">
+   <property name="geometry">
+    <rect>
+     <x>21</x>
+     <y>20</y>
+     <width>141</width>
+     <height>16</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Title:</string>
+   </property>
+  </widget>
+  <widget class="QLineEdit" name="lineEdit_3">
+   <property name="geometry">
+    <rect>
+     <x>92</x>
+     <y>177</y>
+     <width>130</width>
+     <height>22</height>
+    </rect>
+   </property>
+  </widget>
+  <widget class="QLineEdit" name="lineEdit_4">
+   <property name="geometry">
+    <rect>
+     <x>92</x>
+     <y>207</y>
+     <width>130</width>
+     <height>22</height>
+    </rect>
+   </property>
+  </widget>
+  <widget class="QLineEdit" name="lineEdit_5">
+   <property name="geometry">
+    <rect>
+     <x>92</x>
+     <y>237</y>
+     <width>130</width>
+     <height>22</height>
+    </rect>
+   </property>
+  </widget>
+  <widget class="QLineEdit" name="lineEdit_6">
+   <property name="geometry">
+    <rect>
+     <x>92</x>
+     <y>267</y>
+     <width>130</width>
+     <height>22</height>
+    </rect>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_4">
+   <property name="geometry">
+    <rect>
+     <x>22</x>
+     <y>150</y>
+     <width>211</width>
+     <height>16</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Extent of canvas:</string>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_5">
+   <property name="geometry">
+    <rect>
+     <x>22</x>
+     <y>181</y>
+     <width>41</width>
+     <height>16</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>XMin:</string>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_6">
+   <property name="geometry">
+    <rect>
+     <x>22</x>
+     <y>210</y>
+     <width>41</width>
+     <height>16</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>XMax:</string>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_7">
+   <property name="geometry">
+    <rect>
+     <x>22</x>
+     <y>241</y>
+     <width>41</width>
+     <height>16</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>YMin:</string>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_8">
+   <property name="geometry">
+    <rect>
+     <x>22</x>
+     <y>270</y>
+     <width>41</width>
+     <height>16</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>YMax:</string>
+   </property>
+  </widget>
+  <widget class="QLineEdit" name="lineEdit_7">
+   <property name="geometry">
+    <rect>
+     <x>20</x>
+     <y>110</y>
+     <width>201</width>
+     <height>22</height>
+    </rect>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_9">
+   <property name="geometry">
+    <rect>
+     <x>20</x>
+     <y>84</y>
+     <width>141</width>
+     <height>16</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Description:</string>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_info">
+   <property name="geometry">
+    <rect>
+     <x>20</x>
+     <y>300</y>
+     <width>321</width>
+     <height>31</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-size:12pt; color:#ff0000;&quot;&gt;Composition name already exists!&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+   </property>
+  </widget>
+  <widget class="QPushButton" name="pushButton_defaultExtent">
+   <property name="geometry">
+    <rect>
+     <x>20</x>
+     <y>340</y>
+     <width>141</width>
+     <height>27</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Canvas extent</string>
+   </property>
+  </widget>
+ </widget>
+ <tabstops>
+  <tabstop>lineEdit</tabstop>
+  <tabstop>lineEdit_2</tabstop>
+  <tabstop>lineEdit_7</tabstop>
+  <tabstop>lineEdit_3</tabstop>
+  <tabstop>lineEdit_4</tabstop>
+  <tabstop>lineEdit_5</tabstop>
+  <tabstop>lineEdit_6</tabstop>
+  <tabstop>treeWidget</tabstop>
+  <tabstop>pushButton_CreateComposition</tabstop>
+  <tabstop>pushButton_close</tabstop>
+ </tabstops>
+ <resources/>
+ <connections/>
+</ui>

+ 44 - 0
QGIS_Installer/bin/Debug/layman/dlg_deleteLayerFromMap.py

@@ -0,0 +1,44 @@
+# -*- coding: utf-8 -*-
+"""
+/***************************************************************************
+ CartoDBDialog
+                                 A QGIS plugin
+ CartoDB plugin
+ Generated by Plugin Builder: http://g-sherman.github.io/Qgis-Plugin-Builder/
+                             -------------------
+        begin                : 2019-03-19
+        git sha              : $Format:%H$
+        copyright            : (C) 2019 by Ondřej Tomančák, Jan Vrobel
+        email                : vrobel.jan@seznam.cz
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ ***************************************************************************/
+"""
+
+import os
+
+from PyQt5 import uic
+from PyQt5 import QtWidgets
+
+# This loads your .ui file so that PyQt can populate your plugin with the elements from Qt Designer
+FORM_CLASS, _ = uic.loadUiType(os.path.join(
+    os.path.dirname(__file__), 'dlg_deleteLayerFromMap.ui'))
+
+
+class DeleteLayerFromMapDialog(QtWidgets.QDialog, FORM_CLASS):
+    def __init__(self, parent=None):
+        """Constructor."""
+        super(DeleteLayerFromMapDialog, self).__init__(parent)
+        # Set up the user interface from Designer through FORM_CLASS.
+        # After self.setupUi() you can access any designer object by doing
+        # self.<objectname>, and you can use autoconnect slots - see
+        # http://qt-project.org/doc/qt-4.8/designer-using-a-ui-file.html
+        # #widgets-and-dialogs-with-auto-connect
+        self.setupUi(self)

+ 120 - 0
QGIS_Installer/bin/Debug/layman/dlg_deleteLayerFromMap.ui

@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>CartoDBDialogBase</class>
+ <widget class="QDialog" name="CartoDBDialogBase">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>657</width>
+    <height>455</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Layman - Delete layer from map</string>
+  </property>
+  <widget class="QPushButton" name="pushButton">
+   <property name="geometry">
+    <rect>
+     <x>70</x>
+     <y>250</y>
+     <width>88</width>
+     <height>27</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Delete layer</string>
+   </property>
+  </widget>
+  <widget class="QPushButton" name="pushButton_close">
+   <property name="geometry">
+    <rect>
+     <x>360</x>
+     <y>250</y>
+     <width>93</width>
+     <height>28</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Close</string>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label">
+   <property name="geometry">
+    <rect>
+     <x>10</x>
+     <y>10</y>
+     <width>141</width>
+     <height>16</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Loaded compositions:</string>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_2">
+   <property name="geometry">
+    <rect>
+     <x>360</x>
+     <y>10</y>
+     <width>141</width>
+     <height>16</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Layers in composition:</string>
+   </property>
+  </widget>
+  <widget class="QListWidget" name="listWidget">
+   <property name="geometry">
+    <rect>
+     <x>10</x>
+     <y>40</y>
+     <width>261</width>
+     <height>192</height>
+    </rect>
+   </property>
+  </widget>
+  <widget class="QListWidget" name="listWidget_listLayers2">
+   <property name="geometry">
+    <rect>
+     <x>360</x>
+     <y>40</y>
+     <width>271</width>
+     <height>192</height>
+    </rect>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_3">
+   <property name="geometry">
+    <rect>
+     <x>370</x>
+     <y>320</y>
+     <width>131</width>
+     <height>121</height>
+    </rect>
+   </property>
+   <property name="frameShape">
+    <enum>QFrame::Box</enum>
+   </property>
+   <property name="text">
+    <string/>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_4">
+   <property name="geometry">
+    <rect>
+     <x>370</x>
+     <y>292</y>
+     <width>141</width>
+     <height>16</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Preview:</string>
+   </property>
+  </widget>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

+ 44 - 0
QGIS_Installer/bin/Debug/layman/dlg_deleteMap.py

@@ -0,0 +1,44 @@
+# -*- coding: utf-8 -*-
+"""
+/***************************************************************************
+ CartoDBDialog
+                                 A QGIS plugin
+ CartoDB plugin
+ Generated by Plugin Builder: http://g-sherman.github.io/Qgis-Plugin-Builder/
+                             -------------------
+        begin                : 2019-03-19
+        git sha              : $Format:%H$
+        copyright            : (C) 2019 by Ondřej Tomančák, Jan Vrobel
+        email                : vrobel.jan@seznam.cz
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ ***************************************************************************/
+"""
+
+import os
+
+from PyQt5 import uic
+from PyQt5 import QtWidgets
+
+# This loads your .ui file so that PyQt can populate your plugin with the elements from Qt Designer
+FORM_CLASS, _ = uic.loadUiType(os.path.join(
+    os.path.dirname(__file__), 'dlg_deleteMap.ui'))
+
+
+class DeleteMapDialog(QtWidgets.QDialog, FORM_CLASS):
+    def __init__(self, parent=None):
+        """Constructor."""
+        super(DeleteMapDialog, self).__init__(parent)
+        # Set up the user interface from Designer through FORM_CLASS.
+        # After self.setupUi() you can access any designer object by doing
+        # self.<objectname>, and you can use autoconnect slots - see
+        # http://qt-project.org/doc/qt-4.8/designer-using-a-ui-file.html
+        # #widgets-and-dialogs-with-auto-connect
+        self.setupUi(self)

+ 60 - 0
QGIS_Installer/bin/Debug/layman/dlg_deleteMap.ui

@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>CartoDBDialogBase</class>
+ <widget class="QDialog" name="CartoDBDialogBase">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>716</width>
+    <height>450</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Atlas - Delete Map</string>
+  </property>
+  <widget class="QPushButton" name="pushButton">
+   <property name="geometry">
+    <rect>
+     <x>280</x>
+     <y>410</y>
+     <width>88</width>
+     <height>27</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Delete map</string>
+   </property>
+  </widget>
+  <widget class="QTreeWidget" name="treeWidget">
+   <property name="geometry">
+    <rect>
+     <x>10</x>
+     <y>10</y>
+     <width>691</width>
+     <height>391</height>
+    </rect>
+   </property>
+   <column>
+    <property name="text">
+     <string>Map</string>
+    </property>
+   </column>
+  </widget>
+  <widget class="QPushButton" name="pushButton_close">
+   <property name="geometry">
+    <rect>
+     <x>420</x>
+     <y>410</y>
+     <width>93</width>
+     <height>28</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Zavřít</string>
+   </property>
+  </widget>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

+ 44 - 0
QGIS_Installer/bin/Debug/layman/dlg_editMap.py

@@ -0,0 +1,44 @@
+# -*- coding: utf-8 -*-
+"""
+/***************************************************************************
+ CartoDBDialog
+                                 A QGIS plugin
+ CartoDB plugin
+ Generated by Plugin Builder: http://g-sherman.github.io/Qgis-Plugin-Builder/
+                             -------------------
+        begin                : 2019-03-19
+        git sha              : $Format:%H$
+        copyright            : (C) 2019 by Ondřej Tomančák, Jan Vrobel
+        email                : vrobel.jan@seznam.cz
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ ***************************************************************************/
+"""
+
+import os
+
+from PyQt5 import uic
+from PyQt5 import QtWidgets
+
+# This loads your .ui file so that PyQt can populate your plugin with the elements from Qt Designer
+FORM_CLASS, _ = uic.loadUiType(os.path.join(
+    os.path.dirname(__file__), 'dlg_editMap.ui'))
+
+
+class EditMapDialog(QtWidgets.QDialog, FORM_CLASS):
+    def __init__(self, parent=None):
+        """Constructor."""
+        super(EditMapDialog, self).__init__(parent)
+        # Set up the user interface from Designer through FORM_CLASS.
+        # After self.setupUi() you can access any designer object by doing
+        # self.<objectname>, and you can use autoconnect slots - see
+        # http://qt-project.org/doc/qt-4.8/designer-using-a-ui-file.html
+        # #widgets-and-dialogs-with-auto-connect
+        self.setupUi(self)

+ 335 - 0
QGIS_Installer/bin/Debug/layman/dlg_editMap.ui

@@ -0,0 +1,335 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>DialogBase</class>
+ <widget class="QDialog" name="DialogBase">
+  <property name="windowModality">
+   <enum>Qt::ApplicationModal</enum>
+  </property>
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>550</width>
+    <height>250</height>
+   </rect>
+  </property>
+  <property name="sizePolicy">
+   <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+    <horstretch>0</horstretch>
+    <verstretch>0</verstretch>
+   </sizepolicy>
+  </property>
+  <property name="minimumSize">
+   <size>
+    <width>550</width>
+    <height>250</height>
+   </size>
+  </property>
+  <property name="maximumSize">
+   <size>
+    <width>550</width>
+    <height>250</height>
+   </size>
+  </property>
+  <property name="windowTitle">
+   <string>Layman - Edit metadata</string>
+  </property>
+  <widget class="QPushButton" name="pushButton_save">
+   <property name="geometry">
+    <rect>
+     <x>51</x>
+     <y>204</y>
+     <width>88</width>
+     <height>27</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Save</string>
+   </property>
+  </widget>
+  <widget class="QPushButton" name="pushButton_close">
+   <property name="geometry">
+    <rect>
+     <x>188</x>
+     <y>203</y>
+     <width>93</width>
+     <height>28</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Close</string>
+   </property>
+  </widget>
+  <widget class="QLineEdit" name="lineEdit_name">
+   <property name="geometry">
+    <rect>
+     <x>140</x>
+     <y>1</y>
+     <width>137</width>
+     <height>20</height>
+    </rect>
+   </property>
+   <property name="readOnly">
+    <bool>true</bool>
+   </property>
+  </widget>
+  <widget class="QLineEdit" name="lineEdit_abstract">
+   <property name="geometry">
+    <rect>
+     <x>140</x>
+     <y>60</y>
+     <width>137</width>
+     <height>20</height>
+    </rect>
+   </property>
+  </widget>
+  <widget class="QLineEdit" name="lineEdit_title">
+   <property name="geometry">
+    <rect>
+     <x>140</x>
+     <y>30</y>
+     <width>137</width>
+     <height>20</height>
+    </rect>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label">
+   <property name="geometry">
+    <rect>
+     <x>50</x>
+     <y>60</y>
+     <width>71</width>
+     <height>16</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Abstract:</string>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_2">
+   <property name="geometry">
+    <rect>
+     <x>50</x>
+     <y>1</y>
+     <width>61</width>
+     <height>16</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Name:</string>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_3">
+   <property name="geometry">
+    <rect>
+     <x>50</x>
+     <y>30</y>
+     <width>61</width>
+     <height>16</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Title:</string>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_4">
+   <property name="geometry">
+    <rect>
+     <x>50</x>
+     <y>89</y>
+     <width>61</width>
+     <height>16</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Units:</string>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_5">
+   <property name="geometry">
+    <rect>
+     <x>50</x>
+     <y>119</y>
+     <width>51</width>
+     <height>16</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Scale:</string>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_6">
+   <property name="geometry">
+    <rect>
+     <x>50</x>
+     <y>150</y>
+     <width>61</width>
+     <height>16</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>User:</string>
+   </property>
+  </widget>
+  <widget class="QLineEdit" name="lineEdit_units">
+   <property name="geometry">
+    <rect>
+     <x>140</x>
+     <y>89</y>
+     <width>137</width>
+     <height>20</height>
+    </rect>
+   </property>
+   <property name="readOnly">
+    <bool>true</bool>
+   </property>
+  </widget>
+  <widget class="QLineEdit" name="lineEdit_scale">
+   <property name="geometry">
+    <rect>
+     <x>140</x>
+     <y>119</y>
+     <width>137</width>
+     <height>20</height>
+    </rect>
+   </property>
+   <property name="readOnly">
+    <bool>true</bool>
+   </property>
+  </widget>
+  <widget class="QLineEdit" name="lineEdit_user">
+   <property name="geometry">
+    <rect>
+     <x>140</x>
+     <y>150</y>
+     <width>137</width>
+     <height>20</height>
+    </rect>
+   </property>
+   <property name="readOnly">
+    <bool>true</bool>
+   </property>
+  </widget>
+  <widget class="QLineEdit" name="lineEdit_xmin">
+   <property name="geometry">
+    <rect>
+     <x>370</x>
+     <y>56</y>
+     <width>130</width>
+     <height>22</height>
+    </rect>
+   </property>
+  </widget>
+  <widget class="QLineEdit" name="lineEdit_ymin">
+   <property name="geometry">
+    <rect>
+     <x>370</x>
+     <y>116</y>
+     <width>130</width>
+     <height>22</height>
+    </rect>
+   </property>
+  </widget>
+  <widget class="QLineEdit" name="lineEdit_ymax">
+   <property name="geometry">
+    <rect>
+     <x>370</x>
+     <y>146</y>
+     <width>130</width>
+     <height>22</height>
+    </rect>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_8">
+   <property name="geometry">
+    <rect>
+     <x>300</x>
+     <y>149</y>
+     <width>41</width>
+     <height>16</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>YMax:</string>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_7">
+   <property name="geometry">
+    <rect>
+     <x>300</x>
+     <y>89</y>
+     <width>41</width>
+     <height>16</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>XMax:</string>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_9">
+   <property name="geometry">
+    <rect>
+     <x>300</x>
+     <y>60</y>
+     <width>41</width>
+     <height>16</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>XMin:</string>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_10">
+   <property name="geometry">
+    <rect>
+     <x>300</x>
+     <y>29</y>
+     <width>211</width>
+     <height>16</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Extent of canvas:</string>
+   </property>
+  </widget>
+  <widget class="QLineEdit" name="lineEdit_xmax">
+   <property name="geometry">
+    <rect>
+     <x>370</x>
+     <y>86</y>
+     <width>130</width>
+     <height>22</height>
+    </rect>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_11">
+   <property name="geometry">
+    <rect>
+     <x>300</x>
+     <y>120</y>
+     <width>41</width>
+     <height>16</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>YMin:</string>
+   </property>
+  </widget>
+ </widget>
+ <tabstops>
+  <tabstop>pushButton_save</tabstop>
+  <tabstop>pushButton_close</tabstop>
+  <tabstop>lineEdit_name</tabstop>
+  <tabstop>lineEdit_title</tabstop>
+  <tabstop>lineEdit_abstract</tabstop>
+  <tabstop>lineEdit_units</tabstop>
+  <tabstop>lineEdit_scale</tabstop>
+  <tabstop>lineEdit_user</tabstop>
+  <tabstop>lineEdit_xmin</tabstop>
+  <tabstop>lineEdit_xmax</tabstop>
+  <tabstop>lineEdit_ymin</tabstop>
+  <tabstop>lineEdit_ymax</tabstop>
+ </tabstops>
+ <resources/>
+ <connections/>
+</ui>

+ 44 - 0
QGIS_Installer/bin/Debug/layman/dlg_importLayer.py

@@ -0,0 +1,44 @@
+# -*- coding: utf-8 -*-
+"""
+/***************************************************************************
+ CartoDBDialog
+                                 A QGIS plugin
+ CartoDB plugin
+ Generated by Plugin Builder: http://g-sherman.github.io/Qgis-Plugin-Builder/
+                             -------------------
+        begin                : 2019-03-19
+        git sha              : $Format:%H$
+        copyright            : (C) 2019 by Ondřej Tomančák, Jan Vrobel
+        email                : vrobel.jan@seznam.cz
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ ***************************************************************************/
+"""
+
+import os
+
+from PyQt5 import uic
+from PyQt5 import QtWidgets
+
+# This loads your .ui file so that PyQt can populate your plugin with the elements from Qt Designer
+FORM_CLASS, _ = uic.loadUiType(os.path.join(
+    os.path.dirname(__file__), 'dlg_importLayer.ui'))
+
+
+class ImportLayerDialog(QtWidgets.QDialog, FORM_CLASS):
+    def __init__(self, parent=None):
+        """Constructor."""
+        super(ImportLayerDialog, self).__init__(parent)
+        # Set up the user interface from Designer through FORM_CLASS.
+        # After self.setupUi() you can access any designer object by doing
+        # self.<objectname>, and you can use autoconnect slots - see
+        # http://qt-project.org/doc/qt-4.8/designer-using-a-ui-file.html
+        # #widgets-and-dialogs-with-auto-connect
+        self.setupUi(self)

+ 102 - 0
QGIS_Installer/bin/Debug/layman/dlg_importLayer.ui

@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>DialogBase</class>
+ <widget class="QDialog" name="DialogBase">
+  <property name="windowModality">
+   <enum>Qt::ApplicationModal</enum>
+  </property>
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>400</width>
+    <height>299</height>
+   </rect>
+  </property>
+  <property name="sizePolicy">
+   <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+    <horstretch>0</horstretch>
+    <verstretch>0</verstretch>
+   </sizepolicy>
+  </property>
+  <property name="minimumSize">
+   <size>
+    <width>400</width>
+    <height>299</height>
+   </size>
+  </property>
+  <property name="maximumSize">
+   <size>
+    <width>400</width>
+    <height>299</height>
+   </size>
+  </property>
+  <property name="windowTitle">
+   <string>Layman - Export Layer to server</string>
+  </property>
+  <widget class="QListWidget" name="listWidget_listLayers">
+   <property name="geometry">
+    <rect>
+     <x>10</x>
+     <y>10</y>
+     <width>381</width>
+     <height>191</height>
+    </rect>
+   </property>
+  </widget>
+  <widget class="QPushButton" name="pushButton">
+   <property name="geometry">
+    <rect>
+     <x>50</x>
+     <y>260</y>
+     <width>131</width>
+     <height>27</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Export layer</string>
+   </property>
+  </widget>
+  <widget class="QPushButton" name="pushButton_close">
+   <property name="geometry">
+    <rect>
+     <x>212</x>
+     <y>260</y>
+     <width>131</width>
+     <height>28</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Close</string>
+   </property>
+  </widget>
+  <widget class="QTreeWidget" name="treeWidget">
+   <property name="geometry">
+    <rect>
+     <x>10</x>
+     <y>10</y>
+     <width>381</width>
+     <height>241</height>
+    </rect>
+   </property>
+   <property name="selectionMode">
+    <enum>QAbstractItemView::ExtendedSelection</enum>
+   </property>
+   <property name="selectionBehavior">
+    <enum>QAbstractItemView::SelectRows</enum>
+   </property>
+   <column>
+    <property name="text">
+     <string>Layer</string>
+    </property>
+   </column>
+   <column>
+    <property name="text">
+     <string>Type</string>
+    </property>
+   </column>
+  </widget>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

+ 44 - 0
QGIS_Installer/bin/Debug/layman/dlg_importMap (2).py

@@ -0,0 +1,44 @@
+# -*- coding: utf-8 -*-
+"""
+/***************************************************************************
+ CartoDBDialog
+                                 A QGIS plugin
+ CartoDB plugin
+ Generated by Plugin Builder: http://g-sherman.github.io/Qgis-Plugin-Builder/
+                             -------------------
+        begin                : 2019-03-19
+        git sha              : $Format:%H$
+        copyright            : (C) 2019 by Ondřej Tomančák, Jan Vrobel
+        email                : vrobel.jan@seznam.cz
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ ***************************************************************************/
+"""
+
+import os
+
+from PyQt5 import uic
+from PyQt5 import QtWidgets
+
+# This loads your .ui file so that PyQt can populate your plugin with the elements from Qt Designer
+FORM_CLASS, _ = uic.loadUiType(os.path.join(
+    os.path.dirname(__file__), 'dlg_importLayer.ui'))
+
+
+class ImportLayerDialog(QtWidgets.QDialog, FORM_CLASS):
+    def __init__(self, parent=None):
+        """Constructor."""
+        super(ImportLayerDialog, self).__init__(parent)
+        # Set up the user interface from Designer through FORM_CLASS.
+        # After self.setupUi() you can access any designer object by doing
+        # self.<objectname>, and you can use autoconnect slots - see
+        # http://qt-project.org/doc/qt-4.8/designer-using-a-ui-file.html
+        # #widgets-and-dialogs-with-auto-connect
+        self.setupUi(self)

+ 55 - 0
QGIS_Installer/bin/Debug/layman/dlg_importMap (2).ui

@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>CartoDBDialogBase</class>
+ <widget class="QDialog" name="CartoDBDialogBase">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>400</width>
+    <height>300</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Layman</string>
+  </property>
+  <widget class="QListWidget" name="listWidget_listLayers">
+   <property name="geometry">
+    <rect>
+     <x>10</x>
+     <y>10</y>
+     <width>381</width>
+     <height>191</height>
+    </rect>
+   </property>
+  </widget>
+  <widget class="QPushButton" name="pushButton_importLayer">
+   <property name="geometry">
+    <rect>
+     <x>70</x>
+     <y>220</y>
+     <width>88</width>
+     <height>27</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Import layer</string>
+   </property>
+  </widget>
+  <widget class="QPushButton" name="pushButton_close">
+   <property name="geometry">
+    <rect>
+     <x>230</x>
+     <y>220</y>
+     <width>93</width>
+     <height>28</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Close</string>
+   </property>
+  </widget>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

+ 44 - 0
QGIS_Installer/bin/Debug/layman/dlg_importMap.py

@@ -0,0 +1,44 @@
+# -*- coding: utf-8 -*-
+"""
+/***************************************************************************
+ CartoDBDialog
+                                 A QGIS plugin
+ CartoDB plugin
+ Generated by Plugin Builder: http://g-sherman.github.io/Qgis-Plugin-Builder/
+                             -------------------
+        begin                : 2019-03-19
+        git sha              : $Format:%H$
+        copyright            : (C) 2019 by Ondřej Tomančák, Jan Vrobel
+        email                : vrobel.jan@seznam.cz
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ ***************************************************************************/
+"""
+
+import os
+
+from PyQt5 import uic
+from PyQt5 import QtWidgets
+
+# This loads your .ui file so that PyQt can populate your plugin with the elements from Qt Designer
+FORM_CLASS, _ = uic.loadUiType(os.path.join(
+    os.path.dirname(__file__), 'dlg_importMap.ui'))
+
+
+class ImportMapDialog(QtWidgets.QDialog, FORM_CLASS):
+    def __init__(self, parent=None):
+        """Constructor."""
+        super(ImportMapDialog, self).__init__(parent)
+        # Set up the user interface from Designer through FORM_CLASS.
+        # After self.setupUi() you can access any designer object by doing
+        # self.<objectname>, and you can use autoconnect slots - see
+        # http://qt-project.org/doc/qt-4.8/designer-using-a-ui-file.html
+        # #widgets-and-dialogs-with-auto-connect
+        self.setupUi(self)

+ 430 - 0
QGIS_Installer/bin/Debug/layman/dlg_importMap.ui

@@ -0,0 +1,430 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>DialogBase</class>
+ <widget class="QDialog" name="DialogBase">
+  <property name="windowModality">
+   <enum>Qt::ApplicationModal</enum>
+  </property>
+  <property name="enabled">
+   <bool>true</bool>
+  </property>
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>1139</width>
+    <height>700</height>
+   </rect>
+  </property>
+  <property name="sizePolicy">
+   <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+    <horstretch>0</horstretch>
+    <verstretch>0</verstretch>
+   </sizepolicy>
+  </property>
+  <property name="minimumSize">
+   <size>
+    <width>1139</width>
+    <height>700</height>
+   </size>
+  </property>
+  <property name="maximumSize">
+   <size>
+    <width>1139</width>
+    <height>700</height>
+   </size>
+  </property>
+  <property name="acceptDrops">
+   <bool>false</bool>
+  </property>
+  <property name="windowTitle">
+   <string>Layman -Manage Maps</string>
+  </property>
+  <widget class="QPushButton" name="pushButton_close">
+   <property name="geometry">
+    <rect>
+     <x>510</x>
+     <y>650</y>
+     <width>151</width>
+     <height>28</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Close</string>
+   </property>
+  </widget>
+  <widget class="QGroupBox" name="groupBox">
+   <property name="geometry">
+    <rect>
+     <x>420</x>
+     <y>10</y>
+     <width>701</width>
+     <height>621</height>
+    </rect>
+   </property>
+   <property name="title">
+    <string>Layers</string>
+   </property>
+   <widget class="QListWidget" name="listWidget_listLayers">
+    <property name="geometry">
+     <rect>
+      <x>22</x>
+      <y>50</y>
+      <width>351</width>
+      <height>311</height>
+     </rect>
+    </property>
+    <property name="acceptDrops">
+     <bool>false</bool>
+    </property>
+    <property name="dragDropMode">
+     <enum>QAbstractItemView::NoDragDrop</enum>
+    </property>
+    <property name="selectionMode">
+     <enum>QAbstractItemView::SingleSelection</enum>
+    </property>
+   </widget>
+   <widget class="QLabel" name="label_4">
+    <property name="geometry">
+     <rect>
+      <x>23</x>
+      <y>29</y>
+      <width>201</width>
+      <height>16</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>Existing layers in map composition:</string>
+    </property>
+   </widget>
+   <widget class="QPushButton" name="pushButton_deleteLayers">
+    <property name="geometry">
+     <rect>
+      <x>22</x>
+      <y>441</y>
+      <width>161</width>
+      <height>27</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string> Delete Layer</string>
+    </property>
+    <property name="icon">
+     <iconset>
+      <normaloff>../../../../../../../Users/Honza/.designer/backup/icons/minus.png</normaloff>../../../../../../../Users/Honza/.designer/backup/icons/minus.png</iconset>
+    </property>
+   </widget>
+   <widget class="QLabel" name="label_thumbnail">
+    <property name="geometry">
+     <rect>
+      <x>200</x>
+      <y>420</y>
+      <width>170</width>
+      <height>170</height>
+     </rect>
+    </property>
+    <property name="frameShape">
+     <enum>QFrame::Box</enum>
+    </property>
+    <property name="text">
+     <string/>
+    </property>
+   </widget>
+   <widget class="QLabel" name="label_5">
+    <property name="geometry">
+     <rect>
+      <x>52</x>
+      <y>520</y>
+      <width>181</width>
+      <height>16</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>Layer preview:</string>
+    </property>
+   </widget>
+   <widget class="QLabel" name="label_import">
+    <property name="geometry">
+     <rect>
+      <x>420</x>
+      <y>270</y>
+      <width>141</width>
+      <height>16</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>Importing layer:</string>
+    </property>
+   </widget>
+   <widget class="QProgressBar" name="progressBar">
+    <property name="enabled">
+     <bool>true</bool>
+    </property>
+    <property name="geometry">
+     <rect>
+      <x>420</x>
+      <y>310</y>
+      <width>191</width>
+      <height>23</height>
+     </rect>
+    </property>
+    <property name="maximum">
+     <number>0</number>
+    </property>
+    <property name="value">
+     <number>0</number>
+    </property>
+   </widget>
+   <widget class="QgsMapLayerComboBox" name="mMapLayerComboBox">
+    <property name="geometry">
+     <rect>
+      <x>420</x>
+      <y>50</y>
+      <width>231</width>
+      <height>27</height>
+     </rect>
+    </property>
+    <property name="showCrs">
+     <bool>true</bool>
+    </property>
+   </widget>
+   <widget class="QPushButton" name="pushButton">
+    <property name="geometry">
+     <rect>
+      <x>420</x>
+      <y>96</y>
+      <width>161</width>
+      <height>27</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string> Add Layer</string>
+    </property>
+    <property name="icon">
+     <iconset>
+      <normaloff>../../../../../../../Users/Honza/.designer/backup/icons/plus.png</normaloff>../../../../../../../Users/Honza/.designer/backup/icons/plus.png</iconset>
+    </property>
+   </widget>
+   <widget class="QLabel" name="label_2">
+    <property name="geometry">
+     <rect>
+      <x>420</x>
+      <y>27</y>
+      <width>211</width>
+      <height>16</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>Loaded vector layer from canvas:</string>
+    </property>
+   </widget>
+   <widget class="QComboBox" name="comboBox_raster">
+    <property name="geometry">
+     <rect>
+      <x>420</x>
+      <y>180</y>
+      <width>231</width>
+      <height>22</height>
+     </rect>
+    </property>
+   </widget>
+   <widget class="QPushButton" name="pushButton_addRaster">
+    <property name="geometry">
+     <rect>
+      <x>420</x>
+      <y>220</y>
+      <width>161</width>
+      <height>27</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string> Add Layer</string>
+    </property>
+    <property name="icon">
+     <iconset>
+      <normaloff>../../../../../../../Users/Honza/.designer/backup/icons/plus.png</normaloff>../../../../../../../Users/Honza/.designer/backup/icons/plus.png</iconset>
+    </property>
+   </widget>
+   <widget class="QLabel" name="label_3">
+    <property name="geometry">
+     <rect>
+      <x>420</x>
+      <y>150</y>
+      <width>201</width>
+      <height>16</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>Existing layers in Layman:</string>
+    </property>
+   </widget>
+   <widget class="QPushButton" name="pushButton_down">
+    <property name="geometry">
+     <rect>
+      <x>200</x>
+      <y>380</y>
+      <width>171</width>
+      <height>28</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>Up</string>
+    </property>
+   </widget>
+   <widget class="QPushButton" name="pushButton_up">
+    <property name="geometry">
+     <rect>
+      <x>22</x>
+      <y>380</y>
+      <width>161</width>
+      <height>28</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>Down</string>
+    </property>
+   </widget>
+   <widget class="QPushButton" name="pushButton_saveOrder">
+    <property name="geometry">
+     <rect>
+      <x>20</x>
+      <y>420</y>
+      <width>161</width>
+      <height>27</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>Save order</string>
+    </property>
+    <property name="icon">
+     <iconset>
+      <normaloff>../../../../../../../Users/Honza/.designer/backup/icons/minus.png</normaloff>../../../../../../../Users/Honza/.designer/backup/icons/minus.png</iconset>
+    </property>
+   </widget>
+  </widget>
+  <widget class="QGroupBox" name="groupBox_2">
+   <property name="geometry">
+    <rect>
+     <x>7</x>
+     <y>10</y>
+     <width>391</width>
+     <height>621</height>
+    </rect>
+   </property>
+   <property name="title">
+    <string>Map compositions</string>
+   </property>
+   <widget class="QListWidget" name="listWidget">
+    <property name="geometry">
+     <rect>
+      <x>20</x>
+      <y>47</y>
+      <width>341</width>
+      <height>311</height>
+     </rect>
+    </property>
+   </widget>
+   <widget class="QLabel" name="label">
+    <property name="geometry">
+     <rect>
+      <x>23</x>
+      <y>27</y>
+      <width>171</width>
+      <height>16</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>Existing map compositions:</string>
+    </property>
+   </widget>
+   <widget class="QPushButton" name="pushButton_deleteMap">
+    <property name="geometry">
+     <rect>
+      <x>20</x>
+      <y>380</y>
+      <width>161</width>
+      <height>27</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string> Delete Map</string>
+    </property>
+    <property name="icon">
+     <iconset>
+      <normaloff>../../../../../../../Users/Honza/.designer/backup/icons/minus.png</normaloff>../../../../../../../Users/Honza/.designer/backup/icons/minus.png</iconset>
+    </property>
+   </widget>
+   <widget class="QPushButton" name="pushButton_addMap">
+    <property name="geometry">
+     <rect>
+      <x>200</x>
+      <y>380</y>
+      <width>161</width>
+      <height>28</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string> Add Map</string>
+    </property>
+   </widget>
+   <widget class="QPushButton" name="pushButton_editMeta">
+    <property name="geometry">
+     <rect>
+      <x>20</x>
+      <y>440</y>
+      <width>161</width>
+      <height>28</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>  Edit metada</string>
+    </property>
+   </widget>
+   <widget class="QPushButton" name="pushButton_loadMap">
+    <property name="geometry">
+     <rect>
+      <x>20</x>
+      <y>500</y>
+      <width>161</width>
+      <height>28</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>Load Map (WMS)</string>
+    </property>
+   </widget>
+   <widget class="QComboBox" name="comboBox_loadMap">
+    <property name="geometry">
+     <rect>
+      <x>20</x>
+      <y>540</y>
+      <width>231</width>
+      <height>22</height>
+     </rect>
+    </property>
+   </widget>
+   <widget class="QPushButton" name="pushButton_loadMapWFS">
+    <property name="geometry">
+     <rect>
+      <x>200</x>
+      <y>500</y>
+      <width>161</width>
+      <height>28</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>Load Map (WFS)</string>
+    </property>
+   </widget>
+  </widget>
+ </widget>
+ <customwidgets>
+  <customwidget>
+   <class>QgsMapLayerComboBox</class>
+   <extends>QComboBox</extends>
+   <header>qgsmaplayercombobox.h</header>
+  </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>

+ 44 - 0
QGIS_Installer/bin/Debug/layman/dlg_userInfo.py

@@ -0,0 +1,44 @@
+# -*- coding: utf-8 -*-
+"""
+/***************************************************************************
+ CartoDBDialog
+                                 A QGIS plugin
+ CartoDB plugin
+ Generated by Plugin Builder: http://g-sherman.github.io/Qgis-Plugin-Builder/
+                             -------------------
+        begin                : 2019-03-19
+        git sha              : $Format:%H$
+        copyright            : (C) 2019 by Ondřej Tomančák, Jan Vrobel
+        email                : vrobel.jan@seznam.cz
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ ***************************************************************************/
+"""
+
+import os
+
+from PyQt5 import uic
+from PyQt5 import QtWidgets
+
+# This loads your .ui file so that PyQt can populate your plugin with the elements from Qt Designer
+FORM_CLASS, _ = uic.loadUiType(os.path.join(
+    os.path.dirname(__file__), 'dlg_userInfo.ui'))
+
+
+class UserInfoDialog(QtWidgets.QDialog, FORM_CLASS):
+    def __init__(self, parent=None):
+        """Constructor."""
+        super(UserInfoDialog, self).__init__(parent)
+        # Set up the user interface from Designer through FORM_CLASS.
+        # After self.setupUi() you can access any designer object by doing
+        # self.<objectname>, and you can use autoconnect slots - see
+        # http://qt-project.org/doc/qt-4.8/designer-using-a-ui-file.html
+        # #widgets-and-dialogs-with-auto-connect
+        self.setupUi(self)

+ 87 - 0
QGIS_Installer/bin/Debug/layman/dlg_userInfo.ui

@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>DialogBase</class>
+ <widget class="QDialog" name="DialogBase">
+  <property name="windowModality">
+   <enum>Qt::ApplicationModal</enum>
+  </property>
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>322</width>
+    <height>216</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Layman</string>
+  </property>
+  <widget class="QLabel" name="label">
+   <property name="geometry">
+    <rect>
+     <x>40</x>
+     <y>60</y>
+     <width>111</width>
+     <height>16</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Layman username:</string>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_2">
+   <property name="geometry">
+    <rect>
+     <x>40</x>
+     <y>100</y>
+     <width>111</width>
+     <height>16</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Agrihub username:</string>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_layman">
+   <property name="geometry">
+    <rect>
+     <x>200</x>
+     <y>60</y>
+     <width>181</width>
+     <height>16</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string/>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_agrihub">
+   <property name="geometry">
+    <rect>
+     <x>200</x>
+     <y>100</y>
+     <width>191</width>
+     <height>16</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string/>
+   </property>
+  </widget>
+  <widget class="QPushButton" name="pushButton_logout">
+   <property name="geometry">
+    <rect>
+     <x>42</x>
+     <y>140</y>
+     <width>93</width>
+     <height>28</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Logout</string>
+   </property>
+  </widget>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

+ 47 - 0
QGIS_Installer/bin/Debug/layman/flask/flask.py

@@ -0,0 +1,47 @@
+# -*- coding: utf-8 -*-
+"""
+Created on Wed Nov 20 16:17:30 2019
+
+@author: Honza
+"""
+
+from flask import Flask, request, jsonify
+import requests
+import json
+import tempfile
+import os
+
+app = Flask(__name__)
+
+def writeCode(value):
+    path = tempfile.gettempdir() + os.sep + "atlas" + os.sep + "auth.txt" 
+    #path = r'C:\Users\Honza\AppData\Local\Temp\test.txt'
+    f = open(path, "w")
+    f.write(value)
+    f.close()
+
+@app.route('/')
+def hello():
+    return "Hello World!"
+
+
+@app.route('/<name>')
+def hello_name(name):
+    return "Hello {}!".format(name)
+
+@app.route("/client/authn/oauth2-liferay/callback", methods=['POST', 'GET', 'HEAD', 'OPTIONS'])
+def form_to_json():
+    data = request.form.to_dict(flat=False)
+    code = request.args.get('code')
+    writeCode(code)
+    #return (code)
+    return "Authorize code optained. Please continue with QGIS plugin."
+
+#@app.route("/client/authn/oauth2-liferay/code", methods=['POST', 'GET', 'HEAD', 'OPTIONS'])
+#def sendCode():   
+#    API_ENDPOINT = "http://localhost:3000/client/authn/oauth2-liferay/callback"
+#    return (authCode)    
+#  #  return jsonify(c)
+
+if __name__ == '__main__':
+    app.run(host='0.0.0.0', port=3000)

+ 94 - 0
QGIS_Installer/bin/Debug/layman/flaskServer.py

@@ -0,0 +1,94 @@
+# -*- coding: utf-8 -*-
+"""
+Created on Wed Nov 20 16:17:30 2019
+
+@author: Honza
+"""
+class flaskServer(object):
+    from flask import Flask                                                         
+    import threading
+
+    data = 'foo'
+    print(data)
+    app = Flask(__name__)
+
+    #@app.route("/")
+    #def main():
+    #    return data
+
+    @app.route("/")
+    def main():
+        print('aa')
+        threading.Thread(target=app.run).start()
+
+
+
+
+#from flask import Flask, request, jsonify
+#import threading
+#class flaskServer(object):
+#     app = Flask(__name__)                                                             
+#     def main():
+#         print("python main function")  
+
+#         data = 'foo'
+         
+#         print("test")
+#         threading.Thread(target=app.run).start()
+#     @app.route("/")
+#     def main():
+#         return "Layman"
+#     @app.route("/client/authn/oauth2-liferay/callback", methods=['POST', 'GET', 'HEAD', 'OPTIONS'])
+#     def form_to_json(self):
+#         data = request.form.to_dict(flat=False)
+#         code = request.args.get('code')   
+      
+#         return (code)
+#     def startServer():
+#         app.run(host='0.0.0.0', port=3000)
+
+
+
+
+
+
+     #if __name__ == "__main__":
+     #    print("flask is starting")
+     #    threading.Thread(target=app.run).start()
+    #app = Flask(__name__)
+    #app.run(host='0.0.0.0', port=3000)
+    ##def __init__(self):
+    ##    app = Flask(__name__)
+    ##    #if __name__ == '__main__':
+    ##    app.run(host='0.0.0.0', port=3000)
+
+    #@app.route('/')
+    #def hello():
+    #    return "Hello World!"
+
+
+    #@app.route('/<name>')
+    #def hello_name(name):
+    #    return "Hello {}!".format(name)
+
+    #@app.route("/client/authn/oauth2-liferay/callback", methods=['POST', 'GET', 'HEAD', 'OPTIONS'])
+    ##def get_text():
+    ##    return "some text"
+    ##def add():                                                                                                                              
+    ##    data = request.get_json()
+    #    # ... do your business logic, and return some response
+    #    # e.g. below we're just echo-ing back the received JSON data
+    #  # print (jsonify(data))
+    #   # print (request.headers)
+    #   # print (request.__dict__)
+    #    print (request.data)
+    #    return jsonify(data)
+    #def form_to_json(self):
+    #    data = request.form.to_dict(flat=False)
+    #    code = request.args.get('code')
+    
+    #    return jsonify(data)
+    #    return (code)
+
+
+    

+ 72 - 0
QGIS_Installer/bin/Debug/layman/flaskServer2.py

@@ -0,0 +1,72 @@
+# -*- coding: utf-8 -*-
+"""
+Created on Wed Nov 20 16:17:30 2019
+
+@author: Honza
+"""
+
+from flask import Flask, request, jsonify
+import threading
+class flaskServer(object):
+                                                                   
+       
+
+     data = 'foo'
+     print (data)
+     app = Flask(__name__)
+     app.run(host='0.0.0.0', port=3000)
+    # threading.Thread(target=app.run).start()
+     @app.route("/")
+     def main():
+         print(data)
+         return "Layman"
+#     @app.route("/client/authn/oauth2-liferay/callback", methods=['POST', 'GET', 'HEAD', 'OPTIONS'])
+#     def form_to_json(self):
+#         data = request.form.to_dict(flat=False)
+#         code = request.args.get('code')   
+#      
+#         return (code)
+#     def startServer():
+#         print("test")
+#         app.run(host='0.0.0.0', port=3000)
+
+     #if __name__ == "__main__":
+     #    print("flask is starting")
+     #    threading.Thread(target=app.run).start()
+    #app = Flask(__name__)
+    #app.run(host='0.0.0.0', port=3000)
+    ##def __init__(self):
+    ##    app = Flask(__name__)
+    ##    #if __name__ == '__main__':
+    ##    app.run(host='0.0.0.0', port=3000)
+
+    #@app.route('/')
+    #def hello():
+    #    return "Hello World!"
+
+
+    #@app.route('/<name>')
+    #def hello_name(name):
+    #    return "Hello {}!".format(name)
+
+    #@app.route("/client/authn/oauth2-liferay/callback", methods=['POST', 'GET', 'HEAD', 'OPTIONS'])
+    ##def get_text():
+    ##    return "some text"
+    ##def add():                                                                                                                              
+    ##    data = request.get_json()
+    #    # ... do your business logic, and return some response
+    #    # e.g. below we're just echo-ing back the received JSON data
+    #  # print (jsonify(data))
+    #   # print (request.headers)
+    #   # print (request.__dict__)
+    #    print (request.data)
+    #    return jsonify(data)
+    #def form_to_json(self):
+    #    data = request.form.to_dict(flat=False)
+    #    code = request.args.get('code')
+    
+    #    return jsonify(data)
+    #    return (code)
+
+
+    

BIN
QGIS_Installer/bin/Debug/layman/flask_listener/__pycache__/flask.cpython-37.pyc


+ 36 - 0
QGIS_Installer/bin/Debug/layman/flask_listener/flask_listener.py

@@ -0,0 +1,36 @@
+# -*- coding: utf-8 -*-
+"""
+Created on Wed Nov 20 16:17:30 2019
+
+@author: Honza
+"""
+
+from flask import Flask, request, jsonify
+import json
+import tempfile
+import os
+
+app = Flask(__name__)
+
+def writeCode(value):
+    path = tempfile.gettempdir() + os.sep + "atlas" + os.sep + "auth.txt"    
+    f = open(path, "w")
+    f.write(value)
+    f.close()
+
+@app.route('/')
+def hello():
+    return "Flask server"
+
+
+@app.route("/client/authn/oauth2-liferay/callback", methods=['POST', 'GET', 'HEAD', 'OPTIONS'])
+def form_to_json():
+    data = request.form.to_dict(flat=False)
+    code = request.args.get('code')
+    writeCode(code)
+    return "Authorize code optained. Please continue with QGIS plugin."
+
+
+
+if __name__ == '__main__':
+    app.run(host='0.0.0.0', port=3000)

+ 47 - 0
QGIS_Installer/bin/Debug/layman/flask_listener/flask_test.py

@@ -0,0 +1,47 @@
+# -*- coding: utf-8 -*-
+"""
+Created on Wed Nov 20 16:17:30 2019
+
+@author: Honza
+"""
+
+from flask import Flask, request, jsonify
+import requests
+import json
+import tempfile
+import os
+
+app = Flask(__name__)
+
+def writeCode(value):
+    path = tempfile.gettempdir() + os.sep + "atlas" + os.sep + "auth.txt" 
+    #path = r'C:\Users\Honza\AppData\Local\Temp\test.txt'
+    f = open(path, "w")
+    f.write(value)
+    f.close()
+
+@app.route('/')
+def hello():
+    return "Hello World!"
+
+
+@app.route('/<name>')
+def hello_name(name):
+    return "Hello {}!".format(name)
+
+@app.route("/client/authn/oauth2-liferay/callback", methods=['POST', 'GET', 'HEAD', 'OPTIONS'])
+def form_to_json():
+    data = request.form.to_dict(flat=False)
+    code = request.args.get('code')
+    writeCode(code)
+    #return (code)
+    return "Authorize code optained. Please continue with QGIS plugin."
+
+#@app.route("/client/authn/oauth2-liferay/code", methods=['POST', 'GET', 'HEAD', 'OPTIONS'])
+#def sendCode():   
+#    API_ENDPOINT = "http://localhost:3000/client/authn/oauth2-liferay/callback"
+#    return (authCode)    
+#  #  return jsonify(c)
+
+if __name__ == '__main__':
+    app.run(host='0.0.0.0', port=3000)

+ 130 - 0
QGIS_Installer/bin/Debug/layman/help/Makefile

@@ -0,0 +1,130 @@
+# Makefile for Sphinx documentation
+#
+
+# You can set these variables from the command line.
+SPHINXOPTS    =
+SPHINXBUILD   = sphinx-build
+PAPER         =
+BUILDDIR      = build
+
+# Internal variables.
+PAPEROPT_a4     = -D latex_paper_size=a4
+PAPEROPT_letter = -D latex_paper_size=letter
+ALLSPHINXOPTS   = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
+
+.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest
+
+help:
+	@echo "Please use \`make <target>' where <target> is one of"
+	@echo "  html       to make standalone HTML files"
+	@echo "  dirhtml    to make HTML files named index.html in directories"
+	@echo "  singlehtml to make a single large HTML file"
+	@echo "  pickle     to make pickle files"
+	@echo "  json       to make JSON files"
+	@echo "  htmlhelp   to make HTML files and a HTML help project"
+	@echo "  qthelp     to make HTML files and a qthelp project"
+	@echo "  devhelp    to make HTML files and a Devhelp project"
+	@echo "  epub       to make an epub"
+	@echo "  latex      to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
+	@echo "  latexpdf   to make LaTeX files and run them through pdflatex"
+	@echo "  text       to make text files"
+	@echo "  man        to make manual pages"
+	@echo "  changes    to make an overview of all changed/added/deprecated items"
+	@echo "  linkcheck  to check all external links for integrity"
+	@echo "  doctest    to run all doctests embedded in the documentation (if enabled)"
+
+clean:
+	-rm -rf $(BUILDDIR)/*
+
+html:
+	$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
+	@echo
+	@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
+
+dirhtml:
+	$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
+	@echo
+	@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
+
+singlehtml:
+	$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
+	@echo
+	@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
+
+pickle:
+	$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
+	@echo
+	@echo "Build finished; now you can process the pickle files."
+
+json:
+	$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
+	@echo
+	@echo "Build finished; now you can process the JSON files."
+
+htmlhelp:
+	$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
+	@echo
+	@echo "Build finished; now you can run HTML Help Workshop with the" \
+	      ".hhp project file in $(BUILDDIR)/htmlhelp."
+
+qthelp:
+	$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
+	@echo
+	@echo "Build finished; now you can run "qcollectiongenerator" with the" \
+	      ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
+	@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/template_class.qhcp"
+	@echo "To view the help file:"
+	@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/template_class.qhc"
+
+devhelp:
+	$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
+	@echo
+	@echo "Build finished."
+	@echo "To view the help file:"
+	@echo "# mkdir -p $$HOME/.local/share/devhelp/template_class"
+	@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/template_class"
+	@echo "# devhelp"
+
+epub:
+	$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
+	@echo
+	@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
+
+latex:
+	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+	@echo
+	@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
+	@echo "Run \`make' in that directory to run these through (pdf)latex" \
+	      "(use \`make latexpdf' here to do that automatically)."
+
+latexpdf:
+	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+	@echo "Running LaTeX files through pdflatex..."
+	make -C $(BUILDDIR)/latex all-pdf
+	@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
+
+text:
+	$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
+	@echo
+	@echo "Build finished. The text files are in $(BUILDDIR)/text."
+
+man:
+	$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
+	@echo
+	@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
+
+changes:
+	$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
+	@echo
+	@echo "The overview file is in $(BUILDDIR)/changes."
+
+linkcheck:
+	$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
+	@echo
+	@echo "Link check complete; look for any errors in the above output " \
+	      "or in $(BUILDDIR)/linkcheck/output.txt."
+
+doctest:
+	$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
+	@echo "Testing of doctests in the sources finished, look at the " \
+	      "results in $(BUILDDIR)/doctest/output.txt."

+ 155 - 0
QGIS_Installer/bin/Debug/layman/help/make.bat

@@ -0,0 +1,155 @@
+@ECHO OFF
+
+REM Command file for Sphinx documentation
+
+if "%SPHINXBUILD%" == "" (
+	set SPHINXBUILD=sphinx-build
+)
+set BUILDDIR=build
+set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% source
+if NOT "%PAPER%" == "" (
+	set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
+)
+
+if "%1" == "" goto help
+
+if "%1" == "help" (
+	:help
+	echo.Please use `make ^<target^>` where ^<target^> is one of
+	echo.  html       to make standalone HTML files
+	echo.  dirhtml    to make HTML files named index.html in directories
+	echo.  singlehtml to make a single large HTML file
+	echo.  pickle     to make pickle files
+	echo.  json       to make JSON files
+	echo.  htmlhelp   to make HTML files and a HTML help project
+	echo.  qthelp     to make HTML files and a qthelp project
+	echo.  devhelp    to make HTML files and a Devhelp project
+	echo.  epub       to make an epub
+	echo.  latex      to make LaTeX files, you can set PAPER=a4 or PAPER=letter
+	echo.  text       to make text files
+	echo.  man        to make manual pages
+	echo.  changes    to make an overview over all changed/added/deprecated items
+	echo.  linkcheck  to check all external links for integrity
+	echo.  doctest    to run all doctests embedded in the documentation if enabled
+	goto end
+)
+
+if "%1" == "clean" (
+	for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
+	del /q /s %BUILDDIR%\*
+	goto end
+)
+
+if "%1" == "html" (
+	%SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
+	echo.
+	echo.Build finished. The HTML pages are in %BUILDDIR%/html.
+	goto end
+)
+
+if "%1" == "dirhtml" (
+	%SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
+	echo.
+	echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
+	goto end
+)
+
+if "%1" == "singlehtml" (
+	%SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml
+	echo.
+	echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.
+	goto end
+)
+
+if "%1" == "pickle" (
+	%SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
+	echo.
+	echo.Build finished; now you can process the pickle files.
+	goto end
+)
+
+if "%1" == "json" (
+	%SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
+	echo.
+	echo.Build finished; now you can process the JSON files.
+	goto end
+)
+
+if "%1" == "htmlhelp" (
+	%SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
+	echo.
+	echo.Build finished; now you can run HTML Help Workshop with the ^
+.hhp project file in %BUILDDIR%/htmlhelp.
+	goto end
+)
+
+if "%1" == "qthelp" (
+	%SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
+	echo.
+	echo.Build finished; now you can run "qcollectiongenerator" with the ^
+.qhcp project file in %BUILDDIR%/qthelp, like this:
+	echo.^> qcollectiongenerator %BUILDDIR%\qthelp\template_class.qhcp
+	echo.To view the help file:
+	echo.^> assistant -collectionFile %BUILDDIR%\qthelp\template_class.ghc
+	goto end
+)
+
+if "%1" == "devhelp" (
+	%SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp
+	echo.
+	echo.Build finished.
+	goto end
+)
+
+if "%1" == "epub" (
+	%SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub
+	echo.
+	echo.Build finished. The epub file is in %BUILDDIR%/epub.
+	goto end
+)
+
+if "%1" == "latex" (
+	%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
+	echo.
+	echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
+	goto end
+)
+
+if "%1" == "text" (
+	%SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text
+	echo.
+	echo.Build finished. The text files are in %BUILDDIR%/text.
+	goto end
+)
+
+if "%1" == "man" (
+	%SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man
+	echo.
+	echo.Build finished. The manual pages are in %BUILDDIR%/man.
+	goto end
+)
+
+if "%1" == "changes" (
+	%SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
+	echo.
+	echo.The overview file is in %BUILDDIR%/changes.
+	goto end
+)
+
+if "%1" == "linkcheck" (
+	%SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
+	echo.
+	echo.Link check complete; look for any errors in the above output ^
+or in %BUILDDIR%/linkcheck/output.txt.
+	goto end
+)
+
+if "%1" == "doctest" (
+	%SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
+	echo.
+	echo.Testing of doctests in the sources finished, look at the ^
+results in %BUILDDIR%/doctest/output.txt.
+	goto end
+)
+
+:end

+ 216 - 0
QGIS_Installer/bin/Debug/layman/help/source/conf.py

@@ -0,0 +1,216 @@
+# -*- coding: utf-8 -*-
+#
+# Atlas documentation build configuration file, created by
+# sphinx-quickstart on Sun Feb 12 17:11:03 2012.
+#
+# This file is execfile()d with the current directory set to its containing dir.
+#
+# Note that not all possible configuration values are present in this
+# autogenerated file.
+#
+# All configuration values have a default; values that are commented out
+# serve to show the default.
+
+import sys, os
+
+# If extensions (or modules to document with autodoc) are in another directory,
+# add these directories to sys.path here. If the directory is relative to the
+# documentation root, use os.path.abspath to make it absolute, like shown here.
+#sys.path.insert(0, os.path.abspath('.'))
+
+# -- General configuration -----------------------------------------------------
+
+# If your documentation needs a minimal Sphinx version, state it here.
+#needs_sphinx = '1.0'
+
+# Add any Sphinx extension module names here, as strings. They can be extensions
+# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
+extensions = ['sphinx.ext.todo', 'sphinx.ext.imgmath', 'sphinx.ext.viewcode']
+
+# Add any paths that contain templates here, relative to this directory.
+templates_path = ['_templates']
+
+# The suffix of source filenames.
+source_suffix = '.rst'
+
+# The encoding of source files.
+#source_encoding = 'utf-8-sig'
+
+# The master toctree document.
+master_doc = 'index'
+
+# General information about the project.
+project = u'Atlas'
+copyright = u'2013, jan vrobel'
+
+# The version info for the project you're documenting, acts as replacement for
+# |version| and |release|, also used in various other places throughout the
+# built documents.
+#
+# The short X.Y version.
+version = '0.1'
+# The full version, including alpha/beta/rc tags.
+release = '0.1'
+
+# The language for content autogenerated by Sphinx. Refer to documentation
+# for a list of supported languages.
+#language = None
+
+# There are two options for replacing |today|: either, you set today to some
+# non-false value, then it is used:
+#today = ''
+# Else, today_fmt is used as the format for a strftime call.
+#today_fmt = '%B %d, %Y'
+
+# List of patterns, relative to source directory, that match files and
+# directories to ignore when looking for source files.
+exclude_patterns = []
+
+# The reST default role (used for this markup: `text`) to use for all documents.
+#default_role = None
+
+# If true, '()' will be appended to :func: etc. cross-reference text.
+#add_function_parentheses = True
+
+# If true, the current module name will be prepended to all description
+# unit titles (such as .. function::).
+#add_TemplateModuleNames = True
+
+# If true, sectionauthor and moduleauthor directives will be shown in the
+# output. They are ignored by default.
+#show_authors = False
+
+# The name of the Pygments (syntax highlighting) style to use.
+pygments_style = 'sphinx'
+
+# A list of ignored prefixes for module index sorting.
+#modindex_common_prefix = []
+
+
+# -- Options for HTML output ---------------------------------------------------
+
+# The theme to use for HTML and HTML Help pages.  See the documentation for
+# a list of builtin themes.
+html_theme = 'default'
+
+# Theme options are theme-specific and customize the look and feel of a theme
+# further.  For a list of options available for each theme, see the
+# documentation.
+#html_theme_options = {}
+
+# Add any paths that contain custom themes here, relative to this directory.
+#html_theme_path = []
+
+# The name for this set of Sphinx documents.  If None, it defaults to
+# "<project> v<release> documentation".
+#html_title = None
+
+# A shorter title for the navigation bar.  Default is the same as html_title.
+#html_short_title = None
+
+# The name of an image file (relative to this directory) to place at the top
+# of the sidebar.
+#html_logo = None
+
+# The name of an image file (within the static path) to use as favicon of the
+# docs.  This file should be a Windows icon file (.ico) being 16x16 or 32x32
+# pixels large.
+#html_favicon = None
+
+# Add any paths that contain custom static files (such as style sheets) here,
+# relative to this directory. They are copied after the builtin static files,
+# so a file named "default.css" will overwrite the builtin "default.css".
+html_static_path = ['_static']
+
+# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
+# using the given strftime format.
+#html_last_updated_fmt = '%b %d, %Y'
+
+# If true, SmartyPants will be used to convert quotes and dashes to
+# typographically correct entities.
+#html_use_smartypants = True
+
+# Custom sidebar templates, maps document names to template names.
+#html_sidebars = {}
+
+# Additional templates that should be rendered to pages, maps page names to
+# template names.
+#html_additional_pages = {}
+
+# If false, no module index is generated.
+#html_domain_indices = True
+
+# If false, no index is generated.
+#html_use_index = True
+
+# If true, the index is split into individual pages for each letter.
+#html_split_index = False
+
+# If true, links to the reST sources are added to the pages.
+#html_show_sourcelink = True
+
+# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
+#html_show_sphinx = True
+
+# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
+#html_show_copyright = True
+
+# If true, an OpenSearch description file will be output, and all pages will
+# contain a <link> tag referring to it.  The value of this option must be the
+# base URL from which the finished HTML is served.
+#html_use_opensearch = ''
+
+# This is the file name suffix for HTML files (e.g. ".xhtml").
+#html_file_suffix = None
+
+# Output file base name for HTML help builder.
+htmlhelp_basename = 'TemplateClassdoc'
+
+
+# -- Options for LaTeX output --------------------------------------------------
+
+# The paper size ('letter' or 'a4').
+#latex_paper_size = 'letter'
+
+# The font size ('10pt', '11pt' or '12pt').
+#latex_font_size = '10pt'
+
+# Grouping the document tree into LaTeX files. List of tuples
+# (source start file, target name, title, author, documentclass [howto/manual]).
+latex_documents = [
+  ('index', 'Atlas.tex', u'Atlas Documentation',
+   u'jan vrobel', 'manual'),
+]
+
+# The name of an image file (relative to this directory) to place at the top of
+# the title page.
+#latex_logo = None
+
+# For "manual" documents, if this is true, then toplevel headings are parts,
+# not chapters.
+#latex_use_parts = False
+
+# If true, show page references after internal links.
+#latex_show_pagerefs = False
+
+# If true, show URL addresses after external links.
+#latex_show_urls = False
+
+# Additional stuff for the LaTeX preamble.
+#latex_preamble = ''
+
+# Documents to append as an appendix to all manuals.
+#latex_appendices = []
+
+# If false, no module index is generated.
+#latex_domain_indices = True
+
+
+# -- Options for manual page output --------------------------------------------
+
+# One entry per manual page. List of tuples
+# (source start file, name, description, authors, manual section).
+man_pages = [
+    ('index', 'TemplateClass', u'Atlas Documentation',
+     [u'jan vrobel'], 1)
+]

+ 20 - 0
QGIS_Installer/bin/Debug/layman/help/source/index.rst

@@ -0,0 +1,20 @@
+.. Atlas documentation master file, created by
+   sphinx-quickstart on Sun Feb 12 17:11:03 2012.
+   You can adapt this file completely to your liking, but it should at least
+   contain the root `toctree` directive.
+
+Welcome to Atlas's documentation!
+============================================
+
+Contents:
+
+.. toctree::
+   :maxdepth: 2
+
+Indices and tables
+==================
+
+* :ref:`genindex`
+* :ref:`modindex`
+* :ref:`search`
+

+ 11 - 0
QGIS_Installer/bin/Debug/layman/i18n/af.ts

@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS><TS version="2.0" language="af" sourcelanguage="en">
+<context>
+    <name>@default</name>
+    <message>
+        <location filename="test_translations.py" line="48"/>
+        <source>Good morning</source>
+        <translation>Goeie more</translation>
+    </message>
+</context>
+</TS>

BIN
QGIS_Installer/bin/Debug/layman/icon.png


File diff suppressed because it is too large
+ 13 - 0
QGIS_Installer/bin/Debug/layman/icons/account.svg


BIN
QGIS_Installer/bin/Debug/layman/icons/cloud.png


BIN
QGIS_Installer/bin/Debug/layman/icons/delete.png


BIN
QGIS_Installer/bin/Debug/layman/icons/download_map.png


BIN
QGIS_Installer/bin/Debug/layman/icons/edit.png


BIN
QGIS_Installer/bin/Debug/layman/icons/file.png


BIN
QGIS_Installer/bin/Debug/layman/icons/globus.png


BIN
QGIS_Installer/bin/Debug/layman/icons/layers-down.png


BIN
QGIS_Installer/bin/Debug/layman/icons/layers-up.png


BIN
QGIS_Installer/bin/Debug/layman/icons/layers.png


BIN
QGIS_Installer/bin/Debug/layman/icons/load.png


BIN
QGIS_Installer/bin/Debug/layman/icons/login.png


BIN
QGIS_Installer/bin/Debug/layman/icons/map_download.png


BIN
QGIS_Installer/bin/Debug/layman/icons/map_upload.png


BIN
QGIS_Installer/bin/Debug/layman/icons/minus.png


BIN
QGIS_Installer/bin/Debug/layman/icons/plus.png


BIN
QGIS_Installer/bin/Debug/layman/icons/save.png


Some files were not shown because too many files changed in this diff