various Python 3 adjustments
This commit is contained in:
parent
c882bcd59f
commit
834233ac17
|
@ -66,14 +66,14 @@ class FeApUserInterface(object):
|
|||
cb(self.__nsi_cnt % 10)
|
||||
|
||||
def __on_nsi_falling(self, pin):
|
||||
#print 'nsi'
|
||||
#print('nsi')
|
||||
self.__nsi_cnt += 1
|
||||
|
||||
def __on_gabelschalter_change(self, pin):
|
||||
gbstate = gpio.input(self.__pinconfig.pin_gabelschalter)
|
||||
if self.__pinconfig.invert_gs:
|
||||
gbstate = 1 - gbstate
|
||||
print 'gabelschalter:', gbstate
|
||||
print('gabelschalter:', gbstate)
|
||||
for cb in self.__gabelschalter_callbacks:
|
||||
cb(gbstate)
|
||||
|
||||
|
@ -89,10 +89,10 @@ class FeApUserInterface(object):
|
|||
gpio.output(self.__pinconfig.pin_wecker_b, 1)
|
||||
time.sleep(0.02)
|
||||
c += 40
|
||||
print 'ring'
|
||||
print('ring')
|
||||
gpio.output(self.__pinconfig.pin_wecker_enable, 0)
|
||||
|
||||
print ''
|
||||
print('')
|
||||
time.sleep(4)
|
||||
|
||||
|
||||
|
@ -123,7 +123,7 @@ if __name__ == '__main__':
|
|||
t = FeApUserInterface(pinconfig)
|
||||
|
||||
def dailed(num):
|
||||
print num
|
||||
print(num)
|
||||
|
||||
t.add_nummernschalter_callback(dailed)
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import csv
|
||||
import ConfigParser
|
||||
import configparser
|
||||
import apparatinterface
|
||||
import phoneinterface
|
||||
import statemachine
|
||||
|
@ -20,7 +20,7 @@ class ConfigurationReader(object):
|
|||
}
|
||||
|
||||
def __init__(self):
|
||||
self.__cp = ConfigParser.ConfigParser(defaults=ConfigurationReader.DEFAULTS)
|
||||
self.__cp = configparser.ConfigParser(defaults=ConfigurationReader.DEFAULTS)
|
||||
self.pinconfig = None
|
||||
self.dialconfig = None
|
||||
self.phoneconfig = None
|
||||
|
@ -45,9 +45,9 @@ class ConfigurationReader(object):
|
|||
shortcuts = {}
|
||||
with open(fname, 'r') as csvfile:
|
||||
for row in csv.DictReader(csvfile):
|
||||
print 'row', row
|
||||
print('row', row)
|
||||
shortcuts[row['shortcut']] = row['number']
|
||||
print 'shortcuts:', shortcuts
|
||||
print('shortcuts:', shortcuts)
|
||||
return shortcuts
|
||||
|
||||
def __read_blacklist(self):
|
||||
|
@ -61,7 +61,7 @@ class ConfigurationReader(object):
|
|||
def read(self, f):
|
||||
self.__cp.read(f)
|
||||
|
||||
print 'pin_nsa:', self.__get_global_val_int('pin_nsa'),
|
||||
print('pin_nsa:', self.__get_global_val_int('pin_nsa'),)
|
||||
self.pinconfig = apparatinterface.FeApPinConfiguration(
|
||||
gpio_numbering = self.__get_global_val('gpio_numbering'),
|
||||
pin_nsa = self.__get_global_val_int('pin_nsa'),
|
||||
|
|
|
@ -65,7 +65,7 @@ def phone_cb(event):
|
|||
controller.queue_event('invalid_number')
|
||||
|
||||
if __name__ == '__main__':
|
||||
print FeTAp
|
||||
print(FeTAp)
|
||||
|
||||
cfg = configreader.ConfigurationReader()
|
||||
cfg.read('fetap.ini')
|
||||
|
|
|
@ -41,7 +41,7 @@ class PhoneEvent(object):
|
|||
|
||||
@classmethod
|
||||
def string(cls, val):
|
||||
for k, v in vars(cls).iteritems():
|
||||
for k, v in vars(cls).items():
|
||||
if v == val:
|
||||
return k
|
||||
|
||||
|
@ -87,12 +87,12 @@ class PhoneInterface(object):
|
|||
#self.__core.video_display_enabled = False
|
||||
|
||||
def __global_state_changed(self, core, state, msg):
|
||||
print 'Global state changed:', state, msg
|
||||
print('Global state changed:', state, msg)
|
||||
# TODO: Do we need events emitted here?
|
||||
pass
|
||||
|
||||
def __registration_state_changed(self, core, proxyconf, state, msg):
|
||||
print 'Registration state changed:', proxyconf, state, msg
|
||||
print('Registration state changed:', proxyconf, state, msg)
|
||||
evt = None
|
||||
if state == linphone.RegistrationState.Progress:
|
||||
evt = PhoneEvent.RegInProgress
|
||||
|
@ -105,10 +105,10 @@ class PhoneInterface(object):
|
|||
for cb in self.__event_cbs:
|
||||
cb(evt)
|
||||
else:
|
||||
print 'Unhandled registration state:', linphone.RegistrationState.string(state)
|
||||
print('Unhandled registration state:', linphone.RegistrationState.string(state))
|
||||
|
||||
def __call_state_changed(self, core, call, state, msg):
|
||||
print 'Call state changed:', call, state, msg
|
||||
print('Call state changed:', call, state, msg)
|
||||
evt = None
|
||||
if state == linphone.CallState.IncomingReceived:
|
||||
evt = PhoneEvent.CallIncoming
|
||||
|
@ -131,7 +131,7 @@ class PhoneInterface(object):
|
|||
for cb in self.__event_cbs:
|
||||
cb(evt)
|
||||
else:
|
||||
print 'Unhandled call state:', linphone.CallState.string(state)
|
||||
print('Unhandled call state:', linphone.CallState.string(state))
|
||||
|
||||
def __pollthread(self):
|
||||
while self.__running:
|
||||
|
@ -199,7 +199,7 @@ class PhoneInterface(object):
|
|||
self.__audioproc.terminate()
|
||||
|
||||
def read_text(self, text):
|
||||
self.__ttsproc.stdin.write(text + '\n')
|
||||
self.__ttsproc.stdin.write(text.encode('utf8') + b'\n')
|
||||
self.__ttsproc.stdin.flush()
|
||||
|
||||
def get_remote_number(self):
|
||||
|
@ -207,7 +207,7 @@ class PhoneInterface(object):
|
|||
|
||||
if __name__ == '__main__':
|
||||
def event_cb(evt):
|
||||
print 'Got event:', PhoneEvent.string(evt)
|
||||
print('Got event:', PhoneEvent.string(evt))
|
||||
|
||||
try:
|
||||
phone = PhoneInterface('.linphonerc-foo', '.linphonerc')
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import threading
|
||||
import Queue as queue
|
||||
import queue
|
||||
|
||||
|
||||
class DialConfiguration(object):
|
||||
|
@ -263,10 +263,10 @@ class DialingState(BaseState):
|
|||
|
||||
def on_timeout(self):
|
||||
number = self.__number
|
||||
print 'Dialing number:', number
|
||||
print('Dialing number:', number)
|
||||
if number in self._controller.dialconfig.shortcuts:
|
||||
number = self._controller.dialconfig.shortcuts[number]
|
||||
print 'shortcut resolved:', number
|
||||
print('shortcut resolved:', number)
|
||||
self._controller.phone.call(number)
|
||||
return ConnectingState
|
||||
|
||||
|
|
Loading…
Reference in a new issue