aboutsummaryrefslogtreecommitdiff
path: root/src/prepaid-manager-applet.py
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2011-12-28 16:47:10 +0100
committerGuido Günther <agx@sigxcpu.org>2011-12-28 17:51:52 +0100
commitdd63a041f9ac0afbb192a207765e59b9f5cd9e3c (patch)
tree84acc02be2b56f3b6445d01daaa47cd3ecfd8feb /src/prepaid-manager-applet.py
parentf500a15d3cf2c9b68f1ea712cc3c2e7ec8b027c9 (diff)
When changing the provider allow the user to enter all data
Diffstat (limited to 'src/prepaid-manager-applet.py')
-rwxr-xr-xsrc/prepaid-manager-applet.py31
1 files changed, 20 insertions, 11 deletions
diff --git a/src/prepaid-manager-applet.py b/src/prepaid-manager-applet.py
index 75ac064..2a44daa 100755
--- a/src/prepaid-manager-applet.py
+++ b/src/prepaid-manager-applet.py
@@ -121,18 +121,27 @@ class PPMController(GObject.GObject):
"""
Given the imsi, determine the provider based on that information
from providerdb, request user input where ncessary
+
+ @param imsi: If given use this to dertimine the mcc and mnc
+ and from that the provider. If set to C{None} request all
+ information from the user.
+ @type imsi: C{str}
"""
- imsi = imsi or self.imsi
- mcc, mnc = self._imsi_to_network_id(imsi)
- self.providers = self.providerdb.get_providers(mcc, mnc)
- if self.providers:
- if len(self.providers) > 1:
- # More than one provider matching mcc/mnc, let user select
- self.view.show_provider_assistant(self.providers)
- else:
- self.set_provider(self.providers[0])
+ self.providers = []
+ if imsi:
+ mcc, mnc = self._imsi_to_network_id(imsi)
+ self.providers = self.providerdb.get_providers(mcc, mnc)
+
+ if len(self.providers) == 1:
+ self.set_provider(self.providers[0])
+ elif len(self.providers):
+ # More than one provider matching mcc/mnc, let user select
+ self.view.show_provider_assistant(self.providers)
else:
- self.view.show_provider_unknown(mcc, mnc)
+ if imsi:
+ self.view.show_provider_unknown(mcc, mnc)
+ else:
+ self.view.show_provider_assistant(None)
def _get_account_from_accountdb(self, imsi):
"""
@@ -387,7 +396,7 @@ class PPMDialog(GObject.GObject, PPMObject):
self.controller.fetch_balance()
def on_provider_change_clicked(self, dummy):
- self.controller.get_provider_interactive()
+ self.controller.get_provider_interactive(imsi=None)
def on_entry_code_insert(self, entry):
cur_len = entry.get_text_length()