I test this, and I obtain import error in all my .cdxml files. This happens
without Import Declarations :

Traceback (most recent call last):
  File
"D:\python24\Lib\site-packages\Dabo-0.7a-py2.4.egg\dabo\lib\eventMixin.py",
line 87, in raiseEvent
    bindingFunction(event)
  File "D:\AppsPython\daboide\ClassDesigner.py", line 1171, in onRunDesign
    self.currentForm.onRunDesign(evt)
  File "D:\AppsPython\daboide\ClassDesignerFormMixin.py", line 280, in
onRunDesign
    frm = dui.createForm(self._classFile)
  File
"D:\python24\Lib\site-packages\Dabo-0.7a-py2.4.egg\dabo\ui\uiwx\__init__.py"
, line 763, in createForm
    cls = conv.classFromXml(srcFile)
  File
"D:\python24\Lib\site-packages\Dabo-0.7a-py2.4.egg\dabo\lib\DesignerXmlConve
rter.py", line 69, in classFromXml
    exec compClass in nmSpace
  File "", line 7, in ?
ImportError: No module named tmppsxoao

And with Import Declarations and I obtain SyntaxError :

Traceback (most recent call last):
  File
"D:\python24\Lib\site-packages\Dabo-0.7a-py2.4.egg\dabo\lib\eventMixin.py",
line 87, in raiseEvent
    bindingFunction(event)
  File "D:\AppsPython\daboide\ClassDesigner.py", line 1171, in onRunDesign
    self.currentForm.onRunDesign(evt)
  File "D:\AppsPython\daboide\ClassDesignerFormMixin.py", line 280, in
onRunDesign
    frm = dui.createForm(self._classFile)
  File
"D:\python24\Lib\site-packages\Dabo-0.7a-py2.4.egg\dabo\ui\uiwx\__init__.py"
, line 763, in createForm
    cls = conv.classFromXml(srcFile)
  File
"D:\python24\Lib\site-packages\Dabo-0.7a-py2.4.egg\dabo\lib\DesignerXmlConve
rter.py", line 67, in classFromXml
    compClass = compile(self.classText, "", "exec")
  File "<string>", line 7
     import tmppx72-o as _daboCode
                   ^
 SyntaxError: invalid syntax


Windows XP

daboide Revision 584

dabo Revision 2182

Thanks
-- 
Jaime Mora Ramones
Tantoyuca Veracruz, Mexico

"Ed Leafe" <[EMAIL PROTECTED]> escribió en el
mensaje news:[EMAIL PROTECTED]
> daboide Commit
> Revision 584
> Date: 2006-05-29 15:31:22 -0700 (Mon, 29 May 2006)
> Author: ed
>
> Changed:
> U   trunk/ClassDesigner.py
> U   trunk/ClassDesignerControlMixin.py
> U   trunk/ClassDesignerEditor.py
> U   trunk/ClassDesignerFormMixin.py
> U   trunk/ClassDesignerMenu.py
> U   trunk/ClassDesignerPropSheet.py
>
> Log:
> Added the ability to specify class-wide import statements.
>
> Also cleaned up some stray non-localized strings.
>
>
> Diff:
> Modified: trunk/ClassDesigner.py
> ===================================================================
> --- trunk/ClassDesigner.py 2006-05-29 01:02:30 UTC (rev 583)
> +++ trunk/ClassDesigner.py 2006-05-29 22:31:22 UTC (rev 584)
> @@ -52,6 +52,7 @@
>   self._srcObj = None
>   self._codeDict = {}
>   self._classPropDict = {}
> + self._classImportDict = {}
>   self._classDefaultVals = {}
>   self._mixedControlClasses = {}
>  # self.isClosing = False
> @@ -116,7 +117,7 @@
>   {"name" : "Line", "class" : dui.dLine, "order" : 130},
>   {"name" : "ListBox", "class" : dui.dListBox, "order" : 140},
>   {"name" : "ListControl", "class" : dui.dListControl, "order" : 150},
> -# {"name" : "RadioGroup", "class" : dui.dRadioGroup, "order" : 160},
> + {"name" : "RadioList", "class" : dui.dRadioList, "order" : 160},
>   {"name" : "Panel", "class" : dui.dPanel, "order" : 170},
>   {"name" : "ScrollPanel", "class" : dui.dScrollPanel, "order" : 180},
>   {"name" : "PageFrame", "class" : dui.dPageFrame, "order" : 190},
> @@ -245,7 +246,7 @@
>   dct = defVals.copy()
>   self._sizerDefaults[dui.dOkCancelDialog] = dct
>   dct = defVals.copy()
> - self._sizerDefaults[dui.dRadioGroup] = dct
> + self._sizerDefaults[dui.dRadioList] = dct
>   dct = defVals.copy()
>   self._sizerDefaults[dui.dPage] = {}
>   dct.update({"HAlign" : "center", "VAlign" : "middle"})
> @@ -303,9 +304,9 @@
>   dui.dGauge, dui.dGrid, dui.dImage, dui.dLabel, dui.dLine,
>   dui.dListBox, dui.dListControl, dui.dPanel,
>   dui.dScrollPanel, dui.dPage, dui.dPageFrame, dui.dPageList,
> - dui.dPageSelect, dui.dPageFrameNoTabs, dui.dSlider, dui.dSpinner,
> - dui.dSplitter, dui.dTextBox, dui.dToggleButton, dui.dTreeView)
> -# dui.dRadioGroup,
> + dui.dPageSelect, dui.dPageFrameNoTabs, dui.dRadioList,
> + dui.dSlider, dui.dSpinner, dui.dSplitter, dui.dTextBox,
> + dui.dToggleButton, dui.dTreeView)
>
>   def evtsForClass(cls):
>   ret = []
> @@ -443,7 +444,10 @@
>   # Each method will be a separate dict
>   for mthd, cd in code.items():
>   cd = cd.replace("\n]", "]")
> - self._codeDict[frm][mthd] = cd
> + if mthd == "importStatements":
> + self._classImportDict[frm] = cd
> + else:
> + self._codeDict[frm][mthd] = cd
>   # Do the same for the properties
>   propDefs = clsd.get("properties", {})
>   # Restore any prop definitions.
> @@ -675,7 +679,55 @@
>   self._srcObj = currPnl
>   return ret
>
> +
> + def onDeclareImports(self, evt):
> + """Show a dialog that enables the user to edit the import statements
> + that will be included with the code when this class is run.
> + """
> + frm = self.currentForm
> + txt = self._classImportDict.get(frm)
> + if not txt:
> + self._classImportDict[frm] = ""
> + # Create the dialog
> + class ImportEditDialog(dui.dOkCancelDialog):
> + def addControls(self):
> + self.AutoSize = False
> + self.Caption = _("Import Declarations")
> + self.Size = (400, 300)
> + self.edtImport = dui.dEditBox(self)
> + self.Sizer.append1x(self.edtImport, border=12)
>
> + dlg = ImportEditDialog(None)
> + dlg.edtImport.Value = txt
> + dlg.show()
> + if dlg.Accepted:
> + self._classImportDict[frm] = dlg.edtImport.Value
> + dlg.release()
> +
> +
> + def addToImportDict(self, txt):
> + """Adds the passed line(s) to the import statements."""
> + if isinstance(txt, (list, tuple)):
> + for stmnt in txt:
> + self.addToImportDict(stmnt)
> + else:
> + frm = self.currentForm
> + imp = self._classImportDict.get(frm, "")
> + impLines = imp.splitlines()
> + if txt not in impLines:
> + imp += "\n%s" % txt
> + self._classImportDict[frm] = imp
> +
> +
> + def getImportDict(self, frm=None):
> + """Returns the import statements for the requested form,
> + or the current form if no form is specified.
> + """
> + if frm is None:
> + frm = self.currentForm
> + return self._classImportDict.get(frm, "")
> +
> +
>   def setProp(self, obj, prop, val, typ):
>   if prop == "Font":
>   obj.Font = val
> @@ -902,7 +954,7 @@
>   # the values in propDict.
>   self._sizerObj = obj
>   dlg = SizerEditDlg(fillDlg)
> - dlg.Caption = "Sizer Settings"
> + dlg.Caption = _("Sizer Settings")
>   self.currentForm.bringToFront()
>   # This is used to determine if anything has changed in
>   # the dialog, so we know whether to update or not.
> @@ -1134,18 +1186,17 @@
>   chc = ["dForm", "dPanel", "dScrollPanel", "dPageFrame", "dPageList",
"dPageSelect",
>   "dPageNoTabs", "dBox", "dBitmap", "dBitmapButton", "dButton",
"dCheckBox",
>   "dComboBox", "dDateTextBox", "dDropdownList", "dEditBox", "dGauge",
"dGrid",
> - "dImage", "dLabel", "dLine", "dListBox", "dListControl", "dSlider",
> + "dImage", "dLabel", "dLine", "dListBox", "dListControl", "dRadioList",
"dSlider",
>   "dSpinner", "dSplitter", "dTextBox", "dToggleButton", "dTreeView"]
> -# "dRadioGroup",
>   self.dd = dabo.ui.dDropdownList(self, Choices=chc, Value="dForm")
>  # self.dd.Value = "dForm"
>   self.Sizer.appendSpacer(25)
> - self.Sizer.append(dabo.ui.dLabel(self, Caption="Select the class to
create:"),
> + self.Sizer.append(dabo.ui.dLabel(self, Caption=_("Select the class to
create:")),
>   halign="center")
>   self.Sizer.append1x(self.dd, halign="Center", border=40)
>   self.Sizer.appendSpacer(25)
>
> - dlg = NewClassPicker(Caption="New Class")
> + dlg = NewClassPicker(Caption=_("New Class"))
>   dlg.show()
>   if dlg.Accepted:
>   newClassName = dlg.dd.StringValue
> @@ -1178,8 +1229,8 @@
>   code = self.miniAppTemplate() % fname
>   out = os.path.splitext(nm)[0] + ".py"
>   open(out, "w").write(code)
> - dui.info("You can run your form by running the file\n%s"
> - % out, title="Runnable App Saved")
> + dui.info(_("You can run your form by running the file\n%s")
> + % out, title=_("Runnable App Saved"))
>
>
>   def onRevert(self, evt):
> @@ -1449,7 +1500,7 @@
>   "\tself._%s = val" % propertyAtt]
>   setCodeText = os.linesep.join(setCode)
>   cd[setMethod] = setCodeText
> -
> +
>   if delMethod is None:
>   if oldData:
>   oldMethod = oldData["deller"]
> @@ -1696,8 +1747,8 @@
>   szit = pnl.ControllingSizerItem
>   if szit is None:
>   # Something is wrong; write it to the log and return
> - dabo.errorLog.write(_("Attempted to add an object of class %s to parent
%s, "
> - "but parent has no sizer information.") % (cls, pnl))
> + dabo.errorLog.write(_("Attempted to add an object of class %s to parent
%s, but parent has no sizer information.")
> + % (cls, pnl))
>   return
>
>   # Get the defaults for this class of control.
> @@ -1734,7 +1785,7 @@
>   super(PageInfoDialog, self).__init__(*args, **kwargs)
>
>   def addControls(self):
> - self.Caption = "Paged Control Settings"
> + self.Caption = _("Paged Control Settings")
>   gsz = dui.dGridSizer(maxCols=2, hgap=5, vgap=12)
>   lbl = dui.dLabel(self, Caption=_("Number of pages:"))
>   spn = dui.dSpinner(self, DataSource="form",
> @@ -1783,8 +1834,8 @@
>   newCols = None
>   if not props.has_key("ColumnCount"):
>   try:
> - newCols = int(dui.getString("How many columns?",
> - "New Grid Control", "3"))
> + newCols = int(dui.getString(_("How many columns?"),
> + _("New Grid Control"), _("3")))
>   except:
>   newCols = 3
>
> @@ -1904,51 +1955,51 @@
>   self._srcObj = srcObj
>   mainpop = dui.dMenu()
>   pop = dui.dMenu(Caption=_("Sizers"))
> - pop.append("Add New Vertical Sizer", bindfunc=self.onNewVert)
> - pop.append("Add New Horizontal Sizer", bindfunc=self.onNewHoriz)
> - pop.append("Add New Spacer", bindfunc=self.onNewSpacer)
> - pop.append("Add New Grid Sizer", bindfunc=self.onNewGridSizer)
> + pop.append(_("Add New Vertical Sizer"), bindfunc=self.onNewVert)
> + pop.append(_("Add New Horizontal Sizer"), bindfunc=self.onNewHoriz)
> + pop.append(_("Add New Spacer"), bindfunc=self.onNewSpacer)
> + pop.append(_("Add New Grid Sizer"), bindfunc=self.onNewGridSizer)
>   mainpop.appendMenu(pop)
>   if not justSizers:
>   pop = dui.dMenu(Caption=_("Data Controls"))
> - pop.append("Add CheckBox", bindfunc=self.onNewCheckBox)
> - pop.append("Add ComboBox", bindfunc=self.onNewComboBox)
> - pop.append("Add DateTextBox", bindfunc=self.onNewDateTextBox)
> - pop.append("Add DropdownList", bindfunc=self.onNewDropdownList)
> - pop.append("Add EditBox", bindfunc=self.onNewEditBox)
> - pop.append("Add Grid", bindfunc=self.onNewGrid)
> - pop.append("Add ListBox", bindfunc=self.onNewListBox)
> - pop.append("Add ListControl", bindfunc=self.onNewListControl)
> -# pop.append("Add RadioGroup", bindfunc=self.onNewRadioGroup)
> - pop.append("Add Spinner", bindfunc=self.onNewSpinner)
> - pop.append("Add TextBox", bindfunc=self.onNewTextBox)
> - pop.append("Add ToggleButton", bindfunc=self.onNewToggleButton)
> + pop.append(_("Add CheckBox"), bindfunc=self.onNewCheckBox)
> + pop.append(_("Add ComboBox"), bindfunc=self.onNewComboBox)
> + pop.append(_("Add DateTextBox"), bindfunc=self.onNewDateTextBox)
> + pop.append(_("Add DropdownList"), bindfunc=self.onNewDropdownList)
> + pop.append(_("Add EditBox"), bindfunc=self.onNewEditBox)
> + pop.append(_("Add Grid"), bindfunc=self.onNewGrid)
> + pop.append(_("Add ListBox"), bindfunc=self.onNewListBox)
> + pop.append(_("Add ListControl"), bindfunc=self.onNewListControl)
> + pop.append(_("Add RadioList"), bindfunc=self.onNewRadioList)
> + pop.append(_("Add Spinner"), bindfunc=self.onNewSpinner)
> + pop.append(_("Add TextBox"), bindfunc=self.onNewTextBox)
> + pop.append(_("Add ToggleButton"), bindfunc=self.onNewToggleButton)
>   mainpop.appendMenu(pop)
>   pop = dui.dMenu(Caption=_("Display Controls"))
> - pop.append("Add Box", bindfunc=self.onNewBox)
> - pop.append("Add Bitmap", bindfunc=self.onNewBitmap)
> - pop.append("Add Image", bindfunc=self.onNewImage)
> - pop.append("Add Label", bindfunc=self.onNewLabel)
> - pop.append("Add Line", bindfunc=self.onNewLine)
> - pop.append("Add Panel", bindfunc=self.onNewPanel)
> - pop.append("Add ScrollPanel", bindfunc=self.onNewScrollPanel)
> - pop.append("Add Splitter", bindfunc=self.onNewSplitter)
> + pop.append(_("Add Box"), bindfunc=self.onNewBox)
> + pop.append(_("Add Bitmap"), bindfunc=self.onNewBitmap)
> + pop.append(_("Add Image"), bindfunc=self.onNewImage)
> + pop.append(_("Add Label"), bindfunc=self.onNewLabel)
> + pop.append(_("Add Line"), bindfunc=self.onNewLine)
> + pop.append(_("Add Panel"), bindfunc=self.onNewPanel)
> + pop.append(_("Add ScrollPanel"), bindfunc=self.onNewScrollPanel)
> + pop.append(_("Add Splitter"), bindfunc=self.onNewSplitter)
>   mainpop.appendMenu(pop)
>   pop = dui.dMenu(Caption=_("Interactive Controls"))
> - pop.append("Add BitmapButton", bindfunc=self.onNewBitmapButton)
> - pop.append("Add Button", bindfunc=self.onNewButton)
> - pop.append("Add Gauge", bindfunc=self.onNewGauge)
> - pop.append("Add Slider", bindfunc=self.onNewSlider)
> - pop.append("Add TreeView", bindfunc=self.onNewTreeView)
> + pop.append(_("Add BitmapButton"), bindfunc=self.onNewBitmapButton)
> + pop.append(_("Add Button"), bindfunc=self.onNewButton)
> + pop.append(_("Add Gauge"), bindfunc=self.onNewGauge)
> + pop.append(_("Add Slider"), bindfunc=self.onNewSlider)
> + pop.append(_("Add TreeView"), bindfunc=self.onNewTreeView)
>   mainpop.appendMenu(pop)
>   pop = dui.dMenu(Caption=_("Paged Controls"))
> - pop.append("Add PageFrame", bindfunc=self.onNewPageFrame)
> - pop.append("Add PageList", bindfunc=self.onNewPageList)
> - pop.append("Add PageSelect", bindfunc=self.onNewPageSelect)
> - pop.append("Add PageNoTabs", bindfunc=self.onNewPageNoTabs)
> + pop.append(_("Add PageFrame"), bindfunc=self.onNewPageFrame)
> + pop.append(_("Add PageList"), bindfunc=self.onNewPageList)
> + pop.append(_("Add PageSelect"), bindfunc=self.onNewPageSelect)
> + pop.append(_("Add PageNoTabs"), bindfunc=self.onNewPageNoTabs)
>   mainpop.appendMenu(pop)
>   pop = dui.dMenu(Caption=self._customClassCaption)
> - pop.append("Select...", bindfunc=self.onSelectClass)
> + pop.append(_("Select..."), bindfunc=self.onSelectClass)
>   self.onMenuOpenMRU(pop)
>   mainpop.appendMenu(pop)
>   return mainpop
> @@ -2055,7 +2106,7 @@
>   try:
>   exec "obj.%s = '%s'" % (att, escVal)
>   except:
> - raise ValueError, "Could not set attribute '%s' to value: %s" % (att,
val)
> + raise ValueError, _("Could not set attribute '%s' to value: %s") % (att,
val)
>   # If the item has children, set their atts, too.
>   isSizer = isinstance(obj, dui.dSizerMixin)
>   if isSizer:
> @@ -2137,8 +2188,8 @@
>   dui.callAfter(self.addNewControl, None, dui.dListBox)
>   def onNewListControl(self, evt):
>   dui.callAfter(self.addNewControl, None, dui.dListControl)
> - def onNewRadioGroup(self, evt):
> - dui.callAfter(self.addNewControl, None, dui.dRadioGroup)
> + def onNewRadioList(self, evt):
> + dui.callAfter(self.addNewControl, None, dui.dRadioList)
>   def onNewPanel(self, evt):
>   dui.callAfter(self.addNewControl, None, dui.dPanel)
>   def onNewScrollPanel(self, evt):
> @@ -2460,38 +2511,38 @@
>   obj = self._srcObj
>  # for obj in self._selection:
>   if isinstance(obj, (LayoutPanel, dui.dPanel)):
> - funcDict = {"Vert. Sizer" : self.onNewVert,
> - "Horiz. Sizer" : self.onNewHoriz,
> - "Grid Sizer" : self.onNewGridSizer,
> - "Box" : self.onNewBox,
> - "Bitmap" : self.onNewBitmap,
> - "BitmapButton" : self.onNewBitmapButton,
> - "Button" : self.onNewButton,
> - "CheckBox" : self.onNewCheckBox,
> - "ComboBox" : self.onNewComboBox,
> - "DateTextBox" : self.onNewDateTextBox,
> - "DropdownList" : self.onNewDropdownList,
> - "EditBox" : self.onNewEditBox,
> - "Gauge" : self.onNewGauge,
> - "Grid" : self.onNewGrid,
> - "Image" : self.onNewImage,
> - "Label" : self.onNewLabel,
> - "Line" : self.onNewLine,
> - "ListBox" : self.onNewListBox,
> - "ListControl" : self.onNewListControl,
> -# "RadioGroup" : self.onNewRadioGroup,
> - "Panel" : self.onNewPanel,
> - "ScrollPanel" : self.onNewScrollPanel,
> - "PageFrame" : self.onNewPageFrame,
> - "PageList" : self.onNewPageList,
> - "PageSelect" : self.onNewPageSelect,
> - "PageNoTabs" : self.onNewPageNoTabs,
> - "Slider" : self.onNewSlider,
> - "Spinner" : self.onNewSpinner,
> - "Splitter" : self.onNewSplitter,
> - "TextBox" : self.onNewTextBox,
> - "ToggleButton" : self.onNewToggleButton,
> - "TreeView" : self.onNewTreeView}
> + funcDict = {_("Vert. Sizer") : self.onNewVert,
> + _("Horiz. Sizer") : self.onNewHoriz,
> + _("Grid Sizer") : self.onNewGridSizer,
> + _("Box") : self.onNewBox,
> + _("Bitmap") : self.onNewBitmap,
> + _("BitmapButton") : self.onNewBitmapButton,
> + _("Button") : self.onNewButton,
> + _("CheckBox") : self.onNewCheckBox,
> + _("ComboBox") : self.onNewComboBox,
> + _("DateTextBox") : self.onNewDateTextBox,
> + _("DropdownList") : self.onNewDropdownList,
> + _("EditBox") : self.onNewEditBox,
> + _("Gauge") : self.onNewGauge,
> + _("Grid") : self.onNewGrid,
> + _("Image") : self.onNewImage,
> + _("Label") : self.onNewLabel,
> + _("Line") : self.onNewLine,
> + _("ListBox") : self.onNewListBox,
> + _("ListControl") : self.onNewListControl,
> + _("RadioList") : self.onNewRadioList,
> + _("Panel") : self.onNewPanel,
> + _("ScrollPanel") : self.onNewScrollPanel,
> + _("PageFrame") : self.onNewPageFrame,
> + _("PageList") : self.onNewPageList,
> + _("PageSelect") : self.onNewPageSelect,
> + _("PageNoTabs") : self.onNewPageNoTabs,
> + _("Slider") : self.onNewSlider,
> + _("Spinner") : self.onNewSpinner,
> + _("Splitter") : self.onNewSplitter,
> + _("TextBox") : self.onNewTextBox,
> + _("ToggleButton") : self.onNewToggleButton,
> + _("TreeView") : self.onNewTreeView}
>   func = funcDict[ctlCap]
>   func(evt)
>
> @@ -2668,13 +2719,13 @@
>   sz.append(10)
>
>   # Now add the control buttons
> - ctls = (_("Box"), _("Bitmap"), _("BitmapButton"), _("Button"),
_("CheckBox"),
> - _("ComboBox"), _("DateTextBox"), _("DropdownList"), _("EditBox"),
_("Gauge"),
> - _("Grid"), _("Image"), _("Label"), _("Line"), _("ListBox"),
_("ListControl"),
> - _("Panel"), _("ScrollPanel"), _("PageFrame"), _("PageList"),
> - _("PageSelect"), _("PageNoTabs"), _("Slider"), _("Spinner"),
_("Splitter"),
> - _("TextBox"), _("ToggleButton"), _("TreeView"))
> -# _("RadioGroup"),
> + ctls = (_("Box"), _("Bitmap"), _("BitmapButton"), _("Button"),
_("CheckBox"),
> + _("ComboBox"), _("DateTextBox"), _("DropdownList"), _("EditBox"),
> + _("Gauge"), _("Grid"), _("Image"), _("Label"), _("Line"), _("ListBox"),
> + _("ListControl"), _("Panel"), _("ScrollPanel"), _("PageFrame"),
> + _("PageList"), _("PageSelect"), _("PageNoTabs"), _("RadioList"),
> + _("Slider"), _("Spinner"), _("Splitter"), _("TextBox"),
_("ToggleButton"),
> + _("TreeView"))
>   for ctl in ctls:
>   btn = paletteButton(cp, Caption=ctl)
>   btn.bindEvent(dEvents.Hit, self.onPaletteClick)
>
> Modified: trunk/ClassDesignerControlMixin.py
> ===================================================================
> --- trunk/ClassDesignerControlMixin.py 2006-05-29 01:02:30 UTC (rev 583)
> +++ trunk/ClassDesignerControlMixin.py 2006-05-29 22:31:22 UTC (rev 584)
> @@ -498,10 +498,11 @@
>   pass
>   elif isinstance(self, dabo.ui.dMenuItem):
>   ret.update(captionProps)
> - elif isinstance(self, dabo.ui.dRadioGroup):
> + elif isinstance(self, dabo.ui.dRadioList):
>   ret.update(colorProps)
>   ret.update(captionProps)
>   ret.update(fontProps)
> + ret.update(choiceProps)
>   elif isinstance(self, (dabo.ui.dPageFrame, dabo.ui.dPageList,
>   dabo.ui.dPageSelect, dabo.ui.dPageFrameNoTabs)):
>   ret.update(colorProps)
>
> Modified: trunk/ClassDesignerEditor.py
> ===================================================================
> --- trunk/ClassDesignerEditor.py 2006-05-29 01:02:30 UTC (rev 583)
> +++ trunk/ClassDesignerEditor.py 2006-05-29 22:31:22 UTC (rev 584)
> @@ -16,7 +16,7 @@
>   obj = self.Form.getEditedObject()
>   if not obj:
>   # Should never happen!
> - dabo.ErrorLog.write("Bad object ref returned to
_makeContainingClassIntoSelf()")
> + dabo.ErrorLog.write(_("Bad object ref returned to
_makeContainingClassIntoSelf()"))
>   return None
>   try:
>   args = "dabo.ui.%s" % str(obj.BaseClass).split("'")[1].split(".")[-1]
> @@ -29,9 +29,13 @@
>
>   def _namespaceHacks(self):
>   """We'll want to be able to use 'dabo.' and 'dui.' to bring up
> - intellisense for those two modules.
> + intellisense for those two modules. We also want to add any class-wide
> + import statements into the namespace.
>   """
>   exec "import dabo\ndui = dabo.ui" in self._namespaces
> + imp = self.Application.getImportDict()
> + if imp:
> + exec imp in self._namespaces
>
>
>
> @@ -119,19 +123,31 @@
>   self.Sizer.append1x(pnl)
>   sz = pnl.Sizer = dabo.ui.dSizer("v")
>
> - dui.dLabel(pnl, Caption="Object:", RegID="lblObj")
> + dui.dLabel(pnl, Caption=_("Object:"), RegID="lblObj")
>   dui.dDropdownList(pnl, RegID="ddObject")
> - dui.dLabel(pnl, Caption="Method:", RegID="lblMethod")
> + dui.dLabel(pnl, Caption=_("Method:"), RegID="lblMethod")
>   dui.dDropdownList(pnl, RegID="ddMethod")
> - hs = dui.dSizer("h", DefaultBorder=8)
> + hs = dui.dSizer("h", DefaultBorder=8, DefaultBorderTop=True,
> + DefaultBorderBottom=True)
> + hs.appendSpacer(8)
>   hs.append(self.lblObj, 0, valign="middle")
> + hs.appendSpacer(2)
>   hs.append(self.ddObject, 0)
> - hs.appendSpacer(1,1)
> + hs.appendSpacer(8)
>   hs.append(self.lblMethod, 0, valign="middle")
> + hs.appendSpacer(2)
>   hs.append(self.ddMethod, 0)
> - dui.dButton(pnl, Caption="New", RegID="btnNewMethod")
> - hs.appendSpacer(1,1)
> + hs.appendSpacer(4)
> + dui.dButton(pnl, Caption=_("New"), RegID="btnNewMethod")
>   hs.append(self.btnNewMethod, 0)
> + hs.appendSpacer(8)
> + hs.append(dui.dLine(pnl, Height=self.btnNewMethod.Height, Width=2),
> + valign="middle")
> + hs.appendSpacer(8)
> + dui.dButton(pnl, Caption=_("Manage Imports"), RegID="btnImports")
> + hs.append(self.btnImports, 0)
> +
> +
>   sz.append(hs, 0, "x")
>   dui.dPageFrameNoTabs(pnl, RegID="pgf")
>   sz.append1x(self.pgf)
> @@ -199,13 +215,13 @@
>   def setEditorCaption(self):
>   obj = self.ddObject.KeyValue
>   if obj is None:
> - nm = "No object"
> + nm = _("No object")
>   else:
>   nm = obj.Name
>   mthd = self.ddMethod.StringValue
>   if not mthd:
> - mthd = "no method"
> - self.Caption = "Editing: %s, %s" % (nm, mthd)
> + mthd = _("no method")
> + self.Caption = _("Editing: %s, %s") % (nm, mthd)
>
>
>   def onHit_ddObject(self, evt):
> @@ -219,12 +235,12 @@
>
>
>   def onHit_btnNewMethod(self, evt):
> - nm = dabo.ui.getString("Name of method?")
> + nm = dabo.ui.getString(_("Name of method?"))
>   if nm:
>   # Make sure that it's legal
>   nm = nm.strip()
>   if not re.match("[a-zA-Z_][a-zA-Z_0-9]*", nm):
> - dabo.ui.stop("Illegal name: %s" % nm, title="Illegal Name")
> + dabo.ui.stop(_("Illegal name: %s") % nm, title=_("Illegal Name"))
>   return
>
>   # Default to the currently selected object
> @@ -235,6 +251,10 @@
>   self.edit(obj, nm, True)
>
>
> + def onHit_btnImports(self, evt):
> + self.app.onDeclareImports(evt)
> +
> +
>   def refreshStatus(self):
>   dui.callAfter(self.setEditorCaption)
>   self.populateMethodList()
> @@ -373,12 +393,33 @@
>  # % (mthd, obj.Name, e))
>   # Add it to the repository.
>   if objCode:
> + txt = self._extractImports(txt)
>   objCode[mthd] = txt
>   else:
>   rep[obj] = {}
>   rep[obj][mthd] = txt
> + # Update the page
> + if pg.Text != txt:
> + pg.Text = txt
> + pg.refresh()
> + curr = self.StatusText
> + self.StatusText = _("Code Updated")
> + dabo.ui.setAfterInterval(4000, self, "StatusText", curr)
>
>
> + def _extractImports(self, cd):
> + codeLines = cd.splitlines()
> + for pos, ln in enumerate(codeLines):
> + if ln.lstrip()[:4] == "def ":
> + break
> + if pos > 0:
> + self.app.addToImportDict(codeLines[:pos])
> + ret = "\n".join(codeLines[pos:])
> + else:
> + ret = "\n".join(codeLines)
> + return ret
> +
> +
>   def _getCodeRepository(self):
>   return self.app.getCodeDict()
>
>
> Modified: trunk/ClassDesignerFormMixin.py
> ===================================================================
> --- trunk/ClassDesignerFormMixin.py 2006-05-29 01:02:30 UTC (rev 583)
> +++ trunk/ClassDesignerFormMixin.py 2006-05-29 22:31:22 UTC (rev 584)
> @@ -23,7 +23,7 @@
>  class ClassDesignerFormMixin(LayoutSaverMixin):
>   def __init__(self, parent=None, properties=None, *args, **kwargs):
>   if not self.Caption:
> - self.Caption = "Dabo Class Designer"
> + self.Caption = _("Dabo Class Designer")
>
>   self._controls = []
>   self._namedConnection = ""
> @@ -181,6 +181,13 @@
>   self.app.saveAllProps = True
>   propDict = self.getClassDesignerDict(obj)
>   self.app.saveAllProps = False
> +
> + imp = self.app._classImportDict.get(self, "")
> + if imp:
> + cd = propDict.get("code", {})
> + cd.update({"importStatements": imp})
> + propDict["code"] = cd
> +
>   xml = dicttoxml(propDict)
>   # Try opening the file. If it is read-only, it will raise an
>   # IOError that the calling method can catch.
> @@ -261,7 +268,7 @@
>   try:
>   self.onSaveDesign(None)
>   except IOError, e:
> - dabo.ui.info(_("Cannot write file"), title="Write Error")
> + dabo.ui.info(_("Cannot write file"), title=_("Write Error"))
>   if not self._classFile or not os.path.isfile(self._classFile):
>   # Nothing was saved
>   return
> @@ -276,7 +283,7 @@
>   obj = frm.addObject(self._classFile)
>   if frm.Sizer:
>   frm.Sizer.append1x(obj)
> - frm.Caption = "Test form for: %s" % os.path.split(self._classFile)[1]
> + frm.Caption = _("Test form for: %s") % os.path.split(self._classFile)[1]
>   frm.layout()
>   frm.isDemoTest = True
>   frm.Visible = True
>
> Modified: trunk/ClassDesignerMenu.py
> ===================================================================
> --- trunk/ClassDesignerMenu.py 2006-05-29 01:02:30 UTC (rev 583)
> +++ trunk/ClassDesignerMenu.py 2006-05-29 22:31:22 UTC (rev 584)
> @@ -59,6 +59,9 @@
>   help=_("Re-load the form from disk, losing any pending changes"))
>   fm.prepend(_("Save Runnable App"), bindfunc=app.onSaveRunnable,
>   help=_("Create a mini app to run your form"))
> + fm.prependSeparator()
> + itm = fm.prepend(_("&Import Declarations...\tCtrl-I"),
bindfunc=app.onDeclareImports,
> + help=_("Edit the import statements for the code for this class"))
>   itm = fm.prepend(_("Save as C&lass\tCtrl+Shift+S"),
bindfunc=app.onSaveClassDesign,
>   help=_("Save the ClassDesigner contents as a class"))
>   itm.DynamicEnabled = app.shouldEnableSaveAsClass
>
> Modified: trunk/ClassDesignerPropSheet.py
> ===================================================================
> --- trunk/ClassDesignerPropSheet.py 2006-05-29 01:02:30 UTC (rev 583)
> +++ trunk/ClassDesignerPropSheet.py 2006-05-29 22:31:22 UTC (rev 584)
> @@ -359,7 +359,7 @@
>   obj = objs[0]
>   class MultiListDialog(dabo.ui.dOkCancelDialog):
>   def addControls(self):
> - self.Caption = "Border Sides"
> + self.Caption = _("Border Sides")
>   lbl = dabo.ui.dLabel(self,
>   Caption=_("Select the sides to which the border will apply:"))
>   self.Sizer.append(lbl, halign="center")
> @@ -442,7 +442,7 @@
>   for row in range(self.RowCount):
>   pd = self.getPropDictForRow(row)
>   if not isinstance(pd, dict):
> - print "BAD PROP DICT:", pd, type(pd), "ROW", row
> + print _("BAD PROP DICT:"), pd, type(pd), _("ROW"), row
>   continue
>   typ = pd["type"]
>   rnd = self.stringRendererClass
> @@ -475,9 +475,9 @@
>
>   if not isinstance(pd, dict):
>   if pd is None:
> - print "None PROP DICT:, ROW=",
> + print _("None PROP DICT:, ROW="),
>   else:
> - print "BAD PROP DICT:", pd, type(pd), "ROW=",
> + print _("BAD PROP DICT:"), pd, type(pd), _("ROW="),
>   else:
>   if pd["type"] == "multi":
>   # This is a catch-all setting for props such as 'Value' that
> @@ -736,8 +736,8 @@
>   Props = property(_getProps, _setProps)
>
>   btnClass = getControlClass(TestButton)
> - b1 = btnClass(self, Caption="First Button")
> - b2 = btnClass(self, Caption="Second Button")
> + b1 = btnClass(self, Caption=_("First Button"))
> + b2 = btnClass(self, Caption=_("Second Button"))
>   vs = LayoutSizer("v")
>   sz.append(vs, 1, "x")
>   vs.append1x(b1)
>
>
>
>




_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev

Reply via email to