|
@@ -296,7 +296,14 @@ class UIFunctions(MainWindow):
|
296
|
296
|
# 上传文件的方法
|
297
|
297
|
def execute_script_based_on_selection(self, file_path):
|
298
|
298
|
current_text = self.ui.comboBox_2.currentText()
|
299
|
|
- db_path = r"D:/Code/ControlNetwork/UI/SQL/DataBase.db"
|
|
299
|
+ # db_path = r"D:/Code/ControlNetwork/UI/SQL/DataBase.db"
|
|
300
|
+ # 获取当前脚本所在的目录
|
|
301
|
+ current_dir = os.path.dirname(os.path.abspath(__file__))
|
|
302
|
+ # 构建 SQL 文件夹的相对路径(上一级的上一级中的 SQL 文件夹)
|
|
303
|
+ sql_folder = os.path.join(current_dir, '..', '..', 'SQL')
|
|
304
|
+ # 将相对路径转换为绝对路径
|
|
305
|
+ sql_folder = os.path.abspath(sql_folder)
|
|
306
|
+ db_path = os.path.join(sql_folder, f"{self.ui.comboBox.currentText()}.db")
|
300
|
307
|
file_path = file_path
|
301
|
308
|
if current_text == "水准测段高差稳定计算":
|
302
|
309
|
GC.main_function(file_path, db_path)
|
|
@@ -311,8 +318,15 @@ class UIFunctions(MainWindow):
|
311
|
318
|
# 计算与展示文件的方法
|
312
|
319
|
def compute_show_process_excel_file(self, file_path):
|
313
|
320
|
current_text = self.ui.comboBox_2.currentText()
|
314
|
|
- db_path = r"D:/Code/ControlNetwork/UI/SQL/DataBase.db"
|
315
|
|
- #转换为utf-8
|
|
321
|
+ # db_path = r"D:/Code/ControlNetwork/UI/SQL/DataBase.db"
|
|
322
|
+ # 获取当前脚本所在的目录
|
|
323
|
+ current_dir = os.path.dirname(os.path.abspath(__file__))
|
|
324
|
+ # 构建 SQL 文件夹的相对路径(上一级的上一级中的 SQL 文件夹)
|
|
325
|
+ sql_folder = os.path.join(current_dir, '..', '..', 'SQL')
|
|
326
|
+ # 将相对路径转换为绝对路径
|
|
327
|
+ sql_folder = os.path.abspath(sql_folder)
|
|
328
|
+ db_path = os.path.join(sql_folder, f"{self.ui.comboBox.currentText()}.db")
|
|
329
|
+ # 转换为utf-8
|
316
|
330
|
excelname = os.path.basename(file_path)
|
317
|
331
|
utf_en = excelname.encode('utf-8')
|
318
|
332
|
if current_text == "水准测段高差稳定计算":
|