示例#1
0
    def accept(self):
        # kdyz se klikne na OK
        print("*******************************************")
        print("Projekt zalozen")
        nazev=self.textEdit.toPlainText() # vezme nazev souboru
        print(nazev)

        cesta=self.cesta_souradnice[0]
        cesta_inv=cesta[::-1]
        pozice=cesta_inv.find('/')
        cesta_konecna=cesta[0:len(cesta)-pozice]
        #======================================================================#
        #zalozeni databaze
        databaze = Databaze()
        databaze.vytvoreni(nazev,cesta_konecna)
        databaze.vytvor_tabulku(DB_CONFIG["tabulka_souradnic"], DB_CONFIG["schema_tabulky_souradnic"])
        databaze.vytvor_tabulku(DB_CONFIG["tabulka_mereni"], DB_CONFIG["schema_tabulky_mereni"])
        databaze.vytvor_tabulku(DB_CONFIG["tabulka_projekt"], DB_CONFIG["schema_projekt"])
        databaze.importuj_sour(str(self.cesta_souradnice[0]))
        databaze.importuj_mereni(str(self.cesta_mereni[0]))
        databaze.zapis_info(self.cesta_souradnice[0])

        f=str(cesta_konecna+nazev+'.db')
        print('Projekt ulozen do: '+cesta_konecna+nazev+'.db')
        self.global_cesta.append(f)

        self.close()
示例#2
0
文件: ukazka.py 项目: ctu-yobp/2020-a
# systemove knihovny
import os

# vlastni knihovny
from data import Databaze
from config import DB_CONFIG, DATA_CONFIG  # import konfigurace databaze a dat

databaze = Databaze()

databaze.vytvoreni(DB_CONFIG["nazev_projektu"])

databaze.vytvor_tabulku(DB_CONFIG["tabulka_souradnic"],
                        DB_CONFIG["schema_tabulky_souradnic"])
databaze.vytvor_tabulku(DB_CONFIG["tabulka_mereni"],
                        DB_CONFIG["schema_tabulky_mereni"])

# databaze.smazat(DB_CONFIG["tabulka_souradnic"], '')
# databaze.smazat(DB_CONFIG["tabulka_mereni"], '')

databaze.importuj_sour(DATA_CONFIG['cesta_sour'])
databaze.importuj_mereni(DATA_CONFIG['cesta_mereni'])

# data=Databaze.sql_query(projekt,'select * from gps_sour')
# print(data[0][:])