Package XPyTools :: Package codetpl :: Module guiCodeTpl :: Class CodeTplManagerDlg
[hide private]
[frames] | no frames]

Class CodeTplManagerDlg

source code

     object --+                    
              |                    
wx._core.Object --+                
                  |                
wx._core.EvtHandler --+            
                      |            
        wx._core.Window --+        
                          |        
 wx._windows.TopLevelWindow --+    
                              |    
             wx._windows.Dialog --+
                                  |
                                 CodeTplManagerDlg

Dialog, main window of gui templates.

For you may specify (set befor calling ShowModal() dialog method) self.language and self.srcfile and self.init_name for default language and source file for which called template.

For setting of srcfile and language take effect you must call self.ReloadCtrls before calling show dialog.

init_name - currently not work properly, but after fix in future must select toolbar tool as here given.

For initialize this dialog you must additionaly get for parameters codetpl.CodeTemplateMngr instance.

Instance Methods [hide private]
 
_init_coll_bsMiddleRightTop_Items(self, parent) source code
 
_init_coll_bsMiddleRight_Items(self, parent) source code
 
_init_coll_bsMiddleRightTopLeft_Items(self, parent) source code
 
_init_coll_bsTopSizer_Items(self, parent) source code
 
_init_coll_bsMiddleLeft_Items(self, parent) source code
 
_init_coll_bsMiddleRightTopRight_Items(self, parent) source code
 
_init_coll_bsMiddleSizer_Items(self, parent) source code
 
_init_sizers(self) source code
 
_init_ctrls(self, prnt) source code
 
__init__(self, parent, ctm)
__init__(self, Window parent, int id=-1, String title=EmptyString, ...
source code
 
ReloadToolbar(self)
Reload toolbars buttons and etc.
source code
 
ReloadCtrls(self)
Reload controls content.
source code
 
ReloadCtrls2(self)
Reload controls.
source code
 
ClearGrid(self)
Clear grid.
source code
 
FillGrid(self)
You must clear grid if need by calling self.ClearGrid.
source code
str
ValidateTxt(self, txt)
Validate with whole templates name and partial.
source code
 
Preview(self)
Fill controls for priview.
source code
 
OnToolBarTabCodeTool(self, event)
Toolbar events handler.
source code
 
OnChoiceSelected(self, event)
Language changed.
source code
 
OntreeTplNamesSelChanged(self, treeevent)
Tree selection changed.
source code
 
OntxtTplNameText(self, event=None)
Validate input to existing templates.
source code
 
OntxtTplNameChar(self, keyevent) source code
 
OntxtTplNameEnter(self, event)
Enter pressed, work for templates and end modal.
source code
 
DoAction(self)
Call handler for working with selected template.
source code
 
OngridCellChange(self, gridevent)
Field value changed event.
source code
 
OnOk(self, event)
Okey event/button.
source code
 
OnCancel(self, event)
Cancel event/button.
source code
 
OnActivate(self, event)
Try select tool then window activated.
source code
 
toolhandlerdefault(self)
Default tool handler.
source code

Inherited from wx._windows.Dialog: Create, CreateButtonSizer, CreateSeparatedButtonSizer, CreateStdDialogButtonSizer, CreateTextSizer, EndModal, GetAffirmativeId, GetEscapeId, GetReturnCode, IsModal, SetAffirmativeId, SetEscapeId, SetReturnCode, ShowModal

Inherited from wx._windows.Dialog (private): _CreateButtonSizer

Inherited from wx._windows.TopLevelWindow: CenterOnScreen, CentreOnScreen, EnableCloseButton, GetDefaultItem, GetIcon, GetTitle, GetTmpDefaultItem, Iconize, IsActive, IsAlwaysMaximized, IsFullScreen, IsIconized, IsMaximized, MacGetMetalAppearance, MacGetUnifiedAppearance, MacSetMetalAppearance, Maximize, RequestUserAttention, Restore, SetDefaultItem, SetIcon, SetIcons, SetShape, SetTitle, SetTmpDefaultItem, ShowFullScreen, __repr__

Inherited from wx._core.Window: AcceptsFocus, AcceptsFocusFromKeyboard, AddChild, AdjustForLayoutDirection, AssociateHandle, CacheBestSize, CanSetTransparent, CaptureMouse, Center, CenterOnParent, Centre, CentreOnParent, ClearBackground, ClientToScreen, ClientToScreenXY, Close, ConvertDialogPointToPixels, ConvertDialogSizeToPixels, ConvertPixelPointToDialog, ConvertPixelSizeToDialog, DLG_PNT, DLG_SZE, Destroy, DestroyChildren, Disable, DissociateHandle, DragAcceptFiles, Enable, FindWindowById, FindWindowByName, Fit, FitInside, Freeze, GetAcceleratorTable, GetAdjustedBestSize, GetAutoLayout, GetBackgroundColour, GetBackgroundStyle, GetBestFittingSize, GetBestSize, GetBestSizeTuple, GetBestVirtualSize, GetBorder, GetCaret, GetCharHeight, GetCharWidth, GetChildren, GetClientAreaOrigin, GetClientRect, GetClientSize, GetClientSizeTuple, GetConstraints, GetContainingSizer, GetCursor, GetDefaultAttributes, GetDropTarget, GetEffectiveMinSize, GetEventHandler, GetExtraStyle, GetFont, GetForegroundColour, GetFullTextExtent, GetGrandParent, GetGtkWidget, GetHandle, GetHelpText, GetHelpTextAtPoint, GetId, GetLabel, GetLayoutDirection, GetMaxHeight, GetMaxSize, GetMaxWidth, GetMinHeight, GetMinSize, GetMinWidth, GetName, GetParent, GetPosition, GetPositionTuple, GetRect, GetScreenPosition, GetScreenPositionTuple, GetScreenRect, GetScrollPos, GetScrollRange, GetScrollThumb, GetSize, GetSizeTuple, GetSizer, GetTextExtent, GetThemeEnabled, GetToolTip, GetTopLevelParent, GetUpdateClientRect, GetUpdateRegion, GetValidator, GetVirtualSize, GetVirtualSizeTuple, GetWindowBorderSize, GetWindowStyle, GetWindowStyleFlag, GetWindowVariant, HasCapture, HasFlag, HasMultiplePages, HasScrollbar, HasTransparentBackground, Hide, HitTest, HitTestXY, InheritAttributes, InheritsBackgroundColour, InitDialog, InvalidateBestSize, IsBeingDeleted, IsDoubleBuffered, IsEnabled, IsExposed, IsExposedPoint, IsExposedRect, IsFrozen, IsRetained, IsShown, IsShownOnScreen, IsTopLevel, Layout, LineDown, LineUp, Lower, MakeModal, Move, MoveAfterInTabOrder, MoveBeforeInTabOrder, MoveXY, Navigate, PageDown, PageUp, PopEventHandler, PopupMenu, PopupMenuXY, PostCreate, PrepareDC, PushEventHandler, Raise, Refresh, RefreshRect, RegisterHotKey, ReleaseMouse, RemoveChild, RemoveEventHandler, Reparent, ScreenToClient, ScreenToClientXY, ScrollLines, ScrollPages, ScrollWindow, SendSizeEvent, SetAcceleratorTable, SetAutoLayout, SetBackgroundColour, SetBackgroundStyle, SetBestFittingSize, SetCaret, SetClientRect, SetClientSize, SetClientSizeWH, SetConstraints, SetContainingSizer, SetCursor, SetDimensions, SetDoubleBuffered, SetDropTarget, SetEventHandler, SetExtraStyle, SetFocus, SetFocusFromKbd, SetFont, SetForegroundColour, SetHelpText, SetHelpTextForId, SetId, SetInitialSize, SetLabel, SetLayoutDirection, SetMaxSize, SetMinSize, SetName, SetOwnBackgroundColour, SetOwnFont, SetOwnForegroundColour, SetPosition, SetRect, SetScrollPos, SetScrollbar, SetSize, SetSizeHints, SetSizeHintsSz, SetSizeWH, SetSizer, SetSizerAndFit, SetThemeEnabled, SetToolTip, SetToolTipString, SetTransparent, SetValidator, SetVirtualSize, SetVirtualSizeHints, SetVirtualSizeHintsSz, SetVirtualSizeWH, SetWindowStyle, SetWindowStyleFlag, SetWindowVariant, ShouldInheritColours, Show, Thaw, ToggleWindowStyle, TransferDataFromWindow, TransferDataToWindow, UnregisterHotKey, Update, UpdateWindowUI, UseBgCol, Validate, WarpPointer

Inherited from wx._core.EvtHandler: AddPendingEvent, Bind, Connect, Disconnect, GetEvtHandlerEnabled, GetNextHandler, GetPreviousHandler, ProcessEvent, ProcessPendingEvents, SetEvtHandlerEnabled, SetNextHandler, SetPreviousHandler, Unbind

Inherited from wx._core.EvtHandler (private): _setOORInfo

Inherited from wx._core.Object: GetClassName, IsSameAs

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __str__

Static Methods [hide private]

Inherited from wx._windows.Dialog: GetClassDefaultAttributes

Inherited from wx._core.Window: FindFocus, GetCapture, NewControlId, NextControlId, PrevControlId

Class Variables [hide private]

Inherited from wx._windows.Dialog: ButtonSizerFlags

Instance Variables [hide private]
XPyTools.codetpl.codetpl.CodetemplateMngr ctm
XPyTools.codetpl.codetpl.CodetemplateMngr instance.
dict{'name' : ('type', 'desc', 'sectionname',ID)} = {} __types
Available types: its names and descriptions.
str={} __fields
Fields for passing to template function..
str = codetpl.ANY __lang
Default language for templates selection.
str = '' __type
Currently selected type (tool).
str = '' init_name
Init toolbar button name (select then show to user).
list =[str] __tpls
Templates names shown in txtTplName.
list[wx.TreeItemId] __tplsid
Templates names shown in txtTplName.
str = '' __prevval
Previous value entered into txtTplName.
bool=False __nomodtxt
If True then txtTplName not be set when tree change selection.
str = '' srcfile
Source file for use in templates.
dict = {} params
Additional parameters for templates.
str = codetpl.ANY language
Default language for templates.
str = '' result
Result from template calling.
Properties [hide private]

Inherited from wx._windows.Dialog: AffirmativeId, EscapeId, ReturnCode, thisown

Inherited from wx._windows.TopLevelWindow: DefaultItem, Icon, Title, TmpDefaultItem

Inherited from wx._core.Window: AcceleratorTable, AutoLayout, BackgroundColour, BackgroundStyle, BestSize, BestVirtualSize, Border, Caret, CharHeight, CharWidth, Children, ClientAreaOrigin, ClientRect, ClientSize, Constraints, ContainingSizer, Cursor, DefaultAttributes, DropTarget, EffectiveMinSize, Enabled, EventHandler, ExtraStyle, Font, ForegroundColour, GrandParent, GtkWidget, Handle, HelpText, Id, Label, LayoutDirection, MaxHeight, MaxSize, MaxWidth, MinHeight, MinSize, MinWidth, Name, Parent, Position, Rect, ScreenPosition, ScreenRect, Shown, Size, Sizer, ThemeEnabled, ToolTip, TopLevel, TopLevelParent, UpdateClientRect, UpdateRegion, Validator, VirtualSize, WindowStyle, WindowStyleFlag, WindowVariant

Inherited from wx._core.EvtHandler: EvtHandlerEnabled, NextHandler, PreviousHandler

Inherited from wx._core.Object: ClassName

Inherited from object: __class__

Method Details [hide private]

__init__(self, parent, ctm)
(Constructor)

source code 

__init__(self, Window parent, int id=-1, String title=EmptyString, 
    Point pos=DefaultPosition, Size size=DefaultSize, 
    long style=DEFAULT_DIALOG_STYLE, String name=DialogNameStr) -> Dialog

Parameters:
  • ctm (XPyTools.codetpl.codetpl.CodetemplateMngr) - XPyTools.codetpl.codetpl.CodetemplateMngr instance.
Overrides: wx._windows.Dialog.__init__

ReloadToolbar(self)

source code 

Reload toolbars buttons and etc.

Usualy call if CodeTemplateManager was reloaded.

ReloadCtrls(self)

source code 

Reload controls content.

1st stage: reload choiceLang.

ReloadCtrls2(self)

source code 
Reload controls. Stage 2: Reload all exclude choiceLang.

ValidateTxt(self, txt)

source code 
Validate with whole templates name and partial. For partial validation return fist equal template name.
Parameters:
  • txt (str) - Text for validation with templates name.
Returns: str
liked template name if text is valid or empty string.

Preview(self)

source code 

Fill controls for priview.

Before calling preview you must set or clear self.__fields. If need you must fill Fields grid by calling self.FillGrid.

Note: If error rised then return error message as template string.

OnToolBarTabCodeTool(self, event)

source code 

Toolbar events handler.

For all toolbar buttons (types) for preview and code calculate called toolhandler_type. By default calling toolhandlerdefault with parameter preview.

OntxtTplNameText(self, event=None)

source code 
Validate input to existing templates.

Note: event may be None if method called from code for validating.

DoAction(self)

source code 

Call handler for working with selected template.

If find method named toolbarhandler_typ, where typ - template type, then call it, else call default handler toolhandlerdefault.

OngridCellChange(self, gridevent)

source code 

Field value changed event.

Update self.__fields, and preview.

OnOk(self, event)

source code 
Okey event/button.
Returns:
1 == True.

OnCancel(self, event)

source code 
Cancel event/button.
Returns:
0 == False.

toolhandlerdefault(self)

source code 

Default tool handler.

If template function return '' then it's not needed to paste template. Usualy used for wizard, action and etc.

Instance Variable Details [hide private]

srcfile

Source file for use in templates. You may set this variable from caller.
Type:
str = ''

params

Additional parameters for templates. You may set this variable from caller.
Type:
dict = {}

language

Default language for templates. Selected by default when dialog opened. If no such lunguage then select first finded. You may set this variable from caller.
Type:
str = codetpl.ANY