コード例 #1
0
    def _connect_dbus(self):
        try:
            yield WaitDBusName('org.freesmartphone.odeviced', time_out=120)
            bus = dbus.SystemBus(mainloop=mainloop.dbus_loop)
            rtc_obj = bus.get_object('org.freesmartphone.odeviced',
                                     '/org/freesmartphone/Device/RTC/rtc0')
            self.rtc = dbus.Interface(
                rtc_obj, 'org.freesmartphone.Device.RealtimeClock')

            self.ListLabel = [('title', 'name'), ('value', 'value')]

            self.hour = TimeSetting("hour", 3, List(range(24)), "int")

            self.minute = TimeSetting("minute", 4, List(range(60)), "int")

            self.ValueList = List()
            self.ValueList.append(self.hour)
            self.ValueList.append(self.minute)

            self.time_setting = ListSetting('time',
                                            'set time',
                                            Text,
                                            value="set",
                                            setter=self.set_time,
                                            options=['set'],
                                            model=self.ValueList,
                                            ListLabel=self.ListLabel,
                                            edje_group="ValueSetting",
                                            save_button=True)

            self.ValueList.connect('save', self.UpdateSystemTime)

        except Exception, e:
            logger.exception(
                "can't use freesmartphone RealTimeClock service : %s", e)
コード例 #2
0
ファイル: contact.py プロジェクト: vmx/paroli
 def __init__(self):
     super(FallbackContactsService, self).__init__()
     self.contacts = List()
     # TODO: the problem here is that when we load the contacts we
     # are going to rewrite them !
     self.contacts.connect('modified', self._on_contacts_modified)
     # For optimization we keep a map of number to contact
     self._number_to_contact = {}
コード例 #3
0
ファイル: wifi.py プロジェクト: vmx/paroli
    def init(self):
        logger.info('wifi service init')
        try:
            self.config_service = Service.get("Config")
            yield self.config_service.wait_initialized()
            self.usage_service = Service.get('Usage')
            yield self.usage_service.wait_initialized()
            yield self.usage_service.request_resource('Wifi')
            bus = dbus.SystemBus(mainloop=mainloop.dbus_loop)

            ## power related
            power_obj = bus.get_object('org.freesmartphone.odeviced', 
                                       '/org/freesmartphone/Device/PowerControl/WiFi')
            self.power_iface = dbus.Interface(power_obj, 
                                              'org.freesmartphone.Device.PowerControl')
            try_num = 0
            obj = None
            ## devicing
            for i in range(5):
                    try:
                        obj = bus.get_object("org.moblin.connman", "/")
                        logger.info("moblin success")
                    except:
                        logger.info("moblin failed")
                        yield WaitFirst(Sleep(1))
                        continue
                    else:
                        break
                        #raise Exception("moblin not starting")
            if obj:
                self.devicing_iface = dbus.Interface(
                                           obj, 
                                           "org.moblin.connman.Manager")
                self.status_setting = tichy.settings.ToggleSetting(
                                            'wifi', 'power', 
                                            Text, value=self.get_power(), 
                                            setter=self.power, 
                                            options=['active','inactive'])
                self.NetworkList = List()
                self.ListLabel = [('title','name'),('subtitle','info')]
                self.scan_setting = tichy.settings.ListSetting('wifi', 
                                                               'scan', 
                                                               Text, 
                                                               value="Networks", 
                                                               setter=self.run_scan, 
                                                               options=['Networks'], 
                                                               model=self.NetworkList, 
                                                               ListLabel=self.ListLabel)
                if self.get_power():
                    self.get_device()
                self.devicing_iface.connect_to_signal('PropertyChanged', 
                                                      self.property_changed)
                self.connect("closing", self.closing)
            else: 
                logger.error("Moblin failed. Is Connman/moblin installed?")
        except Exception, e:
            logger.exception("can't use wifi service : %s", e)
            raise
コード例 #4
0
    def run(self, parent, edje_file, group, layout, *args, **kargs):

        layout.elm_obj.hide()

        self.parent = parent

        self.window = ElementaryListSubwindow(parent, edje_file, "main",
                                              "list")
        self.edje_obj = self.window.main_layout

        self.edje_obj.edje.signal_emit("sublist_mode", "*")

        self.settings = List()
        self.cb_list = List()

        for i in Setting.groups[group]:
            o = Setting.groups[group][i]
            self.settings.append(o)

        def comp(m1, m2):
            return cmp(m2.name, m1.name)

        self.list_label = [('title', 'name'), ('subtitle', 'value')]
        self.item_list = ElementaryList(self.settings, self.window, edje_file,
                                        "item", self.list_label, comp)

        for i in self.settings:
            if hasattr(i, 'options'):
                oid = i.options.connect('updated', self.item_list._redraw_view)
                self.cb_list.append([i.options, oid])

        self.item_list.add_callback("*", "sublist", self.action)

        yield WaitFirst(Wait(self.window, 'delete_request'),
                        Wait(self.edje_obj, 'back'))

        for i in self.cb_list:
            i[0].disconnect(i[1])

        self.edje_obj.elm_obj.visible_set(False)
        self.edje_obj.delete()
        parent.restore_orig()
        layout.elm_obj.show()
コード例 #5
0
    def run(self, parent=None, standalone=False):
        ##the edje file
        self.edje_file = join(dirname(__file__), 'settings.edj')

        ##import a parameter which tells the app about paroli's window's size
        self.standalone = config.getboolean('standalone', 'activated', False)

        ##generate app-window
        self.window = ElementaryListWindow(self.edje_file, "main", "list",
                                           None, None, True)
        self.edje_obj = self.window.main_layout

        self.groups = List()

        for i in Setting.groups:
            t = Text(i)
            self.groups.append(Text(i))

        def comp(m1, m2):
            return cmp(str(m2).lower(), str(m1).lower())

        self.list_label = [('title', 'value')]
        self.item_list = ElementaryList(self.groups, self.window,
                                        self.edje_file, "item",
                                        self.list_label, comp)

        self.item_list.add_callback("*", "sublist", self._show_sublist)

        ## close the Tele app, with the back button (signal, source, method)
        self.edje_obj.add_callback("back", "edje", self.signal)

        parent.emit("unblock")

        i, args = yield WaitFirst(Wait(self.window, 'delete_request'),
                                  Wait(self.window, 'back'),
                                  Wait(self.window.window, 'closing'))
        ##we write a logger message that the application is closing
        logger.info('Settings closing')

        ##we delete the window object (the class would also delete all children object)
        if i != 2:
            self.item_list._remove_cb()
            self.window.delete()
コード例 #6
0
ファイル: message.py プロジェクト: vmx/paroli
 def __init__(self):
     super(MessagesService, self).__init__()
     self.messages = List()
     self.unread = Text(0)
     self.messages.connect('appended', self._update_unread)
     self.ready = False
コード例 #7
0
    def init(self):
        """register on the network"""
        logger.info("Turn on antenna power")
        logger.info("Register on the network")
        self.emit('provider-modified', "Charlie Telecom")
        self.network_strength = 100
        yield Service.get('Config').wait_initialized()
        self.config_service = Service.get("Config")
        logger.info("got config service")
        self.values = self.config_service.get_items("call_forwarding")
        if self.values != None: self.values = dict(self.values)
        logger.info("realized values is none")
        self.SettingReason = ListSetting('Call Forwarding', 'Reason', Text, value='unconditional', setter=self.ForwardingSetReason, options=["unconditional","mobile busy","no reply","not reachable","all","all conditional"], model=List([ListSettingObject("unconditional", self.action),ListSettingObject("mobile busy", self.action),ListSettingObject("no reply", self.action),ListSettingObject("not reachable", self.action),ListSettingObject("all", self.action),ListSettingObject("all conditional", self.action)]), ListLabel = [('title','name')])
        self.SettingChannels = Setting('Call Forwarding', 'channels', Text, value=self.ForwardingGet('class'), setter=self.ForwardingSetClass, options=["voice","data","voice+data","fax","voice+data+fax"])
        self.SettingTargetNumber = NumberSetting('Call Forwarding', 'Target Number', Text, value=self.ForwardingGet('number'), setter=self.ForwardingSetNumber)
        self.SettingTargetNumber = NumberSetting('Call Forwarding', 'Timeout', Text, value=self.ForwardingGet('timeout'), setter=self.ForwardingSetTimeout)

        if len(self.logs) == 0:
            for i in range(3):
                call = Call('0049110', direction='out')
                self.logs.insert(0, call)
        yield None
コード例 #8
0
    def run(self,
            setting,
            parent,
            model,
            list_label,
            layout,
            group="item",
            save_button=False,
            *args,
            **kargs):
        layout.elm_obj.hide()

        self.parent = parent
        self.setting = setting

        self.edje_file = join(dirname(__file__), 'settings.edj')

        self.window = ElementaryListSubwindow(parent, self.edje_file, "main",
                                              "list")

        self.edje_obj = self.window.main_layout

        self.edje_obj.edje.signal_emit("sublist_mode", "*")

        if save_button:
            self.edje_obj.edje.signal_emit("save_button", "*")

        self.ItemList = model
        self.cb_list = List()

        #for i in Setting.groups[group]:
        #o = Setting.groups[group][i]
        #self.settings.append(o)

        def comp(m1, m2):
            if m1.name == None or m1.name == "":
                return cmp(m2, m1)
            else:
                return cmp(m2.name, m1.name)

        item_group = group or "item"

        self.list_label = list_label
        self.item_list = ElementaryList(self.ItemList, self.window,
                                        self.edje_file, item_group, list_label,
                                        comp)

        for i in self.ItemList:
            if hasattr(i, 'connect'):
                oid = i.connect('updated', self.item_list._redraw_view)
                self.cb_list.append([i, oid])

        self.item_list.add_callback("*", "sublist", self.action)
        self.item_list.add_callback("pressed", "decrease", self.decrease)
        self.item_list.add_callback("pressed", "increase", self.increase)
        self.edje_obj.edje.signal_callback_add("pressed", "save", self.save)

        yield WaitFirst(Wait(self.window, 'delete_request'),
                        Wait(self.edje_obj, 'back'),
                        Wait(self.ItemList, 'save'))

        for i in self.cb_list:
            i[0].disconnect(i[1])

        self.edje_obj.elm_obj.visible_set(False)
        self.edje_obj.delete()
        self.item_list._remove_cb()
        layout.elm_obj.show()
コード例 #9
0
 def __init__(self):
     super(GSMService, self).__init__()
     self.logs = List()
     self.missed_call_count = Int(0)
     self.logs.connect('modified', self._on_logs_modified)
     self._load_logs()