Esempio n. 1
0
    def __init__(self, name, parent, pos):
        "Class to handle wxGrid objects"
        ManagedBase.__init__(self, name, 'wxGrid', parent, pos)

        # instance properties
        self.create_grid = np.CheckBoxProperty(True)
        columns = [['A', -1], ['B', -1], ['C', -1]]
        self.columns = GridColsProperty([])
        rows =  [[str(n),-1] for n in range(10)]
        self.rows = GridRowsProperty( rows )
        self.properties["rows_number"] = self.properties["rows"]  # backward compatibility
        #self.rows_number        = np.SpinProperty(10, immediate=True)
        self.row_label_size     = np.SpinPropertyD(30, default_value=30, immediate=True)
        self.col_label_size     = np.SpinPropertyD(30, default_value=30, immediate=True)

        self.lines_color        = np.ColorPropertyD('#000000', default_value='#000000')
        self.label_bg_color     = np.ColorPropertyD('#C0C0C0', default_value='#C0C0C0')

        self.enable_editing     = np.CheckBoxProperty(True)
        self.enable_grid_lines  = np.CheckBoxProperty(True)
        self.enable_col_resize  = np.CheckBoxProperty(True)
        self.enable_row_resize  = np.CheckBoxProperty(True)
        self.enable_grid_resize = np.CheckBoxProperty(True)

        self.selection_mode = np.RadioProperty(0, [0,1,2], ["Cells","Rows","Columns"], aliases=self._SELECTION_MODES,
                                               columns=3)
Esempio n. 2
0
    def _init_properties(self):
        self.tools = ToolsProperty()  # incl. the Edit button
        self.bitmapsize = np.IntPairPropertyD('16, 15', default_value='16, 15')
        self.margins    = np.IntPairPropertyD('0, 0',   default_value='0, 0')
        self.packing    = np.SpinPropertyD(1, val_range=(0,100), default_value=1, immediate=True)
        self.separation = np.SpinPropertyD(5, val_range=(0,100), default_value=5, immediate=True)

        self.window_id = None  # just a dummy for code generation

        self.widget = self._tb = None  # a panel and the actual ToolBar
Esempio n. 3
0
    def __init__(self, name, parent, id, win_1, win_2, orientation, sizer,
                 pos):
        ManagedBase.__init__(self, name, 'wxSplitterWindow', parent, id, sizer,
                             pos)
        EditStylesMixin.__init__(self)

        # initialise instance properties
        self.no_custom_class = np.CheckBoxProperty(False, default_value=False)
        self.sash_pos = np.SpinPropertyD(0, default_value="")
        if hasattr(wx, "SpinCtrlDouble"):
            self.sash_gravity = np.SpinDoublePropertyD(0.5, (0.0, 1.0),
                                                       default_value=0.0,
                                                       immediate=True)
        else:
            self.sash_gravity = np.FloatPropertyD(0.5, (0.0, 1.0),
                                                  default_value=0.0)
        self.min_pane_size = np.SpinProperty(20)

        # hidden properties: orientation string, window_1, window_2
        self.orientation = np.Property(orientation)
        self.window_1 = ChildWidgetNameProperty("_window_1")
        self.window_2 = ChildWidgetNameProperty("_window_2")

        self.virtual_sizer = SplitterWindowSizer(self)
        labels = ("SLOT Left",
                  "SLOT Right") if orientation == "wxSPLIT_VERTICAL" else (
                      "SLOT Top", "SLOT Bottom")
        self._window_1 = win_1 or SizerSlot(
            self, self.virtual_sizer, 1, label=labels[0])
        self._window_2 = win_2 or SizerSlot(
            self, self.virtual_sizer, 2, label=labels[1])
Esempio n. 4
0
    def __init__(self, name, parent, id, style, win_1, win_2, orientation,
                 sizer, pos):
        ManagedBase.__init__(self, name, 'wxSplitterWindow', parent, id, sizer,
                             pos)
        EditStylesMixin.__init__(self)

        # initialise instance properties
        self.no_custom_class = np.CheckBoxProperty(False, default_value=False)
        self.sash_pos = np.SpinPropertyD(0, default_value=0)
        self.min_pane_size = np.SpinProperty(20)

        # hidden properties: orientation string, window_1, window_2
        self.orientation = np.Property(orientation)
        self.window_1 = ChildWidgetNameProperty("_window_1")
        self.window_2 = ChildWidgetNameProperty("_window_2")

        self.virtual_sizer = SplitterWindowSizer(self)
        labels = ("SLOT Left",
                  "SLOT Right") if orientation == "wxSPLIT_VERTICAL" else (
                      "SLOT Top", "SLOT Bottom")
        self._window_1 = win_1 or SizerSlot(self, self.virtual_sizer, 1,
                                            labels[0])
        self._window_2 = win_2 or SizerSlot(self, self.virtual_sizer, 2,
                                            labels[1])

        if style: self.properties["style"].set(style)
Esempio n. 5
0
    def __init__(self, name, parent, index, label):
        ManagedBase.__init__(self, name, parent, index)
        EditStylesMixin.__init__(self)

        # initialise instance properties
        self.label     = np.TextProperty(label, multiline="grow")
        self.attribute = np.CheckBoxProperty(False, default_value=False)
        self.wrap      = np.SpinPropertyD(100, val_range=(1,100000), immediate=True, default_value=-1)
Esempio n. 6
0
    def __init__(self, name, klass, parent):
        custom_class = parent is None
        EditBase.__init__( self, name, 'wxToolBar', parent, wx.NewId(), custom_class=custom_class )
        EditStylesMixin.__init__(self)

        # initialise instance properties
        self.bitmapsize = np.ScrollRatePropertyD('16, 15', default_value='16, 15')
        self.margins    = np.ScrollRatePropertyD('0, 0',   default_value='0, 0')
        self.packing    = np.SpinPropertyD(1, val_range=(0,100), default_value=1, immediate=True)
        self.separation = np.SpinPropertyD(5, val_range=(0,100), default_value=5, immediate=True)
        self.tools = ToolsProperty()  # the Edit button

        self.pwidget = self.widget = None  # a panel and the actual ToolBar

        if not self.parent:
            PreviewMixin.__init__(self)  # add a preview button
        else:
            self.preview = None
Esempio n. 7
0
    def __init__(self, name, parent, pos):
        # initialize base classes
        ManagedBase.__init__(self, name, 'wxSearchCtrl', parent, pos)
        EditStylesMixin.__init__(self)

        # initialize instance properties
        self.value = np.TextProperty("")
        self.descriptive_text = np.TextPropertyD("Search", default_value="")
        self.search_button = np.CheckBoxProperty(True, default_value=True)
        self.cancel_button = np.CheckBoxProperty(True, default_value=True)
        self.max_length = np.SpinPropertyD(80, val_range=(1,1000), default_value=-1)
Esempio n. 8
0
    def __init__(self, name, parent, orientation, pos, create_slots=True):
        ManagedBase.__init__(self, name, 'wxSplitterWindow', parent, pos)
        EditStylesMixin.__init__(self)

        # initialise instance properties
        self.no_custom_class = np.CheckBoxProperty(False, default_value=False)
        self.sash_pos = np.SpinPropertyD(0, default_value="")
        if hasattr(wx, "SpinCtrlDouble"):
            self.sash_gravity = np.SpinDoublePropertyD(0.5, (0.0,1.0), default_value=0.0, immediate=True)
        else:
            self.sash_gravity = np.FloatPropertyD(0.5, (0.0,1.0), default_value=0.0)
        self.min_pane_size = np.SpinPropertyA(20)

        # hidden properties: orientation string, window names window_1, window_2
        self.orientation = np.Property(orientation)
        self.window_1 = ChildWidgetNameProperty(0)
        self.window_2 = ChildWidgetNameProperty(1)
        self._window_old = None