Changeset 4081
- Timestamp:
- 05/12/2008 06:47:58 AM (2 months ago)
- Files:
-
- branches/ed-ide/Studio.py (modified) (6 diffs)
- branches/ed-ide/components/ClassDesigner/__init__.py (modified) (1 diff)
- branches/ed-ide/components/TextEditor/__init__.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/ed-ide/Studio.py
r4074 r4081 9 9 from dabo.dLocalize import _ 10 10 import dabo.dEvents as dEvents 11 import components 11 12 from components.ClassDesigner import ClassDesigner 12 13 from components.CxnEditor import CxnEditor … … 39 40 def onEditFile(self, evt): 40 41 if not self._context: 41 print "WASSIP with dat?"42 42 return 43 43 nd = self._context["node"] … … 47 47 48 48 49 class StudioToolBar(dabo.ui.dToolBar): 50 """Overrides the _appendInsertButton() method, so that we get actual Dabo 51 dBitmapButton or dToggleButton controls instead of the default wx.ToolBarItem 52 buttons that are difficult to work with. 53 """ 54 def _appendInsertButton(self, pos, caption, pic, bindfunc, toggle, tip, help, *args, **kwargs): 55 buttonClass = {True: dabo.ui.dToggleButton, False: dabo.ui.dBitmapButton}[toggle] 56 if not toggle: 57 kwargs["AutoSize"] = True 58 ctl = buttonClass(self, Caption=caption, Picture=pic, ToolTipText=tip, *args, **kwargs) 59 # Don't show the caption if there is an image 60 def _dyncap(obj): 61 if obj.Picture: 62 return "" 63 else: 64 return obj._caption 65 ctl.DynamicCaption = (_dyncap, ctl) 66 return self.insertControl(pos, ctl, bindfunc=bindfunc) 49 67 50 class StudioForm(dabo.ui.dSplitForm): 68 69 class StudioForm(dabo.ui.dDockForm): 51 70 def initProperties(self): 52 71 self.Caption = _("Dabo Developer Studio") … … 55 74 56 75 def afterInit(self): 57 dabo.ui.setAfter(self.Splitter, "SashPercent", 30)58 pnl1 = self.Panel159 pnl1.Sizer.Orientation = "v"60 btn = dabo.ui.dButton( pnl1, Caption="Open Project", OnHit=self.onOpenProject)61 pnl1.Sizer.append(btn, halign="center", border=30)62 self.tree = ProjectTree( pnl1)76 treePnl = self.projectTreePanel = self.addPanel(Caption=_("Projects"), Docked=True, 77 DockSide="Left", ShowPinButton=True) 78 sz = self.projectTreePanel.Sizer = dabo.ui.dSizer("v") 79 btn = dabo.ui.dButton(treePnl, Caption="Open Project", OnHit=self.onOpenProject) 80 sz.append(btn, halign="center", border=30) 81 self.tree = ProjectTree(treePnl) 63 82 self.tree.controller = self 64 pnl1.Sizer.append1x(self.tree) 65 pnl2 = self.Panel2 66 self.pgfEditors = dabo.ui.dPageFrame(pnl2, PageCount=0) 67 pnl2.Sizer.append1x(self.pgfEditors) 83 sz.append1x(self.tree) 84 85 self.toolbar = self.addPanel(Toolbar=True, Docked=True, DockSide="Top", 86 ShowCaption=False, ShowGripper=True, BottomDockable=False, 87 LeftDockable=False, RightDockable=False) 88 self.toolbar.Sizer = dabo.ui.dSizer("h") 89 cp = self.CenterPanel 90 csz = cp.Sizer = dabo.ui.dSizer("v") 91 # self.toolbar = self.ToolBar = StudioToolBar(self) 92 # csz.append(self.toolbar) 93 self._toolSets = {None: []} 94 self._currentToolBar = None 95 self.pgfEditors = dabo.ui.dPageFrame(self.CenterPanel, PageCount=0) 96 csz.append1x(self.pgfEditors) 97 98 # Enable the various parts of the IDE. 99 self.registerComponents() 100 self.registerPlugins() 101 102 # Make sure that all components are visible 103 dabo.ui.callAfter(self._showAllPanels) 104 105 106 def _showAllPanels(self): 107 self.toolbar.Visible = self.projectTreePanel.Visible = True 108 self.toolbar.Show() 109 self._refreshState() 110 111 def registerComponents(self): 112 import types 113 comps = [getattr(components, comp) for comp in dir(components) 114 if isinstance(getattr(components, comp), types.ModuleType)] 115 for comp in comps: 116 try: 117 comp.register(self) 118 except AttributeError: 119 dabo.errorLog.write(_("Component '%s' lacks a 'register()' method.") % comp) 120 121 122 def registerPlugins(self): 123 pass 124 125 126 def setToolBarGroup(self, key, grp): 127 self._toolSets[key] = grp 68 128 69 129 … … 72 132 pg.openFile(pth) 73 133 self.pgfEditors.SelectedPage = pg 134 self.CurrentToolBar = "TextEditor" 74 135 75 136 … … 85 146 86 147 148 def _getCurrentToolBar(self): 149 return self._currentToolBar 150 151 def _setCurrentToolBar(self, val): 152 if self._constructed(): 153 if val == self._currentToolBar: 154 return 155 if val not in self._toolSets: 156 dabo.errorLog.write(_("Invalid toolbar specified: '%s'") % val) 157 158 print self._toolSets.keys() 159 return 160 # Hide all visible buttons 161 for btn in self.toolbar.Children[::-1]: 162 self.toolbar.remove(btn, False) 163 self._currentToolBar = val 164 # Show the new button set 165 for btn in self._toolSets[self._currentToolBar]: 166 try: 167 self.toolbar.appendItem(btn) 168 except AttributeError: 169 # A control, not a tool item 170 btn.Visible = True 171 else: 172 self._properties["CurrentToolBar"] = val 173 174 175 CurrentToolBar = property(_getCurrentToolBar, _setCurrentToolBar, None, 176 _("Name of the current toolbar to display. Changing this will change the buttons that are visible in the editing area. (str)")) 177 178 179 87 180 def main(): 88 181 app = dabo.dApp() 182 app.BasePrefKey = "DeveloperStudio" 89 183 app.MainFormClass = StudioForm 90 184 app.start() branches/ed-ide/components/ClassDesigner/__init__.py
r4063 r4081 2 2 # -*- coding: utf-8 -*- 3 3 4 # from ClassDesignerPropSheet import PropSheet5 # from ClassDesignerPropSheet import PropertyGrid6 # from ClassDesignerComponents import LayoutSaverMixin7 # from ClassDesignerComponents import LayoutPanel8 # from ClassDesignerComponents import LayoutSpacerPanel9 # from ClassDesignerComponents import LayoutSizerMixin10 # from ClassDesignerComponents import LayoutSizer11 # from ClassDesignerComponents import LayoutBorderSizer12 # from ClassDesignerComponents import LayoutGridSizer13 # from ClassDesignerComponents import LayoutBasePanel14 # from ClassDesignerComponents import NoSizerBasePanel15 # from ClassDesignerTreeSheet import TreeSheet16 # from ClassDesignerObjectPropertySheet import ObjectPropertySheet17 # from ClassDesignerCustomPropertyDialog import ClassDesignerCustomPropertyDialog18 # from ClassDesignerControlMixin import ClassDesignerControlMixin19 # from ClassDesignerFormMixin import ClassDesignerFormMixin20 # from ClassDesignerEditor import EditorControl21 # from ClassDesignerEditor import EditorForm22 # from ClassDesignerPemForm import PemForm23 # from ClassDesignerMethodSheet import MethodSheet24 # from ClassDesignerSizerPalette import ContentBoxSizerPanel25 # from ClassDesignerSizerPalette import ContentGridSizerPanel26 # from ClassDesignerSizerPalette import BoxSizerSelfPanel27 # from ClassDesignerSizerPalette import GridSizerSelfPanel28 # from ClassDesignerSizerPalette import SizerInfoFrame29 # from ClassDesignerSizerPalette import SizerContentFrame30 # from ClassDesignerSizerPalette import SizerSelfFrame31 # from ClassDesignerSizerPalette import AbstractSizerPanel32 # from ClassDesignerSizerPalette import SizerContentPanel33 # from ClassDesignerSizerPalette import SizerSelfPanel34 # from ClassDesignerSizerPalette import SizerPaletteForm35 4 from ClassDesigner import ClassDesigner 36 5 from ClassDesignerExceptions import PropertyUpdateException 6 7 8 def register(master): 9 print "Class Designer is registered" 10 # toolbar 11 # editor class 12 # extensions 13 branches/ed-ide/components/TextEditor/__init__.py
r4073 r4081 2 2 # -*- coding: utf-8 -*- 3 3 4 import dabo 5 import dabo.dEvents as dEvents 6 from dabo.dLocalize import _ 7 import TextEditor 4 8 from TextEditor import EditorPage as TextEditorPage 9 10 masterForm = None 11 12 def register(master): 13 global masterForm 14 masterForm = master 15 tb = master.toolbar 16 17 funcBtn = tb.appendButton(_("Functions"), 18 dabo.ui.bitmapFromData(TextEditor.funcButtonData()), 19 toggle=False, 20 OnMouseLeftDown=onFuncButton) 21 bmkBtn = tb.appendButton(_("Bookmarks"), 22 dabo.ui.bitmapFromData(TextEditor.bmkButtonData()), 23 toggle=False, 24 OnMouseLeftDown=onBmkButton) 25 printBtn = tb.appendButton(_("Print"), 26 "print", 27 toggle=False, 28 OnHit=onPrint) 29 lexSelector = dabo.ui.dDropdownList(tb, ValueMode="String", 30 Choices = dabo.ui.dEditor.getAvailableLanguages(), 31 OnHit = onLexSelect) 32 tb.appendControl(lexSelector) 33 34 master.setToolBarGroup("TextEditor", [funcBtn, bmkBtn, printBtn, lexSelector]) 35 36 37 def onFuncButton(evt): 38 masterForm.Caption = "FUNC BUTT" 39 def onBmkButton(evt): 40 masterForm.Caption = "BMK BUTT" 41 def onPrint(evt): 42 masterForm.Caption = "PRINT BUTT" 43 def onLexSelect(evt): 44 masterForm.Caption = evt.EventObject.Value 45 46 def updateLex(self): 47 if not self.lexSelector.Choices: 48 self.lexSelector.Choices = self.CurrentEditor.getAvailableLanguages()
