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
def __init__(self, name, klass, parent, id): EditBase.__init__(self, name, klass, parent, id) self.window_id = np.TextPropertyD("wxID_ANY", name="id", default_value=None) self.size = np.SizePropertyD("-1, -1", default_value="-1, -1") self.sel_marker = None # selection markers (a SelectionMarker instance) # background, foreground, font properties # their actual values will be stored/modified after widget creation in 'finish_widget_creation' # before that, the actual values will be stored in this dict from the actual values of the widget: self._original = {'font': None} # colors self.background = np.ColorPropertyD(None) self.foreground = np.ColorPropertyD(None) # font if "font" in self.PROPERTIES: self._font_changed = False # this is True if the user has selected a custom font if config.use_gui: font = self._build_from_font( compat.wx_SystemSettings_GetFont(wx.SYS_DEFAULT_GUI_FONT)) font[1] = 'default' else: font = (9, 'default', 'normal', 'normal', 0, 'Segoe UI') self.font = np.FontPropertyD(tuple(font)) # tooltip, focused, hiden self.tooltip = np.TextPropertyD(multiline="grow") self.disabled = np.CheckBoxProperty(False, default_value=False) self.focused = np.CheckBoxProperty(False, default_value=False) self.hidden = np.CheckBoxProperty(False, default_value=False)
def __init__(self, name, parent, id, title, style=wx.DEFAULT_DIALOG_STYLE, klass='wxDialog'): TopLevelBase.__init__(self, name, klass, parent, id, title=title) self.properties["base"].set('wxDialog') EditStylesMixin.__init__(self) # initialise instance properties self.icon = np.FileNamePropertyD("", default_value="") self.centered = np.CheckBoxProperty(False) self.sizehints = np.CheckBoxProperty(False)
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)
def __init__(self, name, parent, klass, title, style=wx.DEFAULT_FRAME_STYLE): #XXX style is not used TopLevelBase.__init__(self, name, parent, klass, title) EditStylesMixin.__init__(self) self.properties["style"].set(style) # initialise instance properties self.icon = np.BitmapPropertyD("") self.centered = np.CheckBoxProperty(False, default_value=False) self.sizehints = np.CheckBoxProperty(False, default_value=False) self.menubar = BarProperty("MenuBar") self.toolbar = BarProperty("ToolBar") if "statusbar" in self.PROPERTIES: # not for MDIChildFrame self.statusbar = BarProperty("StatusBar")
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
def __init__(self, style='wxTAB_TRAVERSAL'): "Class to handle wxPanel objects" # initialise instance logger self._logger = logging.getLogger(self.__class__.__name__) # initialise instance EditStylesMixin.__init__(self, 'wxPanel') self.top_sizer = None # sizer to handle the layout of children # initialise properties self.no_custom_class = np.CheckBoxProperty(False, default_value=False) self.scrollable = np.CheckBoxProperty(False, default_value=False) self.scroll_rate = np.ScrollRatePropertyD("10, 10") if style: self.properties["style"].set(style)
def __init__(self, style='wxTAB_TRAVERSAL'): "Class to handle wxPanel objects" # initialise instance logger self._logger = logging.getLogger(self.__class__.__name__) # initialise instance EditStylesMixin.__init__(self, 'wxPanel') # initialise properties self.no_custom_class = np.CheckBoxProperty(False, default_value=False) self.scrollable = np.CheckBoxProperty(False, default_value=False) self.scroll_rate = prop = np.IntPairPropertyD("10, 10") prop.set_blocked(True) if style: self.properties["style"].set(style)
def __init__(self, name, parent, index, bmp_file): ManagedBase.__init__(self, name, parent, index) EditStylesMixin.__init__(self) # initialise instance properties self.bitmap = np.BitmapProperty(bmp_file) self.attribute = np.CheckBoxProperty(False, default_value=False)
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)
def __init__(self, name, parent, klass, title, style=wx.DEFAULT_DIALOG_STYLE): TopLevelBase.__init__(self, name, parent, klass, title) EditStylesMixin.__init__(self) self.properties["style"].set(style) # initialise instance properties self.icon = np.BitmapPropertyD("") self.affirmative = AffirmativePropertyD("", default_value="OK") self.escape = AffirmativePropertyD("", default_value="CANCEL") self.centered = np.CheckBoxProperty(False, default_value=False) self.sizehints = np.CheckBoxProperty(False, default_value=False)
def __init__(self, name, parent, index, style): ManagedBase.__init__(self, name, parent, index) EditStylesMixin.__init__(self) # initialise instance properties self.attribute = np.CheckBoxProperty(False, default_value=False) if style: self.properties["style"].set(style)
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])
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 __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)
def __init__(self, name, parent, pos): # Initialise parent classes ManagedBase.__init__(self, name, 'wxCalendarCtrl', parent, pos) EditStylesMixin.__init__(self) # initialise instance properties self.default = np.CheckBoxProperty(False, default_value=False)
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)
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 __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
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 __init__(self, name, parent, bmp_file, pos): ManagedBase.__init__(self, name, 'wxStaticBitmap', parent, 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.BitmapProperty(bmp_file) self.attribute = np.CheckBoxProperty(False, default_value=False)
def __init__(self, style='wxTAB_TRAVERSAL'): "Class to handle wxPanel objects" EditStylesMixin.__init__(self, style, 'wxPanel') # initialise properties self.scrollable = np.CheckBoxProperty(False, default_value=False) self.scroll_rate = prop = np.IntPairPropertyD( "10, 10" ) prop.set_blocked(True)
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)
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)
def __init__(self, name, parent, id, title, style=wx.DEFAULT_FRAME_STYLE, klass='wxFrame'): #XXX style is not used TopLevelBase.__init__(self, name, klass, parent, id, title=title) self.base = 'wxFrame' EditStylesMixin.__init__(self) self.properties["style"].set(style) # initialise instance properties self.icon = np.BitmapPropertyD("") self.centered = np.CheckBoxProperty(False, default_value=False) self.sizehints = np.CheckBoxProperty(False, default_value=False) self.menubar = np.CheckBoxProperty(False, default_value=False) self.toolbar = np.CheckBoxProperty(False, default_value=False) if "statusbar" in self.PROPERTIES: self.statusbar = np.CheckBoxProperty(False, default_value=False) self._statusbar = None else: self.statusbar = None self._menubar = self._toolbar = None # these properties will hold the EditMenubar instances etc.
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)
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)
def __init__(self, name, parent, index, style): ManagedBase.__init__(self, name, parent, index) EditStylesMixin.__init__(self, style) # 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)
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 )
def __init__(self, name, parent, bmp_file, pos): ManagedBase.__init__(self, name, 'wxBitmapButton', parent, pos) EditStylesMixin.__init__(self) BitmapMixin.__init__(self) # initialise instance properties self.bitmap = np.BitmapProperty(bmp_file) self.disabled_bitmap = np.BitmapPropertyD("") 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)) self.default = np.CheckBoxProperty(False, default_value=False)