Пример #1
0
    def __init__(self, *args, **kwds):

        # Create instance of the CDMPanel class.
        kwdsnew = copy.copy(kwds)
        kwdsnew[
            'style'] = wx.SIMPLE_BORDER | wx.TAB_TRAVERSAL  # Set the style of this RowPanel class
        cdml.CDMPanel.__init__(
            self, is_row=True, *args,
            **kwdsnew)  # Second argument should be 'True' always

        # Create variables using State class and initialize those variables
        # using initial values defined in State Class
        self.record = cdml.GetInstanceAttr(DB.State)

        # create controls
        self.btn_del = cdml.Button(
            self, wx.ID_DELETE, "x")  # Second argument should be wx.ID_DELETE
        self.st_status = wx.StaticText(self, -1, "")

        # Create controls to enter/display the variables in State object
        # For controls include text area set wx.TE_NOHIDESEL always.
        # This style need for the Find function
        self.tc_name = cdml.Text(self, -1, "", style=wx.TE_NOHIDESEL)
        self.cb_isSplit = cdml.Checkbox(self, -1, "")
        self.cb_isEvent = cdml.Checkbox(self, -1, "")
        self.cb_isTerminal = cdml.Checkbox(self, -1, "")
        self.cc_joiner_split = cdml.Combo(self,
                                          -1,
                                          validator=cdml.KeyValidator(
                                              cdml.NO_EDIT))
        self.tc_notes = cdml.Text(self,
                                  -1,
                                  "",
                                  style=wx.TE_MULTILINE | wx.TE_NOHIDESEL)
        self.lc_states = cdml.List(self,
                                   -1,
                                   style=wx.LC_REPORT | wx.SUNKEN_BORDER)
        self.cc_states = cdml.Combo(self,
                                    -1,
                                    validator=cdml.KeyValidator(cdml.NO_EDIT))

        arrow_up = cdml.getSmallUpArrowBitmap()  # arrow bitmap for buttons
        arrow_dn = cdml.getSmallDnArrowBitmap()

        # add buttons for child States
        self.btn_add_state = cdml.BitmapButton(self, -1, arrow_up)
        self.btn_del_state = cdml.BitmapButton(self, -1, arrow_dn)

        self.__set_properties()
        self.__do_layout()

        # Opening another instance of the form is currently disabled since
        # recursive opening of this form and updating a parent form according
        # to a modification performed with a child is not supported. However,
        # doing this from the list box is ok since the record is saved and
        # changing the data is not possible in the child form
        # self.cc_states.GetTextCtrl().Bind(wx.EVT_LEFT_DCLICK, self.OnLeftDblClick)
        self.lc_states.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.OnLeftDblClick)