Ejemplo n.º 1
0
    def __init__(self, *args, **kw):
        wx.Frame.__init__(self, *args, **kw)

        self.move_timer_handler = wx.EvtHandler()
        self.size_timer_handler = wx.EvtHandler()
        self.move_timer = wx.Timer(self.move_timer_handler)
        self.size_timer = wx.Timer(self.size_timer_handler)
        self.Bind(wx.EVT_MOVE, self.cb_move)
        self.Bind(wx.EVT_SIZE, self.cb_size)
        self.move_timer_handler.Bind(wx.EVT_TIMER, self.cb_move_timer_event)
        self.size_timer_handler.Bind(wx.EVT_TIMER, self.cb_size_timer_event)

        self.cfg_file_name = 'data/%s_window_cfg.json' % (self.GetLabel())

        cfg = self.load_config()
        if cfg is not None:
            self.cfg = cfg
        else:
            self.cfg = {
                "position": [100, 100],
                "size": [500, 300],
                "pinned": 0
            }
            self.save_config()

        self.pinned = bool(self.cfg["pinned"])
Ejemplo n.º 2
0
    def __init__(self):
        """Initialize"""
        super(MessageHandler, self).__init__()

        # Attributes
        self._prevfile = u""
        self._evthandler = wx.EvtHandler()
        self._jobtimer = wx.Timer(self._evthandler)
        self._updateeditor = None
        self.editor = None
        self.editorlineno = None
        self.contextlineno = None
        self.contextmenus = {1:(True, ID_ON_RUNTOLINE, _("Run To Line"), self.OnRunToLine), 
                             2:(True, ID_ON_JUMP, _("Jump"), self.OnJump)}
        self.debugeditorupdate = lambda x,y,z:None
        
        # Setup debugger hooks
        rpdbdebugger = RpdbDebugger() # singleton don't keep ref
        rpdbdebugger.conflictingmodules = self.ConflictingModules
        rpdbdebugger.clearstepmarker = self.ClearStepMarker
        rpdbdebugger.setstepmarker = self.SetStepMarker
        rpdbdebugger.restorestepmarker = self.RestoreStepMarker
        rpdbdebugger.catchunhandledexception = self.CatchUnhandledException
        
        # Editra Message Handlers
        ed_msg.Subscribe(self.OnFileLoad, ed_msg.EDMSG_FILE_OPENED)
        ed_msg.Subscribe(self.OnFileSave, ed_msg.EDMSG_FILE_SAVED)
        ed_msg.Subscribe(self.OnPageChanged, ed_msg.EDMSG_UI_NB_CHANGED)        
        ed_msg.Subscribe(self.OnContextMenu, ed_msg.EDMSG_UI_STC_CONTEXT_MENU)
        self._evthandler.Bind(wx.EVT_TIMER,
                              lambda evt: self.UpdateForEditor(self._updateeditor))
Ejemplo n.º 3
0
 def Create(self, parent, id, evtHandler):
     "Called to create the control, which must derive from wxControl."
     self._tc = wx.ComboBox(parent, id, "", (100, 50))
     self.SetControl(self._tc)
     # pushing a different event handler instead evtHandler:
     self._tc.PushEventHandler(wx.EvtHandler())
     self._tc.Bind(wx.EVT_COMBOBOX, self.OnChange)
Ejemplo n.º 4
0
    def __init__(self, *args, **kw):
        # ensure the parent's __init__ is called
        super(Frame, self).__init__(*args, **kw)

        #sonido
        pygame.mixer_music.load(
            "C:/Users\juand\Desktop\proyectoAutomatas\src/kiss.mp3")
        pygame.mixer.music.play(-1)
        self.encender(wx.EvtHandler())
        # create a panel in the frame
        self.pnl = wx.Panel(self, 0, pos=(0, 0), size=(1200, 745))
        self.pnl.SetBackgroundColour('WHITE')
        #self.pintura(wx.EVT_PAINT,pnl)
        pnl2 = wx.Panel(self, 0, pos=(1201, 0), size=(180, 745))
        # and create a sizer to manage the layout of child widgets
        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer2 = wx.BoxSizer(wx.VERTICAL)
        self.pnl.SetSizer(sizer)
        pnl2.SetSizer(sizer2)
        # create a menu bar
        self.makeMenuBar()
        # and a status bar
        self.CreateStatusBar()
        self.SetStatusText("Automatas!")
        #crear botonera
        self.crearBotonera(pnl2)
Ejemplo n.º 5
0
 def __init__(self, MainView):
     self.log = getLogger("%s.%s" % (constants.LOG_PREFIX, "manager"))
     self.MainView = MainView
     self.evtHandler = wx.EvtHandler()
     self.evtHandler.Bind(wx.EVT_TIMER, self.timer)
     if historyData.exists() == False:
         historyData.touch()
     self.history = historyData.read_text().split("\n")
     if len(self.history) == 1 and self.history[0] == "":
         del self.history[0]
     if favoritesData.exists() == False:
         favoritesData.touch()
     self.favorites = favoritesData.read_text().split("\n")
     if len(self.favorites) == 1 and self.favorites[0] == "":
         del self.favorites[0]
     self.myAccount = []
     for i in globalVars.app.accountManager.tokens:
         self.myAccount.append(i["user"])
     self.timers = []
     self.livePlayer = None
     self.fxPlayer = None
     self.played = False
     self.changeMenuState(False)
     if globalVars.app.config.getboolean("fx", "playStartupSound",
                                         False) == True:
         self.playFx(globalVars.app.config["fx"]["startupSound"])
     self.playStatusTimer = wx.Timer(self.evtHandler, evtPlaystatus)
     self.timers.append(self.playStatusTimer)
Ejemplo n.º 6
0
    def create(self, parent):
        """ Creates the underlying Wx object. As necessary, subclasses
        should reimplement this method to create different types of
        widgets.

        """
        self.widget = wx.EvtHandler()
Ejemplo n.º 7
0
    def setUp(self):
        self.handler = wx.EvtHandler()
        self.port = ed_ipc.EDPORT + 1
        self.key = "foo"
        self.recieved = False
        self.server = ed_ipc.EdIpcServer(self.handler, self.key, self.port)

        self.handler.Bind(ed_ipc.EVT_COMMAND_RECV, self.OnIpcMsg)
Ejemplo n.º 8
0
    def __init__(self, generator, callback, loop_callback=None):
        (self.ThreadedResultEvent,
         EVT_THREAD_RESULT) = wx.lib.newevent.NewEvent()

        self.evt_handler = wx.EvtHandler()
        self.evt_handler.Bind(EVT_THREAD_RESULT, self.OnThreadedResultEvent)

        self.generator = generator
        self.callback = callback
        self.loop_callback = loop_callback
Ejemplo n.º 9
0
def InstallSpy(window):
    #get the current event handler
    eh = window.GetEventHandler()

    #install our custom event handler at the top of the stack
    meh = wx.EvtHandler()
    #window.SetEventHandler(meh)

    meh.Bind(wx.EVT_MOUSE_EVENTS, MouseEvent)

    #push the original handler back onto the stack so everything works as expected
    window.PushEventHandler(meh)
Ejemplo n.º 10
0
	def __init__(self, MainView):
		self.MainView = MainView
		self.evtHandler = wx.EvtHandler()
		self.evtHandler.Bind(wx.EVT_TIMER, self.timer)
		if historyData.exists() == False:
			historyData.touch()
		self.history = historyData.read_text().split("\n")
		if len(self.history) == 1 and self.history[0] == "":
			del self.history[0]
		if favoritesData.exists() == False:
			favoritesData.touch()
		self.favorites = favoritesData.read_text().split("\n")
		if len(self.favorites) == 1 and self.favorites[0] == "":
			del self.favorites[0]
		self.myAccount = []
		self.myAccount.append(twitcasting.twitcasting.VerifyCredentials()["user"])
Ejemplo n.º 11
0
    def __init__(self, parent=None):

        # Basic construction stuff
        super().__init__()
        self.parent = parent
        self.settings = Settings()
        self._garbage_event_collector = 0

        instance = ModbusConnectionThreadSingleton()
        self.modbus = instance.thread_instance_get()

        # Start with connect menu
        self.conn_submenu = wx.Menu()
        self.conn_submenu_item_connect = self.conn_submenu.Append(
            -1, 'Connect...', 'Connect...')
        self.conn_submenu_item_disconnect = self.conn_submenu.Append(
            -1, 'Disconnect', 'Disconnect')
        self.conn_submenu.AppendSeparator()
        self.conn_submenu_item_quick_conn = self.conn_submenu.Append(
            -1, 'Quick Connect', 'Quick Connect')

        # TODO: Decide if this one is needed
        # self.help_menu = wx.Menu()
        # self.about = self.help_menu.Append(-1, 'About', 'About')

        self.Append(self.conn_submenu, 'Connection')
        # self.Append(self.help_menu, 'Help')

        self.dialog_window = None

        parent.Bind(wx.EVT_MENU, self.on_click_conn,
                    self.conn_submenu_item_connect)
        parent.Bind(wx.EVT_MENU, self.on_clock_dc,
                    self.conn_submenu_item_disconnect)
        parent.Bind(wx.EVT_MENU, self.on_click_quick_conn,
                    self.conn_submenu_item_quick_conn)

        # Insert a certain delay for refresh button
        self.timer = wx.Timer()
        self.timer_evt_handler = wx.EvtHandler()
        self.timer.SetOwner(self.timer_evt_handler, id=228)
        self.timer_evt_handler.Bind(wx.EVT_TIMER,
                                    self._refresh,
                                    self.timer,
                                    id=228)

        self._refresh(wx.EVT_TIMER)
Ejemplo n.º 12
0
    def __init__(self, *args, **kwds):
        wx.GenericDirCtrl.__init__(self, *args, **kwds)
        self._handler = wx.EvtHandler()
        self.PushEventHandler(self._handler)
        self._added_items = {}
        self._virtual_tree_done = {}
        self.tree = self.GetTreeCtrl()
        imglist = self.tree.GetImageList()

        folder = common.get_bitmap_for_theme('folder')
        folder_open = common.get_bitmap_for_theme('folder_open')

        if folder:
            imglist.Replace(0, folder)
        if folder_open:
            imglist.Replace(1, folder_open)
            imglist.Replace(2, folder_open)
        bmp = common.get_bitmap_for_theme('zip')
        self.zip_image = imglist.Add(bmp)
Ejemplo n.º 13
0
    def create_widget(self, parent, tree):
        """ A method which should be reimplemented by subclasses.

        This method is called by the create(...) method. It should
        create and return the underlying Wx widget. Implementations
        of this method should *not* call the superclass version.

        Parameters
        ----------
        parent : wxEvtHandler or None
            The parent Wx toolkit object for this control, or None if
            the control does not have a parent.

        tree : dict
            The dictionary representation of the tree for this object.
            This is provided in the even that the component needs to
            create a different type of widget based on the information
            in the tree.

        """
        return wx.EvtHandler()
Ejemplo n.º 14
0
    def __init__(self, parent=None):

        # Initial Create
        super().__init__(wx.HORIZONTAL)
        self.settings = Settings()
        self.choices_data = None
        self.timer = None
        self.port_index = 0
        self._garbage_evt_collector = 0
        self._some_time = 1000

        # Create COM port drop down list
        self.choicer = wx.Choice(parent=parent, size=(73, -1))

        # Handle choicer selection
        self.update_choices()
        if self.settings.device_port is not None:
            self.port_index = self.choicer.FindString(
                self.settings.device_port, False)
        if self.port_index == -1:
            self.port_index = 0
        self.choicer.SetSelection(self.port_index)

        # Assign choice callback
        parent.Bind(wx.EVT_CHOICE, self._choice_cb, self.choicer)

        # Add choicer to a sizer (which is this class itself)
        self.Add(self.choicer, 1, wx.LEFT, 0)

        # Insert a certain delay for refresh button
        self._can_be_refreshed = 1
        self.timer = wx.Timer()
        self.timer_evt_handler = wx.EvtHandler()
        self.timer.SetOwner(self.timer_evt_handler, id=228)
        self.timer_evt_handler.Bind(wx.EVT_TIMER,
                                    self._refresh,
                                    self.timer,
                                    id=228)

        self.timer.Start(self._some_time, True)
Ejemplo n.º 15
0
    def hook_events(self,
                    ui,
                    control,
                    events=None,
                    handler=None,
                    drop_target=None):
        """ Hooks all specified events for all controls in a UI so that they
            can be routed to the correct event handler.
        """
        if events is None:
            events = (wx.wxEVT_LEFT_DOWN, wx.wxEVT_LEFT_DCLICK,
                      wx.wxEVT_LEFT_UP, wx.wxEVT_MIDDLE_DOWN,
                      wx.wxEVT_MIDDLE_DCLICK, wx.wxEVT_MIDDLE_UP,
                      wx.wxEVT_RIGHT_DOWN, wx.wxEVT_RIGHT_DCLICK,
                      wx.wxEVT_RIGHT_UP, wx.wxEVT_MOTION,
                      wx.wxEVT_ENTER_WINDOW, wx.wxEVT_LEAVE_WINDOW,
                      wx.wxEVT_MOUSEWHEEL, wx.wxEVT_PAINT)
            control.SetDropTarget(
                PythonDropTarget(DragHandler(ui=ui, control=control)))
        elif events == 'keys':
            events = (wx.wxEVT_CHAR, )

        if handler is None:
            handler = ui.route_event

        id = control.GetId()
        event_handler = wx.EvtHandler()
        connect = event_handler.Connect

        for event in events:
            connect(id, id, event, handler)

        control.PushEventHandler(event_handler)

        for child in control.GetChildren():
            self.hook_events(ui, child, events, handler, drop_target)
Ejemplo n.º 16
0
#-*- coding:utf-8 -*-
import wx

if evt_handler == None:
		evt_handler = wx.EvtHandler()
Ejemplo n.º 17
0
    def __init__(self, document):
        """
        Create the MainFrame
        """
        self.document = document
        self.findDialog = None
        self.openDialogs = []
        self.lastClickedTool = None
        self.egEvent = None
        self.lastFocus = None

        wx.Frame.__init__(self,
                          None,
                          -1,
                          document.GetTitle(),
                          pos=Config.position,
                          size=(1, 1),
                          style=self.style)
        self.SetMinSize((400, 200))
        document.frame = self
        auiManager = wx.aui.AuiManager(self, wx.aui.AUI_MGR_DEFAULT)
        self.auiManager = auiManager

        self.logCtrl = self.CreateLogCtrl()
        self.corConst = self.logCtrl.GetWindowBorderSize()[0] + \
            wx.SystemSettings.GetMetric(wx.SYS_VSCROLL_X)
        self.treeCtrl = self.CreateTreeCtrl()
        self.toolBar = self.CreateToolBar()
        self.menuBar = self.CreateMenuBar()
        self.statusBar = StatusBar(self)
        self.SetStatusBar(self.statusBar)

        # tree popup menu
        self.popupMenu = self.CreateTreePopupMenu()

        iconBundle = wx.IconBundle()
        iconBundle.AddIcon(eg.taskBarIcon.stateIcons[0])
        icon = wx.EmptyIcon()
        icon.LoadFile(join(eg.imagesDir, "icon32x32.png"), wx.BITMAP_TYPE_PNG)
        iconBundle.AddIcon(icon)
        self.SetIcons(iconBundle)

        self.Bind(wx.EVT_ICONIZE, self.OnIconize)
        self.Bind(wx.EVT_MENU_OPEN, self.OnMenuOpen)
        self.Bind(wx.EVT_CLOSE, self.OnClose)
        self.mainSizeFlag = True
        self.ratioLock = False
        self.ratio = Config.ratio
        self.Bind(wx.EVT_SIZE, self.OnSize)
        self.Bind(wx.EVT_MOVE, self.OnMove)
        self.Bind(wx.aui.EVT_AUI_PANE_CLOSE, self.OnPaneClose)
        self.Bind(wx.aui.EVT_AUI_PANE_MAXIMIZE, self.OnPaneMaximize)
        self.Bind(wx.aui.EVT_AUI_PANE_RESTORE, self.OnPaneRestore)
        self.UpdateViewOptions()
        self.SetSize(Config.size)
        eg.Bind("DocumentFileChange", self.OnDocumentFileChange)
        eg.Bind("DocumentChange", self.OnDocumentChange)
        eg.Bind("DialogCreate", self.OnAddDialog)
        eg.Bind("DialogDestroy", self.OnRemoveDialog)
        eg.Bind("UndoChange", self.OnUndoChange)
        self.OnUndoChange(document.undoState)
        eg.Bind("SelectionChange", self.OnSelectionChange)
        if document.selection is not None:
            self.OnSelectionChange(document.selection)
        eg.Bind("FocusChange", self.OnFocusChange)
        self.OnFocusChange(self.treeCtrl)
        eg.Bind("ClipboardChange", self.OnClipboardChange)
        # tell FrameManager to manage this frame
        if (Config.perspective is not None):
            try:
                auiManager.LoadPerspective(Config.perspective, False)
            except:
                pass
        artProvider = auiManager.GetArtProvider()
        artProvider.SetMetric(wx.aui.AUI_DOCKART_PANE_BORDER_SIZE, 0)
        artProvider.SetMetric(wx.aui.AUI_DOCKART_GRADIENT_TYPE,
                              wx.aui.AUI_GRADIENT_HORIZONTAL)
        artProvider.SetColour(wx.aui.AUI_DOCKART_INACTIVE_CAPTION_COLOUR,
                              eg.colour.inactiveCaption)
        artProvider.SetColour(
            wx.aui.AUI_DOCKART_INACTIVE_CAPTION_GRADIENT_COLOUR,
            eg.colour.inactiveCaptionGradient)
        artProvider.SetColour(wx.aui.AUI_DOCKART_INACTIVE_CAPTION_TEXT_COLOUR,
                              eg.colour.inactiveCaptionTextColour)
        auiManager.GetPane("tree").Caption(" " + Text.Tree.caption)
        self.toolBar.Show(Config.showToolbar)
        auiManager.Update()
        auiManager.GetPane("logger").MinSize((100, 100))\
            .Caption(" " + Text.Logger.caption)

        # create an accelerator for the "Log only assigned and activated
        # events" checkbox. An awful hack.
        @eg.LogIt
        def ToggleOnlyLogAssigned(dummyEvent):
            checkBox = self.statusBar.checkBox
            flag = not checkBox.GetValue()
            checkBox.SetValue(flag)
            eg.config.onlyLogAssigned = flag
            self.statusBar.SetCheckBoxColour(flag)

        toggleOnlyLogAssignedId = wx.NewId()
        wx.EvtHandler().Bind(wx.EVT_MENU,
                             ToggleOnlyLogAssigned,
                             id=toggleOnlyLogAssignedId)

        # find the accelerator key in the label of the checkbox
        labelText = eg.text.MainFrame.onlyLogAssigned
        result = re.search(r'&([a-z])', labelText, re.IGNORECASE)
        if result:
            hotKey = result.groups()[0].upper()
        else:
            hotKey = "L"

        # create an accelerator for the "Del" key. This way we can temporarily
        # disable it while editing a tree label.
        # (see TreeCtrl.py OnBeginLabelEdit and OnEndLabelEdit)

        def OnDelKey(dummyEvent):
            self.DispatchCommand('OnCmdDelete')

        delId = wx.NewId()
        wx.EvtHandler().Bind(wx.EVT_MENU, OnDelKey, id=delId)

        def OnEnterKey(dummyEvent):
            if self.lastFocus == self.treeCtrl.editControl:
                self.treeCtrl.EndEditLabel(self.treeCtrl.editLabelId, False)

        enterId = wx.NewId()
        wx.EvtHandler().Bind(wx.EVT_MENU, OnEnterKey, id=enterId)

        self.acceleratorTable = wx.AcceleratorTable([
            (wx.ACCEL_NORMAL, wx.WXK_DELETE, delId),
            (wx.ACCEL_NORMAL, wx.WXK_RETURN, enterId),
            (wx.ACCEL_ALT, ord(hotKey), toggleOnlyLogAssignedId),
        ])
        self.SetAcceleratorTable(self.acceleratorTable)
        self.logCtrl.Bind(wx.EVT_SIZE, self.OnLogCtrlSize)
        eg.EnsureVisible(self)
Ejemplo n.º 18
0
def hook_grid_button_column(grid,
                            col,
                            bitmap_dictionary,
                            bevel_width=2,
                            hook_events=True):
    """Attach hooks to a grid to make a column display grid buttons
    
    grid - the grid in question
    col  - the index of the column to modify
    bitmap_dictionary - a dictionary of bitmaps suitable for GridButtonRenderer
    """
    renderer = GridButtonRenderer(bitmap_dictionary, bevel_width)
    ui_dictionary = {"selected_row": None}
    event_handler = wx.EvtHandler()
    width = 0
    for bitmap in bitmap_dictionary.values():
        width = max(bitmap.Width, width)
    width += bevel_width * 2
    grid.SetColSize(col, width)

    def on_left_down(event):
        x = event.GetX()
        y = event.GetY()
        coords = grid.XYToCell(x, y)
        if coords and coords.Col == col:
            row = coords.Row
            if renderer.get_state(grid, row, col) == BU_NORMAL:
                ui_dictionary["selected_row"] = row
                renderer.set_cell_state(grid, row, col, BU_PRESSED)
                grid.GridWindow.CaptureMouse()
                event.Skip()
        else:
            if event_handler.NextHandler:
                event_handler.NextHandler.ProcessEvent(event)

    def on_mouse_move(event):
        if (ui_dictionary["selected_row"] is not None
                and grid.GridWindow.HasCapture()):
            x = event.GetX()
            y = event.GetY()
            coords = grid.XYToCell(x, y)
            row = ui_dictionary["selected_row"]
            selection_state = BU_NORMAL
            if coords and coords.Col == col and coords.Row == row:
                selection_state = BU_PRESSED
            if renderer.get_state(grid, row, col) != selection_state:
                renderer.set_cell_state(grid, row, col, selection_state)
        if event_handler.NextHandler:
            event_handler.NextHandler.ProcessEvent(event)

    def on_capture_lost(event):
        if ui_dictionary["selected_row"] is not None:
            renderer.set_cell_state(grid, ui_dictionary["selected_row"], col,
                                    BU_NORMAL)
            ui_dictionary["selected_row"] = None
        else:
            if event_handler.NextHandler:
                event_handler.NextHandler.ProcessEvent(event)

    def on_left_up(event):
        if (ui_dictionary["selected_row"] is not None
                and grid.GridWindow.HasCapture()):
            row = ui_dictionary["selected_row"]
            if renderer.get_state(grid, row, col) == BU_PRESSED:
                renderer.set_cell_state(grid, row, col, BU_NORMAL)
                grid.AddPendingEvent(GridButtonClickedEvent(grid, row, col))
            ui_dictionary["selected_row"] = None
            grid.GridWindow.ReleaseMouse()
            event.Skip()
        else:
            if event_handler.NextHandler:
                event_handler.NextHandler.ProcessEvent(event)

    col_attr = wx.grid.GridCellAttr()
    col_attr.SetReadOnly(True)
    col_attr.SetRenderer(renderer)
    grid.SetColAttr(col, col_attr)
    if hook_events:
        grid.GridWindow.PushEventHandler(event_handler)
        event_handler.Bind(wx.EVT_LEFT_DOWN, on_left_down, grid.GridWindow)
        event_handler.Bind(wx.EVT_LEFT_UP, on_left_up, grid.GridWindow)
        event_handler.Bind(wx.EVT_MOTION, on_mouse_move, grid.GridWindow)
        event_handler.Bind(wx.EVT_MOUSE_CAPTURE_LOST, on_capture_lost,
                           grid.GridWindow)
    return renderer, width
Ejemplo n.º 19
0
 def on_button(e=None):
     random.choice(threads).q.put(wx.EvtHandler())
Ejemplo n.º 20
0
    def __init__(self, parent=None):
        super().__init__(parent=parent)
        self.conn_blink_state = 0
        self.settings = Settings()
        self.app_data = AppData()
        self.sizer = wx.BoxSizer(wx.HORIZONTAL)
        self._output_garbage_collector = 0
        self.act_indicator_wrapper = wx.BoxSizer(wx.VERTICAL)
        self.slave_id_sequence_wrapper = wx.BoxSizer(wx.VERTICAL)

        # Create display matrix for Relays
        self.output_matrix = InputArray(
            parent=self,
            title='Outputs state:',
            dimension=(1, 8),
            col_titles=['K1', 'K2', 'K3', 'K4', 'K5', 'K6', 'K7', 'K8'],
            interface=DISPLAY_INTERFACE,
            secret_ids=[1, 2, 3, 4, 5, 6, 7, 8],
            is_input_indication=False)
        self.output_matrix_wrapper = wx.BoxSizer(wx.VERTICAL)
        self.output_matrix_wrapper.Add(self.output_matrix, 0,
                                       wx.RIGHT | wx.ALIGN_RIGHT, 18)

        # Assign instance of modbus singleton, to have access to its props
        instance = ModbusConnectionThreadSingleton()
        self.modbus = instance.thread_instance_get()

        # Create an activity Led
        self.act_label = wx.StaticText(parent=self, label='Activity')
        self.activity_led = InputArray(parent=self,
                                       dimension=(1, 1),
                                       is_conn=True,
                                       interface=DISPLAY_INTERFACE,
                                       outlined=False)

        # Create Slave id sequence
        self.slave_id_label = wx.StaticText(parent=self, label='Slave ID')
        self.slave_id_control = wx.SpinCtrl(parent=self,
                                            size=(60, -1),
                                            style=wx.TE_LEFT,
                                            max=999)

        # Wrap indicator
        act_label_wrapper = wx.BoxSizer(wx.HORIZONTAL)
        led_activity_wrapper = wx.BoxSizer(wx.HORIZONTAL)
        act_label_wrapper.Add(self.act_label, 1, wx.LEFT, 8)
        led_activity_wrapper.Add(self.activity_led, 1, wx.LEFT, 21)
        self.act_indicator_wrapper.Add(act_label_wrapper, 2, wx.TOP, 12)
        self.act_indicator_wrapper.Add(led_activity_wrapper, 2, wx.TOP, 14)

        # Wrap slave id
        slave_id_label_wrapper = wx.BoxSizer(wx.HORIZONTAL)
        slave_id_control_wrapper = wx.BoxSizer(wx.HORIZONTAL)
        slave_id_label_wrapper.Add(self.slave_id_label, 1, wx.LEFT, 3)
        slave_id_control_wrapper.Add(self.slave_id_control, 1, wx.LEFT, 8)
        self.slave_id_sequence_wrapper.Add(slave_id_label_wrapper, 3, wx.TOP,
                                           18)
        self.slave_id_sequence_wrapper.Add(slave_id_control_wrapper, 2, wx.TOP,
                                           4)

        # Bind events
        self.Bind(wx.EVT_SPINCTRL, self.slave_id_update, self.slave_id_control)
        self.app_data.iface_output_handler_register(self._slave_id_update)

        # Assemble panel sizer
        self.sizer.Add(self.act_indicator_wrapper, 1,
                       wx.LEFT | wx.ALIGN_CENTER_VERTICAL, 20)
        self.sizer.Add(self.slave_id_sequence_wrapper, 1,
                       wx.LEFT | wx.ALIGN_CENTER_VERTICAL, 20)
        self.sizer.Add(self.output_matrix_wrapper, 6, wx.EXPAND, 0)

        # Apply panel sizer
        self.SetSizer(self.sizer)

        # Register handler to update output state
        self.app_data.iface_output_handler_register(
            self._output_indication_update)

        # Insert a certain delay for refresh button
        self.timer = wx.Timer()
        self.timer_evt_handler = wx.EvtHandler()
        self.timer.SetOwner(self.timer_evt_handler, id=228)
        self.timer_evt_handler.Bind(wx.EVT_TIMER,
                                    self._refresh_conn_activity,
                                    self.timer,
                                    id=228)

        self.timer.Start(100, True)