-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
83 lines (65 loc) · 2.22 KB
/
main.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
72
73
74
75
76
77
78
79
80
81
82
83
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# generated by wxGlade 0.9.6 on Thu Oct 29 22:41:10 2020
#
import numpy, matplotlib
if matplotlib.__version__ < '2.2':
raise ValueError("Minimum Matplotlib version required: 2.2")
#
from matplotlib.figure import Figure
from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas
import wx
import os
from shutil import make_archive
# read from glade
import gui
# read from main solver
import mnGen
# begin wxGlade: dependencies
# end wxGlade
# begin wxGlade: extracode
# end wxGlade
class MyFrame(gui.MyFrame):
def OnChooseTargetFile(self, event): # wxGlade: MyFrame.<event_handler>
pathname = self.showFileDialog()
self.text_ctrl_1.SetValue(pathname)
def OnChooseOutputFile(self, event): # wxGlade: MyFrame.<event_handler>
pathname = self.showFileDialog()
self.text_ctrl_2.SetValue(pathname)
def showFileDialog(self):
with wx.FileDialog(self, 'Pls, select File',
style=wx.DD_DEFAULT_STYLE
| wx.DD_DIR_MUST_EXIST
| wx.DD_CHANGE_DIR
) as dialog:
if dialog.ShowModal() == wx.ID_CANCEL:
return
return dialog.GetPath()
def OnCancel(self, event): # wxGlade: MyFrame.<event_handler>
self.Destroy()
def OnExec(self, event): # wxGlade: MyFrame.<event_handler>
target_file = self.text_ctrl_1.GetValue()
#output_file = self.text_ctrl_2.GetValue()
#
#fmt = self.combo_box_1.GetValue()
#filepath = os.path.join(output_file, os.path.basename(target_file))
#print(target_file)
# Main Program
# 入出力ファイルを初期設定以外にする場合は引数 inp_path out_path を指定
obj = mnGen.MnGen(target_file)
obj.read_cntl()
obj.read_column()
obj.solve()
obj.read_calc()
# end of class MyFrame
class MyApp(wx.App):
def OnInit(self):
self.frame = MyFrame(None, wx.ID_ANY, "")
self.SetTopWindow(self.frame)
self.frame.Show()
return True
# end of class MyApp
if __name__ == "__main__":
app = MyApp(0)
app.MainLoop()