示例#1
0
    def __init__(self, name, parent, id, label, sizer, pos, property_window,
                 show=True):
        """\
        Class to handle wxStaticText objects
        """
        import config
        ManagedBase.__init__(self, name, 'wxStaticText', parent, id, sizer,
                             pos, property_window, show=show)
        self.label = label
        self.style = 0
        self.attribute = True

        self.access_functions['label'] = (self.get_label, self.set_label)
        self.access_functions['style'] = (self.get_style, self.set_style)
        def set_attribute(v): self.attribute = int(v)
        self.access_functions['attribute'] = (lambda : self.attribute,
                                              set_attribute)

        self.properties['label'] = TextProperty(self, 'label', None,
                                                multiline=True, label=_('label'))
        self.style_pos  = (wx.ALIGN_LEFT, wx.ALIGN_RIGHT, wx.ALIGN_CENTRE,
                           wx.ST_NO_AUTORESIZE)
        style_labels = ('#section#' + _('Style'), 'wxALIGN_LEFT', 'wxALIGN_RIGHT',
                        'wxALIGN_CENTRE', 'wxST_NO_AUTORESIZE')
        self.properties['style'] = CheckListProperty(self, 'style', None,
                                                     style_labels)
        self.properties['attribute'] = CheckBoxProperty(
            self, 'attribute', None, _('Store as attribute'), write_always=True)
        # 2003-09-04 added default_border
        if config.preferences.default_border:
            self.border = config.preferences.default_border_size
            self.flag = wx.ALL
示例#2
0
 def __init__(self, name, parent, id, sizer, pos, property_window,
              show=True, style=wx.TR_HAS_BUTTONS|wx.SUNKEN_BORDER):
     ManagedBase.__init__(self, name, 'wxTreeCtrl', parent, id, sizer, pos,
                          property_window, show=show)
     self.style = style
     self.access_functions['style'] = (self.get_style, self.set_style)
     # style property
     self.style_pos  = (wx.TR_HAS_BUTTONS, wx.TR_NO_LINES, wx.TR_LINES_AT_ROOT,
                        wx.TR_EDIT_LABELS, wx.TR_MULTIPLE, wx.TR_NO_BUTTONS,
                        wx.TR_TWIST_BUTTONS, wx.TR_FULL_ROW_HIGHLIGHT,
                        wx.TR_HIDE_ROOT, wx.TR_ROW_LINES,
                        wx.TR_HAS_VARIABLE_ROW_HEIGHT,
                        wx.TR_SINGLE, wx.TR_MULTIPLE, wx.TR_EXTENDED,
                        wx.TR_DEFAULT_STYLE, wx.SIMPLE_BORDER, wx.DOUBLE_BORDER,
                        wx.SUNKEN_BORDER, wx.RAISED_BORDER, wx.STATIC_BORDER,
                        wx.NO_BORDER, wx.WANTS_CHARS, 
                        wx.NO_FULL_REPAINT_ON_RESIZE,
                        wx.FULL_REPAINT_ON_RESIZE)
     style_labels = ('#section#' + _('Style'), 'wxTR_HAS_BUTTONS', 'wxTR_NO_LINES',
                     'wxTR_LINES_AT_ROOT', 'wxTR_EDIT_LABELS',
                     'wxTR_MULTIPLE', 'wxTR_NO_BUTTONS',
                     'wxTR_TWIST_BUTTONS', 'wxTR_FULL_ROW_HIGHLIGHT',
                     'wxTR_HIDE_ROOT', 'wxTR_ROW_LINES', 
                     'wxTR_HAS_VARIABLE_ROW_HEIGHT','wxTR_SINGLE', 
                     'wxTR_MULTIPLE', 'wxTR_EXTENDED',
                     'wxTR_DEFAULT_STYLE', 'wxSIMPLE_BORDER',
                     'wxDOUBLE_BORDER', 'wxSUNKEN_BORDER',
                     'wxRAISED_BORDER', 'wxSTATIC_BORDER', 'wxNO_BORDER',
                     'wxWANTS_CHARS', 'wxNO_FULL_REPAINT_ON_RESIZE',
                     'wxFULL_REPAINT_ON_RESIZE')
     self.properties['style'] = CheckListProperty(self, 'style', None,
                                                  style_labels)
     self._item_with_name = None
示例#3
0
    def create_properties(self):
        ManagedBase.create_properties(self)
        panel = wx.ScrolledWindow(self.notebook, -1)
        szr = wx.BoxSizer(wx.VERTICAL)
        ctor = self.properties['custom_ctor']
        ctor.display(panel)
        szr.Add(ctor.panel, 0, wx.EXPAND)
        args = self.properties['arguments']
        args.display(panel)
        szr.Add(args.panel, 1, wx.ALL|wx.EXPAND, 5)
        help_btn = wx.Button(panel, -1, _('Help on "Arguments" property'))
        text = _("""\
The 'Arguments' property behaves differently when generating
XRC code wrt C++ or python: you can use it to add custom attributes
to the resource object. To do so, arguments must have the following
format: ATTRIBUTE_NAME: ATTRIBUTE_VALUE
For instance:
    default_value: 10
is translated to:
    <default_value>10</default_value>
Invalid entries are silently ignored""")
        def show_help(event):
            wx.MessageBox(text, _('Help on "Arguments" property'),
                         wx.OK|wx.CENTRE|wx.ICON_INFORMATION)
        wx.EVT_BUTTON(help_btn, -1, show_help)
        szr.Add(help_btn, 0, wx.BOTTOM|wx.LEFT|wx.RIGHT|wx.EXPAND, 5)
        panel.SetAutoLayout(True)
        panel.SetSizer(szr)
        szr.Fit(panel)
        self.notebook.AddPage(panel, 'Widget')
        args.set_col_sizes([-1])
示例#4
0
    def __init__(self, name, parent, id, sizer, pos, property_window,
                 show=True):
        import config
        ManagedBase.__init__(self, name, 'wxSpinCtrl', parent, id, sizer, pos,
                             property_window, show=show)
        self.style = 0
        self.value = 0
        self.range = (0, 100) # Default values in wxSpinCtrl constructor.

        prop = self.properties
        self.access_functions['style'] = (self.get_style, self.set_style)
        self.access_functions['value'] = (self.get_value, self.set_value)
        self.access_functions['range'] = (self.get_range, self.set_range)
        style_labels = ('#section#' + _('Style'), 'wxSP_ARROW_KEYS', 'wxSP_WRAP',
                        'wxTE_PROCESS_ENTER',
                        'wxTE_PROCESS_TAB', 'wxTE_MULTILINE', 'wxTE_PASSWORD',
                        'wxTE_READONLY', 'wxHSCROLL', 'wxTE_RICH',
                        'wxTE_RICH2', 'wxTE_AUTO_URL', 'wxTE_NOHIDESEL',
                        'wxTE_CENTRE', 'wxTE_RIGHT', 'wxTE_LINEWRAP',
                        'wxTE_WORDWRAP', 'wxNO_BORDER')
        self.style_pos = (wx.SP_ARROW_KEYS, wx.SP_WRAP,
                          wx.TE_PROCESS_ENTER, wx.TE_PROCESS_TAB,
                          wx.TE_MULTILINE,wx.TE_PASSWORD, wx.TE_READONLY,
                          wx.HSCROLL, wx.TE_RICH, wx.TE_RICH2, wx.TE_AUTO_URL,
                          wx.TE_NOHIDESEL, wx.TE_CENTRE, wx.TE_RIGHT,
                          wx.TE_LINEWRAP, wx.TE_WORDWRAP, wx.NO_BORDER)
        prop['style'] = CheckListProperty(self, 'style', None, style_labels)
        prop['range'] = TextProperty(self, 'range', None, can_disable=True, label=_("range"))
        prop['value'] = SpinProperty(self, 'value', None, can_disable=True, label=_("value"))
        # 2003-09-04 added default_border
        if config.preferences.default_border:
            self.border = config.preferences.default_border_size
            self.flag = wx.ALL
示例#5
0
    def __init__(self, name, parent, id, label, sizer, pos, property_window, show=True):
        """\
        Class to handle wxRadioButton objects
        """
        import config

        ManagedBase.__init__(self, name, "wxRadioButton", parent, id, sizer, pos, property_window, show=show)
        self.label = label
        self.value = 0  # if nonzero, che radio button is selected
        self.style = 0
        # label and checked properties
        self.access_functions["label"] = (self.get_label, self.set_label)
        self.access_functions["clicked"] = (self.get_value, self.set_value)
        self.access_functions["style"] = (self.get_style, self.set_style)
        self.properties["label"] = TextProperty(self, "label", None, multiline=True, label=_("label"))
        self.properties["clicked"] = CheckBoxProperty(self, "clicked", None, _("Clicked"))
        self.style_pos = [wx.RB_GROUP, wx.RB_SINGLE, wx.RB_USE_CHECKBOX]
        self.properties["style"] = CheckListProperty(
            self,
            "style",
            None,
            ["#section#" + _("Style"), "wxRB_GROUP", "wxRB_SINGLE", "wxRB_USE_CHECKBOX"],
            tooltips=[
                _("Marks the beginning of a new group of radio buttons."),
                _(
                    "In some circumstances, radio buttons that are not consecutive siblings trigger a hang bug in Windows (only). If this happens, add this style to mark the button as not belonging to a group, and implement the mutually-exclusive group behaviour yourself."
                ),
                _("Use a checkbox button instead of radio button (currently supported only on PalmOS)."),
            ],
        )
        # 2003-09-04 added default_border
        if config.preferences.default_border:
            self.border = config.preferences.default_border_size
            self.flag = wx.ALL
示例#6
0
 def __init__(self, name, parent, id, sizer, pos, property_window,
              show=True):
     import config
     ManagedBase.__init__(self, name, 'wxTextCtrl', parent, id, sizer, pos,
                          property_window, show=show)
     self.value = ""
     self.style = 0
     self.access_functions['value'] = (self.get_value, self.set_value)
     self.access_functions['style'] = (self.get_style, self.set_style)
     prop = self.properties
     # value property
     prop['value'] = TextProperty(self, 'value', None,
                                  multiline=True, label=_("value"))
     # style property
     self.style_pos  = (wx.TE_PROCESS_ENTER, wx.TE_PROCESS_TAB,
                        wx.TE_MULTILINE,wx.TE_PASSWORD, wx.TE_READONLY,
                        wx.HSCROLL, wx.TE_RICH, wx.TE_RICH2, wx.TE_AUTO_URL,
                        wx.TE_NOHIDESEL, wx.TE_CENTRE, wx.TE_RIGHT,
                        wx.TE_LINEWRAP, wx.TE_WORDWRAP, wx.NO_BORDER)
     style_labels = ('#section#' + _('Style'), 'wxTE_PROCESS_ENTER',
                     'wxTE_PROCESS_TAB', 'wxTE_MULTILINE', 'wxTE_PASSWORD',
                     'wxTE_READONLY', 'wxHSCROLL', 'wxTE_RICH',
                     'wxTE_RICH2', 'wxTE_AUTO_URL', 'wxTE_NOHIDESEL',
                     'wxTE_CENTRE', 'wxTE_RIGHT', 'wxTE_LINEWRAP',
                     'wxTE_WORDWRAP', 'wxNO_BORDER')
     prop['style'] = CheckListProperty(self, 'style', None, style_labels)
     # 2003-09-04 added default_border
     if config.preferences.default_border:
         self.border = config.preferences.default_border_size
         self.flag = wx.ALL
示例#7
0
    def __init__(self, name, parent, id, style, sizer, pos,
                 property_window, show=True):
        """\
        Class to handle wxNotebook objects
        """
        ManagedBase.__init__(self, name, 'wxNotebook', parent, id, sizer,
                             pos, property_window, show=show)
        self.virtual_sizer = NotebookVirtualSizer(self)
        self._is_removing_pages = False
        self.style = style
        self.tabs = [ ['tab1', None] ] # list of pages of this notebook
                                       # (actually a list of
                                       # 2-list label, window)

        self.access_functions['style'] = (self.get_tab_pos, self.set_tab_pos)
        self.properties['style'] = HiddenProperty(self, 'style', label=_("style"))
        self.access_functions['tabs'] = (self.get_tabs, self.set_tabs)
        tab_cols = [('Tab label', GridProperty.STRING)]
        self.properties['tabs'] = NotebookPagesProperty(self, 'tabs', None,
                                                        tab_cols, label=_("tabs"))
        del tab_cols
        self.nb_sizer = None
        self._create_slots = False

        self.no_custom_class = False
        self.access_functions['no_custom_class'] = (self.get_no_custom_class,
                                                    self.set_no_custom_class)
        self.properties['no_custom_class'] = CheckBoxProperty(
            self, 'no_custom_class',
            label=_("Don't generate code for this custom class"))
示例#8
0
 def __init__(self, name, parent, id, sizer, pos, property_window,
              show=True):
     """\
     Class to handle wxCalendarCtrl objects
     """
     import config
     self.default = False
     ManagedBase.__init__(self, name, 'wxCalendarCtrl', parent, id, sizer, pos,
                          property_window, show=show)
     #self.access_functions['label'] = (self.get_label, self.set_label)
     #self.properties['label'] = TextProperty(self, 'label', None,
     #                                       multiline=True)
     self.access_functions['default'] = (self.get_default, self.set_default)
     self.access_functions['style'] = (self.get_style, self.set_style)
     self.properties['default'] = CheckBoxProperty(self, 'default', None, label=_("default"))
     style_labels = ('#section#' + _('Style'), 'wxCAL_SUNDAY_FIRST', 'wxCAL_MONDAY_FIRST', 
         'wxCAL_SHOW_HOLIDAYS', 'wxCAL_NO_YEAR_CHANGE', 'wxCAL_NO_MONTH_CHANGE',
         'wxCAL_SHOW_SURROUNDING_WEEKS','wxCAL_SEQUENTIAL_MONTH_SELECTION')
     self.style_pos = (CAL_SUNDAY_FIRST, CAL_MONDAY_FIRST, 
         CAL_SHOW_HOLIDAYS, CAL_NO_YEAR_CHANGE, CAL_NO_MONTH_CHANGE,
         CAL_SHOW_SURROUNDING_WEEKS, CAL_SEQUENTIAL_MONTH_SELECTION)
     self.tooltips = (_("Show Sunday as the first day in the week"),
                      _("Show Monday as the first day in the week"),
                      _("Highlight holidays in the calendar"),
                      _("Disable the year changing"),
                      _("Disable the month (and, implicitly, the year) changing"),
                      _("Show the neighbouring weeks in the previous and next months"),
                      _("Use alternative, more compact, style for the month and year selection controls."))
     self.properties['style'] = CheckListProperty(self, 'style', None,
                                                  style_labels,tooltips=self.tooltips)
     
     if config.preferences.default_border:
         self.border = config.preferences.default_border_size
         self.flag = wx.ALL
示例#9
0
    def __init__(self, name, parent, id, sizer, pos, property_window,
                 show=True):
        """\
        Class to handle wxDatePickerCtrl objects
        """
        import config
        self.default = False
        ManagedBase.__init__(self, name, 'wxDatePickerCtrl', parent, id, sizer, pos,
                             property_window, show=show)
        #self.access_functions['label'] = (self.get_label, self.set_label)
        #self.properties['label'] = TextProperty(self, 'label', None,
        #                                       multiline=True, label=_("label"))
        self.access_functions['default'] = (self.get_default, self.set_default)
        self.access_functions['style'] = (self.get_style, self.set_style)
        self.properties['default'] = CheckBoxProperty(self, 'default', None, label=_("default"))
        style_labels = ('#section#' + _('Style'), 'wxDP_SPIN', 'wxDP_DROPDOWN', 
            'wxDP_DEFAULT', 'wxDP_ALLOWNONE', 'wxDP_SHOWCENTURY')
        self.style_pos = (wx.DP_SPIN, wx.DP_DROPDOWN, 
            wx.DP_DEFAULT, wx.DP_ALLOWNONE, wx.DP_SHOWCENTURY)
	self.tooltips = (_("Creates a control without a month calendar drop down but with spin-control-like arrows to change individual date components. This style is not supported by the generic version."),
		_("Creates a control with a month calendar drop-down part from which the user can select a date."),
		_("Creates a control with the style that is best supported for the current platform (currently wxDP_SPIN under Windows and wxDP_DROPDOWN elsewhere)."),
		_("With this style, the control allows the user to not enter any valid date at all. Without it - the default - the control always has some valid date."),
		_("Forces display of the century in the default date format. Without this style the century could be displayed, or not, depending on the default date representation in the system."))
        self.properties['style'] = CheckListProperty(self, 'style', None,
                                                     style_labels,tooltips=self.tooltips)
        
        if config.preferences.default_border:
            self.border = config.preferences.default_border_size
            self.flag = wx.ALL
示例#10
0
文件: panel.py 项目: dsqiu/qzystudy
 def __init__(self, name, parent, id, sizer, pos, property_window,
              show=True, style=wx.TAB_TRAVERSAL):
     """\
     Class to handle wxPanel objects
     """
     ManagedBase.__init__(self, name, 'wxPanel', parent, id, sizer,
                          pos, property_window, show=show)
     PanelBase.__init__(self, style)
示例#11
0
文件: button.py 项目: dsqiu/qzystudy
    def __init__(self, name, parent, id, label, sizer, pos, property_window,
                 show=True):
        """\
        Class to handle wxButton objects
        """
        import config
        self.label = label
        self.default = False
        self.stockitem = "None"
        ManagedBase.__init__(self, name, 'wxButton', parent, id, sizer, pos,
                             property_window, show=show)
        self.access_functions['label'] = (self.get_label, self.set_label)
        self.properties['label'] = TextProperty(self, 'label', None,
                                                multiline=True)
        self.access_functions['stockitem'] = (self.get_stockitem,
                                              self.set_stockitem)
        self.access_functions['default'] = (self.get_default, self.set_default)
        self.access_functions['style'] = (self.get_style, self.set_style)
        self.properties['default'] = CheckBoxProperty(self, 'default', None, label=_("Default"))
        self.properties['default'].tooltip = \
            _("This sets the button to be the default "
              "item for the panel or dialog box.")

        #Get the list of items, and add a 'None'
        choices = ButtonStockItems.stock_ids.keys()
        choices.sort()
        choices[:0] = ['None']
        self.properties['stockitem'] = ComboBoxProperty(
            self, 'stockitem', choices, can_disable=True, label=_("Stock item"))
        self.properties['stockitem'].tooltip = \
            _("Standard IDs for button identifiers")

        self.style_pos = (wx.BU_LEFT, wx.BU_RIGHT, wx.BU_TOP, wx.BU_BOTTOM,
            wx.BU_EXACTFIT,wx.NO_BORDER)
        style_labels = ('#section#' + _('Style'), 'wxBU_LEFT', 'wxBU_RIGHT', 
            'wxBU_TOP', 'wxBU_BOTTOM', 'wxBU_EXACTFIT','wxNO_BORDER')
        
        #The tooltips tuple
        style_tooltips=(_("Left-justifies the label. Windows and GTK+ only."),
                        _("Right-justifies the bitmap label. Windows and GTK+ "
                        "only."),
                        _("Aligns the label to the top of the button. Windows "
                        "and GTK+ only."),
                        _("Aligns the label to the bottom of the button. "
                        "Windows and GTK+ only."),
                        _("Creates the button as small as possible instead of "
                        "making it of the standard size (which is the default "
                        "behaviour )."),
                        _("Creates a flat button. Windows and GTK+ only."))
        self.properties['style'] = CheckListProperty(
            self, 'style', None,
            style_labels, tooltips=style_tooltips) # the tooltips tuple is
                                                   # passed as the last
                                                   # argument
        # 2003-09-04 added default_border
        if config.preferences.default_border:
            self.border = config.preferences.default_border_size
            self.flag = wx.ALL
示例#12
0
 def show_widget(self, yes):
     ManagedBase.show_widget(self, yes)
     if yes and wx.Platform in ('__WXMSW__', '__WXMAC__'):
         wx.CallAfter(_ugly_hack_for_win32_notebook_bug, self.widget)
     if self._create_slots:
         self._create_slots = False
         for i in range(len(self.tabs)):
             if self.tabs[i][1] is None:
                 self.tabs = self.tabs[:i]
                 self.properties['tabs'].set_value(self.get_tabs())
示例#13
0
 def __init__(self, name, parent, id, sizer, pos, property_window,
              show=True, style=wx.LC_REPORT|wx.SUNKEN_BORDER):
     ManagedBase.__init__(self, name, 'wxListCtrl', parent, id, sizer, pos,
                          property_window, show=show)
     self.style = style
     self.access_functions['style'] = (self.get_style, self.set_style)
     # style property
     self.style_pos  = (wx.LC_LIST, wx.LC_REPORT, wx.LC_ICON, wx.LC_VIRTUAL,
                        wx.LC_SMALL_ICON, wx.LC_ALIGN_TOP, wx.LC_ALIGN_LEFT,
                        wx.LC_AUTOARRANGE, wx.LC_EDIT_LABELS, wx.LC_NO_HEADER,
                        wx.LC_SINGLE_SEL, wx.LC_SORT_ASCENDING,
                        wx.LC_SORT_DESCENDING, wx.LC_HRULES, wx.LC_VRULES,
                        wx.SIMPLE_BORDER,
                        wx.DOUBLE_BORDER, wx.SUNKEN_BORDER, wx.RAISED_BORDER,
                        wx.STATIC_BORDER, wx.NO_BORDER,
                        wx.WANTS_CHARS, wx.NO_FULL_REPAINT_ON_RESIZE,
                        wx.FULL_REPAINT_ON_RESIZE)
     style_labels = ('#section#' + _('Style'),
                     'wxLC_LIST', 'wxLC_REPORT', 'wxLC_ICON',
                     'wxLC_VIRTUAL', 'wxLC_SMALL_ICON',
                     'wxLC_ALIGN_TOP', 'wxLC_ALIGN_LEFT',
                     'wxLC_AUTOARRANGE', 'wxLC_EDIT_LABELS',
                     'wxLC_NO_HEADER', 'wxLC_SINGLE_SEL',
                     'wxLC_SORT_ASCENDING', 'wxLC_SORT_DESCENDING',
                     'wxLC_HRULES', 'wxLC_VRULES', 'wxSIMPLE_BORDER',
                     'wxDOUBLE_BORDER', 'wxSUNKEN_BORDER',
                     'wxRAISED_BORDER', 'wxSTATIC_BORDER', 'wxNO_BORDER',
                     'wxWANTS_CHARS', 'wxNO_FULL_REPAINT_ON_RESIZE',
                     'wxFULL_REPAINT_ON_RESIZE')
     self.style_tooltips = (_("Multicolumn list view, with optional small icons. Columns are computed automatically, i.e. you don't set columns as in wxLC_REPORT. In other words, the list wraps, unlike a wxListBox."),
         _("Single or multicolumn report view, with optional header."),
         _("Large icon view, with optional labels."),
         _("The application provides items text on demand. May only be used with wxLC_REPORT."),
         _("Small icon view, with optional labels."),
         _("Icons align to the top. Win32 default, Win32 only."),
         _("Icons align to the left."),
         _("Icons arrange themselves. Win32 only."),
         _("Labels are editable: the application will be notified when editing starts."),
         _("No header in report mode."),
         _("Single selection (default is multiple)."),
         _("Sort in ascending order (must still supply a comparison callback in SortItems."),
         _("Sort in descending order (must still supply a comparison callback in SortItems."),
         _("Draws light horizontal rules between rows in report mode."),
         _("Draws light vertical rules between columns in report mode"),
         _("Displays a thin border around the window. wxBORDER is the old name for this style."),
         _("Displays a double border. Windows and Mac only."),
         _("Displays a sunken border."),
         _("Displays a raised border."),
         _("Displays a border suitable for a static control. Windows only."),
         _("Displays no border, overriding the default border style for the window."),
         _("Use this to indicate that the window wants to get all char/key events for all keys - even for keys like TAB or ENTER which are usually used for dialog navigation and which wouldn't be generated without this style. If you need to use this style in order to get the arrows or etc., but would still like to have normal keyboard navigation take place, you should create and send a wxNavigationKeyEvent in response to the key events for Tab and Shift-Tab."),
         _("On Windows, this style used to disable repainting the window completely when its size is changed. Since this behaviour is now the default, the style is now obsolete and no longer has an effect."),
         _("Use this style to force a complete redraw of the window whenever it is resized instead of redrawing just the part of the window affected by resizing. Note that this was the behaviour by default before 2.5.1 release and that if you experience redraw problems with code which previously used to work you may want to try this. Currently this style applies on GTK+ 2 and Windows only, and full repainting is always done on other platforms."))
     self.properties['style'] = CheckListProperty(
         self, 'style', None, style_labels, tooltips=self.style_tooltips)
示例#14
0
    def __init__(self, name, parent, id, bmp_file, sizer, pos, property_window, show=True):
        """\
        Class to handle wxBitmapButton objects
        """
        import config

        ManagedBase.__init__(self, name, "wxBitmapButton", parent, id, sizer, pos, property_window, show=show)
        self.default = False
        self.set_bitmap(bmp_file)
        # bitmap property
        self.access_functions["bitmap"] = (self.get_bitmap, self.set_bitmap)
        self.properties["bitmap"] = FileDialogProperty(
            self, "bitmap", None, style=wx.OPEN | wx.FILE_MUST_EXIST, can_disable=False, label=_("bitmap")
        )
        self.access_functions["default"] = (self.get_default, self.set_default)
        self.access_functions["style"] = (self.get_style, self.set_style)
        self.properties["default"] = CheckBoxProperty(self, "default", None, label=_("default"))
        # 2003-08-07: added 'disabled_bitmap' property
        self.disabled_bitmap = ""
        self.access_functions["disabled_bitmap"] = (self.get_disabled_bitmap, self.set_disabled_bitmap)
        self.properties["disabled_bitmap"] = FileDialogProperty(
            self, "disabled_bitmap", None, style=wx.OPEN | wx.FILE_MUST_EXIST, label=_("disabled bitmap")
        )
        # 2003-09-04 added default_border
        if config.preferences.default_border:
            self.border = config.preferences.default_border_size
            self.flag = wx.ALL

        self.style_pos = (wx.BU_AUTODRAW, wx.BU_LEFT, wx.BU_RIGHT, wx.BU_TOP, wx.BU_BOTTOM, wx.NO_BORDER)
        style_labels = (
            "#section#" + _("Style"),
            "wxBU_AUTODRAW",
            "wxBU_LEFT",
            "wxBU_RIGHT",
            "wxBU_TOP",
            "wxBU_BOTTOM",
            "wxNO_BORDER",
        )

        # The tooltips tuple
        self.tooltips = (
            _(
                "If this is specified, the button will be drawn "
                "automatically using the label bitmap only, providing"
                " a 3D-look border. If this style is not specified, the "
                "button will be drawn without borders and using all "
                "provided bitmaps. WIN32 only."
                "Left-justifies the bitmap label. WIN32 only."
            ),
            _("Right-justifies the bitmap label. WIN32 only."),
            _("Aligns the bitmap label to the top of the button." " WIN32 only."),
            _("Aligns the bitmap label to the bottom of the button." " WIN32 only."),
            _("Creates a flat button. Windows and GTK+ only."),
        )
        self.properties["style"] = CheckListProperty(self, "style", None, style_labels, tooltips=self.tooltips)
示例#15
0
    def __init__(self, name, parent, id, style, win_1, win_2, orientation,
                 sizer, pos, property_window, show=True):
        """\
        Class to handle wxSplitterWindow objects
        """
        ManagedBase.__init__(self, name, 'wxSplitterWindow', parent, id, sizer,
                             pos, property_window, show=show)
        self.virtual_sizer = SplitterWindowSizer(self)
        if style is None: style = wx.SP_3D
        self.style = style
        self.window_1 = win_1 
        self.window_2 = win_2 
        self.orientation = orientation
        self.sash_pos = 0

        self.access_functions['style'] = (self.get_style, self.set_style)
        self.access_functions['sash_pos'] = (self.get_sash_pos,
                                             self.set_sash_pos)

        self.style_pos  = (wx.SP_3D, wx.SP_3DSASH, wx.SP_3DBORDER,
                           #wx.SP_FULLSASH,
                           wx.SP_BORDER, wx.SP_NOBORDER,
                           wx.SP_PERMIT_UNSPLIT, wx.SP_LIVE_UPDATE,
                           wx.CLIP_CHILDREN)
        style_labels = ('#section#' + _('Style'), 'wxSP_3D', 'wxSP_3DSASH',
                        'wxSP_3DBORDER', #'wxSP_FULLSASH',
                        'wxSP_BORDER',
                        'wxSP_NOBORDER', 'wxSP_PERMIT_UNSPLIT',
                        'wxSP_LIVE_UPDATE', 'wxCLIP_CHILDREN')

        self.properties['style'] = CheckListProperty(self, 'style', None,
                                                     style_labels)
        if self.orientation == wx.SPLIT_HORIZONTAL:
            od = 'wxSPLIT_HORIZONTAL'
        else: od = 'wxSPLIT_VERTICAL'
        self.access_functions['orientation'] = (self.get_orientation,
                                                self.set_orientation)
        self.properties['orientation'] = HiddenProperty(self, 'orientation', label=_("orientation"))

        self.access_functions['window_1'] = (self.get_win_1, lambda v: None)
        self.access_functions['window_2'] = (self.get_win_2, lambda v: None)
        self.properties['window_1'] = HiddenProperty(self, 'window_1')
        self.properties['window_2'] = HiddenProperty(self, 'window_2')
        self.window_1 = SizerSlot(self, self.virtual_sizer, 1)
        self.window_2 = SizerSlot(self, self.virtual_sizer, 2)

        self.properties['sash_pos'] = SpinProperty(self, 'sash_pos', None,
                                                   r=(0, 20),
                                                   can_disable=True, label=_("sash_pos")) 
        self.no_custom_class = False
        self.access_functions['no_custom_class'] = (self.get_no_custom_class,
                                                    self.set_no_custom_class)
        self.properties['no_custom_class'] = CheckBoxProperty(
            self, 'no_custom_class',
            label=_("Don't generate code for this custom class"))
示例#16
0
 def finish_widget_creation(self):
     ManagedBase.finish_widget_creation(self, sel_marker_parent=self.widget)
     sp = self.properties['sash_pos']
     if sp.is_active():
         sp.set_value(self.sash_pos)
         self.widget.SetSashPosition(self.sash_pos)
     else:
         sp.set_value(self.widget.GetSashPosition())
     
     wx.EVT_SPLITTER_SASH_POS_CHANGED(self.widget, self.widget.GetId(),
                                      self.on_sash_pos_changed)
示例#17
0
 def create_properties(self):
     ManagedBase.create_properties(self)
     if self.removed_p.panel: self.removed_p.panel.Hide()
     panel = wx.Panel(self.notebook, -1)
     szr = wx.BoxSizer(wx.VERTICAL)
     self.properties['attribute'].display(panel)
     szr.Add(self.properties['attribute'].panel, 0, wx.EXPAND)
     panel.SetAutoLayout(True)
     panel.SetSizer(szr)
     szr.Fit(panel)
     self.notebook.AddPage(panel, 'Widget')        
示例#18
0
 def create_properties(self):
     ManagedBase.create_properties(self)
     panel = wx.Panel(self.notebook, -1)
     szr = wx.BoxSizer(wx.VERTICAL)
     self.properties['label'].display(panel)
     self.properties['value'].display(panel)
     szr.Add(self.properties['label'].panel, 0, wx.EXPAND)
     szr.Add(self.properties['value'].panel, 0, wx.EXPAND)
     panel.SetAutoLayout(True)
     panel.SetSizer(szr)
     szr.Fit(panel)
     self.notebook.AddPage(panel, 'Widget')
示例#19
0
文件: spacer.py 项目: nyimbi/SPE
    def __init__(self, name, parent, id, width, height, sizer, pos, property_window, show=True):
        """\
        Class to handle spacers for sizers
        """
        ManagedBase.__init__(self, name, "spacer", parent, id, sizer, pos, property_window, show=show)
        self.__size = [width, height]

        self.access_functions["width"] = (self.get_width, self.set_width)
        self.access_functions["height"] = (self.get_height, self.set_height)

        self.properties["width"] = SpinProperty(self, "width", None, label=_("width"))
        self.properties["height"] = SpinProperty(self, "height", None, label=_("height"))
示例#20
0
    def __init__(self, name, parent, style, pos):
        ManagedBase.__init__(self, name, 'wxNotebook', parent, pos)
        EditStylesMixin.__init__(self)
        self.properties["style"].set(style)

        self._is_removing_pages = False

        # initialise instance properties
        self.pages = None  # on loading from XML, this will be used
        tabs = []  # list of page labels of this notebook
        tab_cols = [('Tab label', np.GridProperty.STRING)]
        self.tabs = NotebookPagesProperty(tabs, tab_cols)
        self.no_custom_class = np.CheckBoxProperty(False, default_value=False)
示例#21
0
 def _properties_changed(self, modified, actions):
     if "value" in modified and self.widget:
         self.widget.SetValue(self.value)
     if "search_button" in modified and self.widget:
         self.widget.ShowSearchButton(self.search_button)
     if "cancel_button" in modified and self.widget:
         self.widget.ShowCancelButton(self.cancel_button)
     if "descriptive_text" in modified and self.widget:
         self.widget.SetDescriptiveText(self.descriptive_text)
     if "max_length" in modified and self.widget:
         self.widget.SetMaxLength(self.max_length)
     EditStylesMixin._properties_changed(self, modified, actions)
     ManagedBase._properties_changed(self, modified, actions)
示例#22
0
文件: gauge.py 项目: CrazyPython/SPE
 def create_properties(self):
     ManagedBase.create_properties(self)
     panel = wx.ScrolledWindow(self.notebook, -1, style=wx.TAB_TRAVERSAL)
     prop = self.properties
     szr = wx.BoxSizer(wx.VERTICAL)
     prop['range'].display(panel)
     prop['style'].display(panel)
     szr.Add(prop['range'].panel, 0, wx.EXPAND)
     szr.Add(prop['style'].panel, 0, wx.EXPAND)
     panel.SetAutoLayout(True)
     panel.SetSizer(szr)
     szr.Fit(panel)
     self.notebook.AddPage(panel, 'Widget')
示例#23
0
    def __init__(self,
                 name,
                 parent,
                 id,
                 sizer,
                 pos,
                 style=wx.TR_HAS_BUTTONS | wx.BORDER_SUNKEN):
        ManagedBase.__init__(self, name, 'wxTreeCtrl', parent, id, sizer, pos)
        EditStylesMixin.__init__(self)

        # initialise instance properties
        if style: self.properties["style"].set(style)
        self._item_with_name = None  # a Tree item for visualization
示例#24
0
    def properties_changed(self, modified):
        if not modified or "label" in modified:
            if self.widget:
                self.widget.SetLabel(self.label)
                self._set_widget_best_size()
            common.app_tree.refresh(self, refresh_label=True, refresh_image=False)

        if not modified or "url" in modified:
            if self.widget:
                self.widget.SetURL(self.url)

        EditStylesMixin.properties_changed(self, modified)
        ManagedBase.properties_changed(self, modified)
示例#25
0
    def properties_changed(self, modified):
        resize = False

        if not modified or "label" in modified:
            self._set_label()
            if common.app_tree:
                common.app_tree.refresh(self, refresh_label=True, refresh_image=False)

        if not modified or "clicked" in modified and self.widget:
            self.widget.SetValue(self.clicked)

        EditStylesMixin.properties_changed(self, modified)
        ManagedBase.properties_changed(self, modified)
示例#26
0
    def __init__(self, name, parent, index, label):
        ManagedBase.__init__(self, name, parent, index)
        EditStylesMixin.__init__(self)

        # initialise instance variable
        self.label = np.TextProperty(label, multiline="grow")
        self.value = np.CheckBoxProperty(False, default_value=False)
        # bitmaps are only for >= 3.0
        self.bitmap = np.BitmapPropertyD(min_version=(3, 0))
        self.disabled_bitmap = np.BitmapPropertyD(min_version=(3, 0))
        self.pressed_bitmap = np.BitmapPropertyD(min_version=(3, 0))
        self.current_bitmap = np.BitmapPropertyD(min_version=(3, 0))
        self.focus_bitmap = np.BitmapPropertyD(min_version=(3, 0))
示例#27
0
文件: choice.py 项目: CrazyPython/SPE
 def create_properties(self):
     ManagedBase.create_properties(self)
     panel = wx.Panel(self.notebook, -1)
     szr = wx.BoxSizer(wx.VERTICAL)
     self.properties['choices'].display(panel)
     self.properties['selection'].display(panel)
     szr.Add(self.properties['selection'].panel, 0, wx.EXPAND)
     szr.Add(self.properties['choices'].panel, 1, wx.EXPAND)
     panel.SetAutoLayout(True)
     panel.SetSizer(szr)
     szr.Fit(panel)
     self.notebook.AddPage(panel, 'Widget')
     self.properties['choices'].set_col_sizes([-1])
示例#28
0
 def on_size(self, event):
     if not self.widget: return
     try:
         if self.orientation == wx.SPLIT_VERTICAL:
             max_pos = self.widget.GetClientSize()[0]
         else: max_pos = self.widget.GetClientSize()[1]
         self.properties['sash_pos'].set_range(-max_pos, max_pos)
         if not self.properties['sash_pos'].is_active():
             self.widget.SetSashPosition(max_pos/2)
             self.sash_pos = self.widget.GetSashPosition()
             self.properties['sash_pos'].set_value(self.sash_pos)
     except (AttributeError, KeyError): pass
     ManagedBase.on_size(self, event)
示例#29
0
    def __init__(self, name, parent, id, style, sizer, pos,
                 property_window, show=True):
        """\
        Class to handle wxNotebook objects
        """
        # create new and (still) unused notebook name
        if not name:
            name = self.next_notebook_name()

        # Increase number of created notebooks
        EditNotebook.notebook_number += 1

        ManagedBase.__init__(self, name, 'wxNotebook', parent, id, sizer,
                             pos, property_window, show=show)

        self.virtual_sizer = NotebookVirtualSizer(self)
        self._is_removing_pages = False
        self.style = style
        self.tabs = [['tab1', None]]  # list of pages of this notebook
                                      # (actually a list of
                                      # 2-list label, window)

        self.access_functions['style'] = (self.get_tab_pos, self.set_tab_pos)
        self.properties['style'] = HiddenProperty(
            self,
            'style',
            label=_("style"),
            )
        self.access_functions['tabs'] = (self.get_tabs, self.set_tabs)
        tab_cols = [('Tab label', GridProperty.STRING)]
        self.properties['tabs'] = NotebookPagesProperty(
            self,
            'tabs',
            None,
            tab_cols,
            label=_("tabs"),
            can_remove_last=False,
            )
        del tab_cols
        self.nb_sizer = None
        self._create_slots = False

        self.no_custom_class = False
        self.access_functions['no_custom_class'] = (self.get_no_custom_class,
                                                    self.set_no_custom_class)
        self.properties['no_custom_class'] = CheckBoxProperty(
            self, 'no_custom_class',
            label=_("Don't generate code for this custom class"))

        # first pane should have number 1
        self.pane_number = 1
示例#30
0
    def properties_changed(self, modified):
        if not modified or "value" in modified and self.widget:
            self.widget.SetValue(self.value)

        if not modified or "label" in modified:
            if self.widget:
                self.widget.SetLabel(self.label)
                self._set_widget_best_size()
            common.app_tree.refresh(self, refresh_label=True, refresh_image=False)

        BitmapMixin._properties_changed(self, modified)
        self._set_widget_best_size()
        EditStylesMixin.properties_changed(self, modified)
        ManagedBase.properties_changed(self, modified)
示例#31
0
 def create_properties(self):
     ManagedBase.create_properties(self)
     panel = wx.Panel(self.notebook, -1)
     szr = wx.BoxSizer(wx.VERTICAL)
     self.properties['label'].display(panel)
     self.properties['clicked'].display(panel)
     self.properties['style'].display(panel)
     szr.Add(self.properties['label'].panel, 0, wx.EXPAND)
     szr.Add(self.properties['clicked'].panel, 0, wx.EXPAND)
     szr.Add(self.properties['style'].panel, 0, wx.EXPAND)
     panel.SetAutoLayout(True)
     panel.SetSizer(szr)
     szr.Fit(panel)
     self.notebook.AddPage(panel, _('Widget'))
示例#32
0
 def create_properties(self):
     ManagedBase.create_properties(self)
     panel = wx.ScrolledWindow(self.notebook, -1, style=wx.TAB_TRAVERSAL)
     self.properties['no_custom_class'].display(panel)
     self.properties['tabs'].display(panel)
     sizer = wx.BoxSizer(wx.VERTICAL)
     sizer.Add(self.properties['no_custom_class'].panel, 0,
               wx.ALL | wx.EXPAND, 3)
     sizer.Add(self.properties['tabs'].panel, 1, wx.ALL | wx.EXPAND, 3)
     panel.SetAutoLayout(True)
     panel.SetSizer(sizer)
     sizer.Fit(panel)
     self.notebook.AddPage(panel, _('Widget'))
     self.properties['tabs'].set_col_sizes([-1])
示例#33
0
    def __init__(self,
                 name,
                 parent,
                 id,
                 style,
                 sizer,
                 pos,
                 property_window,
                 show=True):
        """\
        Class to handle wxNotebook objects
        """
        ManagedBase.__init__(self,
                             name,
                             'wxNotebook',
                             parent,
                             id,
                             sizer,
                             pos,
                             property_window,
                             show=show)
        self.virtual_sizer = NotebookVirtualSizer(self)
        self._is_removing_pages = False
        self.style = style
        self.tabs = [['tab1', None]]  # list of pages of this notebook
        # (actually a list of
        # 2-list label, window)

        self.access_functions['style'] = (self.get_tab_pos, self.set_tab_pos)
        self.properties['style'] = HiddenProperty(self,
                                                  'style',
                                                  label=_("style"))
        self.access_functions['tabs'] = (self.get_tabs, self.set_tabs)
        tab_cols = [('Tab label', GridProperty.STRING)]
        self.properties['tabs'] = NotebookPagesProperty(self,
                                                        'tabs',
                                                        None,
                                                        tab_cols,
                                                        label=_("tabs"))
        del tab_cols
        self.nb_sizer = None
        self._create_slots = False

        self.no_custom_class = False
        self.access_functions['no_custom_class'] = (self.get_no_custom_class,
                                                    self.set_no_custom_class)
        self.properties['no_custom_class'] = CheckBoxProperty(
            self,
            'no_custom_class',
            label=_("Don't generate code for this custom class"))
示例#34
0
 def __init__(self,
              name,
              parent,
              index,
              style=wx.LC_REPORT | wx.BORDER_SUNKEN):
     ManagedBase.__init__(self, name, parent, index)
     EditStylesMixin.__init__(self)
     if style: self.properties["style"].set(style)
     self.columns = GridColsProperty([])
     self.rows_number = np.SpinProperty(0, immediate=True, default_value=0)
     self.properties["style"]._ignore_names = {"wxLC_VIRTUAL"}
     self.properties["style"]._one_required = {
         "wxLC_ICON", "wxLC_SMALL_ICON", "wxLC_LIST", "wxLC_REPORT"
     }
示例#35
0
    def __init__(self, name, parent, id, bmp_file, sizer, pos):
        ManagedBase.__init__(self, name, 'wxStaticBitmap', parent, id, sizer,
                             pos)
        EditStylesMixin.__init__(self)

        # initialise instance properties
        filedialog_style = wx.FD_OPEN | wx.FD_FILE_MUST_EXIST  # for the following two properties
        self.bitmap = np.FileNameProperty(bmp_file, style=filedialog_style)
        self.attribute = np.CheckBoxProperty(False, default_value=False)

        if config.preferences.default_border:
            self.properties["border"].set(
                config.preferences.default_border_size)
            self.properties["flag"].set(wx.ALL)
示例#36
0
 def create_properties(self):
     ManagedBase.create_properties(self)
     panel = wx.Panel(self.notebook, -1)
     szr = wx.BoxSizer(wx.VERTICAL)
     self.properties["label"].display(panel)
     self.properties["clicked"].display(panel)
     self.properties["style"].display(panel)
     szr.Add(self.properties["label"].panel, 0, wx.EXPAND)
     szr.Add(self.properties["clicked"].panel, 0, wx.EXPAND)
     szr.Add(self.properties["style"].panel, 0, wx.EXPAND)
     panel.SetAutoLayout(True)
     panel.SetSizer(szr)
     szr.Fit(panel)
     self.notebook.AddPage(panel, _("Widget"))
示例#37
0
 def create_properties(self):
     ManagedBase.create_properties(self)
     panel = wx.ScrolledWindow(self.notebook, -1, style=wx.TAB_TRAVERSAL)
     self.properties['no_custom_class'].display(panel)
     self.properties['tabs'].display(panel)
     sizer = wx.BoxSizer(wx.VERTICAL)
     sizer.Add(self.properties['no_custom_class'].panel, 0,
               wx.ALL|wx.EXPAND, 3)
     sizer.Add(self.properties['tabs'].panel, 1, wx.ALL|wx.EXPAND, 3)
     panel.SetAutoLayout(True)
     panel.SetSizer(sizer)
     sizer.Fit(panel)
     self.notebook.AddPage(panel, _('Widget'))
     self.properties['tabs'].set_col_sizes([-1])
示例#38
0
    def __init__(self, name, parent, id, sizer, pos):
        # initialize base classes
        ManagedBase.__init__(self, name, 'wxSearchCtrl', parent, id, sizer,
                             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)
示例#39
0
    def __init__(self, name, parent, index):
        ManagedBase.__init__(self, name, parent, index)
        EditStylesMixin.__init__(self)

        # initialise instance properties
        self.range = np.FloatRangePropertyA("0.0, 100.0")
        self.value = np.SpinDoublePropertyA(0,
                                            val_range=(0.0, 100.0),
                                            immediate=True,
                                            default_value="")
        self.increment = np.SpinDoublePropertyD(1.0,
                                                val_range=(0.0, 100.0),
                                                immediate=True,
                                                default_value=1.0)
示例#40
0
 def __init__(self, name, parent, id, bmp_file, sizer, pos, property_window,
              show=True):
     """\
     Class to handle wxBitmapButton objects
     """
     import config
     ManagedBase.__init__(self, name, 'wxBitmapButton', parent, id, sizer,
                          pos, property_window, show=show)
     self.default = False
     self.set_bitmap(bmp_file)
     # bitmap property
     self.access_functions['bitmap'] = (self.get_bitmap, self.set_bitmap)
     self.properties['bitmap'] = FileDialogProperty(self, 'bitmap', None,
                                                    style=wx.OPEN |
                                                    wx.FILE_MUST_EXIST,
                                                    can_disable=False, label=_("bitmap"))
     self.access_functions['default'] = (self.get_default, self.set_default)
     self.access_functions['style'] = (self.get_style, self.set_style)
     self.properties['default'] = CheckBoxProperty(self, 'default', None, label=_("default"))
     # 2003-08-07: added 'disabled_bitmap' property
     self.disabled_bitmap = ""
     self.access_functions['disabled_bitmap'] = (self.get_disabled_bitmap,
                                                 self.set_disabled_bitmap)
     self.properties['disabled_bitmap'] = FileDialogProperty(
         self, 'disabled_bitmap', None, style=wx.OPEN|wx.FILE_MUST_EXIST, label=_("disabled bitmap"))
     # 2003-09-04 added default_border
     if config.preferences.default_border:
         self.border = config.preferences.default_border_size
         self.flag = wx.ALL
     
     self.style_pos = (wx.BU_AUTODRAW, wx.BU_LEFT, wx.BU_RIGHT, wx.BU_TOP,
         wx.BU_BOTTOM, wx.NO_BORDER)
     style_labels = ('#section#' + _('Style'), 'wxBU_AUTODRAW', 'wxBU_LEFT', 'wxBU_RIGHT', 
         'wxBU_TOP', 'wxBU_BOTTOM', 'wxNO_BORDER')
     
     #The tooltips tuple
     self.tooltips=(_("If this is specified, the button will be drawn "
                     "automatically using the label bitmap only, providing"
                     " a 3D-look border. If this style is not specified, the "
                     "button will be drawn without borders and using all "
                     "provided bitmaps. WIN32 only."
                     "Left-justifies the bitmap label. WIN32 only."),
                     _("Right-justifies the bitmap label. WIN32 only."),
                     _("Aligns the bitmap label to the top of the button."
                     " WIN32 only."),
                     _("Aligns the bitmap label to the bottom of the button."
                     " WIN32 only."),
                     _("Creates a flat button. Windows and GTK+ only."))
     self.properties['style'] = CheckListProperty(self, 'style', None,
                                                  style_labels,tooltips=self.tooltips)
示例#41
0
文件: grid.py 项目: nyimbi/SPE
    def create_properties(self):
        ManagedBase.create_properties(self)
        panel = wx.ScrolledWindow(self.notebook, -1, style=wx.TAB_TRAVERSAL)
        self.properties["create_grid"].display(panel)
        self.properties["columns"].display(panel)
        self.properties["rows_number"].display(panel)
        self.properties["row_label_size"].display(panel)
        self.properties["col_label_size"].display(panel)
        self.properties["enable_editing"].display(panel)
        self.properties["enable_grid_lines"].display(panel)
        self.properties["enable_col_resize"].display(panel)
        self.properties["enable_row_resize"].display(panel)
        self.properties["enable_grid_resize"].display(panel)
        self.properties["lines_color"].display(panel)
        self.properties["label_bg_color"].display(panel)
        self.properties["selection_mode"].display(panel)
        szr = wx.BoxSizer(wx.VERTICAL)
        szr.Add(self.properties["create_grid"].panel, 0, wx.EXPAND)
        szr.Add(wx.StaticLine(panel, -1), 0, wx.ALL | wx.EXPAND, 5)
        szr.Add(
            wx.StaticText(
                panel, -1, _("The following properties are " "meaningful\nonly if 'Create grid' is selected")
            ),
            0,
            wx.LEFT | wx.RIGHT | wx.EXPAND,
            10,
        )
        szr.Add(wx.StaticLine(panel, -1), 0, wx.ALL | wx.EXPAND, 5)
        szr.Add(self.properties["columns"].panel, 0, wx.ALL | wx.EXPAND, 2)
        szr.SetItemMinSize(self.properties["columns"].panel, 1, 150)
        szr.Add(self.properties["rows_number"].panel, 0, wx.EXPAND)
        szr.Add(self.properties["row_label_size"].panel, 0, wx.EXPAND)
        szr.Add(self.properties["col_label_size"].panel, 0, wx.EXPAND)
        szr.Add(self.properties["lines_color"].panel, 0, wx.EXPAND)
        szr.Add(self.properties["label_bg_color"].panel, 0, wx.EXPAND)
        szr.Add(self.properties["enable_editing"].panel, 0, wx.EXPAND)
        szr.Add(self.properties["enable_grid_lines"].panel, 0, wx.EXPAND)
        szr.Add(self.properties["enable_col_resize"].panel, 0, wx.EXPAND)
        szr.Add(self.properties["enable_row_resize"].panel, 0, wx.EXPAND)
        szr.Add(self.properties["enable_grid_resize"].panel, 0, wx.EXPAND)
        szr.Add(self.properties["selection_mode"].panel, 0, wx.ALL | wx.EXPAND, 5)
        panel.SetAutoLayout(1)
        panel.SetSizer(szr)
        szr.Fit(panel)
        w, h = panel.GetClientSize()
        self.notebook.AddPage(panel, _("Widget"))
        import math

        panel.SetScrollbars(1, 5, 1, int(math.ceil(h / 5.0)))
        self.properties["columns"].set_col_sizes([-1, 0])
示例#42
0
    def __init__(self, name, parent, index, instance_class=None):
        ManagedBase.__init__(self, name, parent, index, instance_class or "wxWindow")
        self.properties["instance_class"].deactivated = None

        # initialise instance properties
        cols      = [('Arguments', np.GridProperty.STRING)]
        self.arguments   = ArgumentsProperty( [], cols )
        self.custom_ctor = np.TextPropertyD("", name="custom_constructor", strip=True, default_value="")

        self.show_design = np.CheckBoxProperty(False, default_value=False)
        self.show_preview = np.CheckBoxProperty(False, default_value=False)
        if not config.preferences.allow_custom_widgets:
            self.properties["show_design"].set_blocked()
            self.properties["show_preview"].set_blocked()
        self._error_message = None  # when there's an error message due to the previous option
示例#43
0
    def __init__(self, name, parent, id, label, sizer, pos):
        # Initialise parent classes
        ManagedBase.__init__(self, name, 'wxHyperlinkCtrl', parent, id, sizer,
                             pos)
        EditStylesMixin.__init__(self)

        # initialise instance properties
        self.label = np.TextProperty(label, multiline=True)
        self.url = np.TextProperty("")
        self.attribute = np.CheckBoxProperty(False, default_value=False)

        if config.preferences.default_border:
            self.properties["border"].set(
                config.preferences.default_border_size)
            self.properties["flag"].set(wx.ALL)
示例#44
0
 def create_properties(self):
     ManagedBase.create_properties(self)
     panel = wx.ScrolledWindow(self.notebook, -1, style=wx.TAB_TRAVERSAL) 
     prop = self.properties
     prop['style'].display(panel)
     szr = wx.BoxSizer(wx.VERTICAL)
     szr.Add(prop['style'].panel, 0, wx.EXPAND)
     panel.SetAutoLayout(True)
     panel.SetSizer(szr)
     szr.Fit(panel)
     w, h = panel.GetClientSize()
     self.notebook.AddPage(panel, _('Widget'))
     self.property_window.Layout()
     import math
     panel.SetScrollbars(1, 5, 1, int(math.ceil(h/5.0)))
示例#45
0
 def create_properties(self):
     ManagedBase.create_properties(self)
     panel = wx.ScrolledWindow(self.notebook, -1, style=wx.TAB_TRAVERSAL)
     prop = self.properties
     prop['style'].display(panel)
     szr = wx.BoxSizer(wx.VERTICAL)
     szr.Add(prop['style'].panel, 0, wx.EXPAND)
     panel.SetAutoLayout(True)
     panel.SetSizer(szr)
     szr.Fit(panel)
     w, h = panel.GetClientSize()
     self.notebook.AddPage(panel, 'Widget')
     self.property_window.Layout()
     import math
     panel.SetScrollbars(1, 5, 1, int(math.ceil(h / 5.0)))
示例#46
0
 def create_properties(self):
     ManagedBase.create_properties(self)
     panel = wx.Panel(self.notebook, -1)
     szr = wx.BoxSizer(wx.VERTICAL)
     self.properties['choices'].display(panel)
     self.properties['style'].display(panel)
     self.properties['selection'].display(panel)
     szr.Add(self.properties['style'].panel, 0, wx.EXPAND)
     szr.Add(self.properties['selection'].panel, 0, wx.EXPAND)
     szr.Add(self.properties['choices'].panel, 1, wx.EXPAND)
     panel.SetAutoLayout(True)
     panel.SetSizer(szr)
     szr.Fit(panel)
     self.notebook.AddPage(panel, 'Widget')
     self.properties['choices'].set_col_sizes([-1])
示例#47
0
 def create_properties(self):
     ManagedBase.create_properties(self)
     panel = wx.ScrolledWindow(self.notebook, -1, style=wx.TAB_TRAVERSAL)
     szr = wx.BoxSizer(wx.VERTICAL)
     for name in self.property_names:
         self.properties[name].display(panel)
         szr.Add(self.properties[name].panel, self.property_proportion[name],
                 wx.EXPAND)
     panel.SetAutoLayout(1)
     panel.SetSizer(szr)
     szr.Fit(panel)
     w, h = panel.GetClientSize()
     self.notebook.AddPage(panel, 'Widget')
     import math
     panel.SetScrollbars(1, 5, 1, int(math.ceil(h/5.0)))
示例#48
0
文件: slider.py 项目: italomaia/spe
 def create_properties(self):
     ManagedBase.create_properties(self)
     panel = wx.ScrolledWindow(self.notebook, -1, style=wx.TAB_TRAVERSAL)
     prop = self.properties
     szr = wx.BoxSizer(wx.VERTICAL)
     prop['range'].display(panel)
     prop['value'].display(panel)
     prop['style'].display(panel)
     szr.Add(prop['range'].panel, 0, wx.EXPAND)
     szr.Add(prop['value'].panel, 0, wx.EXPAND)
     szr.Add(prop['style'].panel, 0, wx.EXPAND)
     panel.SetAutoLayout(True)
     panel.SetSizer(szr)
     szr.Fit(panel)
     self.notebook.AddPage(panel, _('Widget'))
示例#49
0
 def on_size(self, event):
     if not self.widget: return
     try:
         if self.orientation == wx.SPLIT_VERTICAL:
             max_pos = self.widget.GetClientSize()[0]
         else:
             max_pos = self.widget.GetClientSize()[1]
         self.properties['sash_pos'].set_range(-max_pos, max_pos)
         if not self.properties['sash_pos'].is_active():
             self.widget.SetSashPosition(max_pos / 2)
             self.sash_pos = self.widget.GetSashPosition()
             self.properties['sash_pos'].set_value(self.sash_pos)
     except (AttributeError, KeyError):
         pass
     ManagedBase.on_size(self, event)
示例#50
0
 def create_properties(self):
     ManagedBase.create_properties(self)
     panel = wx.ScrolledWindow(self.notebook, -1, style=wx.TAB_TRAVERSAL)
     szr = wx.BoxSizer(wx.VERTICAL)
     for name in self.property_names:
         self.properties[name].display(panel)
         szr.Add(self.properties[name].panel,
                 self.property_proportion[name], wx.EXPAND)
     panel.SetAutoLayout(1)
     panel.SetSizer(szr)
     szr.Fit(panel)
     w, h = panel.GetClientSize()
     self.notebook.AddPage(panel, 'Widget')
     import math
     panel.SetScrollbars(1, 5, 1, int(math.ceil(h / 5.0)))
示例#51
0
    def _properties_changed(self, modified, actions):
        "update label (and size if label/stockitem have changed)"

        if "bitmap" in modified:
            self.properties["bitmap_dir"].set_blocked(
                not self.check_prop_truth("bitmap"))

        label_modified = not modified or ("label" in modified
                                          or "font" in modified)

        if not modified or "stockitem" in modified:
            # if stockitem is set, label needs to be deactivated and window id is wxID_...
            if self.properties["stockitem"].is_active():
                self.properties["label"].set_blocked(True)
                new_id = "wxID_" + self.stockitem
                if common.history:
                    common.history.monitor_property(self.properties["id"])
                self.properties["id"].set(new_id, deactivate=True)
                #self.properties["id"].default_value = new_id  # avoid this value to be written to XML

                l = ButtonStockItems.stock_ids[self.stockitem]
                if self.widget: self.widget.SetLabel(l)
            else:
                self.properties["label"].set_blocked(False)
                label_modified = True

        if modified and "font" in modified and wx.Platform == '__WXGTK__':
            # on GTK setting a smaller font would fail
            actions.update(("recreate2", "label", "sizeevent"))
            return

        if label_modified and self.properties["label"].is_active(
        ) and self.widget:
            self.widget.SetLabel(self.label)
            label_modified = True

        if label_modified or (modified and "stockitem" in modified):
            actions.update(("layout", "label", "sizeevent"))

        if modified and ("label" in modified or "stockitem" in modified):
            actions.add("label")

        if "bitmap_dir" in modified and self.widget:
            self.widget.SetBitmapPosition(self.bitmap_dir)

        BitmapMixin._properties_changed(self, modified, actions)
        EditStylesMixin._properties_changed(self, modified, actions)
        ManagedBase._properties_changed(self, modified, actions)
示例#52
0
class EditStaticText(ManagedBase, EditStylesMixin):
    "Class to handle wxStaticText objects"
    WX_CLASS = 'wxStaticText'
    _PROPERTIES = ["Widget", "label", "style", "attribute", "wrap"]
    PROPERTIES = ManagedBase.PROPERTIES + _PROPERTIES + ManagedBase.EXTRA_PROPERTIES
    ManagedBase.MOVE_PROPERTY(PROPERTIES, "attribute", "name")
    _PROPERTY_HELP = {
        "attribute":
        'Store instance as attribute of window class; e.g. self.label_1 = wx.StaticText(...)\n'
        'Without this, you can not access the label from your program.',
        "wrap":
        'Wrap text to at most the given width.\nThe lines will be broken at word boundaries.'
    }

    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)

    def create_widget(self):
        # up to 0.8 GenStaticText was used; it seems that nowadays StaticText handles mouse events on gtk as well
        #self.widget = wx.lib.stattext.GenStaticText(self.parent_window.widget, wx.ID_ANY, self.label)
        self.widget = wx.StaticText(self.parent_window.widget,
                                    wx.ID_ANY,
                                    self.label,
                                    style=self.style)
        # self.wrap is now handled in finish_widget_creation

    def _properties_changed(self, modified, actions):
        if not modified or "label" in modified:
            if self.widget:
                p = self.properties["label"]
                if self.wrap != -1 or (p.previous_value and len(
                        p.previous_value) > len(self.label)):
                    # re-create as otherwise the size would not be reduced
                    actions.add("recreate2")
                    return
                self.widget.SetLabel(self.label)
                actions.add("layout")

        if (not modified or "wrap" in modified) and self.widget:
            actions.add(
                "recreate2"
            )  # calling .Wrap(self.wrap) would only work once and not set the size correctly
            return

        if modified and wx.Platform != "__WXMSW__":
            if "style" in modified or "font" in modified or "foreground" in modified:
                actions.add("recreate2")
                return

        EditStylesMixin._properties_changed(self, modified, actions)
        ManagedBase._properties_changed(self, modified, actions)
class EditStaticLine(ManagedBase, EditStylesMixin):
    "Class to handle wxStaticLine objects"
    _PROPERTIES = ["attribute"]
    PROPERTIES = ManagedBase.PROPERTIES + _PROPERTIES + ManagedBase.EXTRA_PROPERTIES
    PROPERTIES.remove("font")
    ManagedBase.MOVE_PROPERTY(PROPERTIES, "attribute", "name")
    _PROPERTY_LABELS = {"attribute":'Store as attribute'}
    _PROPERTY_HELP={"attribute":'Store instance as attribute of window class; e.g. self.line_1 = wx.wxStaticLine(...)\n'
                                'Without this, you can not access the line from your program.'}
    def __init__(self, name, parent, id, style, sizer, pos):
        ManagedBase.__init__(self, name, 'wxStaticLine', parent, id, sizer, pos)
        EditStylesMixin.__init__(self)

        # initialise instance properties
        self.attribute = np.CheckBoxProperty(False, default_value=False)
        if style: self.properties["style"].set(style)

    def create_widget(self):
        self.widget = wx.StaticLine(self.parent.widget, self.id, style=self.style)
        self.widget.Bind(wx.EVT_LEFT_DOWN, self.on_set_focus)

    def finish_widget_creation(self):
        ManagedBase.finish_widget_creation(self)
        self.sel_marker.Reparent(self.parent.widget)
        #del self.properties['font']

    def __getitem__(self, key):
        if key != 'font':
            return ManagedBase.__getitem__(self, key)
        return lambda: "", lambda v: None

    def properties_changed(self, modified=None):
        EditStylesMixin.properties_changed(self, modified)
        ManagedBase.properties_changed(self, modified)
示例#54
0
class EditStaticText(ManagedBase, EditStylesMixin):
    "Class to handle wxStaticText objects"
    _PROPERTIES = ["Widget", "label", "style", "attribute"]
    PROPERTIES = ManagedBase.PROPERTIES + _PROPERTIES + ManagedBase.EXTRA_PROPERTIES
    ManagedBase.MOVE_PROPERTY(PROPERTIES, "attribute", "name")
    _PROPERTY_HELP ={"attribute":'Store instance as attribute of window class; e.g. self.label_1 = wx.StaticText(...)\n'
                                 'Without this, you can not access the label from your program.'}

    def __init__(self, name, parent, id, label, sizer, pos):
        ManagedBase.__init__(self, name, 'wxStaticText', parent, id, sizer, pos)
        EditStylesMixin.__init__(self)

        # initialise instance properties
        self.label     = np.TextProperty(label, multiline="grow")
        self.attribute = np.CheckBoxProperty(False, default_value=False)

    def create_widget(self):
        self.widget = wx.lib.stattext.GenStaticText(self.parent.widget, self.id, self.label)

    def properties_changed(self, modified):
        if not modified or "label" in modified:
            if self.widget:
                self.widget.SetLabel(self.label)
                self._set_widget_best_size()
            common.app_tree.refresh(self.node, refresh_label=True)

        EditStylesMixin.properties_changed(self, modified)
        ManagedBase.properties_changed(self, modified)
示例#55
0
    def __init__(self, name, parent, label, pos):
        # Initialise parent classes
        ManagedBase.__init__(self, name, 'wxButton', parent, pos)
        EditStylesMixin.__init__(self)
        BitmapMixin.__init__(self)

        # initialise instance properties
        self.label     = np.TextProperty(label, default_value="", multiline="grow")
        self.default   = np.CheckBoxProperty(False, default_value=False)
        self.stockitem = np.ListBoxPropertyD(self.STOCKITEMS[0], choices=self.STOCKITEMS)

        self.bitmap          = np.BitmapPropertyD(min_version=(3,0))
        self.disabled_bitmap = np.BitmapPropertyD(min_version=(3,0))
        self.pressed_bitmap  = np.BitmapPropertyD(min_version=(3,0))
        self.current_bitmap  = np.BitmapPropertyD(min_version=(3,0))
        self.focus_bitmap    = np.BitmapPropertyD(min_version=(3,0))
示例#56
0
 def create_properties(self):
     ManagedBase.create_properties(self)
     panel = wx.Panel(self.notebook, -1)
     self.properties["bitmap"].display(panel)
     self.properties["disabled_bitmap"].display(panel)
     self.properties["default"].display(panel)
     self.properties["style"].display(panel)
     szr = wx.BoxSizer(wx.VERTICAL)
     szr.Add(self.properties["bitmap"].panel, 0, wx.EXPAND)
     szr.Add(self.properties["disabled_bitmap"].panel, 0, wx.EXPAND)
     szr.Add(self.properties["default"].panel, 0, wx.EXPAND)
     szr.Add(self.properties["style"].panel, 0, wx.EXPAND)
     panel.SetAutoLayout(True)
     panel.SetSizer(szr)
     szr.Fit(panel)
     self.notebook.AddPage(panel, "Widget")
示例#57
0
 def create_properties(self):
     ManagedBase.create_properties(self)
     panel = wx.Panel(self.notebook, -1)
     self.properties['bitmap'].display(panel)
     self.properties['disabled_bitmap'].display(panel)
     self.properties['default'].display(panel)
     self.properties['style'].display(panel)
     szr = wx.BoxSizer(wx.VERTICAL)
     szr.Add(self.properties['bitmap'].panel, 0, wx.EXPAND)
     szr.Add(self.properties['disabled_bitmap'].panel, 0, wx.EXPAND)
     szr.Add(self.properties['default'].panel, 0, wx.EXPAND)
     szr.Add(self.properties['style'].panel, 0, wx.EXPAND)
     panel.SetAutoLayout(True)
     panel.SetSizer(szr)
     szr.Fit(panel)
     self.notebook.AddPage(panel, 'Widget')
示例#58
0
 def __init__(self,
              name,
              parent,
              id,
              sizer,
              pos,
              property_window,
              show=True,
              style=wx.TR_HAS_BUTTONS | wx.SUNKEN_BORDER):
     ManagedBase.__init__(self,
                          name,
                          'wxTreeCtrl',
                          parent,
                          id,
                          sizer,
                          pos,
                          property_window,
                          show=show)
     self.style = style
     self.access_functions['style'] = (self.get_style, self.set_style)
     # style property
     self.style_pos = (wx.TR_HAS_BUTTONS, wx.TR_NO_LINES,
                       wx.TR_LINES_AT_ROOT, wx.TR_EDIT_LABELS,
                       wx.TR_MULTIPLE, wx.TR_NO_BUTTONS,
                       wx.TR_TWIST_BUTTONS, wx.TR_FULL_ROW_HIGHLIGHT,
                       wx.TR_HIDE_ROOT, wx.TR_ROW_LINES,
                       wx.TR_HAS_VARIABLE_ROW_HEIGHT, wx.TR_SINGLE,
                       wx.TR_MULTIPLE, wx.TR_EXTENDED, wx.TR_DEFAULT_STYLE,
                       wx.SIMPLE_BORDER, wx.DOUBLE_BORDER, wx.SUNKEN_BORDER,
                       wx.RAISED_BORDER, wx.STATIC_BORDER, wx.NO_BORDER,
                       wx.WANTS_CHARS, wx.NO_FULL_REPAINT_ON_RESIZE,
                       wx.FULL_REPAINT_ON_RESIZE)
     style_labels = ('#section#' + _('Style'), 'wxTR_HAS_BUTTONS',
                     'wxTR_NO_LINES', 'wxTR_LINES_AT_ROOT',
                     'wxTR_EDIT_LABELS', 'wxTR_MULTIPLE', 'wxTR_NO_BUTTONS',
                     'wxTR_TWIST_BUTTONS', 'wxTR_FULL_ROW_HIGHLIGHT',
                     'wxTR_HIDE_ROOT', 'wxTR_ROW_LINES',
                     'wxTR_HAS_VARIABLE_ROW_HEIGHT', 'wxTR_SINGLE',
                     'wxTR_MULTIPLE', 'wxTR_EXTENDED', 'wxTR_DEFAULT_STYLE',
                     'wxSIMPLE_BORDER', 'wxDOUBLE_BORDER',
                     'wxSUNKEN_BORDER', 'wxRAISED_BORDER',
                     'wxSTATIC_BORDER', 'wxNO_BORDER', 'wxWANTS_CHARS',
                     'wxNO_FULL_REPAINT_ON_RESIZE',
                     'wxFULL_REPAINT_ON_RESIZE')
     self.properties['style'] = CheckListProperty(self, 'style', None,
                                                  style_labels)
     self._item_with_name = None
示例#59
0
    def __init__(self, name, parent, label, pos):
        "Class to handle wxCheckBox objects"
        ManagedBase.__init__(self, name, 'wxCheckBox', parent, pos)
        EditStylesMixin.__init__(self)

        # initialise instance properties
        self.label = np.TextProperty("", multiline="grow")

        # value: Checkbox state (0 = unchecked, 1 = checked, 2 = undetermined)
        values = [0, 1, 2]
        labels = [_('Unchecked'), _('Checked'), _('Undetermined')]
        self.value = np.IntRadioProperty(0,
                                         values,
                                         labels,
                                         columns=3,
                                         default_value=0,
                                         name="checked")  # rename to value?
示例#60
0
 def __init__(self, name, parent, id, orientation, sizer, pos,
              property_window, show=True):
     """\
     Class to handle wxStaticLine objects
     """
     self.orientation = orientation
     self.attribute = True
     ManagedBase.__init__(self, name, 'wxStaticLine', parent, id, sizer,
                          pos, property_window, show=show)
     self.access_functions['style'] = (self.get_orientation,
                                       self.set_orientation)
     def set_attribute(v): self.attribute = int(v)
     self.access_functions['attribute'] = (lambda : self.attribute,
                                           set_attribute)
     self.properties['style'] = HiddenProperty(self, 'style', label=_("style"))
     self.properties['attribute'] = CheckBoxProperty(
         self, 'attribute', None, _('Store as attribute'), write_always=True)
     self.removed_p = self.properties['font']