http://www.mediawiki.org/wiki/Special:Code/pywikipedia/9065
Revision: 9065 Author: xqt Date: 2011-03-13 14:33:42 +0000 (Sun, 13 Mar 2011) Log Message: ----------- stripped trailing whitespace
Modified Paths: -------------- branches/rewrite/pywikibot/userinterfaces/cgi_interface.py branches/rewrite/pywikibot/userinterfaces/tkinter_interface.py branches/rewrite/pywikibot/userinterfaces/transliteration.py branches/rewrite/pywikibot/userinterfaces/wxpython_interface.py
Modified: branches/rewrite/pywikibot/userinterfaces/cgi_interface.py =================================================================== --- branches/rewrite/pywikibot/userinterfaces/cgi_interface.py 2011-03-13 14:29:45 UTC (rev 9064) +++ branches/rewrite/pywikibot/userinterfaces/cgi_interface.py 2011-03-13 14:33:42 UTC (rev 9065) @@ -15,6 +15,6 @@ if not toStdout: return sys.stdout.write(text.encode('UTF-8', 'replace')) - + def input(self, question, colors = None): self.output(question + ' ', newline = False, showcgi = True)
Modified: branches/rewrite/pywikibot/userinterfaces/tkinter_interface.py =================================================================== --- branches/rewrite/pywikibot/userinterfaces/tkinter_interface.py 2011-03-13 14:29:45 UTC (rev 9064) +++ branches/rewrite/pywikibot/userinterfaces/tkinter_interface.py 2011-03-13 14:33:42 UTC (rev 9065) @@ -39,7 +39,7 @@ self.hotkeys = hotkeys self.default = default tkSimpleDialog.Dialog.__init__(self, master) - + def body(self, master): Label(self, text=self.question).grid(columnspan = len(self.options)) btns = [] @@ -66,7 +66,7 @@
def buttonbox(self): return - + def select(self, i, event=None): self.selection = i self.ok() @@ -115,7 +115,7 @@ object. Do not call this object's methods directly. Methods of this object cannot return values to the main thread; they must store them in attributes to be retrieved by the main thread. - + """ # TODO: use Event for inter-thread communication instead of wait loops def __init__(self, parent, **kwargs): @@ -159,7 +159,7 @@ This object serves only to dispatch event calls to the TkController object, to be run in that object's separate mainloop thread; and, when necessary, to wait for the user's response. - + """ def __init__(self, parent = None): # create a new window if necessary
Modified: branches/rewrite/pywikibot/userinterfaces/transliteration.py =================================================================== --- branches/rewrite/pywikibot/userinterfaces/transliteration.py 2011-03-13 14:29:45 UTC (rev 9064) +++ branches/rewrite/pywikibot/userinterfaces/transliteration.py 2011-03-13 14:33:42 UTC (rev 9065) @@ -42,7 +42,7 @@ if char == u"Ð": return u"Dh" if char == u"ð": - return u"dh" + return u"dh" if char in u"ĎḊḌḎḐḒĐƉƊƋ": return u"D" if char in u"ďḋḍḏḑḓđɖɗƌ": @@ -175,7 +175,7 @@ return u"z" if char == u"ɀ": return u"zv" - + # Latin: extended Latin alphabet if char == u"ɑ": return u"a" @@ -331,8 +331,8 @@ return u"?!" if char == u"؟": return u";-)" -
+ # Cyrillic if char == u"А": return u"A" @@ -706,8 +706,8 @@ return u"Ü" if char == u"ѵ": return u"ü" -
+ # Hebrew alphabet if char in u"אע": return u"'" @@ -751,7 +751,7 @@ return u"sh" if char == u"ת": return u"th" - + # Arab alphabet if char in u"اﺍﺎ": return u"a" @@ -1818,7 +1818,7 @@ return u"8" if char == u"৯": return u"9" - + # Thai (because of complications of the alphabet, transliterations # are very imprecise here) if char == u"ก": @@ -1902,6 +1902,6 @@ if char in u"ฯ": return u"." if char in u"ๆ": - return u"(2)" - + return u"(2)" + return default
Modified: branches/rewrite/pywikibot/userinterfaces/wxpython_interface.py =================================================================== --- branches/rewrite/pywikibot/userinterfaces/wxpython_interface.py 2011-03-13 14:29:45 UTC (rev 9064) +++ branches/rewrite/pywikibot/userinterfaces/wxpython_interface.py 2011-03-13 14:33:42 UTC (rev 9065) @@ -12,7 +12,7 @@ class UI(terminal_interface.UI): def __init__(self): pass - + def input(self, question, password = False): """ Works like raw_input(), but returns a unicode string instead of ASCII. @@ -21,7 +21,7 @@ question. """ # TODO: hide input if password = True - + self.output(question) if password: answer = wx.PasswordEntryDialog( None, question, '','') @@ -42,7 +42,7 @@ options[i] = '%s[%s]%s' % (option[:pos], option[pos], option[pos+1:]) else: options[i] = '%s [%s]' % (option, hotkey) - + while True: prompt = '%s\n(%s)' % (question, ', '.join(options)) self.output('%s (%s)' % (question, ', '.join(options))) @@ -50,7 +50,7 @@ answer.ShowModal() answer = answer.GetValue() self.output(answer+'\n') - + if answer.lower() in hotkeys or answer.upper() in hotkeys: return answer elif default and answer=='':# empty string entered