test: Convert to Python 3

Change raw_input() to input() and unicode to str. This is *not*
compatible with Python 2. Update the hashbangs to run with Python 3.
This commit is contained in:
Martin Pitt 2014-03-11 17:39:22 +01:00 committed by Denis Kenzior
parent ad4f90684f
commit c027ab9fbc
94 changed files with 124 additions and 124 deletions

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import sys import sys
import dbus import dbus

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import dbus import dbus

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import os import os
import re import re

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import sys import sys
import dbus import dbus

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import dbus import dbus
import sys import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import dbus import dbus
import sys import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import sys import sys
import dbus import dbus

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import sys import sys
import dbus import dbus

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import dbus import dbus

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import dbus import dbus
import sys import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import dbus import dbus
import sys import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import sys import sys
import dbus import dbus

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import sys import sys
import dbus import dbus

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import sys import sys
import dbus import dbus

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import sys import sys
import dbus import dbus

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import sys import sys
import dbus import dbus

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import sys import sys
import dbus import dbus

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import sys import sys
from gi.repository import GLib from gi.repository import GLib

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import dbus import dbus
import sys import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import dbus import dbus
import sys import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import sys import sys
import dbus import dbus

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import dbus import dbus
import sys import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import dbus import dbus
import sys import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import dbus import dbus
import sys import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import dbus import dbus
import sys import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import dbus import dbus
import sys import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import dbus import dbus
import sys import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import dbus import dbus
import sys import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import dbus import dbus
import sys import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import dbus, sys import dbus, sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import sys import sys
import dbus import dbus

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import sys import sys
import dbus import dbus

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import sys import sys
import dbus import dbus

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import sys import sys
import dbus import dbus

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import sys import sys
import dbus import dbus

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import sys import sys
import dbus import dbus
@ -45,7 +45,7 @@ if state == "idle":
print("State: %s" % (state)) print("State: %s" % (state))
while state == "user-response": while state == "user-response":
response = raw_input("Enter response: ") response = input("Enter response: ")
result = ussd.Respond(response, timeout=100) result = ussd.Respond(response, timeout=100)

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import dbus import dbus

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import dbus import dbus

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import dbus import dbus

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import dbus import dbus

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import dbus import dbus
import sys import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import dbus import dbus
import sys import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import dbus import dbus
import sys import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
from gi.repository import GLib from gi.repository import GLib
@ -6,7 +6,7 @@ import dbus
import dbus.mainloop.glib import dbus.mainloop.glib
_dbus2py = { _dbus2py = {
dbus.String : unicode, dbus.String : str,
dbus.UInt32 : int, dbus.UInt32 : int,
dbus.Int32 : int, dbus.Int32 : int,
dbus.Int16 : int, dbus.Int16 : int,

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
from gi.repository import GLib from gi.repository import GLib
@ -6,7 +6,7 @@ import dbus
import dbus.mainloop.glib import dbus.mainloop.glib
_dbus2py = { _dbus2py = {
dbus.String : unicode, dbus.String : str,
dbus.UInt32 : int, dbus.UInt32 : int,
dbus.Int32 : int, dbus.Int32 : int,
dbus.Int16 : int, dbus.Int16 : int,

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import dbus, sys import dbus, sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import dbus, sys import dbus, sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import sys import sys
import dbus import dbus

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import os import os
import dbus import dbus

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
from gi.repository import GLib from gi.repository import GLib

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import dbus import dbus

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import dbus import dbus

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import dbus import dbus

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import dbus import dbus

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import dbus import dbus
import sys import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import dbus import dbus
import sys import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import sys import sys
import dbus import dbus

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import sys import sys
import dbus import dbus
@ -46,7 +46,7 @@ if state == "idle":
print("State: %s" % (state)) print("State: %s" % (state))
while state == "user-response": while state == "user-response":
response = raw_input("Enter response: ") response = input("Enter response: ")
print(ussd.Respond(response, timeout=100)) print(ussd.Respond(response, timeout=100))

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import sys import sys
import dbus import dbus

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import sys import sys
import dbus import dbus

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import sys import sys
from gi.repository import GLib from gi.repository import GLib

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import dbus import dbus
import sys import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import sys import sys
import dbus import dbus

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import dbus import dbus
import sys import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import dbus import dbus
import sys import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import sys import sys
import dbus import dbus

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import sys import sys
import dbus import dbus

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import dbus import dbus
import sys import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import sys import sys
import dbus import dbus

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import sys import sys
import dbus import dbus

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import dbus import dbus
import sys import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import dbus import dbus
import sys import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import dbus import dbus
import sys import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import dbus import dbus
import sys import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import sys import sys
import dbus import dbus

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
from gi.repository import GLib from gi.repository import GLib
import sys import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
from gi.repository import GLib from gi.repository import GLib
import sys import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
from gi.repository import GLib from gi.repository import GLib

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
from gi.repository import GLib from gi.repository import GLib

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import dbus import dbus
import dbus.mainloop.glib import dbus.mainloop.glib
@ -78,7 +78,7 @@ def set_topics(cbs):
invalidData = False; invalidData = False;
index = 0 index = 0
topics = raw_input('Enter the topic ID(s) you want to register to: ') topics = input('Enter the topic ID(s) you want to register to: ')
while index < len(topics): while index < len(topics):
if topics[index] == ',' or topics[index] == '-': if topics[index] == ',' or topics[index] == '-':

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
from gi.repository import GLib from gi.repository import GLib
import sys import sys
@ -40,7 +40,7 @@ def print_menu():
def stdin_handler(channel, condition, gnss, path): def stdin_handler(channel, condition, gnss, path):
in_key = os.read(channel.unix_get_fd(), 160).rstrip().decode('UTF-8') in_key = os.read(channel.unix_get_fd(), 160).rstrip().decode('UTF-8')
if in_key == '0': if in_key == '0':
xml = raw_input('type the element and press enter: ') xml = input('type the element and press enter: ')
try: try:
gnss.SendPositioningElement(dbus.String(xml)) gnss.SendPositioningElement(dbus.String(xml))
print("ok") print("ok")

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
from gi.repository import GLib from gi.repository import GLib
import sys import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
from gi.repository import GLib from gi.repository import GLib

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
from gi.repository import GLib from gi.repository import GLib
import sys import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import dbus, sys import dbus, sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
from gi.repository import GLib from gi.repository import GLib

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
from gi.repository import GLib from gi.repository import GLib

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from gi.repository import GLib from gi.repository import GLib
@ -132,7 +132,7 @@ def stdin_handler(channel, condition, sms, value, number):
lock = "on" lock = "on"
if in_key == '0': if in_key == '0':
print_send_sms_menu() print_send_sms_menu()
sms_type = raw_input('Select SMS type: ') sms_type = input('Select SMS type: ')
if sms_type == '1': if sms_type == '1':
message_send(sms, number, value) message_send(sms, number, value)
@ -150,49 +150,49 @@ def stdin_handler(channel, condition, sms, value, number):
elif in_key == '1': elif in_key == '1':
message_delivery_report(sms, 1) message_delivery_report(sms, 1)
send_msg = raw_input('Send test message[y/n]?: ') send_msg = input('Send test message[y/n]?: ')
if send_msg == 'y': if send_msg == 'y':
message_send(sms, number, ("(1)" + value + message_send(sms, number, ("(1)" + value +
": UseDeliveryReports[TRUE]")) ": UseDeliveryReports[TRUE]"))
elif in_key == '2': elif in_key == '2':
message_delivery_report(sms, 0) message_delivery_report(sms, 0)
send_msg = raw_input('Send test message[y/n]?: ') send_msg = input('Send test message[y/n]?: ')
if send_msg == 'y': if send_msg == 'y':
message_send(sms, number, ("(2) " + value + message_send(sms, number, ("(2) " + value +
": UseDeliveryReports[FALSE]")) ": UseDeliveryReports[FALSE]"))
elif in_key == '3': elif in_key == '3':
message_service_center_address(sms, SCA) message_service_center_address(sms, SCA)
send_msg = raw_input('Send test message[y/n]?: ') send_msg = input('Send test message[y/n]?: ')
if send_msg == 'y': if send_msg == 'y':
message_send(sms, number, ("(3) " + value + message_send(sms, number, ("(3) " + value +
": ServiceCenterAddress")) ": ServiceCenterAddress"))
elif in_key == '4': elif in_key == '4':
message_bearer(sms, "ps-only") message_bearer(sms, "ps-only")
send_msg = raw_input('Send test message[y/n]?: ') send_msg = input('Send test message[y/n]?: ')
if send_msg == 'y': if send_msg == 'y':
message_send(sms, number, ("(4) " + value + message_send(sms, number, ("(4) " + value +
": Bearer[ps-only]")) ": Bearer[ps-only]"))
elif in_key == '5': elif in_key == '5':
message_bearer(sms, "cs-only") message_bearer(sms, "cs-only")
send_msg = raw_input('Send test message[y/n]?: ') send_msg = input('Send test message[y/n]?: ')
if send_msg == 'y': if send_msg == 'y':
message_send(sms, number, ("(5) " + value + message_send(sms, number, ("(5) " + value +
": Bearer[cs-only]")) ": Bearer[cs-only]"))
elif in_key == '6': elif in_key == '6':
message_bearer(sms, "ps-preferred") message_bearer(sms, "ps-preferred")
send_msg = raw_input('Send test message[y/n]?: ') send_msg = input('Send test message[y/n]?: ')
if send_msg == 'y': if send_msg == 'y':
message_send(sms, number, ("(6) " + value + message_send(sms, number, ("(6) " + value +
": Bearer[ps-preferred]")) ": Bearer[ps-preferred]"))
elif in_key == '7': elif in_key == '7':
message_bearer(sms, "cs-preferred") message_bearer(sms, "cs-preferred")
send_msg = raw_input('Send test message[y/n]?: ') send_msg = input('Send test message[y/n]?: ')
if send_msg == 'y': if send_msg == 'y':
message_send(sms,number, ("(7) " + value + message_send(sms,number, ("(7) " + value +
": Bearer[cs-preferred]")) ": Bearer[cs-preferred]"))

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import sys import sys
import dbus import dbus

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
from gi.repository import GLib from gi.repository import GLib

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
from gi.repository import GLib from gi.repository import GLib

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
from gi.repository import GLib from gi.repository import GLib

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
from gi.repository import GLib from gi.repository import GLib
@ -57,7 +57,7 @@ class StkAgent(dbus.service.Object):
index += 1 index += 1
print("\nDefault: %d" % (default)) print("\nDefault: %d" % (default))
select = raw_input("Enter Selection (t, b):") select = input("Enter Selection (t, b):")
if select == 'b': if select == 'b':
raise GoBack("User wishes to go back") raise GoBack("User wishes to go back")
@ -74,7 +74,7 @@ class StkAgent(dbus.service.Object):
print("DisplayText (%s)" % (title)) print("DisplayText (%s)" % (title))
print("Icon: (%d)" % (icon)) print("Icon: (%d)" % (icon))
print("Urgent: (%d)" % (urgent)) print("Urgent: (%d)" % (urgent))
key = raw_input("Press return to clear ('t' terminates, " key = input("Press return to clear ('t' terminates, "
"'b' goes back, 'n' busy, " "'b' goes back, 'n' busy, "
"'w' return and wait):") "'w' return and wait):")
@ -107,7 +107,7 @@ class StkAgent(dbus.service.Object):
print("Hide typing: (%s)" % (hide_typing)) print("Hide typing: (%s)" % (hide_typing))
print("Enter characters, min: %d, max: %d:" % (min_chars, print("Enter characters, min: %d, max: %d:" % (min_chars,
max_chars)) max_chars))
userin = raw_input("") userin = input("")
return userin return userin
@ -121,7 +121,7 @@ class StkAgent(dbus.service.Object):
print("Hide typing: (%s)" % (hide_typing)) print("Hide typing: (%s)" % (hide_typing))
print("Enter digits, min: %d, max: %d:" % (min_chars, print("Enter digits, min: %d, max: %d:" % (min_chars,
max_chars)) max_chars))
userin = raw_input("'t' terminates, 'b' goes back:") userin = input("'t' terminates, 'b' goes back:")
if userin == 'b': if userin == 'b':
raise GoBack("User wishes to go back") raise GoBack("User wishes to go back")
@ -135,7 +135,7 @@ class StkAgent(dbus.service.Object):
def RequestKey(self, title, icon): def RequestKey(self, title, icon):
print("Title: (%s)" % (title)) print("Title: (%s)" % (title))
print("Icon: (%d)" % (icon)) print("Icon: (%d)" % (icon))
key = raw_input("Enter Key (t, b):") key = input("Enter Key (t, b):")
if key == 'b': if key == 'b':
raise GoBack("User wishes to go back") raise GoBack("User wishes to go back")
@ -149,7 +149,7 @@ class StkAgent(dbus.service.Object):
def RequestDigit(self, title, icon): def RequestDigit(self, title, icon):
print("Title: (%s)" % (title)) print("Title: (%s)" % (title))
print("Icon: (%d)" % (icon)) print("Icon: (%d)" % (icon))
key = raw_input("Enter Digit (t, b):") key = input("Enter Digit (t, b):")
if key == 'b': if key == 'b':
raise GoBack("User wishes to go back") raise GoBack("User wishes to go back")
@ -163,7 +163,7 @@ class StkAgent(dbus.service.Object):
def RequestQuickDigit(self, title, icon): def RequestQuickDigit(self, title, icon):
print("Title: (%s)" % (title)) print("Title: (%s)" % (title))
print("Icon: (%d)" % (icon)) print("Icon: (%d)" % (icon))
key = raw_input("Quick digit (0-9, *, #, t, b):") key = input("Quick digit (0-9, *, #, t, b):")
if key == 'b': if key == 'b':
raise GoBack("User wishes to go back") raise GoBack("User wishes to go back")
@ -177,7 +177,7 @@ class StkAgent(dbus.service.Object):
def RequestConfirmation(self, title, icon): def RequestConfirmation(self, title, icon):
print("Title: (%s)" % (title)) print("Title: (%s)" % (title))
print("Icon: (%d)" % (icon)) print("Icon: (%d)" % (icon))
key = raw_input("Enter Confirmation (t, b, y, n):") key = input("Enter Confirmation (t, b, y, n):")
if key == 'b': if key == 'b':
raise GoBack("User wishes to go back") raise GoBack("User wishes to go back")
@ -193,7 +193,7 @@ class StkAgent(dbus.service.Object):
def ConfirmCallSetup(self, info, icon): def ConfirmCallSetup(self, info, icon):
print("Information: (%s)" % (info)) print("Information: (%s)" % (info))
print("Icon: (%d)" % (icon)) print("Icon: (%d)" % (icon))
key = raw_input("Enter Confirmation (t, y, n):") key = input("Enter Confirmation (t, y, n):")
if key == 't': if key == 't':
raise EndSession("User wishes to terminate session") raise EndSession("User wishes to terminate session")
@ -208,7 +208,7 @@ class StkAgent(dbus.service.Object):
print("Information: (%s)" % (info)) print("Information: (%s)" % (info))
print("Icon: (%d)" % (icon)) print("Icon: (%d)" % (icon))
print("URL (%s)" % (url)) print("URL (%s)" % (url))
key = raw_input("Enter Confirmation (y, n):") key = input("Enter Confirmation (y, n):")
if key == 'y': if key == 'y':
return True return True
@ -231,7 +231,7 @@ class StkAgent(dbus.service.Object):
signal.alarm(5) signal.alarm(5)
try: try:
key = raw_input("Press return to end before end of" key = input("Press return to end before end of"
" single tone (t):") " single tone (t):")
signal.alarm(0) signal.alarm(0)
@ -249,7 +249,7 @@ class StkAgent(dbus.service.Object):
print("LoopTone: %s" % (tone)) print("LoopTone: %s" % (tone))
print("Text: %s" % (text)) print("Text: %s" % (text))
print("Icon: %d" % (icon)) print("Icon: %d" % (icon))
key = raw_input("Press return to end before timeout " key = input("Press return to end before timeout "
"('t' terminates, 'w' return and wait):") "('t' terminates, 'w' return and wait):")
if key == 'w': if key == 'w':
@ -278,7 +278,7 @@ class StkAgent(dbus.service.Object):
def DisplayAction(self, text, icon): def DisplayAction(self, text, icon):
print("Text: (%s)" % (text)) print("Text: (%s)" % (text))
print("Icon: (%d)" % (icon)) print("Icon: (%d)" % (icon))
key = raw_input("Press 't' to terminate the session ") key = input("Press 't' to terminate the session ")
if key == 't': if key == 't':
raise EndSession("User wishes to terminate session") raise EndSession("User wishes to terminate session")
@ -288,7 +288,7 @@ class StkAgent(dbus.service.Object):
def ConfirmOpenChannel(self, info, icon): def ConfirmOpenChannel(self, info, icon):
print("Open channel confirmation: (%s)" % (info)) print("Open channel confirmation: (%s)" % (info))
print("Icon: (%d)" % (icon)) print("Icon: (%d)" % (icon))
key = raw_input("Enter Confirmation (t, y, n):") key = input("Enter Confirmation (t, y, n):")
if key == 't': if key == 't':
raise EndSession("User wishes to terminate session") raise EndSession("User wishes to terminate session")
@ -298,7 +298,7 @@ class StkAgent(dbus.service.Object):
return False return False
_dbus2py = { _dbus2py = {
dbus.String : unicode, dbus.String : str,
dbus.UInt32 : int, dbus.UInt32 : int,
dbus.Int32 : int, dbus.Int32 : int,
dbus.Int16 : int, dbus.Int16 : int,
@ -395,7 +395,7 @@ if __name__ == '__main__':
except: except:
pass pass
select = int(raw_input("Enter Selection: ")) select = int(input("Enter Selection: "))
stk.SelectItem(select, path) stk.SelectItem(select, path)
elif mode == 'agent': elif mode == 'agent':
path = "/test/agent" path = "/test/agent"

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import dbus import dbus
import sys import sys