Commit a163721e authored by Guido Gunther's avatar Guido Gunther
Browse files

Switch to python3

parent 805d20d1
......@@ -10,6 +10,7 @@ by the built in 3G chipset in your laptop/netbook.
Requirements
------------
* Python3
* ModemManager with ussd support (>= 1.4)
* mobile-broadband-provider-info with top-up support (>= 20110319)
* GTK+ >= 3.22, Debian package: libgtk+-3-0
......
......@@ -14,6 +14,7 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
from builtins import object
from gi.repository import Gio
from gi.repository import GObject
import logging
......
......@@ -92,10 +92,10 @@ class ModemManagerProxy(GObject.GObject):
def mm_request(func):
def wrapped_f( self, *args, **kw):
self.request = "%s" % func.func_name
if kw.has_key('reply_func'):
self.request = "%s" % func.__name__
if 'reply_func' in kw:
self.reply_func = kw['reply_func']
if kw.has_key('error_func'):
if 'error_func' in kw:
self.error_func = kw['error_func']
self.emit('request-started', self)
func(self, *args, **kw)
......@@ -135,7 +135,7 @@ class ModemManagerProxy(GObject.GObject):
def get_modems(self):
modems = []
self.get_objects()
for path, obj in self.objects().iteritems():
for path, obj in self.objects().items():
if self.MM_DBUS_INTERFACE_MODEM in obj:
modems.append(path)
return modems
......
......@@ -14,6 +14,7 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
from builtins import object
import logging
class ProviderError(Exception):
......@@ -48,14 +49,14 @@ class Provider(object):
def has_fetch_balance_cmd(self):
# Only USSD for now
if self.fetch_balance_cmds.has_key('ussd'):
if 'ussd' in self.fetch_balance_cmds:
return True
else:
return False
def has_top_up_cmd(self):
# Only USSD for now
if self.top_up_cmds.has_key('ussd'):
if 'ussd' in self.top_up_cmds:
return True
else:
return False
......
......@@ -14,11 +14,12 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
from builtins import object
import os
import logging
from lxml import etree
from provider import Provider
from . provider import Provider
class ProviderDB(object):
"""Proxy to mobile broadband provider database"""
......@@ -50,7 +51,7 @@ class ProviderDB(object):
def _load_countries(self):
try:
for line in file(self.country_codes, 'r'):
for line in open(self.country_codes, 'r'):
if line[0] != '#':
(code, country) = line.split('\t',2)
self.__countries[code.lower()] = country.strip()
......
#!/bin/sh
exec python "@PYTHONDIR@/@PACKAGE@.py" "$@"
exec python3 "@PYTHONDIR@/@PACKAGE@.py" "$@"
......@@ -15,6 +15,10 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
from builtins import str
from builtins import range
from past.utils import old_div
from builtins import object
import gettext
import gi
from gi.repository import GObject
......@@ -410,8 +414,8 @@ class PPMDialog(GObject.GObject, PPMObject):
sensitive = True
if self.code_len > 0:
self.entry_code.set_progress_fraction(float(cur_len) /
self.code_len)
self.entry_code.set_progress_fraction(old_div(float(cur_len),
self.code_len))
if cur_len != self.code_len:
sensitive = False
self.button_top_up.set_sensitive(sensitive)
......@@ -569,7 +573,7 @@ class PPMNoModemFoundInfoBar(PPMInfoBar):
class PPMProviderAssistant(PPMObject):
PAGE_INTRO, PAGE_COUNTRIES, PAGE_PROVIDERS, PAGE_CONFIRM = range(0, 4)
PAGE_INTRO, PAGE_COUNTRIES, PAGE_PROVIDERS, PAGE_CONFIRM = list(range(0, 4))
def __init__(self, main_dialog):
PPMObject.__init__(self, main_dialog, "ppm-provider-assistant")
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment