bms-can-ui/BmsView.py
2020-08-06 14:39:10 -07:00

124 lines
4.9 KiB
Python

#!/usr/bin/env python
# -*- coding: UTF-8 -*-
#
# generated by wxGlade 0.9.6 on Thu Aug 6 14:36:04 2020
#
import wx
import wx.grid
import wx.propgrid
# begin wxGlade: dependencies
import gettext
# end wxGlade
# begin wxGlade: extracode
# end wxGlade
class BmsMonitorFrame(wx.Frame):
def __init__(self, *args, **kwds):
# begin wxGlade: BmsMonitorFrame.__init__
kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_FRAME_STYLE
wx.Frame.__init__(self, *args, **kwds)
self.SetSize((831, 774))
self.button_1 = wx.ToggleButton(self, wx.ID_ANY, _("Start"))
self.choice_2 = wx.Choice(self, wx.ID_ANY, choices=[_("choice 1")])
self.choice_1 = wx.Choice(self, wx.ID_ANY, choices=[_("0x02"), _("0x03"), _("0x04"), _("0x05"), _("0x06"), _("0x07"), _("0x08"), _("0x09")])
self.property_grid_1 = wx.propgrid.PropertyGridManager(self, wx.ID_ANY, style=wx.propgrid.PG_AUTO_SORT | wx.propgrid.PG_DESCRIPTION | wx.propgrid.PG_TOOLBAR)
self.spin_ctrl_1 = wx.SpinCtrl(self, wx.ID_ANY, "0", min=0, max=27)
self.combo_box_1 = wx.ComboBox(self, wx.ID_ANY, choices=[], style=wx.CB_DROPDOWN)
self.grid_1 = wx.grid.Grid(self, wx.ID_ANY, size=(1, 1))
self.grid_2 = wx.grid.Grid(self, wx.ID_ANY, size=(1, 1))
self.__set_properties()
self.__do_layout()
self.Bind(wx.EVT_TOGGLEBUTTON, self.OnToggle, self.button_1)
# end wxGlade
def __set_properties(self):
# begin wxGlade: BmsMonitorFrame.__set_properties
self.SetTitle(_("BMS Monitor"))
_icon = wx.NullIcon
_icon.CopyFromBitmap(wx.Bitmap("C:\\Users\\ignis\\PycharmProjects\\bms-can-ui\\res\\repurpose-energy-ci-icon.ico", wx.BITMAP_TYPE_ANY))
self.SetIcon(_icon)
self.choice_2.SetSelection(0)
self.choice_1.SetSelection(0)
self.grid_1.CreateGrid(12, 3)
self.grid_1.SetColLabelValue(0, _("Voltage"))
self.grid_1.SetColLabelValue(1, _("Temperature"))
self.grid_1.SetColLabelValue(2, _("Balancing"))
self.grid_1.SetRowLabelValue(0, _("Cell 1"))
self.grid_1.SetRowLabelValue(1, _("Cell 2"))
self.grid_1.SetRowLabelValue(2, _("Cell 3"))
self.grid_1.SetRowLabelValue(3, _("Cell 4"))
self.grid_1.SetRowLabelValue(4, _("Cell 5"))
self.grid_1.SetRowLabelValue(5, _("Cell 6"))
self.grid_1.SetRowLabelValue(6, _("Cell 7"))
self.grid_1.SetRowLabelValue(7, _("Cell 8"))
self.grid_1.SetRowLabelValue(8, _("Cell 9"))
self.grid_1.SetRowLabelValue(9, _("Cell 10"))
self.grid_1.SetRowLabelValue(10, _("Cell 11"))
self.grid_1.SetRowLabelValue(11, _("Cell 12"))
self.grid_2.CreateGrid(16, 3)
self.grid_2.SetColLabelValue(0, _("Warning1"))
self.grid_2.SetColLabelValue(1, _("Warning2"))
self.grid_2.SetColLabelValue(2, _("Fault"))
# end wxGlade
def __do_layout(self):
# begin wxGlade: BmsMonitorFrame.__do_layout
sizer_1 = wx.BoxSizer(wx.HORIZONTAL)
sizer_4 = wx.BoxSizer(wx.VERTICAL)
sizer_5 = wx.BoxSizer(wx.HORIZONTAL)
sizer_3 = wx.BoxSizer(wx.VERTICAL)
sizer_2 = wx.BoxSizer(wx.HORIZONTAL)
sizer_2.Add(self.button_1, 0, 0, 0)
sizer_2.Add((20, 20), 0, 0, 0)
label_1 = wx.StaticText(self, wx.ID_ANY, _("CAN Device"))
sizer_2.Add(label_1, 0, 0, 0)
sizer_2.Add((10, 20), 0, 0, 0)
sizer_2.Add(self.choice_2, 0, 0, 0)
sizer_2.Add((20, 20), 0, 0, 0)
label_2 = wx.StaticText(self, wx.ID_ANY, _("Master BMS ID"))
sizer_2.Add(label_2, 0, 0, 0)
sizer_2.Add((10, 20), 0, 0, 0)
sizer_2.Add(self.choice_1, 0, 0, 0)
sizer_3.Add(sizer_2, 0, wx.EXPAND, 0)
sizer_3.Add(self.property_grid_1, 1, wx.EXPAND, 0)
sizer_1.Add(sizer_3, 1, wx.EXPAND, 0)
label_3 = wx.StaticText(self, wx.ID_ANY, _("Module Number: "))
sizer_5.Add(label_3, 0, 0, 0)
sizer_5.Add(self.spin_ctrl_1, 0, 0, 0)
sizer_5.Add(self.combo_box_1, 0, 0, 0)
sizer_4.Add(sizer_5, 0, wx.EXPAND, 0)
sizer_4.Add(self.grid_1, 1, wx.EXPAND, 0)
static_line_1 = wx.StaticLine(self, wx.ID_ANY)
sizer_4.Add(static_line_1, 0, wx.EXPAND, 0)
sizer_4.Add(self.grid_2, 1, wx.EXPAND, 0)
sizer_1.Add(sizer_4, 1, wx.EXPAND, 0)
self.SetSizer(sizer_1)
self.Layout()
# end wxGlade
def OnToggle(self, event): # wxGlade: BmsMonitorFrame.<event_handler>
print("Event handler 'OnToggle' not implemented!")
event.Skip()
# end of class BmsMonitorFrame
class BmsApp(wx.App):
def OnInit(self):
self.frame = BmsMonitorFrame(None, wx.ID_ANY, "")
self.SetTopWindow(self.frame)
self.frame.Show()
return True
# end of class BmsApp
if __name__ == "__main__":
gettext.install("app") # replace with the appropriate catalog name
app = BmsApp(0)
app.MainLoop()