text stringlengths 1 93.6k |
|---|
def extractDeath(grave, str):
|
if 'Death place:' in str:
|
grave['death'] = str.split('\n')[0]
|
grave['deathplace'] = str.split('\n')[1].replace('Death place: ', '')
|
else:
|
grave['death'] = str
|
# <FILESEP>
|
# -*- coding: utf-8 -*-
|
# PyQt
|
from qtpy.QtGui import *
|
from qtpy.QtWidgets import *
|
from qtpy.QtCore import *
|
from qtpy import QtGui,QtCore
|
# Others
|
import os
|
import imp
|
import sys
|
import json
|
import glob
|
from functools import partial
|
from collections import OrderedDict
|
# 导入按钮函数
|
#---------------------------------------------------------------------------------------
|
ALL_FUNC_BUTTON = []
|
funcBtnPath = os.getcwd() + '/func-button/'
|
allPath = glob.glob(funcBtnPath+r'*.py')
|
for path in allPath:
|
fileName = path.split("\\")[-1]
|
modelName = fileName.split(".")[0]
|
ALL_FUNC_BUTTON.append(modelName)
|
imp.load_source('ctaFuncButttons',path)
|
BUTTON_FUNC = {}
|
from ctaFuncButttons import *
|
for func_bt in ALL_FUNC_BUTTON:
|
fn_obj = getattr(sys.modules['ctaFuncButttons'], func_bt)
|
BUTTON_FUNC[func_bt] = fn_obj
|
# 字符串转换
|
#---------------------------------------------------------------------------------------
|
try:
|
_fromUtf8 = QtCore.QString.fromUtf8
|
except AttributeError:
|
def _fromUtf8(s):
|
return s
|
########################################################################
|
class uiBasicIO(QWidget):
|
"""通过json文件,自动生成输入框和按钮的元类"""
|
#----------------------------------------------------------------------
|
def __init__(self,parent=None,inpFile='',btnFile=''):
|
"""初始化函数"""
|
super(uiBasicIO,self).__init__(parent)
|
# 输入框数据
|
self.classDict = OrderedDict()
|
self.labelDict = {}
|
self.widthDict = {}
|
self.typeDict = {}
|
self.evalDict = {}
|
self.editDict = {}
|
# 按钮数据
|
self.bClassDict = OrderedDict()
|
self.bWidthDict = {}
|
self.bFunDict = {}
|
self.buttonDict = {}
|
# 输入框和按钮
|
self.groupInput = None
|
self.groupProcess = None
|
# 输入框和按钮的配置文件
|
self.inpFile = inpFile
|
self.btnFile = btnFile
|
self.loadInputSetting()
|
self.loadButtonSetting()
|
self.initBasicUi()
|
#----------------------------------------------------------------------
|
def getInputParamByName(self,name):
|
"""获得输入框参数值"""
|
typeName = self.typeDict[name]
|
editCell = self.editDict[name]
|
val = str(editCell.currentText()) if typeName == 'List' else str(editCell.text())
|
try:
|
return (eval(val) if self.evalDict[name] else val)
|
except:
|
return val
|
#----------------------------------------------------------------------
|
def loadInputSetting(self):
|
"""载入输入框界面配置"""
|
settingFile = self.inpFile
|
with open(settingFile) as f:
|
for setting in json.load(f):
|
name = setting['name']
|
label = setting['label']
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.