コード例 #1
0
ファイル: interwiki.py プロジェクト: karstenw/Library
 def translate(self, hints = None):
     """Add the translation hints given to the todo list"""
     import titletranslate
     arr = {}
     titletranslate.translate(self.inpl, arr, same = globalvar.same, hints = hints)
     for pl in arr.iterkeys():
         self.todo[pl] = pl.code()
コード例 #2
0
ファイル: interwiki.py プロジェクト: karstenw/Library
            if globalvar.untranslated:
                if globalvar.bell:
                    sys.stdout.write('\07')
                newhint = None
                while 1:
                    newhint = raw_input("Hint:")
                    if newhint and not ':' in newhint:
                        print "Please enter a hint like language:pagename"
                        #print "or type 'q' to stop generating new pages"
                        print "or type nothing if you do not have a hint"
                    elif not newhint:
                        break
                    else:
                        arr = {}
                        import titletranslate
                        titletranslate.translate(pl, arr, same = False,
                                                 hints = [newhint])
                        for pl in arr.iterkeys():
                            self.todo[pl] = pl.code()
                            counter.plus(pl.code())

    def isDone(self):
        """Return True if all the work for this subject has completed."""
        return len(self.todo) == 0

    def problem(self, txt):
        """Report a problem with the resolution of this subject."""
        print "ERROR: %s"%txt
        self.confirm += 1
        if globalvar.autonomous:
            f=open('autonomous_problem.dat', 'a')
            f.write("%s {%s}\n" % (self.inpl.asasciilink(), txt))