def resolve_wxversion(): patt = "%d\.%d[0-9\-\.A-Za-z]*-unicode" patts = "-unicode" versions = wxversion.getInstalled() if verbose: print 'wxPython Installed :', versions # need to select the more recent one with 'unicode' vSelected = None vSelectedMsg = '' for eachVersion in versions: for min in range(WXVERSION_MINOR1, WXVERSION_MINOR2 + 1): m = re.search(patt % (WXVERSION_MAJOR, min), eachVersion) if m: if min == WXVERSION_MINOR2: vSelectedMsg = '' else: vSelectedMsg = ' (deprecated version - think to update)' vSelected = eachVersion break if m: break if vSelected: print 'wxPython Selected :', vSelected, vSelectedMsg wxversion.select(vSelected) return # no compatible version :-( : try to select any release bUnicode = False for eachVersion in versions: m = re.search(patts, eachVersion) if m: print 'wxPython Selected :', eachVersion wxversion.select(eachVersion) bUnicode = True break if not bUnicode: # only ansi release :-( => use US lang setLang('us') import sys, wx, webbrowser app = wx.PySimpleApp() wx.MessageBox( message('wxversion_msg') % (WXVERSION_MAJOR, WXVERSION_MINOR2), message('wxversion_title')) app.MainLoop() webbrowser.open("http://wxpython.org/") sys.exit()
def resolve_wxversion(): patt = "%d\.%d[0-9\-\.A-Za-z]*-unicode" patts = "-unicode" versions = wxversion.getInstalled() if verbose: print 'wxPython Installed :',versions # need to select the more recent one with 'unicode' vSelected = None vSelectedMsg = '' for eachVersion in versions: for min in range(WXVERSION_MINOR1,WXVERSION_MINOR2+1): m = re.search( patt % (WXVERSION_MAJOR,min), eachVersion) if m: if min == WXVERSION_MINOR2: vSelectedMsg = '' else: vSelectedMsg = ' (deprecated version - think to update)' vSelected = eachVersion break if m: break if vSelected: print 'wxPython Selected :',vSelected,vSelectedMsg wxversion.select(vSelected) return # no compatible version :-( : try to select any release bUnicode = False for eachVersion in versions: m = re.search(patts, eachVersion) if m: print 'wxPython Selected :',eachVersion wxversion.select(eachVersion) bUnicode = True break if not bUnicode: # only ansi release :-( => use US lang setLang('us') import sys, wx, webbrowser app = wx.PySimpleApp() wx.MessageBox(message('wxversion_msg') % (WXVERSION_MAJOR,WXVERSION_MINOR2), message('wxversion_title')) app.MainLoop() webbrowser.open("http://wxpython.org/") sys.exit()
# ============================================================================ try: ignore(gNewsGoogle) except NameError: gNewsGoogle = News_Google() # ============================================================================ # Test me # ============================================================================ if __name__=='__main__': setLevel(logging.INFO) from itrade_local import setLang setLang('fr') from itrade_quotes import quotes quote = quotes.lookupTicker('AAPL') print gNewsGoogle.feedQuote(quote) quote = quotes.lookupTicker('AXL') print gNewsGoogle.feedQuote(quote) print gNewsGoogle.feedQuote(quote,'fr') quote = quotes.lookupTicker('SAF') print gNewsGoogle.feedQuote(quote) # ============================================================================ # That's all folks ! # ============================================================================