return self.default_config
def on_show_settings( self, widget ) :
- dialog = UssdConfigDialog(self.config, self.widget.get_bg_color(), self.widget.get_text_color())
+ dialog = UssdConfigDialog(self.config, self.widget.get_bg_color(), self.widget.get_text_color(), self.id)
while True:
if dialog.run() != gtk.RESPONSE_OK :
self.sms_counter += 1
self.retry_timer = gobject.timeout_add (1000*self.config[18], self.sms_timeout, self.sms_counter)
- DBusGMainLoop(set_as_default=True)
self.bus = dbus.SystemBus()
self.sms_signal = self.bus.add_signal_receiver(self.handle_sms, path='/com/nokia/phone/SMS', dbus_interface='Phone.SMS', signal_name='IncomingSegment')
self.parent
class UssdConfigDialog(gtk.Dialog):
- def __init__(self, config, bg_color, text_color):
- gtk.Dialog.__init__(self, _("USSD widget"), None,
+ def __init__(self, config, bg_color, text_color, id):
+ gtk.Dialog.__init__(self, _("USSD widget : "+id), None,
gtk.DIALOG_DESTROY_WITH_PARENT | gtk.DIALOG_NO_SEPARATOR,
(_("Save").encode("utf-8"), gtk.RESPONSE_OK))
self.vbox.show_all()
+ DBusGMainLoop(set_as_default=True)
+ bus = dbus.SystemBus()
+ signal = bus.add_signal_receiver(self.set_bg_color_text, path='/su/kibergus/ussd_widget', dbus_interface='su.kibergus.ussd_widget', signal_name='set_bg_color')
+ signal = bus.add_signal_receiver(self.set_text_color_text, path='/su/kibergus/ussd_widget', dbus_interface='su.kibergus.ussd_widget', signal_name='set_text_color')
+ signal = bus.add_signal_receiver(self.ussd_renew, path='/su/kibergus/ussd_widget', dbus_interface='su.kibergus.ussd_widget', signal_name='renew')
+
def do_show(self):
config = self.controller.read_config(self.get_applet_id())
self.set_width(config[5])
else :
self.label.set_width_chars(-1)
+ def ussd_renew(self, id):
+ if id == self.get_applet_id():
+ self.controller.ussd_renew(self, None)
+
+ def set_bg_color_text(self, id, color):
+ if id == self.get_applet_id():
+ try :
+ self.set_bg_color(gtk.gdk.color_parse(color.strip()))
+ except:
+ print _("Unable to parse colour specification")
+ self.queue_draw()
+
+ def set_text_color_text(self, id, color):
+ if id == self.get_applet_id():
+ try:
+ self.set_text_color(gtk.gdk.color_parse(color.strip()))
+ except:
+ print _("Unable to parse colour specification")
+ self.queue_draw()
+
def set_bg_color(self, color):
self.bg_color = color