Blame view

GUI/SW1/SRC/RUN_STATUS.cpp 3.21 KB
886c558b   Steve Greedy   SACAMOS Public Re...
1
2
3
4
5
6
/////////////////////////////////////////////////////////////////////////////////
//
// This file is part of SACAMOS, cable models for EMI simulations in SPICE.
// It was developed by the University of Nottingham and the Netherlands Aerospace
// Centre (NLR) for ESA under contract number 4000112765/14/NL/HK.
//
7ba34678   Steve Greedy   Update Copyright ...
7
// Copyright (C) 2015 - 2018 University of Nottingham
886c558b   Steve Greedy   SACAMOS Public Re...
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
84
85
86
//
// SACAMOS is free software: you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the Free Software
// Foundation, either version 3 of the License, or (at your option) any later
// version.
//
// SACAMOS is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
// for more details.
//
// A copy of the GNU General Public License version 3 can be found in the
// file GNU_GPL_v3 in the root or at <http://www.gnu.org/licenses/>.
//
// wxWidgets is currently licenced under the "wxWindows Library Licence".
// A copy of the wxWindows Library Licence, Version 3.1 can be found in the file
// wxWindows_Library_Licence_v3-1 in the root or at:
// <https://www.wxwidgets.org/about/licence/>
//
// The University of Nottingham can be contacted at: ggiemr@nottingham.ac.uk
//
// File Contents:
//
// NAME
//     RUN_STATUS.cpp
//
// DESCRIPTION
//     Display information contained in run_status file
//
// AUTHOR(S)
//     Steve Greedy
//
/////////////////////////////////////////////////////////////////////////////////

#include "RUN_STATUS.h"

//(*InternalHeaders(RUN_STATUS)
#include <wx/intl.h>
#include <wx/string.h>
//*)

//(*IdInit(RUN_STATUS)
const long RUN_STATUS::ID_TEXTCTRL1 = wxNewId();
//*)

BEGIN_EVENT_TABLE(RUN_STATUS,wxDialog)
	//(*EventTable(RUN_STATUS)
	//*)
END_EVENT_TABLE()

RUN_STATUS::RUN_STATUS(wxWindow* parent,wxWindowID id,const wxPoint& pos,const wxSize& size)
{
	//(*Initialize(RUN_STATUS)
	wxFlexGridSizer* FlexGridSizer1;

	Create(parent, wxID_ANY, _("SACAMOS: Run Status"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE, _T("wxID_ANY"));
	FlexGridSizer1 = new wxFlexGridSizer(0, 1, 0, 0);
	TextCtrl1 = new wxTextCtrl(this, ID_TEXTCTRL1, wxEmptyString, wxDefaultPosition, wxSize(250,150), wxTE_MULTILINE|wxTE_WORDWRAP|wxVSCROLL, wxDefaultValidator, _T("ID_TEXTCTRL1"));
	FlexGridSizer1->Add(TextCtrl1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	SetSizer(FlexGridSizer1);
	FlexGridSizer1->Fit(this);
	FlexGridSizer1->SetSizeHints(this);

	Connect(wxID_ANY,wxEVT_INIT_DIALOG,(wxObjectEventFunction)&RUN_STATUS::OnInit);
	//*)
}

RUN_STATUS::~RUN_STATUS()
{
	//(*Destroy(RUN_STATUS)
	//*)
}

void RUN_STATUS::DisplayRunStatus()
{
    wxString RunStatusFile= "run_status";
    wxString text;
    wxTextFile StatusFile;

886c558b   Steve Greedy   SACAMOS Public Re...
87
88
89
90
91
92
93
94
95
96
97
    if (StatusFile.Open(RunStatusFile))
    {
        for (int i = 0; i<int(StatusFile.GetLineCount()); i++)
        {
            text = text + StatusFile[i];

            text = text + "\n";
        }
    TextCtrl1->SetValue(text);
    }

3d24aeb1   Steve Greedy   Modification to s...
98
99
100
101
102
103
    if (!StatusFile.Open(RunStatusFile))
    {
        DisplayRunStatus();
    }

    StatusFile.Close();
886c558b   Steve Greedy   SACAMOS Public Re...
104
105
106
107
108
109
110
111
}



void RUN_STATUS::OnInit(wxInitDialogEvent& event)
{
    DisplayRunStatus();
}