# Path: persepolis/constants/Os.py
# class OS:
#     LINUX = 'Linux'
#     WINDOWS = 'Windows'
#     FREE_BSD = 'FreeBSD'
#     OPEN_BSD = 'OpenBSD'
#     OSX = DARWIN = 'Darwin'
#     BSD_FAMILY = [FREE_BSD, OPEN_BSD]
#     UNIX_LIKE = BSD_FAMILY + [LINUX]
#     LIST = [LINUX, WINDOWS, FREE_BSD, OPEN_BSD, OSX]
# 
# Path: persepolis/scripts/osCommands.py
# def findFileManager():
# def touch(file_path):
# def xdgOpen(file_path, f_type='file', path='file'):
# def remove(file_path): 
# def removeDir(folder_path):
# def makeDirs(folder_path, hidden=False):
# def findMountPoint(path):
# def makeTempDownloadDir(path):
# def moveFile(old_file_path, new_path, new_path_type='folder'):
#         CREATE_NO_WINDOW = 0x08000000
#             CREATE_NO_WINDOW = 0x08000000


    from PySide6.QtWidgets import QWidget, QVBoxLayout, QHBoxLayout, QLabel, QPushButton
    from PySide6.QtCore import Qt, QSize, QPoint, QTranslator, QCoreApplication, QLocale
    from PySide6 import QtWidgets, QtCore
    from PySide6.QtGui import QIcon
    from PyQt5.QtWidgets import QWidget, QVBoxLayout, QHBoxLayout, QLabel, QPushButton
    from PyQt5.QtCore import Qt, QSize, QPoint, QTranslator, QCoreApplication, QLocale
    from PyQt5 import QtWidgets, QtCore
    from PyQt5.QtGui import QIcon
from persepolis.constants import OS
from persepolis.scripts import osCommands
import platform
import requests
import platform
import ast
    def updateCheck(self, button):
        self.check_button.setText(QCoreApplication.translate("update_src_ui_tr", 'Checking...'))

        try:
            # get information dictionary from github
            updatesource = requests.get('https://persepolisdm.github.io/version')

            updatesource_text = updatesource.text
            updatesource_dict = ast.literal_eval(updatesource_text)

            # get latest stable version
            server_version = updatesource_dict['version']

            # Comparison
            if float(server_version) > float(self.client_version):
                self.status_label.setText(QCoreApplication.translate(
                    "update_src_ui_tr", 'A newer Persepolis release is available'))

                if os_type == OS.WINDOWS:
                    self.winUpdatedl()  # this function download latest release

                    # find system architect
                    if platform.architecture()[0] == '64bit':

                        osCommands.xdgOpen(updatesource_dict['win64dlurl'])

                    elif platform.architecture()[0] == '32bit':

                        osCommands.xdgOpen(updatesource_dict['win32dlurl'])


# Path: persepolis/constants/Os.py
# class OS:
#     LINUX = 'Linux'
#     WINDOWS = 'Windows'
#     FREE_BSD = 'FreeBSD'
#     OPEN_BSD = 'OpenBSD'
#     OSX = DARWIN = 'Darwin'
#     BSD_FAMILY = [FREE_BSD, OPEN_BSD]
#     UNIX_LIKE = BSD_FAMILY + [LINUX]
#     LIST = [LINUX, WINDOWS, FREE_BSD, OPEN_BSD, OSX]
# 
# Path: persepolis/scripts/osCommands.py
# def findFileManager():
# def touch(file_path):
# def xdgOpen(file_path, f_type='file', path='file'):
# def remove(file_path): 
# def removeDir(folder_path):
# def makeDirs(folder_path, hidden=False):
# def findMountPoint(path):
# def makeTempDownloadDir(path):
# def moveFile(old_file_path, new_path, new_path_type='folder'):
#         CREATE_NO_WINDOW = 0x08000000
#             CREATE_NO_WINDOW = 0x08000000


# Path: persepolis/scripts/update.py
    from PySide6.QtWidgets import QWidget, QVBoxLayout, QHBoxLayout, QLabel, QPushButton
    from PySide6.QtCore import Qt, QSize, QPoint, QTranslator, QCoreApplication, QLocale
    from PySide6 import QtWidgets, QtCore
    from PySide6.QtGui import QIcon
    from PyQt5.QtWidgets import QWidget, QVBoxLayout, QHBoxLayout, QLabel, QPushButton
    from PyQt5.QtCore import Qt, QSize, QPoint, QTranslator, QCoreApplication, QLocale
    from PyQt5 import QtWidgets, QtCore
    from PyQt5.QtGui import QIcon
from persepolis.constants import OS
from persepolis.scripts import osCommands
import platform
import requests
import platform
import ast

    def updateCheck(self, button):
        self.check_button.setText(QCoreApplication.translate("update_src_ui_tr", 'Checking...'))

        try:
            # get information dictionary from github
            updatesource = requests.get('https://persepolisdm.github.io/version')

            updatesource_text = updatesource.text
            updatesource_dict = ast.literal_eval(updatesource_text)

            # get latest stable version
            server_version = updatesource_dict['version']

            # Comparison
            if float(server_version) > float(self.client_version):
                self.status_label.setText(QCoreApplication.translate(
                    "update_src_ui_tr", 'A newer Persepolis release is available'))

                if os_type == OS.WINDOWS:
                    self.winUpdatedl()  # this function download latest release

                    # find system architect
                    if platform.architecture()[0] == '64bit':

                        osCommands.xdgOpen(updatesource_dict['win64dlurl'])

                    elif platform.architecture()[0] == '32bit':

                        osCommands.xdgOpen(updatesource_dict['win32dlurl'])


                elif os_type == OS.OSX: