示例#1
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.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.tools = ToolsProperty()  # incl. the Edit button

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

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

        if not self.parent:
            PreviewMixin.__init__(self)  # add a preview button
            self._is_toplevel = True
        else:
            self.preview = None
            self._is_toplevel = False
示例#2
0
文件: toolbar.py 项目: italomaia/spe
 def create_properties(self):
     EditBase.create_properties(self)
     page = self._common_panel
     sizer = page.GetSizer()
     self.properties['bitmapsize'].display(page)
     self.properties['margins'].display(page)
     self.properties['packing'].display(page)
     self.properties['separation'].display(page)
     self.properties['style'].display(page)
     self.properties['tools'].display(page)
     if not sizer:
         sizer = wx.BoxSizer(wx.VERTICAL)
         sizer.Add(self.name_prop.panel, 0, wx.EXPAND)
         sizer.Add(self.klass_prop.panel, 0, wx.EXPAND)
         page.SetAutoLayout(1)
         page.SetSizer(sizer)
     sizer.Add(self.properties['bitmapsize'].panel, 0, wx.EXPAND)
     sizer.Add(self.properties['margins'].panel, 0, wx.EXPAND)
     sizer.Add(self.properties['packing'].panel, 0, wx.EXPAND)
     sizer.Add(self.properties['separation'].panel, 0, wx.EXPAND)
     sizer.Add(self.properties['style'].panel, 0, wx.EXPAND)
     sizer.Add(self.properties['tools'].panel, 0, wx.ALL | wx.EXPAND, 3)
     sizer.Layout()
     sizer.Fit(page)
     w, h = page.GetClientSize()
     self.notebook.AddPage(page, _("Common"))
     if self.parent is not None:
         self.property_window.Layout()
         page.SetScrollbars(1, 5, 1, int(math.ceil(h / 5.0)))
     else:
         PreviewMixin.create_properties(self)
示例#3
0
    def __init__(self, name, klass, parent):
        if parent.IS_ROOT:
            self.__dict__["IS_TOPLEVEL"] = True
        if self.IS_TOPLEVEL:
            custom_class = True
            pos = None
        else:
            custom_class = False
            pos = "_toolbar"
        EditBase.__init__(self, name, 'wxToolBar', parent, custom_class, pos)
        EditStylesMixin.__init__(self)

        # initialise instance properties
        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.tools = ToolsProperty()  # incl. the Edit button

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

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

        if self.IS_TOPLEVEL:
            PreviewMixin.__init__(self)  # add a preview button
        else:
            self.preview = None
示例#4
0
 def create_properties(self):
     EditBase.create_properties(self)
     page = self._common_panel
     sizer = page.GetSizer()
     self.properties['bitmapsize'].display(page)
     self.properties['margins'].display(page)
     self.properties['packing'].display(page)
     self.properties['separation'].display(page)
     self.properties['style'].display(page)
     self.properties['tools'].display(page)
     if not sizer:
         sizer = wx.BoxSizer(wx.VERTICAL)
         sizer.Add(self.name_prop.panel, 0, wx.EXPAND)
         sizer.Add(self.klass_prop.panel, 0, wx.EXPAND)
         page.SetAutoLayout(1)
         page.SetSizer(sizer)
     sizer.Add(self.properties['bitmapsize'].panel, 0, wx.EXPAND)
     sizer.Add(self.properties['margins'].panel, 0, wx.EXPAND)
     sizer.Add(self.properties['packing'].panel, 0, wx.EXPAND)
     sizer.Add(self.properties['separation'].panel, 0, wx.EXPAND)
     sizer.Add(self.properties['style'].panel, 0, wx.EXPAND)
     sizer.Add(self.properties['tools'].panel, 0, wx.ALL|wx.EXPAND, 3)
     sizer.Layout()
     sizer.Fit(page)
     w, h = page.GetClientSize()
     self.notebook.AddPage(page, _("Common"))
     if self.parent is not None:
         self.property_window.Layout()
         page.SetScrollbars(1, 5, 1, int(math.ceil(h/5.0)))
     else:
         PreviewMixin.create_properties(self)
示例#5
0
    def __init__(self, name, parent, class_):
        EditBase.__init__(self, name, parent, None, class_)

        self.menus = MenuProperty()
        self.window_id = None  # just a dummy for code generation

        self._mb = None  # the real menubar

        PreviewMixin.__init__(self)  # add a preview button
示例#6
0
    def __init__(self, name, klass, parent):
        custom_class = parent is None
        EditBase.__init__(self, name, klass, parent, wx.NewId(), custom_class=custom_class)
        self.properties["base"].set('wxMenuBar')

        self.menus = MenuProperty()
        self._mb = None  # the real menubar
        if not self.parent:
            PreviewMixin.__init__(self)  # add a preview button
        else:
            self.preview = None
示例#7
0
    def __init__(self, name, klass, parent, property_window):
        custom_class = parent is None
        EditBase.__init__(self, name, klass,
                          parent, wx.NewId(), property_window,
                          custom_class=custom_class, show=False)
        self.base = 'wx.ToolBar'
        
        def nil(*args): return ()
        self.tools = [] # list of Tool objects
        self._tb = None # the real toolbar
        self.style = 0
        self.access_functions['style'] = (self.get_style, self.set_style)
        self.style_pos  = [wx.TB_FLAT, wx.TB_DOCKABLE, wx.TB_3DBUTTONS]
        if misc.check_wx_version(2, 3, 3):
            self.style_pos += [wx.TB_TEXT, wx.TB_NOICONS, wx.TB_NODIVIDER,
                               wx.TB_NOALIGN]
        if misc.check_wx_version(2, 5, 0):
            self.style_pos += [wx.TB_HORZ_LAYOUT, wx.TB_HORZ_TEXT]
 
        style_labels = ['#section#' + _('Style'), 'wxTB_FLAT', 'wxTB_DOCKABLE',
                        'wxTB_3DBUTTONS']
        if misc.check_wx_version(2, 3, 3):
            style_labels += ['wxTB_TEXT', 'wxTB_NOICONS',
                             'wxTB_NODIVIDER', 'wxTB_NOALIGN']
        if misc.check_wx_version(2, 5, 0):
            style_labels += ['wxTB_HORZ_LAYOUT', 'wxTB_HORZ_TEXT']
        self.properties['style'] = CheckListProperty(self, 'style', None,
                                                     style_labels)
        self.bitmapsize = '16, 15'
        self.access_functions['bitmapsize'] = (self.get_bitmapsize,
                                               self.set_bitmapsize)
        self.properties['bitmapsize'] = TextProperty(self, 'bitmapsize', None,
                                                     can_disable=True, label=_("bitmapsize"))
        self.margins = '0, 0'
        self.access_functions['margins'] = (self.get_margins, self.set_margins)
        self.properties['margins'] = TextProperty(self, 'margins', None,
                                                  can_disable=True, label=_("margins"))
        self.access_functions['tools'] = (self.get_tools, self.set_tools)
        prop = self.properties['tools'] = ToolsProperty(self, 'tools', None)
        self.packing = 1
        self.access_functions['packing'] = (self.get_packing, self.set_packing)
        self.properties['packing'] = SpinProperty(self, 'packing', None,
                                                  r=(0, 100), can_disable=True, label=_("packing"))
        self.separation = 5
        self.access_functions['separation'] = (self.get_separation,
                                               self.set_separation)
        self.properties['separation'] = SpinProperty(
            self, 'separation', None, r=(0, 100), can_disable=True, label=_("separation"))
        # 2003-05-07 preview support
        PreviewMixin.__init__(self)
    def __init__(self, name, klass, parent):
        custom_class = parent is None
        EditBase.__init__(self, name, klass, parent, wx.NewId(), custom_class=custom_class)
        self.base = 'wxMenuBar'

        self.menus = MenuProperty()
        self.window_id = None  # just a dummy for code generation

        self._mb = None  # the real menubar
        if not self.parent:
            PreviewMixin.__init__(self)  # add a preview button
            self._is_toplevel = True
        else:
            self.preview = None
            self._is_toplevel = False
示例#9
0
    def __init__(self, name, klass, parent, property_window):
        custom_class = parent is None
        EditBase.__init__(self, name, klass,
                          parent, wx.NewId(), property_window,
                          custom_class=custom_class, show=False)
        self.base = 'wxMenuBar'
        
        def nil(*args): return ()
        self.menus = [] # list of MenuTree objects
        self._mb = None # the real menubar
        self.access_functions['menus'] = (self.get_menus, self.set_menus)
        prop = self.properties['menus'] = MenuProperty(self, 'menus', None) 
##         self.node = Tree.Node(self)
##         common.app_tree.add(self.node, parent.node)
        PreviewMixin.__init__(self)
示例#10
0
    def __init__(self, name, klass, parent):
        if parent.IS_ROOT:
            self.__dict__["IS_TOPLEVEL"] = True
        if self.IS_TOPLEVEL:
            custom_class = True
            pos = None
        else:
            custom_class = False
            pos = "_menubar"
        EditBase.__init__(self, name, klass, parent, custom_class, pos)

        self.menus = MenuProperty()
        self.window_id = None  # just a dummy for code generation

        self._mb = None  # the real menubar
        if self.IS_TOPLEVEL:
            PreviewMixin.__init__(self)  # add a preview button
        else:
            self.preview = None
示例#11
0
 def create_properties(self):
     EditBase.create_properties(self)
     page = self._common_panel
     sizer = page.GetSizer()
     self.properties['menus'].display(page)
     if not sizer:
         sizer = wx.BoxSizer(wx.VERTICAL)
         sizer.Add(self.name_prop.panel, 0, wx.EXPAND)
         sizer.Add(self.klass_prop.panel, 0, wx.EXPAND)
         page.SetAutoLayout(1)
         page.SetSizer(sizer)
     sizer.Add(self.properties['menus'].panel, 0, wx.ALL|wx.EXPAND, 3)
     sizer.Fit(page)
     page.SetSize(self.notebook.GetClientSize())
     sizer.Layout()
     self.notebook.AddPage(page, _("Common"))
     if self.parent is not None:
         self.property_window.Layout()
     else:
         PreviewMixin.create_properties(self)
示例#12
0
 def __init__(self, name, parent, klass):
     EditBase.__init__( self, name, parent, None, klass )
     EditStylesMixin.__init__(self)
     self._init_properties()
     PreviewMixin.__init__(self)  # add a preview button
示例#13
0
文件: toolbar.py 项目: italomaia/spe
    def __init__(self, name, klass, parent, property_window):
        custom_class = parent is None
        EditBase.__init__(self,
                          name,
                          klass,
                          parent,
                          wx.NewId(),
                          property_window,
                          custom_class=custom_class,
                          show=False)
        self.base = 'wx.ToolBar'

        def nil(*args):
            return ()

        self.tools = []  # list of Tool objects
        self._tb = None  # the real toolbar
        self.style = 0
        self.access_functions['style'] = (self.get_style, self.set_style)
        self.style_pos = [wx.TB_FLAT, wx.TB_DOCKABLE, wx.TB_3DBUTTONS]
        if misc.check_wx_version(2, 3, 3):
            self.style_pos += [
                wx.TB_TEXT, wx.TB_NOICONS, wx.TB_NODIVIDER, wx.TB_NOALIGN
            ]
        if misc.check_wx_version(2, 5, 0):
            self.style_pos += [wx.TB_HORZ_LAYOUT, wx.TB_HORZ_TEXT]

        style_labels = [
            '#section#' + _('Style'), 'wxTB_FLAT', 'wxTB_DOCKABLE',
            'wxTB_3DBUTTONS'
        ]
        if misc.check_wx_version(2, 3, 3):
            style_labels += [
                'wxTB_TEXT', 'wxTB_NOICONS', 'wxTB_NODIVIDER', 'wxTB_NOALIGN'
            ]
        if misc.check_wx_version(2, 5, 0):
            style_labels += ['wxTB_HORZ_LAYOUT', 'wxTB_HORZ_TEXT']
        self.properties['style'] = CheckListProperty(self, 'style', None,
                                                     style_labels)
        self.bitmapsize = '16, 15'
        self.access_functions['bitmapsize'] = (self.get_bitmapsize,
                                               self.set_bitmapsize)
        self.properties['bitmapsize'] = TextProperty(self,
                                                     'bitmapsize',
                                                     None,
                                                     can_disable=True,
                                                     label=_("bitmapsize"))
        self.margins = '0, 0'
        self.access_functions['margins'] = (self.get_margins, self.set_margins)
        self.properties['margins'] = TextProperty(self,
                                                  'margins',
                                                  None,
                                                  can_disable=True,
                                                  label=_("margins"))
        self.access_functions['tools'] = (self.get_tools, self.set_tools)
        prop = self.properties['tools'] = ToolsProperty(self, 'tools', None)
        self.packing = 1
        self.access_functions['packing'] = (self.get_packing, self.set_packing)
        self.properties['packing'] = SpinProperty(self,
                                                  'packing',
                                                  None,
                                                  r=(0, 100),
                                                  can_disable=True,
                                                  label=_("packing"))
        self.separation = 5
        self.access_functions['separation'] = (self.get_separation,
                                               self.set_separation)
        self.properties['separation'] = SpinProperty(self,
                                                     'separation',
                                                     None,
                                                     r=(0, 100),
                                                     can_disable=True,
                                                     label=_("separation"))
        # 2003-05-07 preview support
        PreviewMixin.__init__(self)