コード例 #1
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
コード例 #2
0
    def __init__(self, name, parent, label, pos):
        # Initialise parent classes
        ManagedBase.__init__(self, name, 'wxHyperlinkCtrl', parent, 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)
コード例 #3
0
    def __init__(self, name, parent, index, label):
        # Initialise parent classes
        ManagedBase.__init__(self, name, parent, index)
        EditStylesMixin.__init__(self)

        # initialise instance properties
        self.label = np.TextProperty(label, multiline="grow")
        self.url   = np.TextProperty("")
        self.attribute = np.CheckBoxProperty(False, default_value=False)
コード例 #4
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)
コード例 #5
0
ファイル: text_ctrl.py プロジェクト: kilarionov/GUI_Examples
    def __init__(self, name, parent, id, sizer, pos):
        # initialize base classes
        ManagedBase.__init__(self, name, 'wxTextCtrl', parent, id, sizer, pos)
        EditStylesMixin.__init__(self)

        # initialize instance properties
        self.value = np.TextProperty("", multiline=True)
コード例 #6
0
    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)
コード例 #7
0
ファイル: text_ctrl.py プロジェクト: wxGlade/wxGlade
    def __init__(self, name, parent, index):
        # initialize base classes
        ManagedBase.__init__(self, name, parent, index)
        EditStylesMixin.__init__(self)

        # initialize instance properties
        self.value = np.TextProperty("", multiline="grow")
コード例 #8
0
    def __init__(self, name, parent, label, pos):
        ManagedBase.__init__(self, name, 'wxRadioButton', parent, pos)
        EditStylesMixin.__init__(self)

        # initialise instance properties
        self.label   = np.TextProperty("", multiline="grow")
        self.clicked = np.CheckBoxProperty(False, default_value=False)
コード例 #9
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
コード例 #10
0
    def __init__(self, name, parent, index, label=""):
        ManagedBase.__init__(self, name, parent, index)
        EditStylesMixin.__init__(self)

        # initialise instance properties
        self.label   = np.TextProperty(label, multiline="grow")
        self.clicked = np.CheckBoxProperty(False, default_value=False)
コード例 #11
0
    def __init__(self, name, parent, index, label):
        # Initialise parent classes
        ManagedBase.__init__(self, name, parent, index)
        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))

        values = [wx.LEFT, wx.RIGHT, wx.TOP, wx.BOTTOM]
        aliases = ["wxLEFT", "wxRIGHT", "wxTOP", "wxBOTTOM"]
        p = self.bitmap_dir = np.RadioProperty(wx.LEFT,
                                               values,
                                               columns=4,
                                               aliases=aliases,
                                               default_value=wx.LEFT)
        p.min_version = (3, 0)
        p.blocked = True
コード例 #12
0
 def __init__(self, name, klass, parent, id, title=None):
     WindowBase.__init__(self, name, klass, parent, id)
     self._oldname = name
     self.has_title = "title" in self.PROPERTIES
     if self.has_title:
         self.title = np.TextProperty(title or self.name)
     self.sizer = None  # sizer that controls the layout of the children of the window
     PreviewMixin.__init__(self)
コード例 #13
0
ファイル: toggle_button.py プロジェクト: ledudu/wxGlade
    def __init__(self, name, parent, id, label, sizer, pos):
        ManagedBase.__init__(self, name, 'wxToggleButton', parent, id, sizer,
                             pos)
        EditStylesMixin.__init__(self)

        # initialise instance variable
        self.label = np.TextProperty("", multiline="grow")
        self.value = np.CheckBoxProperty(False, default_value=False)
コード例 #14
0
ファイル: static_text.py プロジェクト: sohanipatel/wxGlade
    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)
コード例 #15
0
ファイル: button.py プロジェクト: ledudu/wxGlade
    def __init__(self, name, parent, id, label, sizer, pos):
        # Initialise parent classes
        ManagedBase.__init__(self, name, 'wxButton', parent, id, sizer, pos)
        EditStylesMixin.__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.ComboBoxPropertyD(self.STOCKITEMS[0],
                                              choices=self.STOCKITEMS)
コード例 #16
0
 def __init__(self, name, klass, parent, id, title=None):
     WindowBase.__init__(self, name, klass, parent, id)
     self._oldname = name
     self.has_title = "title" in self.PROPERTIES
     if self.has_title:
         if title is None: title = self.name
         self.title = np.TextProperty(title)
     self.sizer = None  # sizer that controls the layout of the children of the window
     PreviewMixin.__init__(self)
     self.design = DesignButtonProperty(self.on_design_button)
コード例 #17
0
    def __init__(self, name, parent, id, label, sizer, pos):
        ManagedBase.__init__(self, name, 'wxRadioButton', parent, id, sizer, pos)
        EditStylesMixin.__init__(self)

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

        if config.preferences.default_border:
            self.border.set( config.preferences.default_border_size )
            self.flag.set( wx.ALL )
コード例 #18
0
ファイル: search_ctrl.py プロジェクト: 2050utopia/wxGlade
    def __init__(self, name, parent, pos):
        # initialize base classes
        ManagedBase.__init__(self, name, 'wxSearchCtrl', parent, pos)
        EditStylesMixin.__init__(self)

        # initialize instance properties
        self.value = np.TextProperty("")
        self.descriptive_text = np.TextPropertyD("Search", default_value="")
        self.search_button = np.CheckBoxProperty(True, default_value=True)
        self.cancel_button = np.CheckBoxProperty(True, default_value=True)
        self.max_length = np.SpinPropertyD(80, val_range=(1,1000), default_value=-1)
コード例 #19
0
    def __init__(self, name, parent, index, label=""):
        "Class to handle wxCheckBox objects"
        ManagedBase.__init__(self, name, parent, index)
        EditStylesMixin.__init__(self)

        # initialise instance properties
        self.label = np.TextProperty(label, 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?
コード例 #20
0
ファイル: toggle_button.py プロジェクト: 2050utopia/wxGlade
    def __init__(self, name, parent, label, pos):
        ManagedBase.__init__(self, name, 'wxToggleButton', parent, pos)
        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))
コード例 #21
0
    def __init__(self, name, parent, id, sizer, pos):
        # initialize base classes
        ManagedBase.__init__(self, name, 'wxTextCtrl', parent, id, sizer, pos)
        EditStylesMixin.__init__(self)

        # initialize instance properties
        self.value = np.TextProperty("", multiline=True)

        if config.preferences.default_border:
            # modify default values  XXX should this be moved somewhere else or dropped?
            self.properties["border"].set(
                config.preferences.default_border_size)
            self.properties["flag"].set(wx.ALL)
コード例 #22
0
    def __init__(self, name, klass, parent, id, custom_class=True):
        np.PropertyOwner.__init__(self)
        # initialise instance logger
        self._logger = logging.getLogger(self.__class__.__name__)

        # initialise instance
        self.parent = parent
        self.id = id  # id used for internal purpose events

        # initialise instance properties
        self.name = name_p = np.NameProperty(name)
        self.klass = klass_p = np.TextProperty(
            klass, name="class"
        )  # Name of the object's class: read/write or read only
        if not custom_class: klass_p.readonly = True
        # validation for class
        klass_p.validation_re = re.compile(r'^[a-zA-Z_]+[\w:.0-9-]*$')

        # Name of object's wxWidget class; base and klass are mostly the same, except e.g. wxDialog:
        self.base = np.TextProperty(klass, "base")
        # If true, the user can change the value of the 'class' property:
        self.custom_class = custom_class

        if getattr(self, '_custom_base_classes', False):
            self.custom_base = np.TextPropertyD("", multiline=False)
        else:
            self.custom_base = None

        self.extracode = cp.CodePropertyD()  # code property
        self.extraproperties = cp.ExtraPropertiesProperty()

        self.widget = None  # this is the reference to the actual wxWindow widget, created when required
        self._rmenu = None  # popup menu
        self._dont_destroy = False

        EventsMixin.__init__(self)
コード例 #23
0
ファイル: button.py プロジェクト: miguelmhs/wxGlade
    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))
コード例 #24
0
ファイル: button.py プロジェクト: NonPlayerCtrl/FreePLC_IDE
    def __init__(self, name, parent, id, label, sizer, pos):
        # Initialise parent classes
        ManagedBase.__init__(self, name, 'wxButton', parent, id, sizer, pos)
        EditStylesMixin.__init__(self)

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

        if config.preferences.default_border:
            self.border.set(config.preferences.default_border_size)
            self.flag.set(wx.ALL)
コード例 #25
0
ファイル: checkbox.py プロジェクト: NonPlayerCtrl/FreePLC_IDE
    def __init__(self, name, parent, id, label, sizer, pos):
        "Class to handle wxCheckBox objects"
        ManagedBase.__init__(self, name, 'wxCheckBox', parent, id, sizer, pos)
        EditStylesMixin.__init__(self)

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

        # 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?

        if config.preferences.default_border:
            self.border.set(config.preferences.default_border_size)
            self.flag.set(wx.ALL)