File: console.py

package info (click to toggle)
libaqbanking 2.2.3-3
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 14,912 kB
  • ctags: 6,430
  • sloc: ansic: 59,251; cpp: 17,347; sh: 8,930; xml: 6,189; makefile: 3,326; python: 2,806; pascal: 559; perl: 267
file content (68 lines) | stat: -rw-r--r-- 1,721 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# -*- encoding: latin1 -*-
# Copyright (C) 2005 by Andreas Degert
# see LICENSE.txt in the top level distribution directory
#
import aqbanking, getpass, ctypes, sys

class BankingConsole(aqbanking.BankingBase):

    def getPin(self,ab,flags,token,title,text,buffer,minLen,maxLen):
        text = aqbanking.stripText(
            text, markup=False, encoding=sys.stdin.encoding)
        stdin = sys.stdin
        try:
            sys.stdin = file('/dev/tty')
        except:
            pass
        try:
            p = getpass.getpass(text+': ')
        finally:
            sys.stdin = stdin
        ctypes.memmove(buffer, p, len(p)+1)
        return 0

    def messageBox(self, ab, flags, title, text, b1, b2, b3):
        print "message_box", text
        return 0

    def inputBox(*args):
        print "input_box", args
        return 0

    def showBox(*args):
        print "show_box", args
        return 0

    def hideBox(*args):
        print "hide_box", args
        return 0

    def progressStart(self, ab, title, text, total):
        print text.decode("utf8")
        return 0

    def progressAdvance(self, ab, l_id, progress):
        #sys.stdout.write('.')
        return 0

    def progressLog(self, ab, l_id, level, text):
        print text.decode("utf8")
        return 0

    def progressEnd(*args):
        return 0

    def printout(*args):
        print "printout", args
        return 0

    def setPinStatus(*args):
        #print "set_pin_status", args
        return 0

    def getTan(self,ab,token,title,text,buffer,minLen,maxLen):
        return self.getPin(ab,0,token,title,text,buffer,minLen,maxLen)

    def setTanStatus(*args):
        print "set_tan_status", args
        return 0