viper 软件
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
viper/yiwinframe.py

737 lines
27 KiB

import wx
import os
import time
import threading
import numpy as np
from pathlib import Path,PurePath
from pubsub import pub
# from configobj import ConfigObj
from listctrl import Listctrl
# from mypanel import MyPanel
from mypanel import Plot
from uiconfig.ui_com_setting import UI_Com_Setting
from uiconfig.ui_filepath_setting import UI_Filepath_Setting
from uiconfig.ui_pathsn_setting import UI_PathSN_Setting
from uiconfig.ui_plot_setting import UI_Plot_Setting
from uiconfig.ui_log_setting import UI_Log_Setting
from uiconfig.ui_algorithm import UI_Algorithm
from uiconfig.uiabout import About
from uiconfig.uihelp import Help
from myconfig import DeviceType,YAML_FILE_NAME,RETRIEVE_CFG_FILE
from myconfig import TOKEN,DATA_DIR,FILE_MARK,OUTPUT_DIR,SAVE_EXT_NAME,CAL_DIR,PURE_WATER_FNAME
from myconfig import MyConfig
from configuration import Configuration
# from awrams import AWRAMS,HandHeldBuf
from myexception import MyException
from mylogger import log
from mypath import MyDir
from mythread import Mythead,Multithread
from readcal import ReadCal
from uart import Uart
# from viper import Viper
from dataplot import DataPlot
from myViper import MyViper,WorkMode,PureWaterData
# -定义菜单ID,关联Event-------------------------
"""
# 菜单 文件 -- 处理文件
设备 -- 序列 波长 测量
设置 -- 串口 光程 文件路径 绘图参数 采集设置
作图 -- 最后一条曲线 最后七条 指定位置七条
帮助
"""
ID_MEASURE = 1
ID_DEAL_FILE = 2
ID_DEVICE_SN = 3
ID_DEVICE_WL = 4
ID_DEVICE_LOG = 5
ID_COM_SETTING = 6
ID_PATH_SN = 7
ID_FILE_PATH = 8
ID_PLOT_SETTING = 9
ID_LOG_SETTING = 10
ID_DEVICE_STOP = 11
ID_OPEN_SERIAL = 12
ID_PLOT_ONE = 15
ID_PLOT_SEVEN = 16
ID_PLOT_RULE = 17
ID_HELP = 21
ID_ABOUT = 22
ID_ALGORITHM = 30
class YiwinFrame( wx.Frame ):
'''将buf类传进来'''
def __init__(self, title, parent, size=(900, 750)):
self.device_id = 2
self.device_type = DeviceType.VIPER.name
self.raw_wavelength = []
self.new_wavelength = []
self.device_wavelength = []
self.device_data = []
self.output_wavelength = []
self.output_wl_ndarray = np.array([])
self.syscfg = {}
self.sensor_cfg = {}
self.retrieve = {}
self.calinfo_is_ok = False
self.title = title
self.dir :Path = Path()
self.datadir :Path = self.dir.joinpath(DATA_DIR)
self.output_dir:Path = self.datadir.joinpath(OUTPUT_DIR)
self.save_fname :Path = Path()
self.result = ''
self.displayData:list = []
self.interval = 0
self.measure_time = time.strftime("%Y-%m-%d %H:%M:%S",time.localtime())
super(YiwinFrame, self).__init__( parent, title=self.title, size = size )
self.BoxSizer = wx.BoxSizer(wx.HORIZONTAL) # 建立一个Boxsizer
self.SetSizer(self.BoxSizer)
self.Centre(wx.BOTH)
# 建立 listctrl panel 放到BoxSizer
self.listctrl_panel = Listctrl( self ) # 调用自己建立的 Listctrl panel 类
self.BoxSizer.Add( self.listctrl_panel, proportion =-10, border = 2, flag = wx.ALL | wx.EXPAND)
self.list_ctrl = self.listctrl_panel.list_ctrl
# 隐藏 等待show
self.listctrl_panel.Hide()
self.plotpanel = Plot( self ) # 调用自己建立的 Listctrl panel 类
self.BoxSizer.Add( self.plotpanel, proportion =-10, border = 0, flag = wx.ALL | wx.EXPAND)
# self.static_text = self.plotpanel.staticText1
# 隐藏 等待show
self.plotpanel.Show()
self.statusBar = self.CreateStatusBar() # 创建状态栏
self.statusBar.SetFieldsCount(2) # 状态栏分成3个区域
self.statusBar.SetStatusWidths([-1, -1]) # 区域宽度比列,用负数
self.statusBar.SetStatusText(u" 等待接收消息......", 0)
self.__set_menu() # 添加菜单
self.__attach_events() # 菜单事件
self.__set_properties()
# self.__read_config()
self.__setTimer()
log.info(f"system init....",__name__, "__init__")
self.mycfg = MyConfig()
self.__read_config()
self.ui_sn = self.syscfg['device']['UISN']
self.device_sn = ''
self.file_sn = ''
# self.interval = self.syscfg['logsetting']['LogInterval']
# self.port = self.syscfg['comsetting']['port']
self.myviper = MyViper( sn=self.syscfg['device']['UISN'] )
self.myviper.set_cfg_viper(self.syscfg)
self.mydir = MyDir()
self.mycfg.set_retrieve()
self.uart = Uart()
# self.viper = Viper()
self.dataplot = DataPlot()
self.plot_pure_water()
pub.subscribe( self.updateDisplay, "update")
pass
def __set_menu(self):
'''
# 设置菜单
'''
self.menubar = wx.MenuBar()
fileMenu = wx.Menu()
fileMenu.Append(ID_DEAL_FILE, u'&处理文件', '...')
self.menubar.Append(fileMenu, u'&文件 ')
deviceMenu = wx.Menu()
deviceMenu.Append(ID_OPEN_SERIAL, u'&打开串口', '...')
deviceMenu.AppendSeparator()
deviceMenu.Append(ID_DEVICE_SN, u'&序列号', '...')
deviceMenu.AppendSeparator()
deviceMenu.Append(ID_DEVICE_WL, u'&波长', '...')
deviceMenu.AppendSeparator()
deviceMenu.Append(ID_DEVICE_LOG, u'&采集数据', '...')
deviceMenu.AppendSeparator()
deviceMenu.Append(ID_DEVICE_STOP, u'&停止采集', '...')
self.menubar.Append(deviceMenu, u'&设备 ')
settingMenu = wx.Menu()
settingMenu.Append(ID_COM_SETTING, u'&串口设置', '...')
settingMenu.AppendSeparator()
settingMenu.Append(ID_PATH_SN, u'&光程&序列号', ' ')
settingMenu.AppendSeparator()
settingMenu.Append(ID_FILE_PATH, u'&文件路径', ' ')
settingMenu.AppendSeparator()
settingMenu.Append(ID_PLOT_SETTING, u'&绘图设置', ' ')
settingMenu.AppendSeparator()
settingMenu.Append(ID_LOG_SETTING, u'&采集设置', ' ')
settingMenu.AppendSeparator()
settingMenu.Append(ID_ALGORITHM, u'&算法配置', ' ')
self.menubar.Append(settingMenu, u'&系统设置')
plotMenu = wx.Menu()
plotMenu.Append( ID_PLOT_ONE, u'&最后一条', '...' )
plotMenu.AppendSeparator()
plotMenu.Append( ID_PLOT_SEVEN, u'&最后七条', '...' )
plotMenu.AppendSeparator()
plotMenu.Append( ID_PLOT_RULE, u'&指定七条', '...' )
self.menubar.Append(plotMenu, u'&绘图 ')
aboutMenu = wx.Menu()
aboutMenu.Append( ID_HELP, u'&帮助', 'help...' )
aboutMenu.AppendSeparator()
aboutMenu.Append( ID_ABOUT, u'&关于我们', '关于我们...' )
self.menubar.Append( aboutMenu, u'&帮助')
self.SetMenuBar(self.menubar)
pass
def __set_properties(self):
self.SetSize((800, 600))
# self.SetTitle(u'传感器数据采集--上海奕枫仪器设备有限公司')
self.Centre()
def __attach_events(self):
'''
# 绑定菜单事件
'''
self.Bind(wx.EVT_MENU, self.OnDealFile, id = ID_DEAL_FILE)
self.Bind(wx.EVT_MENU, self.OnOpenSerial, id = ID_OPEN_SERIAL)
self.Bind(wx.EVT_MENU, self.OnDeviceSN, id = ID_DEVICE_SN)
self.Bind(wx.EVT_MENU, self.OnDeviceWL, id = ID_DEVICE_WL)
self.Bind(wx.EVT_MENU, self.OnDeviceLog, id = ID_DEVICE_LOG)
self.Bind(wx.EVT_MENU, self.OnDeviceStop, id = ID_DEVICE_STOP)
self.Bind(wx.EVT_MENU, self.OnComSetting, id = ID_COM_SETTING)
self.Bind(wx.EVT_MENU, self.OnPathSNSetting, id = ID_PATH_SN)
self.Bind(wx.EVT_MENU, self.OnFilePathSetting, id = ID_FILE_PATH)
self.Bind(wx.EVT_MENU, self.OnPlotSetting, id = ID_PLOT_SETTING)
self.Bind(wx.EVT_MENU, self.OnLogSetting, id = ID_LOG_SETTING)
self.Bind(wx.EVT_MENU, self.OnAlgorithm, id = ID_ALGORITHM)
self.Bind(wx.EVT_MENU, self.OnPlotOne, id = ID_PLOT_ONE)
self.Bind(wx.EVT_MENU, self.OnPlotSeven, id = ID_PLOT_SEVEN)
self.Bind(wx.EVT_MENU, self.OnPlotRule, id = ID_PLOT_RULE)
self.Bind(wx.EVT_MENU, self.OnHelpConfig, id = ID_HELP)
self.Bind(wx.EVT_MENU, self.OnAboutConfig, id = ID_ABOUT)
pass
def __setTimer(self):
self.timer = wx.Timer(self) #创建定时器,菜单以后
self.Bind(wx.EVT_TIMER, self.OnTimer, self.timer) #绑定一个定时器事件
pass
def updateDisplay(self,msg):
log.debug(f" updateDisplay 。。 {msg['data']}")
if msg['type'] == "notice":
self.__update_notice(msg['data'])
pass
if msg['type'] == "sn":
self.__update_sn(msg['data'])
pass
if msg['type'] == "wl":
self.__update_wl(msg['data'])
pass
if msg['type'] == "log":
self.__update_log(msg['data'] )
print(f" ...log update ...{msg['data']} " )
pass
if msg['type'] == "data":
# log.info(f" ... update .{msg['data']}........... " )
self.__update_data(msg['data'])
pass
pass
def __update_sn(self,sn):
if sn != self.ui_sn:
self.alterStatus_0(f" sn: {sn} 与系统sn {self.ui_sn} 一致")
self.popDialog(f" sn: {sn} 与系统sn {self.ui_sn} 一致")
raise MyException(f" sn: {sn} 与系统sn {self.ui_sn} 一致")
else:
self.alterStatus_0(f" sn: {sn} 与系统sn {self.ui_sn} 不一致")
pass
def __update_notice(self,msg):
log.debug(f" msg : {msg}")
self.alterStatus_0(msg)
pass
def __update_wl(self,wl):
log.debug(f" 获得的波长成功 : {wl}")
self.output_wavelength = wl
self.alterStatus_0( f" 获得的波长成功 " )
pass
def __update_log(self,d):
log.info(f" 获得的数据 {d}")
self.alterStatus_0( d)
def __update_data( self, d ):
'''对于文件过来的数据'''
log.debug(f" ", __name__," __update_data")
self.plotpanel.clear_past()
self.plotpanel.plot_one(
d['time']
,np.array(self.myviper.viper.outputWavelength)
,np.array(d['data'])
)
pass
def OnStart( self, event ):
log.info( f" OnStart....interval: { self.interval } minutes, port: { self.port} " )
interval_ms = int(self.interval) * 60 * 1000
self.timer.Start( interval_ms ) # 开始监测
def OnStop( self ,event ):
self.timer.Stop()
pass
def OnTimer(self, event):
''' 定时器实现 '''
# log.info( f"OnTimer .... " )
self.__OnDeviceLog( )
pass
def __read_config(self,):
# 读取配置文件
self.syscfg = self.mycfg.read_yaml()
retrieve = self.mycfg.read_rtv_yaml()
self.syscfg.update( { "retrieve" : retrieve } )
def __read_cal_file(self,):
''' 读取 纯水文件 传参myviper '''
fpath = Path().joinpath(CAL_DIR, PURE_WATER_FNAME)
if not fpath.exists():
self.myviper.set_pure_water(PureWaterData.wavelength,PureWaterData.coeff)
else:
_,tmp_purewater_wavelength = ReadCal.read_columns_set_by_mark(
fpath, FILE_MARK, 0)
_,tmp_purewater_attenuation = ReadCal.read_columns_set_by_mark(
fpath, FILE_MARK, 1)
self.myviper.set_pure_water(tmp_purewater_wavelength[0],tmp_purewater_attenuation[0])
def __get_raw_wavelenght_from_onefile(self,fpath, sn):
''' 读取 纯水文件 传参myviper '''
sn = ReadCal.readFileSNbyIDDevice(fpath)
if sn[-4:] != self.ui_sn:
raise MyException(" 标定文件SN 与系统不一致")
_,tmp_wavelength = ReadCal.read_columns_set_by_mark(
fpath, FILE_MARK, 0)
self.raw_wavelength= tmp_wavelength[0]
self.myviper.set_raw_wavelength( self.raw_wavelength )
def OnDealFile(self, e)-> None:
self.myviper.set_mode(mode=WorkMode.FILEMODE)
self.__OnDeviceStop()
log.info( f"OnDealFile: 处理测量文件", __name__, "", "" )
## 获取待处理文件self.file_lst
fdir:Path = Path().joinpath(DATA_DIR)
self.get_data_files(fdir)
## 获取波长并传参
if self.file_lst[0] is None:
raise MyException(f"没有可以处理的文件!")
try:
self.__get_raw_wavelenght_from_onefile(self.file_lst[0],self.ui_sn)
except:
raise MyException(f"无法获取文件的波长信息!")
## 获取纯水标定文件
self.__read_cal_file()
self.alterStatus_0("成功获取波长和标定文件。")
# 线程守护
self.mt = Mythead()
# self.viper.set_cfg(self.syscfg)
try:
self.mt.set_task( self.deal_file_lst )
self.mt.start()
self.alterStatus_0(" 处理完所有文件" )
except Exception as e:
self.alterStatus_0(e )
self.popDialog( e )
pass
def get_data_files(self,fdir:Path) -> list:
fmt="*/*.DAT"
ret = []
tmp_files = fdir.glob(fmt)
for tfs in tmp_files:
if tfs.is_file():
ret.append(tfs)
self.file_lst = ret
def deal_file_lst(self, ):
for fl in self.file_lst:
ReadCal.read_columns_sets_by_mark_callback(
fl, FILE_MARK, self.myviper.deal_measure_time_data, 1)
def OnOpenSerial(self, e)-> None:
self.myviper.set_mode(mode = WorkMode.DEVICEMODE)
self.uart = Uart()
self.uart.set_serial_para(
self.myviper.viper.serailPort.port
,self.myviper.viper.serailPort.baudrate
,self.myviper.viper.serailPort.bytesize
,self.myviper.viper.serailPort.parity
,self.myviper.viper.serailPort.stopbit
)
if not self.uart.connect():
raise MyException(f" 串口不可用 ")
if self.uart.IsOpen():
self.uart.disconnect()
self.uart_thread = Multithread()
pass
def OnDeviceSN(self, e)-> None:
self.__OnDeviceStop()
log.info(f"OnDeviceSN: 获取device sn ", __name__, "", "")
self.alterStatus_0( "正在获取 SN....")
if self.myviper.viper.register is None:
raise MyException(f" 请先打开串口,再试")
self.myviper.viper.rawWavelength =None
self.uart.set_modbus(
self.myviper.viper.register.slaveaddress
,self.myviper.viper.register.functioncode
,self.myviper.viper.register.SNAddress
,self.myviper.viper.register.SNLen)
self.uart_thread.remove_tasks()
self.uart_thread.add_task( self.__device_sn, args=() )
self.uart_thread.sequently_execute_tasks()
self.myviper.viper.register.snBuf = self.res
self.myviper.get_device_sn_from_buf()
self.alterStatus_0( f" SN : {self.myviper.viper.deviceSN} ")
pass
def __device_sn(self)-> None:
self.res =b''
self.uart.disconnect()
self.uart.connect()
self.uart.write()
self.res = self.uart.OneMeasure()
def OnDeviceWL(self, e)-> None:
self.__OnDeviceStop()
log.info(f"OnDeviceWL: 获得device wavelength ... ", __name__, "", "")
self.alterStatus_0( "正在获取波长....")
if self.myviper.viper.register is None:
raise MyException(f" 请先打开串口,再试")
if not self.myviper.devicesn_ok:
raise MyException(f"设备SN {self.myviper.viper.deviceSN} 与系统SN {self.myviper.viper.SN} 不匹配")
self.uart_thread.remove_tasks()
self.res = b''
for i in range(self.myviper.viper.register.count):
log.debug(f" -> i {i}", __name__,"OnDeviceWL")
self.uart.set_modbus( self.myviper.viper.register.slaveaddress,self.myviper.viper.register.functioncode
,self.myviper.viper.register.WLBeginAddress + i*122, 122 )
log.debug(f" command -> {self.uart.command.hex()} ")
self.uart_thread.add_task( self.__device_wl, args=() )
self.uart_thread.sequently_execute_tasks()
# 处理self.res, 将self.res 返回 myviper
self.myviper.viper.register.wavelengthBuf = self.res
self.myviper.get_raw_wavelength_from_buf()
def __device_wl(self, )-> None:
self.uart.disconnect()
self.uart.connect()
self.uart.write()
tmp = self.uart.OneMeasure()
self.res = self.res + tmp[3:len(tmp)-2]
def OnDeviceLog(self, e)-> None:
self.__OnDeviceStop()
log.info( f"OnDeviceLog: 采集数据 定时器采集", __name__, "", "" )
self.alterStatus_0( "开始采集数据....")
if self.myviper.viper.register is None:
self.alterStatus_0( " 请先打开串口,再试")
raise MyException(f" 请先打开串口,再试")
if not self.myviper.devicesn_ok:
self.alterStatus_0( " 设备SN 与系统不匹配")
raise MyException(f"设备SN 与系统不匹配")
if self.myviper.viper.rawWavelength is None:
raise MyException(f"没有波长信息")
## 获取纯水标定文件
self.__read_cal_file()
self.__OnDeviceLog()
# 如何整点获取,如何快速获取
self.timer.Start( int(self.interval) * 60 * 1000 )
pass
def __OnDeviceLog(self,)-> None:
self.uart_thread.remove_tasks()
self.res = b''
for i in range(self.myviper.viper.register.count):
log.debug(f" -> i {i}", __name__,"OnDeviceWL")
self.uart.set_modbus( self.myviper.viper.register.slaveaddress,self.myviper.viper.register.functioncode
,self.myviper.viper.register.DataBeginAddress + i*122, 122 )
log.debug(f" command -> {self.uart.command.hex()} ")
self.uart_thread.add_task( self.__device_log, args=() )
self.uart_thread.sequently_execute_tasks()
# 处理self.res, 将self.res 返回 myviper
self.myviper.viper.register.intensityBuf = self.res
self.myviper.get_raw_intensity_from_buf()
def __device_log(self, )-> None:
# self.res =b''
self.uart.disconnect()
self.uart.connect()
self.uart.write()
tmp = self.uart.OneMeasure()
self.res = self.res + tmp[3:len(tmp)-2]
# def get_device_data( self,tm, data_buf ):
# if len(data_buf) != 0:
# self.device_data = self.viper.convert_buf_2_float( data_buf,8 )
# self.plotpanel.clear_past()
# self.plotpanel.plot_one(
# tm
# , self.output_wl_ndarray
# ,np.array(data_buf)
# )
# else:
# log.error( " 采集设备数据出错 " )
# raise MyException(" 采集设备数据出错 ")
# pass
def OnDeviceStop(self, e)-> None:
self.__OnDeviceStop()
pass
def __OnDeviceStop(self, )-> None:
if self.timer.IsRunning():
self.timer.Stop()
pass
def plot_pure_water(self,):
# self.dataplot.set_file_path()
self.__OnDeviceStop()
self.plotpanel.set_title_x_y( *self.plotpanel.purewater_legend )
time_ = time.strftime("%Y-%m-%d %H:%M:%S",time.localtime())
# wl = np.array(self.myviper.viper.purewaterWavelength)
# att = np.array(self.myviper.viper.purewaterAttenuation)
wl = np.array( PureWaterData.wavelength )
att = np.array( PureWaterData.coeff )
self.plotpanel.plot_one(time_, wl, att)
pass
def OnPlotOne(self,e):
self.__OnDeviceStop()
self.plotpanel.set_title_x_y( *self.plotpanel.measure_legend )
self.dataplot.set_file_path( self.output_dir.joinpath(self.ui_sn+SAVE_EXT_NAME) )
self.dataplot.set_token(TOKEN)
# !! 判断波长,获得波长
wavelength:str = self.dataplot.get_first_line().strip('\n').strip('\r')
self.output_wavelength = wavelength.split(TOKEN)[1:]
self.output_wl_ndarray = np.array(self.output_wavelength).astype(np.float64)
line = self.dataplot.get_multi_by_x_m_n(1,1,1)
line = line[0].strip('\n').strip('\r').split(TOKEN)
tm = line[0]
line = np.array(line[1:]).astype(np.float64)
self.plotpanel.axes.clear()
self.plotpanel.plot_one( tm, self.output_wl_ndarray, line )
self.alterStatus_0( f" plot {tm}")
pass
def OnPlotSeven(self,e):
self.__OnDeviceStop()
self.plotpanel.set_title_x_y( *self.plotpanel.measure_legend )
times = []
lines = []
log.debug( f'+++ ', __name__, 'OnPlotSeven' )
self.dataplot.set_file_path( self.output_dir.joinpath( self.ui_sn+SAVE_EXT_NAME ) )
self.dataplot.set_token(TOKEN)
# !! 判断波长,获得波长
wavelength:str = self.dataplot.get_first_line().strip('\n').strip('\r')
self.output_wavelength = wavelength.split(TOKEN)[1:]
self.output_wl_ndarray = np.array(self.output_wavelength).astype(np.float64)
line_7 = self.dataplot.get_multi_by_x_m_n(1,1,7)
# log.warning( f'+++ {line_7} ',__name__, 'OnPlotSeven' )
for line in line_7:
line = line.strip('\n').strip('\r').split(TOKEN)
tm = line[0]
line = np.array(line[1:]).astype(np.float64)
times.append(tm)
lines.append( line )
self.plotpanel.axes.clear()
# print(f"times =========={times}")
self.plotpanel.plot_multi( times, self.output_wl_ndarray, lines )
self.alterStatus_0( f" plot last 7 ")
pass
def OnPlotRule(self,e):
self.__OnDeviceStop()
self.plotpanel.set_title_x_y( *self.plotpanel.measure_legend )
times = []
lines = []
log.debug( f'+++ ',__name__, 'OnPlotSeven' )
self.dataplot.set_file_path( self.output_dir.joinpath( self.ui_sn+SAVE_EXT_NAME ) )
self.dataplot.set_token(TOKEN)
# !! 判断波长,获得波长
wavelength:str = self.dataplot.get_first_line().strip('\n').strip('\r')
self.output_wavelength = wavelength.split(TOKEN)[1:]
self.output_wl_ndarray = np.array(self.output_wavelength).astype(np.float64)
line_7 = self.dataplot.get_multi_by_x_m_n(self.syscfg['plotsetting']['LineBegin'],
self.syscfg['plotsetting']['LineInterval'],
7)
# print(f"++++++++++++ {len(line_7)} {len(line_7[0])} ")
# log.warning( f'+++ {line_7} ',__name__, 'OnPlotSeven' )
for line in line_7:
line = line.strip('\n').strip('\r').split(TOKEN)
# print(len(line))
# print(line)
tm = line[0]
line = np.array(line[1:]).astype(np.float64)
times.append( tm )
lines.append( line )
self.plotpanel.axes.clear()
self.plotpanel.plot_multi( times, self.output_wl_ndarray, lines )
self.alterStatus_0( f" plot designated ")
pass
def OnComSetting(self,e):
with UI_Com_Setting(
self,
-1 ) as Dialog_Sensor_Setting:
Dialog_Sensor_Setting.CenterOnParent()
resultLog = Dialog_Sensor_Setting.ShowModal()
if resultLog == wx.ID_OK:
log.info( " COM config dialog confirm, call back " )
self.__read_config()
pass
def OnPathSNSetting(self,e):
with UI_PathSN_Setting(
self,
-1 ) as Dialog_Sensor_Setting:
Dialog_Sensor_Setting.CenterOnParent()
resultLog = Dialog_Sensor_Setting.ShowModal()
if resultLog == wx.ID_OK:
log.info( " PathSN config dialog confirm, call back " )
self.__read_config()
pass
def OnFilePathSetting(self,e):
with UI_Filepath_Setting(
self,
-1 ) as Dialog_Sensor_Setting:
Dialog_Sensor_Setting.CenterOnParent()
resultLog = Dialog_Sensor_Setting.ShowModal()
if resultLog == wx.ID_OK:
log.info( " FilePath config dialog confirm, call back " )
self.__read_config()
pass
def OnPlotSetting(self,e):
with UI_Plot_Setting(
self,
-1 ) as Dialog_Sensor_Setting:
Dialog_Sensor_Setting.CenterOnParent()
resultLog = Dialog_Sensor_Setting.ShowModal()
if resultLog == wx.ID_OK:
log.info( " Plot config dialog confirm, call back " )
self.__read_config()
pass
def OnLogSetting(self,e):
with UI_Log_Setting(
self,
-1 ) as Dialog_Sensor_Setting:
Dialog_Sensor_Setting.CenterOnParent()
resultLog = Dialog_Sensor_Setting.ShowModal()
if resultLog == wx.ID_OK:
log.info( " Log config dialog confirm, call back " )
self.__read_config()
pass
def OnAlgorithm(self,e):
with UI_Algorithm(
self,
-1 ) as Dialog_Sensor_Setting:
Dialog_Sensor_Setting.CenterOnParent()
resultLog = Dialog_Sensor_Setting.ShowModal()
if resultLog == wx.ID_OK:
log.info( " Algorithm config dialog confirm, call back " )
self.__read_config()
pass
def OnHelpConfig(self, e):
with Help(
self,
-1,
"") as Dialog_Help:
resultLog = Dialog_Help.ShowModal()
if resultLog == wx.ID_OK:
log.info("Help info")
pass
def OnAboutConfig(self, e):
with About(
self,
-1,
"") as Dialog_About:
resultLog = Dialog_About.ShowModal()
if resultLog == wx.ID_OK:
log.info("Aboutus")
pass
def OnOther(self, e):
pass
def OnQuit(self, e):
self.Close()
def alterStatus_0(self,msg):
self.statusBar.SetStatusText( msg, 0 )
def popDialog(self, msg, msg_type=u"错误提示"):
with wx.MessageDialog( self, msg, msg_type, wx.OK )as dlg:
dlg.ShowModal()