示例#1
0
path_local_database = os.path.join(path_programm, "_database", "_local_database.json")
_local_database = TinyDB(path_local_database)
path_database_addon = os.path.join(path_programm, "_database", "_database_addon.json")

if os.path.isfile(path_database_addon):
    _database_addon = TinyDB(path_database_addon)
else:
    _database_addon = None
# _database.drop_table('table_cria')
# _database.drop_tables()

# table_lama = _database.table('table_lama_1')
# table_lama = _database.table('table_lama_2')
# # table_lama = _database.table('table_cria')

dict_gk = config_loader(config_file, 'dict_gk')




# _database = _database_addon
########################################
##### write all files to database - working ###
######################################
# table_lama = _database.table('table_lama_1')
# for all in dict_gk.values():
#     gk = all.split(" ")[0].split("-L")[0]
# #     ###### Laptop
#     # folder_path = os.path.join("C:/","Users","Christoph", "Dropbox", "_LaMA_Aufgabensammlung", "_database","Typ1Aufgaben", "_Grundkompetenzen","WS", "WS 1.1", "Einzelbeispiele")
#     # folder_path = os.path.join("C:/","Users","Christoph", "Dropbox", "_LaMA_Aufgabensammlung", "_database_inoffiziell","Typ1Aufgaben", "_Grundkompetenzen",gk, all, "Einzelbeispiele")
#     # folder_path = os.path.join("C:/","Users","Christoph", "Dropbox", "_LaMA_Aufgabensammlung", "_database_inoffiziell","Typ1Aufgaben", "_Grundkompetenzen",gk, all, "Einzelbeispiele")
import json
import shutil
from datetime import date, timedelta 
from time import sleep
from refresh_ddb import refresh_ddb, modification_date
from sort_items import order_gesammeltedateien
from standard_dialog_windows import critical_window, question_window, warning_window
from processing_window import working_window_latex_output
import webbrowser
from tinydb import Query
from database_commands import _database, _database_addon, _local_database
from tex_minimal import tex_preamble, tex_end, begin_beispiel, end_beispiel, begin_beispiel_lang, end_beispiel_lang



ag_beschreibung = config_loader(config_file, "ag_beschreibung")
an_beschreibung = config_loader(config_file, "an_beschreibung")
fa_beschreibung = config_loader(config_file, "fa_beschreibung")
ws_beschreibung = config_loader(config_file, "ws_beschreibung")

k5_beschreibung = config_loader(config_file, "k5_beschreibung")
k6_beschreibung = config_loader(config_file, "k6_beschreibung")
k7_beschreibung = config_loader(config_file, "k7_beschreibung")
k8_beschreibung = config_loader(config_file, "k8_beschreibung")

dict_gk = config_loader(config_file, "dict_gk")
Klassen = config_loader(config_file, "Klassen")
list_klassen = config_loader(config_file, "list_klassen")

dict_aufgabenformate = config_loader(config_file, "dict_aufgabenformate")
from PyQt5 import QtCore, QtWidgets, QtGui
import os
import datetime
from config_start import database
from config import config_file, config_loader, is_empty
from processing_window import working_window
from standard_dialog_windows import question_window
from git_sync import git_reset_repo_to_origin, check_for_changes, check_internet_connection
from standard_dialog_windows import warning_window, information_window, question_window, critical_window

list_klassen = config_loader(config_file, "list_klassen")


def modification_date(filename):
    t = os.path.getmtime(filename)
    return datetime.datetime.fromtimestamp(t)


class Worker_CheckChanges(QtCore.QObject):
    finished = QtCore.pyqtSignal()

    @QtCore.pyqtSlot()
    def task(self, Ui_MainWindow):
        Ui_MainWindow.worker_response = []
        modified_files, new_files = check_for_changes(database)

        if modified_files != [] or new_files != []:
            modified = b", ".join(modified_files)
            modified = modified.decode()
            new = ", ".join(new_files)