예제 #1
0
 def __init__(self):
     np.PropertyOwner.__init__(self)
     self.proportion = np.LayoutProportionProperty(0)
     self.span = np.LayoutSpanProperty((1, 1))
     self.border = np.SpinProperty(0)
     self.flag = np.ManagedFlags(None)
     self.pos = np.SpinProperty(None)
예제 #2
0
    def __init__(self, name, parent, width, height, pos):
        #ManagedBase.__init__(self, 'spacer', 'spacer', parent, pos)
        ManagedBase.__init__(self, 'spacer', 'spacer', parent, pos)

        # initialise instance properties
        self.width = np.SpinProperty(width, immediate=True)
        self.height = np.SpinProperty(height, immediate=True)
예제 #3
0
    def __init__(self, name, parent, id, label, choices, major_dim, style,
                 sizer, pos):
        "Class to handle wxRadioBox objects"
        ManagedBase.__init__(self, name, 'wxRadioBox', parent, id, sizer, pos)
        self.static_box = None

        # initialise instance properties
        self.label = np.TextProperty("", multiline=True, fixed_height=True)
        self.dimension = np.SpinProperty(major_dim)
        self.selection = np.SpinProperty(0,
                                         val_range=(0, len(choices) - 1),
                                         immediate=True)
        self.choices = ChoicesProperty(choices,
                                       [(_('Label'), np.GridProperty.STRING)])
        style = style or wx.RA_SPECIFY_ROWS
        styles = [wx.RA_SPECIFY_ROWS, wx.RA_SPECIFY_COLS]
        aliases = ["wxRA_SPECIFY_ROWS",
                   "wxRA_SPECIFY_COLS"]  # labels and aliases
        self.style = np.RadioProperty(style,
                                      styles,
                                      aliases,
                                      aliases=aliases,
                                      columns=2)

        self.buttons = None  # list of wx.RadioButton
예제 #4
0
    def __init__(self):
        np.PropertyOwner.__init__(self)
        self._logger = logging.getLogger(self.__class__.__name__)

        self.__saved    = True  # raw value for self.saved property; if True, there are no changes to save
        self.__filename = None  # raw value for the self.filename property; Name of the output XML file

        # initialise instance properties
        self.is_template = np.Property(False)  # hidden property
        # name and derived class name, including validation
        self.name  = np.TextPropertyA("app",   default_value="")
        self.klass = np.TextPropertyA("MyApp", default_value="", name="class")
        self.properties["name"].validation_re = re.compile(r'^[a-zA-Z]+[\w0-9-]*$')
        self.properties["class"].validation_re = re.compile(r'^[a-zA-Z]+[\w:.0-9-]*$')

        # generate separate file for each class?
        labels   = [_("Single file"),                       _("Separate file for each class") ]
        tooltips = [_("Write all source code in one file"), _("Split source code in one file per class / widget") ]
        self.multiple_files = np.RadioProperty( config.default_multiple_files,
                                                values=[0,1], labels=labels, tooltips=tooltips )

        # code indentation: mode and count
        self.indent_mode   = np.RadioProperty( 1, [0,1], ["Tabs","Spaces"], aliases=["tab","space"], columns=2 )
        self.indent_amount = np.SpinProperty( config.default_indent_amount, val_range=(1, 100) )
        # C++ file extension
        self.source_extension = np.TextProperty('cpp')
        self.header_extension = np.TextProperty('h')
        # output path
        output_path = config.default_output_path  if self.multiple_files else  config.default_output_file
        self.output_path = np.FileNameProperty(output_path, style=wx.FD_SAVE|wx.FD_OVERWRITE_PROMPT)
        self._update_output_path('python')

        self.overwrite = np.InvCheckBoxProperty(config.default_overwrite)
        # YYY 
        self.mark_blocks = np.CheckBoxProperty(True)

        # output language
        languages = sorted( common.code_writers.keys() )
        labels = [misc.capitalize(s) for s in languages]
        self.language = np.RadioProperty('python', languages, labels, columns=3)

        # gettext?
        self.use_gettext = np.CheckBoxProperty(config.default_use_gettext)
        # wx Version: string of major dot minor version number
        version = "%d.%d"%compat.version
        if not version in self.all_supported_versions:
            version = "2.8"  if version[0]=="2" else  "3.0"
        self.for_version = np.RadioProperty( version, self.all_supported_versions, tooltips=self._VERSION_TOOLTIPS)

        # encoding
        encodings = ["UTF-8", "ISO-8859-1", "ISO-8859-15", "CP1252"]  # just some common values
        self.encoding = np.ComboBoxProperty(config.default_encoding, encodings)

        # top window name for the generated app
        self.top_window = prop = np.ListBoxProperty("", choices=[])
        prop.auto_activated = True
        self.generate_code = np.ActionButtonProperty(self.generate_code)

        self.widget = None  # always None, just to keep interface to Tree similar to other editors
        self.node = None
예제 #5
0
    def __init__(self, name, parent, index, choices):
        ManagedBase.__init__(self, name, parent, index)
        EditStylesMixin.__init__(self)

        # initialise instance properties
        self.selection = np.SpinProperty(-1, val_range=len(choices)-1, immediate=True )
        self.choices   = ChoicesProperty( choices, [(_('Label'), np.GridProperty.STRING)] )
예제 #6
0
 def __init__(self, name, parent, index, style=wx.LC_REPORT | wx.BORDER_SUNKEN):
     ManagedBase.__init__(self, name, parent, index)
     EditStylesMixin.__init__(self, 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"]
예제 #7
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])
예제 #8
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)
예제 #9
0
    def __init__(self, name, parent, id, choices, sizer, pos):
        ManagedBase.__init__(self, name, 'wxCheckListBox', parent, id, sizer, pos)
        EditStylesMixin.__init__(self)

        # initialise instance properties
        self.selection = np.SpinProperty(-1, val_range=len(choices)-1, default_value=-1, immediate=True )
        self.choices   = ChoicesProperty( choices, [(_('Label'), np.GridProperty.STRING)] )
예제 #10
0
파일: gauge.py 프로젝트: wxGlade/wxGlade
    def __init__(self, name, parent, index, style):
        ManagedBase.__init__(self, name, parent, index)
        EditStylesMixin.__init__(self)
        if style: self.properties["style"].set(style)

        # initialise instance properties
        self.range = np.SpinProperty(10, val_range=(0,10000000), immediate=True)
예제 #11
0
    def __init__(self, name, parent, id, sizer, pos):
        "Class to handle wxGrid objects"
        ManagedBase.__init__(self, name, 'wxGrid', parent, id, sizer, pos)

        # instance properties
        self.create_grid = np.CheckBoxProperty(True)
        columns = [['A', '-1'], ['B', '-1'], ['C', '-1']]
        self.columns = GridColsProperty(columns,
                                        [('Label', np.GridProperty.STRING),
                                         ('Size', np.GridProperty.INT)])
        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)
예제 #12
0
    def __init__(self, name, parent, id, style, sizer, pos):
        ManagedBase.__init__(self, name, 'wxGauge', parent, id, sizer, pos)
        EditStylesMixin.__init__(self)

        # initialise instance properties
        self.range = np.SpinProperty(10,
                                     val_range=(0, 10000000),
                                     immediate=True)
예제 #13
0
파일: choice.py 프로젝트: zhanggvi/wxGlade
    def __init__(self, name, parent, id, choices, sizer, pos):
        ManagedBase.__init__(self, name, 'wxChoice', parent, id, sizer, pos)

        # initialise instance properties
        self.selection = np.SpinProperty(0,
                                         val_range=(-1, len(choices) - 1),
                                         immediate=True)
        self.choices = ChoicesProperty(choices,
                                       [(_('Label'), np.GridProperty.STRING)])
예제 #14
0
 def __init__(self,
              name,
              parent,
              pos,
              style=wx.LC_REPORT | wx.BORDER_SUNKEN):
     ManagedBase.__init__(self, name, 'wxListCtrl', parent, pos)
     EditStylesMixin.__init__(self)
     if style: self.properties["style"].set(style)
     self.columns = GridColsProperty([])
     self.rows_number = np.SpinProperty(0, immediate=True, default_value=0)
예제 #15
0
    def __init__(self, name, parent, id, choices, sizer, pos):
        ManagedBase.__init__(self, name, 'wxComboBox', parent, id, sizer, pos)
        EditStylesMixin.__init__(self)

        # initialise instance properties
        self.selection = np.SpinProperty(0, val_range=len(choices)-1, immediate=True )
        self.choices = ChoicesProperty( choices, [(_('Label'), np.GridProperty.STRING)] )

        if config.preferences.default_border:
            self.border.set( config.preferences.default_border_size )
            self.flag.set( wx.ALL )
예제 #16
0
    def __init__(self, name, klass, parent, id, sizer, pos):
        WindowBase.__init__(self, name, klass, parent, id)
        # if True, the user is able to control the layout of the widget
        # inside the sizer (proportion, borders, alignment...)
        self._has_layout = not sizer.is_virtual()

        self.sel_marker = None  # selection markers (a SelectionMarker instance)

        # attributes to keep the values of the sizer properties
        self.pos = np.LayoutPosProperty(
            pos, sizer)  # position within the sizer, 1-based
        self.proportion = np.SpinProperty(
            0, name="option",
            immediate=True)  # item growth in sizer main direction
        self.border = np.SpinProperty(0, immediate=True)  # border width
        self.flag = np.ManagedFlags(
            wx.ADJUST_MINSIZE)  # alignment, border; expansion in other dir.

        self.sizer = sizer
        sizer.add_item(self, pos)
예제 #17
0
 def __init__(self):
     np.PropertyOwner.__init__(self)
     self.proportion = np.SpinProperty(0, name="option")
     self.border = np.SpinProperty(0)
     self.flag = np.ManagedFlags(None)
     self.pos = np.SpinProperty(None)
예제 #18
0
    def __init__(self, parent, index, width, height):
        ManagedBase.__init__(self, 'spacer', parent, index)

        # initialise instance properties
        self.width = np.SpinProperty(width, immediate=True)
        self.height = np.SpinProperty(height, immediate=True)