-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathM_Version.py
71 lines (55 loc) · 1.58 KB
/
M_Version.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
##############################
# import
##############################
import wx
import os
import GUI_Version
##############################
# GUI的函数桥接
##############################
class CalcFrame(GUI_Version.Main):
def __init__(self, parent):
# 定义主函数
GUI_Version.Main.__init__(self, parent)
##global
for root, dirs, files in os.walk('./DATA/Version/'):
##print(root) #当前目录路径
##print(dirs) #当前路径下所有子目录
##print(files) #当前路径下所有非目录子文件
self.Place.SetLabel('日志路径: ' + root)
self.Version_L.SetSelection(-1)
number = len(files)
for i in range(0, number):
file = files[i]
file = file[0:9]
##print(file)
self.Version_L.Append(file)
def Start(self, event):
self.Info.Enable(True)
place = './DATA/Version/' + self.Version_L.GetString(self.Version_L.GetSelection()) + '.txt'
info = open(place, 'r', encoding='utf-8')
Version = str(info.readlines(1))[-15:-6]
self.Version_T.SetLabel('版本: ' + Version)
##print(Version)
info = open(place, 'r', encoding='utf-8')
date = str(info.readlines(1))[-32:-22]
self.Date.SetLabel('日期: ' + date)
info = open(place, 'r', encoding='utf-8')
self.Info.SetValue(info.read())
def Close(self, event):
try:
if app.GetAppName() != '_core.cp38-win_amd64':
self.Destroy()
except:
self.Hide()
##############################
# 主函数
##############################
def main():
global app
app = wx.App(False)
frame = CalcFrame(None)
frame.Show(True)
app.MainLoop()
if __name__ == "__main__":
main()