Changeset 3208

Show
Ignore:
Timestamp:
06/23/2007 06:32:54 AM (2 years ago)
Author:
ed
Message:

Added all the options from dGrid.buildFromDataSet() to dabo.ui.browse(). This will allow you to specify things like column order, captions for the columns, which fields to include, etc. By default, if you don't specify any of these, it works the way it always has. Thanks to Kelie (http://leafe.com/archives/showMsg/355365) for the idea to do this.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/dabo/ui/uiwx/__init__.py

    r3199 r3208  
    1414_failedLibs = [] 
    1515# note: may need wx.animate as well 
    16 for lib in ("wx", "wx.stc", "wx.lib.foldpanelbar", "wx.gizmos",  
     16for lib in ("wx", "wx.stc", "wx.lib.foldpanelbar", "wx.gizmos", 
    1717        "wx.lib.calendar", "wx.lib.masked", "wx.lib.buttons"): 
    1818    try: 
     
    2828    %s 
    2929    """ % "\n\t".join(_failedLibs) 
    30      
     30 
    3131    sys.exit(msg) 
    3232del(_failedLibs) 
     
    5252 
    5353# Import dPemMixin first, and then manually put into dabo.ui module. This is 
    54 # because dControlMixinBase, which is in dabo.ui, descends from dPemMixin, which  
     54# because dControlMixinBase, which is in dabo.ui, descends from dPemMixin, which 
    5555# is in dabo.ui.uiwx. Must also do the same with dControlMixin, as dDataControlMixinBase 
    5656# descends from it. 
     
    189189            wx.CallAfter(callback) 
    190190    return ret 
    191      
     191 
    192192 
    193193def callAfter(fnc, *args, **kwargs): 
    194194    """There are times when this functionality is needed when creating UI 
    195     code. This function simply wraps the wx.CallAfter function so that  
     195    code. This function simply wraps the wx.CallAfter function so that 
    196196    developers do not need to use wx code in their apps. 
    197197    """ 
    198198    wx.CallAfter(fnc, *args, **kwargs) 
    199      
     199 
    200200 
    201201_callAfterIntervalReferences = {} 
     
    228228        dabo.errorLog.write(_("setAfter() failed to set property '%s' to value '%s': %s.") 
    229229                % (prop, val, e)) 
    230      
     230 
    231231 
    232232def setAfterInterval(interval, obj, prop, val): 
    233     """Like callAfterInterval(), but allows you to set a property instead  
     233    """Like callAfterInterval(), but allows you to set a property instead 
    234234    of calling a function. 
    235235    """ 
     
    243243 
    244244def callEvery(interval, func, *args, **kwargs): 
    245     """Creates and returns a timer object that fires the specified function  
     245    """Creates and returns a timer object that fires the specified function 
    246246    at the specified interval. Interval is given in milliseconds. It will pass along 
    247247    any additional arguments to the function when it is called. 
     
    257257def yieldUI(*args, **kwargs): 
    258258    """Yield to other apps/messages.""" 
    259     wx.Yield(*args, **kwargs)   
     259    wx.Yield(*args, **kwargs) 
    260260 
    261261 
    262262def beep(): 
    263263    wx.Bell() 
    264      
     264 
    265265 
    266266def busyInfo(msg="Please wait...", *args, **kwargs): 
    267267    """Display a message that the system is busy. 
    268268 
    269     Assign the return value to a local object, and the message will stay until the  
     269    Assign the return value to a local object, and the message will stay until the 
    270270    object is explicitly unbound. For example: 
    271271 
     
    290290            dabo.errorLog.write("Incorrect event class (%s) passed to continueEvent. Error: %s" 
    291291                    % (str(evt), str(e))) 
    292      
    293      
     292 
     293 
    294294def discontinueEvent(evt): 
    295295    try: 
     
    302302            dabo.errorLog.write("Incorrect event class (%s) passed to continueEvent. Error: %s" 
    303303                    % (str(evt), str(e))) 
    304      
    305      
     304 
     305 
    306306def getEventData(wxEvt): 
    307307    ed = {} 
    308308    eventType = wxEvt.GetEventType() 
    309      
     309 
    310310    if isinstance(wxEvt, (wx.KeyEvent, wx.MouseEvent, wx.TreeEvent, 
    311311            wx.CommandEvent, wx.CloseEvent, wx.grid.GridEvent, 
    312312            wx.grid.GridSizeEvent, wx.SplitterEvent) ): 
    313          
     313 
    314314        if dabo.allNativeEventInfo: 
    315315            # Cycle through all the attributes of the wx events, and evaluate them 
     
    319319                upPems = [p for p in d if p[0].isupper()] 
    320320                for pem in upPems: 
    321                     if pem in ("Skip", "Clone", "Destroy", "Button", "ButtonIsDown",  
    322                             "GetLogicalPosition", "ResumePropagation", "SetEventObject",  
    323                             "SetEventType", "SetId", "SetExtraLong", "SetInt", "SetString",  
     321                    if pem in ("Skip", "Clone", "Destroy", "Button", "ButtonIsDown", 
     322                            "GetLogicalPosition", "ResumePropagation", "SetEventObject", 
     323                            "SetEventType", "SetId", "SetExtraLong", "SetInt", "SetString", 
    324324                            "SetTimestamp", "StopPropagation"): 
    325325                        continue 
     
    331331            except: 
    332332                pass 
    333      
     333 
    334334    if isinstance(wxEvt, (wx.SplitterEvent,) ): 
    335335        try: 
     
    362362        else: 
    363363            ed["prompt"] = menu.Caption 
    364          
     364 
    365365 
    366366    if isinstance(wxEvt, wx.CommandEvent): 
     
    388388            if wx.Platform in ("__WXMAC__", "__WXGTK__"): 
    389389                ed["keyChar"] = chr(wxEvt.GetKeyCode()) 
    390             else:   
     390            else: 
    391391                ed["keyChar"] = chr(wxEvt.GetRawKeyCode()) 
    392392        except (ValueError, OverflowError): 
     
    394394        if not ed["keyChar"]: 
    395395            # See if it is one of the keypad keys 
    396             numpadKeys = { wx.WXK_NUMPAD0: "0", wx.WXK_NUMPAD1: "1",  
    397                     wx.WXK_NUMPAD2: "2", wx.WXK_NUMPAD3: "3", wx.WXK_NUMPAD4: "4",  
    398                     wx.WXK_NUMPAD5: "5", wx.WXK_NUMPAD6: "6", wx.WXK_NUMPAD7: "7",  
     396            numpadKeys = { wx.WXK_NUMPAD0: "0", wx.WXK_NUMPAD1: "1", 
     397                    wx.WXK_NUMPAD2: "2", wx.WXK_NUMPAD3: "3", wx.WXK_NUMPAD4: "4", 
     398                    wx.WXK_NUMPAD5: "5", wx.WXK_NUMPAD6: "6", wx.WXK_NUMPAD7: "7", 
    399399                    wx.WXK_NUMPAD8: "8", wx.WXK_NUMPAD9: "9", wx.WXK_NUMPAD_SPACE: " ", 
    400                     wx.WXK_NUMPAD_TAB: "\t", wx.WXK_NUMPAD_ENTER: "\r",  
    401                     wx.WXK_NUMPAD_EQUAL: "=", wx.WXK_NUMPAD_MULTIPLY: "*",  
    402                     wx.WXK_NUMPAD_ADD: "+", wx.WXK_NUMPAD_SUBTRACT: "-",  
     400                    wx.WXK_NUMPAD_TAB: "\t", wx.WXK_NUMPAD_ENTER: "\r", 
     401                    wx.WXK_NUMPAD_EQUAL: "=", wx.WXK_NUMPAD_MULTIPLY: "*", 
     402                    wx.WXK_NUMPAD_ADD: "+", wx.WXK_NUMPAD_SUBTRACT: "-", 
    403403                    wx.WXK_NUMPAD_DECIMAL: ".", wx.WXK_NUMPAD_DIVIDE: "/"} 
    404404            ed["keyChar"] = numpadKeys.get(ed["keyCode"], None) 
    405      
     405 
    406406    if isinstance(wxEvt, wx.ContextMenuEvent): 
    407407        ed["mousePosition"] = wxEvt.GetPosition() 
     
    409409    if isinstance(wxEvt, wx.CloseEvent): 
    410410        ed["force"] = not wxEvt.CanVeto() 
    411          
     411 
    412412    if isinstance(wxEvt, wx.TreeEvent): 
    413413        tree = wxEvt.GetEventObject() 
     
    425425        except: 
    426426            pass 
    427      
     427 
    428428    if isinstance(wxEvt, wx.SplitterEvent): 
    429429        try: 
     
    436436            except: 
    437437                ed["windowRemoved"] = None 
    438          
     438 
    439439    if hasattr(wxEvt, "GetId"): 
    440440        ed["id"] = wxEvt.GetId() 
     
    446446            ed["index"] = wxEvt.GetSelection() 
    447447 
    448      
     448 
    449449    if isinstance(wxEvt, wx.grid.GridEvent): 
    450450        ed["row"] = wxEvt.GetRow() 
     
    459459            ed["commandDown"] = wxEvt.CmdDown() 
    460460        except: pass 
    461      
     461 
    462462    if isinstance(wxEvt, wx.grid.GridSizeEvent): 
    463463        #ed["rowOrCol"] = wxEvt.GetRowOrCol() 
     
    475475            ed["commandDown"] = wxEvt.CmdDown() 
    476476        except: pass 
    477      
     477 
    478478    if isinstance(wxEvt, wx.calendar.CalendarEvent): 
    479479        ed["date"] = wxEvt.PyGetDate() 
     
    486486        ed["collapsed"] = not ed["expanded"] 
    487487        ed["panel"] = wxEvt.GetEventObject().GetParent() 
    488          
     488 
    489489    try: 
    490490        if isinstance(wxEvt, wx.html.HtmlLinkEvent): 
     
    493493        # wxPython 2.6 and earlier doesn't seem to have this event 
    494494        pass 
    495          
     495 
    496496    return ed 
    497      
     497 
    498498 
    499499def getMousePosition(): 
     
    508508    actwin = dabo.dAppRef.ActiveForm 
    509509    return actwin.relativeCoordinates(wx.GetMousePosition()) 
    510      
     510 
    511511 
    512512def getMouseObject(): 
    513513    """Returns a reference to the object below the mouse pointer 
    514     at the moment the command is issued. Useful for interactive  
    515     development when testing changes to classes 'in the wild' of a  
     514    at the moment the command is issued. Useful for interactive 
     515    development when testing changes to classes 'in the wild' of a 
    516516    live application. 
    517517    """ 
     
    522522    if isinstance(actwin, dabo.ui.dShell.dShell): 
    523523        actwin.lockDisplay() 
    524         actwin.sendToBack()     
     524        actwin.sendToBack() 
    525525    else: 
    526526        actwin = None 
     
    565565 
    566566 
    567 #### This will have to wait until I can figure out how to simulate a  
     567#### This will have to wait until I can figure out how to simulate a 
    568568#### modal form for the calendar. 
    569569# def popupCalendar(dt=None, x=None, y=None, pos="topleft"): 
    570570#   """Pops up a calendar control at the specified x,y location, relative 
    571 #   to the position. Positions can be one of 'topleft', 'topright',  
    572 #   'bottomleft', 'bottomright'. If no date is specified, defaults to  
     571#   to the position. Positions can be one of 'topleft', 'topright', 
     572#   'bottomleft', 'bottomright'. If no date is specified, defaults to 
    573573#   today. Returns the selected date, or None if the user presses Esc. 
    574574#   """ 
     
    577577#           dCalendar(self, RegID="cal", Position=(0,0)) 
    578578#           self.Size = self.cal.Size 
    579 #           
     579# 
    580580#       def onHit_cal(self, evt): 
    581581#           self.Visible = False 
    582 #       
     582# 
    583583#   pos = pos.lower().strip() 
    584584#   if dt is None: 
     
    588588#   else: 
    589589#       x, y = wx.ClientToScreen(x, y) 
    590 #   
     590# 
    591591#   calForm = popCal(None) 
    592592#   calForm.cal.Date = dt 
     
    605605#   return ret 
    606606 
    607      
     607 
    608608def _getActiveForm(): 
    609609    app = dabo.dAppRef 
     
    613613 
    614614 
    615 def getString(message=_("Please enter a string:"), caption="Dabo",  
     615def getString(message=_("Please enter a string:"), caption="Dabo", 
    616616        defaultValue="", **kwargs): 
    617617    """Simple dialog for returning a small bit of text from the user. 
     
    622622    # Give the textbox a default value: 
    623623    txt = dabo.ui.getString(defaultValue="initial string value") 
    624      
     624 
    625625    # Password Entry (*'s instead of the actual text) 
    626626    txt = dabo.ui.getString(PasswordEntry=True) 
     
    637637            self.Sizer.append(hs, "expand") 
    638638            dabo.ui.callAfter(self.strVal.setFocus) 
    639      
     639 
    640640    if defaultValue: 
    641641        kwargs["Value"] = defaultValue 
     
    650650 
    651651 
    652 def getInt(message=_("Enter an integer value:"), caption="Dabo",  
     652def getInt(message=_("Enter an integer value:"), caption="Dabo", 
    653653        defaultValue=0, **kwargs): 
    654654    """Simple dialog for returning an integer value from the user.""" 
     
    664664            self.Sizer.append(hs) 
    665665            dabo.ui.callAfter(self.spnVal.setFocus) 
    666              
     666 
    667667    if defaultValue: 
    668668        kwargs["Value"] = defaultValue 
     
    675675    dlg.Destroy() 
    676676    return val 
    677      
     677 
    678678 
    679679# The next two methods prompt the user to select from a list. The first allows 
     
    706706            self.Caption = caption 
    707707            lbl = dabo.ui.dLabel(self, Caption=message) 
    708             self.lst = dabo.ui.dListBox(self, Choices=choices,  
    709                     PositionValue=defaultPos, MultipleSelect=mult,  
     708            self.lst = dabo.ui.dListBox(self, Choices=choices, 
     709                    PositionValue=defaultPos, MultipleSelect=mult, 
    710710                    OnMouseLeftDoubleClick=self.onOK) 
    711711            sz = self.Sizer 
     
    733733                        borderSides=("left", "right")) 
    734734            sz.appendSpacer(24) 
    735          
     735 
    736736        def selectAll(self, evt): 
    737737            self.lst.selectAll() 
    738          
     738 
    739739        def unselectAll(self, evt): 
    740740            self.lst.unselectAll() 
    741          
     741 
    742742        def invertSelection(self, evt): 
    743743            self.lst.invertSelections() 
    744              
     744 
    745745    dlg = ChoiceDialog(_getActiveForm()) 
    746746    dlg.show() 
     
    750750        val = None 
    751751    dlg.release() 
    752     return val          
     752    return val 
    753753 
    754754 
     
    775775 
    776776def getDate(dt=None): 
    777     """Displays a calendar dialog for the user to select a date.  
     777    """Displays a calendar dialog for the user to select a date. 
    778778    Defaults to the given date parameter, or today if no value 
    779779    is passed. 
     
    793793        month = result[2] 
    794794        year = int(result[3]) 
    795         monthNames = ["January", "February", "March", "April", "May", "June",  
     795        monthNames = ["January", "February", "March", "April", "May", "June", 
    796796                "July", "August", "September", "October", "November", "December"] 
    797797        ret = datetime.date(year, monthNames.index(month)+1, day) 
     
    832832    list = fEnum.GetFacenames() 
    833833    list.sort() 
    834     return list     
     834    return list 
    835835 
    836836 
     
    852852    """Display the file selection dialog for the platform, and return selection(s). 
    853853 
    854     Send an optional multiple=True for the user to pick more than one file. In  
     854    Send an optional multiple=True for the user to pick more than one file. In 
    855855    that case, the return value will be a sequence of unicode strings. 
    856856 
    857     Returns the path to the selected file or files, or None if no selection was  
     857    Returns the path to the selected file or files, or None if no selection was 
    858858    made. Only file may be selected if multiple is False. 
    859859 
     
    865865    wc = _getWild(*args) 
    866866    return _getPath(dFileDialog, wildcard=wc, **kwargs)[0] 
    867          
     867 
    868868 
    869869def getFileAndType(*args, **kwargs): 
     
    879879        ret = (pth, args[idx]) 
    880880    return ret 
    881      
     881 
    882882 
    883883def getSaveAs(*args, **kwargs): 
     
    911911    was made. 
    912912    """ 
    913     return _getPath(dFolderDialog, message=message, defaultPath=defaultPath,  
     913    return _getPath(dFolderDialog, message=message, defaultPath=defaultPath, 
    914914            wildcard=wildcard)[0] 
    915915 
     
    929929        arglist = [] 
    930930        tmplt = "%s Files (*.%s)|*.%s" 
    931         fileDict = {"html" : "HTML",  
     931        fileDict = {"html" : "HTML", 
    932932            "xml" : "XML", 
    933933            "txt" : "Text", 
     
    935935            "gif" : "GIF", 
    936936            "png" : "PNG", 
    937             "ico" : "Icon",  
     937            "ico" : "Icon", 
    938938            "bmp" : "Bitmap" } 
    939              
     939 
    940940        for a in args: 
    941941            descrp = ext = "" 
     
    10131013 
    10141014def createMenuBar(srcFile, form=None, previewFunc=None): 
    1015     """Pass in an .mnxml file saved from the Menu Designer,  
    1016     and this will instantiate a MenuBar from that spec. Returns  
     1015    """Pass in an .mnxml file saved from the Menu Designer, 
     1016    and this will instantiate a MenuBar from that spec. Returns 
    10171017    a reference to the newly-created MenuBar. You can optionally 
    10181018    pass in a reference to the form to which this menu is 
    1019     associated, so that you can enter strings that represent  
    1020     form functions in the Designer, such as 'form.close', which  
     1019    associated, so that you can enter strings that represent 
     1020    form functions in the Designer, such as 'form.close', which 
    10211021    will call the associated form's close() method. If 'previewFunc' 
    1022     is passed, the menu command that would have been eval'd  
     1022    is passed, the menu command that would have been eval'd 
    10231023    and executed on a live menu will instead be passed back as 
    10241024    a parameter to that function. 
     
    10391039            return 
    10401040        app = dabo.dAppRef 
    1041         for itm in items:   
     1041        for itm in items: 
    10421042            if "Separator" in itm["name"]: 
    10431043                menu.appendSeparator() 
     
    10591059                help = itmatts["HelpText"] 
    10601060                menuItem = menu.append(cap, OnHit=binding, help=help, 
    1061                         picture=pic)    
    1062      
     1061                        picture=pic) 
     1062 
    10631063    mnd = dabo.lib.xmltodict.xmltodict(srcFile) 
    10641064    mb = dabo.ui.dMenuBar() 
     
    10661066        addMenu(mb, mn, form, previewFunc) 
    10671067    return mb 
    1068      
    1069      
    1070 def browse(dataSource, parent=None): 
     1068 
     1069 
     1070def browse(dataSource, parent=None, keyCaption=None, includeFields=None, 
     1071        colOrder=None, colWidths=None, colTypes=None, autoSizeCols=True): 
    10711072    """Given a data source, a form with a grid containing the data 
    1072     is created and displayed. If the source is a Dabo cursor object,  
     1073    is created and displayed. If the source is a Dabo cursor object, 
    10731074    its getDataSet() method will be called to extract the data. 
    10741075 
    10751076    If parent is passed, the form isn't created, and the browsegrid 
    10761077    becomes a child of parent instead. 
     1078 
     1079    The columns will be taken from the first record of the dataset, with each 
     1080    column header caption being set to the field name, unless   the optional 
     1081    keyCaption parameter is passed. This parameter is a 1:1 dict containing 
     1082    the data set keys as its keys, and the desired caption as the 
     1083    corresponding value. 
     1084 
     1085    If the includeFields parameter is a sequence, the only columns added will 
     1086    be the fieldnames included in the includeFields sequence. If the 
     1087    includeFields   parameter is None, all fields will be added to the grid. 
     1088 
     1089    The columns will be in the order returned by ds.keys(), unless the 
     1090    optional colOrder parameter is passed. Like the keyCaption property, 
     1091    this is a 1:1 dict containing key:order. 
    10771092    """ 
    10781093    if not isinstance(dataSource, (list, tuple)): 
     
    10961111 
    10971112    grd = dGrid(parent, AlternateRowColoring=True) 
    1098     grd.buildFromDataSet(dataSet) 
     1113    grd.buildFromDataSet(dataSet, keyCaption=keyCaption, 
     1114            includeFields=includeFields, colOrder=colOrder, colWidths=colWidths, 
     1115            colTypes=colTypes, autoSizeCols=autoSizeCols) 
    10991116 
    11001117    parent.Sizer.append(grd, 1, "x") 
     
    11231140    return fontMetric(txt=obj.Text, face=obj.FontFace, size=obj.FontSize, 
    11241141            bold=obj.FontBold, italic=obj.FontItalic) 
    1125      
     1142 
    11261143 
    11271144def fontMetric(txt=None, wind=None, face=None, size=None, bold=None, 
    11281145        italic=None): 
    11291146    """Calculate the width and height of the given text using the supplied 
    1130     font information. If any font parameters are missing, they are taken  
     1147    font information. If any font parameters are missing, they are taken 
    11311148    from the specified window, or, if no window is specified, the currently 
    11321149    active form. If no form is active, the app's MainForm is used. 
     
    11731190    """Takes a screenshot of the specified and writes it to a file, converting 
    11741191    it to the requested image type. If no object is specified, the current 
    1175     ActiveForm is used. You can add an optional delaySeconds setting that  
     1192    ActiveForm is used. You can add an optional delaySeconds setting that 
    11761193    will let you set things up as needed before the image is taken; if not specified, 
    11771194    the image is taken immediately. 
     
    11891206        # Nothing active! 
    11901207        stop(_("There is no active form to capture."), _("No Active Form")) 
    1191         return      
     1208        return 
    11921209    bmp = obj.getCaptureBitmap() 
    11931210    knownTypes = ("png", "jpg", "bmp", "pcx") 
     
    11991216        else: 
    12001217            imgType = (imgType, ) 
    1201     wxTypeDict = {"png":  wx.BITMAP_TYPE_PNG,  
    1202             "jpg":  wx.BITMAP_TYPE_JPEG,  
     1218    wxTypeDict = {"png":  wx.BITMAP_TYPE_PNG, 
     1219            "jpg":  wx.BITMAP_TYPE_JPEG, 
    12031220            "bmp":  wx.BITMAP_TYPE_BMP, 
    12041221            "pcx":  wx.BITMAP_TYPE_PCX} 
     
    12181235    img = wx.ImageFromBitmap(bmp) 
    12191236    img.SaveFile(pth, wxTypeDict[typ]) 
    1220          
    1221      
    1222          
    1223      
     1237 
     1238 
     1239 
     1240 
    12241241 
    12251242 
     
    12311248def bitmapFromData(data): 
    12321249    return BitmapFromImage(imageFromData(data)) 
    1233      
    1234      
     1250 
     1251 
    12351252def imageFromData(data): 
    12361253    stream = cStringIO.StringIO(data) 
     
    12411258# For applications that use the same image more than once, 
    12421259# this speeds up resolution of the requested image name. 
    1243 _bmpCache = {}  
     1260_bmpCache = {} 
    12441261def strToBmp(val, scale=None, width=None, height=None): 
    12451262    """This can be either a path, or the name of a built-in graphic. 
    12461263    If an adjusted size is desired, you can either pass a 'scale' value 
    1247     (where 1.00 is full size, 0.5 scales it to 50% in both Height and  
    1248     Width), or you can pass specific 'height' and 'width' values. The  
    1249     final image will be a bitmap resized to those specs.    
     1264    (where 1.00 is full size, 0.5 scales it to 50% in both Height and 
     1265    Width), or you can pass specific 'height' and 'width' values. The 
     1266    final image will be a bitmap resized to those specs. 
    12501267    """ 
    12511268    ret = None 
     
    12561273    else: 
    12571274        # Include all the pathing possibilities 
    1258         iconpaths = [os.path.join(pth, val)  
     1275        iconpaths = [os.path.join(pth, val) 
    12591276                for pth in dabo.icons.__path__] 
    1260         dabopaths = [os.path.join(pth, val)  
     1277        dabopaths = [os.path.join(pth, val) 
    12611278                for pth in dabo.__path__] 
    12621279        localpaths = [os.path.join(os.getcwd(), pth, val) 
     
    12781295    else: 
    12791296        _bmpCache[val] = ret 
    1280      
     1297 
    12811298    if ret is not None: 
    12821299        if scale is None and width is None and height is None: 
     
    13051322                    newWd = oldWd * (newHt / oldHt) 
    13061323            img.Rescale(newWd, newHt) 
    1307             ret = img.ConvertToBitmap()     
     1324            ret = img.ConvertToBitmap() 
    13081325    return ret 
    1309      
    1310      
     1326 
     1327 
    13111328def pathToBmp(pth): 
    13121329    img = wx.NullImage 
     
    13191336    img.Rescale(wd, ht) 
    13201337    return img.ConvertToBitmap() 
    1321      
    1322      
     1338 
     1339 
    13231340def getCommonBitmap(name): 
    1324     """wxPython comes with several built-in bitmaps for common icons.  
     1341    """wxPython comes with several built-in bitmaps for common icons. 
    13251342    This wraps the procedure for generating these bitmaps. If a name is 
    13261343    passed for which there is no icon, an image denoting a missing image 
     
    13361353 
    13371354def getImagePath(nm, url=False): 
    1338     """Given the name of an image in either the Dabo common directory, or the  
     1355    """Given the name of an image in either the Dabo common directory, or the 
    13391356    current directory, returns the full path to the image. If 'url' is true, returns 
    13401357    the path in a 'file:///image.ext' format. 
     
    13681385            ret = "file://%s" % ret 
    13691386    return ret 
    1370          
     1387 
    13711388 
    13721389