def download_and_install_update(self):
     logging.debug(
         'mainwindow.py - download_and_install_update - link_latest_version '
         + str(self.link_latest_version))
     if self.link_latest_version:
         frozen = False
         if getattr(sys, 'frozen', False):
             frozen = True
         self.updateWindow = MyWarningUpdate(frozen, self.config_dict,
                                             self.translations_dict)
         self.updateWindow.exec_()
         temp_folder = None
         if self.updateWindow.update:
             if frozen:
                 temp_folder = tempfile.gettempdir()
             else:
                 if platform.system() == 'Windows':
                     temp_folder = os.path.expanduser("~") + "\\Downloads\\"
                 elif platform.system() == 'Linux':
                     temp_folder = os.path.expanduser("~") + "/Downloads/"
             self.downloadWindow = MyUpdate(self.link_latest_version,
                                            temp_folder, self.config_dict,
                                            self.translations_dict)
             self.downloadWindow.exec_()
             logging.debug(
                 'mainwindow.py - download_and_install_update - download finished'
             )
             if frozen:
                 filename = self.link_latest_version[
                     self.link_latest_version.rfind('/') + 1:]
                 if platform.system() == 'Windows':
                     os.startfile(temp_folder + '\\' + filename)
                     time.sleep(0.1)
                     self.close()
                 elif platform.system() == 'Linux':
                     shutil.copy('functions/unzip_update.py', temp_folder)
                     install_folder = self.config_path + '/'
                     command = ('python3 ' + temp_folder +
                                '/unzip_update.py ' + temp_folder + '/' +
                                filename + ' ' + install_folder)
                     os.system('x-terminal-emulator -e ' + command)
                     time.sleep(0.1)
                     self.close()
             else:
                 time.sleep(0.1)
                 self.close()
 def download_and_install_update(self):
     logging.debug(
         'mainwindow.py - download_and_install_update - link_latest_version '
         + str(self.link_latest_version))
     if self.link_latest_version:
         if isinstance(self.link_latest_version, dict):
             self.downloadWindow = MyDatabaseUpdate(
                 self.link_latest_version)
             x1, y1, w1, h1 = self.geometry().getRect()
             _, _, w2, h2 = self.downloadWindow.geometry().getRect()
             x2 = x1 + w1 / 2 - w2 / 2
             y2 = y1 + h1 / 2 - h2 / 2
             self.downloadWindow.setGeometry(x2, y2, w2, h2)
             self.downloadWindow.setMinimumSize(
                 QtCore.QSize(500,
                              self.downloadWindow.sizeHint().height()))
             self.downloadWindow.setMaximumSize(
                 QtCore.QSize(500,
                              self.downloadWindow.sizeHint().height()))
             self.downloadWindow.exec_()
             if self.downloadWindow.done:
                 self.prepare_datasets_database()
                 self.actionUpdate.setEnabled(False)
                 icon = QtGui.QIcon()
                 icon.addPixmap(
                     QtGui.QPixmap("icons/cmems_data_downloader_icon.svg"),
                     QtGui.QIcon.Normal, QtGui.QIcon.Off)
                 self.actionUpdate.setIcon(icon)
                 self.actionUpdate.setToolTip('')
         else:
             frozen = False
             height = 250
             if getattr(sys, 'frozen', False):
                 frozen = True
                 height = 200
             self.updateWindow = MyWarningUpdate(frozen)
             x1, y1, w1, h1 = self.geometry().getRect()
             _, _, w2, h2 = self.updateWindow.geometry().getRect()
             x2 = x1 + w1 / 2 - w2 / 2
             y2 = y1 + h1 / 2 - h2 / 2
             self.updateWindow.setGeometry(x2, y2, w2, h2)
             self.updateWindow.setMinimumSize(QtCore.QSize(600, height))
             self.updateWindow.setMaximumSize(QtCore.QSize(600, height))
             self.updateWindow.exec_()
             try:
                 if self.updateWindow.buttonName == 'update_button':
                     if getattr(sys, 'frozen', False):
                         temp_folder = tempfile.gettempdir()
                     else:
                         temp_folder = os.path.expanduser(
                             "~") + "/Downloads/"
                     self.downloadWindow = MyUpdate(
                         self.link_latest_version, temp_folder)
                     x1, y1, w1, h1 = self.geometry().getRect()
                     _, _, w2, h2 = self.downloadWindow.geometry().getRect()
                     x2 = x1 + w1 / 2 - w2 / 2
                     y2 = y1 + h1 / 2 - h2 / 2
                     self.downloadWindow.setGeometry(x2, y2, w2, h2)
                     self.downloadWindow.setMinimumSize(
                         QtCore.QSize(
                             500,
                             self.downloadWindow.sizeHint().height()))
                     self.downloadWindow.setMaximumSize(
                         QtCore.QSize(
                             500,
                             self.downloadWindow.sizeHint().height()))
                     self.downloadWindow.exec_()
                     logging.debug(
                         'mainwindow.py - download_and_install_downloader_update - download finished'
                     )
                     if not self.downloadWindow.cancel:
                         if getattr(sys, 'frozen', False):
                             filename = self.link_latest_version[
                                 self.link_latest_version.rfind('/') + 1:]
                             if platform.system() == 'Windows':
                                 os.startfile(temp_folder + '\\' + filename)
                                 time.sleep(0.1)
                                 self.close()
                             elif platform.system() == 'Linux':
                                 shutil.copy('functions/unzip_update.py',
                                             temp_folder)
                                 install_folder = self.config_path + '/'
                                 command = 'python3 ' + temp_folder + '/unzip_update.py ' + temp_folder + '/' + filename + ' ' + install_folder
                                 os.system('x-terminal-emulator -e ' +
                                           command)
                                 time.sleep(0.1)
                                 self.close()
                         else:
                             time.sleep(0.1)
                             self.close()
             except AttributeError:
                 pass