pcs-modbus-ui/FaultView.py
2020-02-19 14:30:17 -08:00

253 lines
13 KiB
Python

# -*- coding: UTF-8 -*-
#
# generated by wxGlade 0.9.5 on Tue Feb 18 18:22:15 2020
#
import wx
import wx.grid
import wx.propgrid
# begin wxGlade: dependencies
import gettext
# end wxGlade
# begin wxGlade: extracode
# end wxGlade
class FaultFrame(wx.Frame):
def __init__(self, *args, **kwds):
# begin wxGlade: FaultFrame.__init__
kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_FRAME_STYLE
wx.Frame.__init__(self, *args, **kwds)
self.SetSize((1099, 729))
self.input_ip = wx.TextCtrl(self, wx.ID_ANY, _("192.168.1.21"))
self.input_port = wx.TextCtrl(self, wx.ID_ANY, _("502"))
self.input_uid = wx.TextCtrl(self, wx.ID_ANY, _("240"))
self.input_refresh = wx.TextCtrl(self, wx.ID_ANY, _("2000"))
self.reset_button = wx.Button(self, wx.ID_ANY, _("Reset Connection"))
self.apply_button = wx.Button(self, wx.ID_ANY, _("Apply"))
self.rreset_button = wx.Button(self, wx.ID_ANY, _("Remote PCS Reset"))
self.button_1 = wx.ToggleButton(self, wx.ID_ANY, _("Start"))
self.op_mode_button = wx.Button(self, wx.ID_ANY, _("System OP Mode"))
self.text_op_mode = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_READONLY)
self.text_ctrl_system_status = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_MULTILINE | wx.TE_READONLY)
self.text_ctrl_ac1_status = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_MULTILINE | wx.TE_READONLY)
self.text_ctrl_dc2_status = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_MULTILINE | wx.TE_READONLY)
self.text_ctrl_dc3_status = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_MULTILINE | wx.TE_READONLY)
self.fault_grid = wx.grid.Grid(self, wx.ID_ANY, size=(1, 1))
self.text_fault_doc = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_MULTILINE | wx.TE_READONLY)
self.text_fault_status = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_MULTILINE | wx.TE_READONLY)
self.panel_1 = wx.Panel(self, wx.ID_ANY)
self.button_2 = wx.Button(self.panel_1, wx.ID_ANY, _("Start"))
self.button_3 = wx.Button(self.panel_1, wx.ID_ANY, _("Stop"))
self.choice_ac1_control = wx.Choice(self.panel_1, wx.ID_ANY, choices=[_("IDLE"), _("NET"), _("GPWR"), _("FPWR")])
self.text_ctrl_ac1_realpwr = wx.TextCtrl(self.panel_1, wx.ID_ANY, _("0"))
self.text_ctrl_ac1_reactpwr = wx.TextCtrl(self.panel_1, wx.ID_ANY, _("0"))
self.choice_dc2_control = wx.Choice(self.panel_1, wx.ID_ANY, choices=[_("IDLE"), _("NET"), _("PV/MPPT"), _("CURR"), _("PWR"), _("VOLT")])
self.text_ctrl_dc2_current = wx.TextCtrl(self.panel_1, wx.ID_ANY, _("0"))
self.text_ctrl_dc2_power = wx.TextCtrl(self.panel_1, wx.ID_ANY, _("0"))
self.text_ctrl_dc2_voltage = wx.TextCtrl(self.panel_1, wx.ID_ANY, _("0"))
self.text_ctrl_7 = wx.TextCtrl(self.panel_1, wx.ID_ANY, "")
self.text_ctrl_8 = wx.TextCtrl(self.panel_1, wx.ID_ANY, "")
self.button_4 = wx.Button(self.panel_1, wx.ID_ANY, _("Enable Precharge"))
self.button_5 = wx.Button(self.panel_1, wx.ID_ANY, _("Disable Precharge"))
self.choice_dc3_control = wx.Choice(self.panel_1, wx.ID_ANY, choices=[_("IDLE"), _("NET"), _("PV/MPPT"), _("CURR"), _("PWR"), _("VOLT")])
self.text_ctrl_dc3_current = wx.TextCtrl(self.panel_1, wx.ID_ANY, _("0"))
self.text_ctrl_dc3_power = wx.TextCtrl(self.panel_1, wx.ID_ANY, _("0"))
self.text_ctrl_dc3_voltage = wx.TextCtrl(self.panel_1, wx.ID_ANY, _("0"))
self.property_grid_1 = wx.propgrid.PropertyGridManager(self, wx.ID_ANY, style=wx.propgrid.PG_DESCRIPTION | wx.propgrid.PG_TOOLBAR)
self.__set_properties()
self.__do_layout()
self.Bind(wx.EVT_BUTTON, self.OnReset, self.reset_button)
self.Bind(wx.EVT_BUTTON, self.OnApply, self.apply_button)
self.Bind(wx.EVT_BUTTON, self.OnButtonRemoteReset, self.rreset_button)
self.Bind(wx.EVT_TOGGLEBUTTON, self.ToggleMonitoring, self.button_1)
self.Bind(wx.EVT_BUTTON, self.OnCheckSysOpMode, self.op_mode_button)
self.Bind(wx.grid.EVT_GRID_CMD_CELL_LEFT_CLICK, self.OnFaultSelect, self.fault_grid)
self.Bind(wx.EVT_BUTTON, self.OnOpStart, self.button_2)
self.Bind(wx.EVT_BUTTON, self.OnOpStop, self.button_3)
# end wxGlade
def __set_properties(self):
# begin wxGlade: FaultFrame.__set_properties
self.SetTitle(_("PCS Controller"))
self.rreset_button.Enable(False)
self.button_1.Enable(False)
self.fault_grid.CreateGrid(8, 8)
self.fault_grid.SetRowLabelSize(30)
self.fault_grid.SetColLabelSize(30)
self.fault_grid.EnableEditing(0)
self.fault_grid.EnableDragColSize(0)
self.fault_grid.EnableDragRowSize(0)
self.fault_grid.EnableDragGridSize(0)
self.fault_grid.SetColSize(0, 30)
self.fault_grid.SetColSize(1, 30)
self.fault_grid.SetColSize(2, 30)
self.fault_grid.SetColSize(3, 30)
self.fault_grid.SetColSize(4, 30)
self.fault_grid.SetColSize(5, 30)
self.fault_grid.SetColSize(6, 30)
self.fault_grid.SetColSize(7, 30)
self.fault_grid.SetRowSize(0, 30)
self.fault_grid.SetRowSize(1, 30)
self.fault_grid.SetRowSize(2, 30)
self.fault_grid.SetRowSize(3, 30)
self.fault_grid.SetRowSize(4, 30)
self.fault_grid.SetRowSize(5, 30)
self.fault_grid.SetRowSize(6, 30)
self.fault_grid.SetRowSize(7, 30)
self.fault_grid.SetMinSize((270, 270))
self.choice_ac1_control.SetSelection(0)
self.choice_dc2_control.SetSelection(0)
self.choice_dc3_control.SetSelection(0)
# end wxGlade
def __do_layout(self):
# begin wxGlade: FaultFrame.__do_layout
sizer_1 = wx.BoxSizer(wx.HORIZONTAL)
sizer_2 = wx.BoxSizer(wx.VERTICAL)
sizer_11 = wx.StaticBoxSizer(wx.StaticBox(self.panel_1, wx.ID_ANY, _("DC3 Port")), wx.HORIZONTAL)
grid_sizer_2 = wx.GridSizer(4, 2, 0, 0)
sizer_10 = wx.StaticBoxSizer(wx.StaticBox(self.panel_1, wx.ID_ANY, _("DC2 Port")), wx.HORIZONTAL)
grid_sizer_1 = wx.GridSizer(7, 2, 0, 0)
sizer_9 = wx.StaticBoxSizer(wx.StaticBox(self.panel_1, wx.ID_ANY, _("AC1 Port")), wx.HORIZONTAL)
grid_sizer_3 = wx.GridSizer(3, 2, 0, 0)
sizer_5 = wx.StaticBoxSizer(wx.StaticBox(self.panel_1, wx.ID_ANY, _("Manual Mode Control")), wx.HORIZONTAL)
sizer_3 = wx.BoxSizer(wx.VERTICAL)
sizer_7 = wx.BoxSizer(wx.VERTICAL)
sizer_8 = wx.BoxSizer(wx.VERTICAL)
sizer_4 = wx.GridSizer(7, 2, 0, 0)
label_1 = wx.StaticText(self, wx.ID_ANY, _("IP Address"))
sizer_4.Add(label_1, 0, 0, 0)
sizer_4.Add(self.input_ip, 0, 0, 0)
label_2 = wx.StaticText(self, wx.ID_ANY, _("Port"))
sizer_4.Add(label_2, 0, 0, 0)
sizer_4.Add(self.input_port, 0, 0, 0)
label_3 = wx.StaticText(self, wx.ID_ANY, _("Unit ID"))
sizer_4.Add(label_3, 0, 0, 0)
sizer_4.Add(self.input_uid, 0, 0, 0)
label_4 = wx.StaticText(self, wx.ID_ANY, _("Refresh Period (ms)"))
sizer_4.Add(label_4, 0, 0, 0)
sizer_4.Add(self.input_refresh, 0, 0, 0)
sizer_4.Add(self.reset_button, 0, 0, 0)
sizer_4.Add(self.apply_button, 0, 0, 0)
sizer_4.Add(self.rreset_button, 0, 0, 0)
sizer_4.Add(self.button_1, 0, 0, 0)
sizer_4.Add(self.op_mode_button, 0, 0, 0)
sizer_4.Add(self.text_op_mode, 0, 0, 0)
sizer_7.Add(sizer_4, 0, wx.EXPAND, 0)
label_21 = wx.StaticText(self, wx.ID_ANY, _("System Status"))
sizer_8.Add(label_21, 0, 0, 0)
sizer_8.Add(self.text_ctrl_system_status, 1, wx.EXPAND, 0)
label_22 = wx.StaticText(self, wx.ID_ANY, _("AC1 Status"))
sizer_8.Add(label_22, 0, 0, 0)
sizer_8.Add(self.text_ctrl_ac1_status, 1, wx.EXPAND, 0)
label_23 = wx.StaticText(self, wx.ID_ANY, _("DC2 Statu"))
sizer_8.Add(label_23, 0, 0, 0)
sizer_8.Add(self.text_ctrl_dc2_status, 1, wx.EXPAND, 0)
label_24 = wx.StaticText(self, wx.ID_ANY, _("DC3 Status"))
sizer_8.Add(label_24, 0, 0, 0)
sizer_8.Add(self.text_ctrl_dc3_status, 1, wx.EXPAND, 0)
sizer_7.Add(sizer_8, 1, wx.EXPAND, 0)
sizer_1.Add(sizer_7, 1, wx.EXPAND, 0)
sizer_3.Add(self.fault_grid, 0, wx.ALIGN_CENTER, 0)
label_25 = wx.StaticText(self, wx.ID_ANY, _("Fault Info (Documented)"))
sizer_3.Add(label_25, 0, 0, 0)
sizer_3.Add(self.text_fault_doc, 1, wx.EXPAND, 0)
label_26 = wx.StaticText(self, wx.ID_ANY, _("Fault Status"))
sizer_3.Add(label_26, 0, 0, 0)
sizer_3.Add(self.text_fault_status, 1, wx.EXPAND, 0)
sizer_1.Add(sizer_3, 1, wx.EXPAND, 0)
sizer_5.Add(self.button_2, 0, 0, 0)
sizer_5.Add(self.button_3, 0, 0, 0)
sizer_2.Add(sizer_5, 0, 0, 0)
label_8 = wx.StaticText(self.panel_1, wx.ID_ANY, _("Control Method"))
grid_sizer_3.Add(label_8, 0, 0, 0)
grid_sizer_3.Add(self.choice_ac1_control, 0, 0, 0)
label_11 = wx.StaticText(self.panel_1, wx.ID_ANY, _("Real Power Setpoint"))
grid_sizer_3.Add(label_11, 0, 0, 0)
grid_sizer_3.Add(self.text_ctrl_ac1_realpwr, 0, 0, 0)
label_12 = wx.StaticText(self.panel_1, wx.ID_ANY, _("Reactive Power Setpoint"))
grid_sizer_3.Add(label_12, 0, 0, 0)
grid_sizer_3.Add(self.text_ctrl_ac1_reactpwr, 0, 0, 0)
sizer_9.Add(grid_sizer_3, 1, wx.EXPAND, 0)
sizer_2.Add(sizer_9, 1, wx.EXPAND, 0)
label_9 = wx.StaticText(self.panel_1, wx.ID_ANY, _("Contol Method"))
grid_sizer_1.Add(label_9, 0, 0, 0)
grid_sizer_1.Add(self.choice_dc2_control, 0, 0, 0)
label_19 = wx.StaticText(self.panel_1, wx.ID_ANY, _("Current Setpoint"))
grid_sizer_1.Add(label_19, 0, 0, 0)
grid_sizer_1.Add(self.text_ctrl_dc2_current, 0, 0, 0)
label_13 = wx.StaticText(self.panel_1, wx.ID_ANY, _("Power Setpoint"))
grid_sizer_1.Add(label_13, 0, 0, 0)
grid_sizer_1.Add(self.text_ctrl_dc2_power, 0, 0, 0)
label_14 = wx.StaticText(self.panel_1, wx.ID_ANY, _("Voltage Setpoint"))
grid_sizer_1.Add(label_14, 0, 0, 0)
grid_sizer_1.Add(self.text_ctrl_dc2_voltage, 0, 0, 0)
label_17 = wx.StaticText(self.panel_1, wx.ID_ANY, _("Precharge Limit Low"))
grid_sizer_1.Add(label_17, 0, 0, 0)
label_18 = wx.StaticText(self.panel_1, wx.ID_ANY, _("Precharge Limit High"))
grid_sizer_1.Add(label_18, 0, 0, 0)
grid_sizer_1.Add(self.text_ctrl_7, 0, 0, 0)
grid_sizer_1.Add(self.text_ctrl_8, 0, 0, 0)
grid_sizer_1.Add(self.button_4, 0, 0, 0)
grid_sizer_1.Add(self.button_5, 0, 0, 0)
sizer_10.Add(grid_sizer_1, 1, wx.EXPAND, 0)
sizer_2.Add(sizer_10, 1, wx.EXPAND, 0)
label_10 = wx.StaticText(self.panel_1, wx.ID_ANY, _("Control Method"))
grid_sizer_2.Add(label_10, 0, 0, 0)
grid_sizer_2.Add(self.choice_dc3_control, 0, 0, 0)
label_20 = wx.StaticText(self.panel_1, wx.ID_ANY, _("Current Setpoint"))
grid_sizer_2.Add(label_20, 0, 0, 0)
grid_sizer_2.Add(self.text_ctrl_dc3_current, 0, 0, 0)
label_15 = wx.StaticText(self.panel_1, wx.ID_ANY, _("Power Setpoint"))
grid_sizer_2.Add(label_15, 0, 0, 0)
grid_sizer_2.Add(self.text_ctrl_dc3_power, 0, 0, 0)
label_16 = wx.StaticText(self.panel_1, wx.ID_ANY, _("Voltage Setpoint"))
grid_sizer_2.Add(label_16, 0, 0, 0)
grid_sizer_2.Add(self.text_ctrl_dc3_voltage, 0, 0, 0)
sizer_11.Add(grid_sizer_2, 1, wx.ALL | wx.EXPAND, 1)
sizer_2.Add(sizer_11, 1, wx.EXPAND, 0)
self.panel_1.SetSizer(sizer_2)
sizer_1.Add(self.panel_1, 1, wx.EXPAND, 0)
sizer_1.Add(self.property_grid_1, 1, wx.EXPAND, 0)
self.SetSizer(sizer_1)
self.Layout()
# end wxGlade
def OnReset(self, event): # wxGlade: FaultFrame.<event_handler>
print("Event handler 'OnReset' not implemented!")
event.Skip()
def OnApply(self, event): # wxGlade: FaultFrame.<event_handler>
print("Event handler 'OnApply' not implemented!")
event.Skip()
def OnButtonRemoteReset(self, event): # wxGlade: FaultFrame.<event_handler>
print("Event handler 'OnButtonRemoteReset' not implemented!")
event.Skip()
def ToggleMonitoring(self, event): # wxGlade: FaultFrame.<event_handler>
print("Event handler 'ToggleMonitoring' not implemented!")
event.Skip()
def OnCheckSysOpMode(self, event): # wxGlade: FaultFrame.<event_handler>
print("Event handler 'OnCheckSysOpMode' not implemented!")
event.Skip()
def OnFaultSelect(self, event): # wxGlade: FaultFrame.<event_handler>
print("Event handler 'OnFaultSelect' not implemented!")
event.Skip()
def OnOpStart(self, event): # wxGlade: FaultFrame.<event_handler>
print("Event handler 'OnOpStart' not implemented!")
event.Skip()
def OnOpStop(self, event): # wxGlade: FaultFrame.<event_handler>
print("Event handler 'OnOpStop' not implemented!")
event.Skip()
# end of class FaultFrame