Esempio n. 1
0
    def __init__(self, parent):
        """ Create the panel. This is called only when the program opens """
        GridPanel.__init__(self, parent)

        self.house = parent.house

        cols = [("Macro Name", 200), ("Description", 400), ("State", 150)]

        self.macro_list = controls.ObjectListCtrl(
            parent=self, id=wx.ID_ANY, style=wx.LC_REPORT | wx.LC_HRULES | wx.SUNKEN_BORDER, size=(-1, -1), cols=cols
        )

        self._addRow([self.macro_list], 0, vProp=1)

        self.addMacro = wx.Button(self, wx.ID_ANY, "Add Macro")

        self._addRow([self.addMacro], prePad=True)
        self.vBox.AddSpacer((-1, 15))

        # Set the panel sizer
        self.SetSizer(self.vBox)

        self.macro_list.Bind(wx.EVT_CONTEXT_MENU, self._call_macro_menu)
        self.macro_list.Bind(wx.EVT_LEFT_DCLICK, self._edit_macro)
        self.Bind(wx.EVT_BUTTON, self._add_macro, self.addMacro)
Esempio n. 2
0
 def __init__(self, parent):
     """ Create the panel. This is called only when the program opens """
     GridPanel.__init__(self, parent)
     
     self.house = parent.house
     
     roomLabel = wx.StaticText(self, wx.ID_ANY, 'Select Room')
     self.roomSelect = wx.ComboBox(self, wx.ID_ANY, style=wx.CB_READONLY, 
                                   choices=self.house.get_rooms())
     self.roomSelect.SetSelection(0)
     self._addRow([roomLabel, self.roomSelect], 1)
     
     cols = [('Device Name',200),('Room',200),('Address',150),('State',150)]
     
     self.device_list = controls.ObjectListCtrl(parent=self, id=wx.ID_ANY, 
                      style=wx.LC_REPORT | wx.LC_HRULES | wx.SUNKEN_BORDER,
                      size=(-1,-1), cols=cols)
                                                         
     self._addRow([self.device_list],0,vProp=1)
     
     self.addDevice = wx.Button(self, wx.ID_ANY, 'Add Device')
             
     self._addRow([self.addDevice], prePad=True)
     self.vBox.AddSpacer((-1,15))
     
     #ComboBox bindings
     self.Bind(wx.EVT_COMBOBOX, self._change_room, self.roomSelect)
     
     #Set the panel sizer
     self.SetSizer(self.vBox)
     
     self.device_list.Bind(wx.EVT_CONTEXT_MENU, self._call_device_menu)
     self.device_list.Bind(wx.EVT_LEFT_DCLICK, self._edit_device)
     self.Bind(wx.EVT_BUTTON, self._add_device, self.addDevice)
Esempio n. 3
0
 def __init__(self, parent):
     """ Create the panel. This is called only when the program opens """
     GridPanel.__init__(self, parent)
             
     txtColor = (255,255,255)
     backColor = (0,0,0)
     
     self.log_data = []
     
     self.log_queue = self.parent.parent.log_queue
     
     self.log = wx.TextCtrl(self, -1, style=wx.TE_MULTILINE|wx.TE_READONLY)
     font = wx.Font(9, wx.FONTFAMILY_TELETYPE, wx.FONTWEIGHT_NORMAL, 
                    wx.FONTSTYLE_NORMAL)
     self.log.SetFont(font)
     self.log.SetBackgroundColour(backColor)
     self.log.SetForegroundColour(txtColor)
     
     self.saveLog = wx.Button(self, wx.ID_ANY, 'Save Log')
     
     #Event log Box
     hBox = wx.BoxSizer(wx.HORIZONTAL)
     hBox.Add(self.log,1,wx.EXPAND)
     self.vBox.Add(hBox, 1, wx.LEFT|wx.RIGHT|wx.TOP|wx.EXPAND, 10)
     
     hBox = wx.BoxSizer(wx.HORIZONTAL)
     hBox.Add(self.saveLog,0)
     self.vBox.Add(hBox, 0, wx.ALL|wx.ALIGN_RIGHT, 10)
     
     self.SetSizer(self.vBox)
     
     text = '[%s] Started pyHome' % time.strftime("%Y-%m-%d %H:%M:%S")
     self.add_to_log(text)
    
     self.Bind(wx.EVT_BUTTON, self._save_log, self.saveLog)
Esempio n. 4
0
 def __init__(self, parent):
     """ Create the panel. This is called only when the program opens """
     GridPanel.__init__(self, parent)
     self.SetBackgroundStyle(wx.BG_STYLE_CUSTOM)
     self.devices = self.parent.parent.devices
     
     self._map = {}
     
     #Set the panel sizer
     self.SetSizer(self.vBox)
     self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground)
     self.Bind(wx.EVT_MOTION, self.mouseMove)
     self.Bind(wx.EVT_RIGHT_DOWN, self._process_right_click)
     self.update()