Пример #1
0
    def run(self, parent=None, standalone=False):

        ##set edje_file
        self.edje_file = join(dirname(__file__), 'telephony.edj')

        self.window = ElementaryLayoutWindow(self.edje_file, "main", None,
                                             None, True)
        self.edje_obj = self.window.main_layout

        ##connect to tichy's contacts service
        self.contact_service = Service.get('Contacts')

        ##connect to tichy's ussd service
        self.ussd_service = Service.get('Ussd')
        self.edje_obj.add_callback("num_field_pressed", "*",
                                   self.num_field_action)

        self.edje_obj.add_callback("*", "embryo", self.embryo)
        self.edje_obj.add_callback("*", "call", self.call)

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

        parent.emit("unblock")

        ##wait until main object emits back signal or delete is requested
        i, args = yield WaitFirst(Wait(self.window, 'delete_request'),
                                  Wait(self.window, 'back'),
                                  Wait(self.window.window, 'closing'),
                                  Wait(self.edje_obj, 'back'))
        logger.info('Tele closing')

        if i != 2:
            self.window.delete()
Пример #2
0
    def run(self, setting, parent, layout):
        self.edje_file = join(dirname(__file__), 'settings.edj')

        layout.elm_obj.hide()
        self.window = ElementaryListSubwindow(parent, self.edje_file,
                                              "numbersetting", "entry",
                                              layout.elm_obj)

        self.edje_obj = self.window.main_layout

        self.edje_obj.edje.signal_emit(str(setting.value), "set_text")

        i, args = yield WaitFirst(Wait(self.window.main_layout, 'save'),
                                  Wait(self.window.main_layout, 'back'),
                                  Wait(parent, 'back'))

        if i == 0:  ##save clicked
            self.edje_obj.edje.signal_emit("save-notice", "*")
            text = str(self.edje_obj.edje.part_text_get("num_field-text"))
            text = text.strip()
            setting.set(text).start()

        self.edje_obj.edje.visible_set(False)
        self.edje_obj.edje.delete()
        layout.elm_obj.show()
Пример #3
0
    def run(self, parent, standalone=False):

        ##set edje file to be used
        ##TODO: make one edje file per plugin
        self.edje_file = join(dirname(__file__), 'messages.edj')

        ##get message service and list of all messages
        self.contact_service = Service.get('Contacts')
        self.contacts = self.contact_service.contacts

        ##sort contact by date
        def comp2(m1, m2):
            return cmp(str(m1.name).lower(), str(m2.name).lower())

        self.contacts.sort(comp2)

        ##get message service and list of all messages
        self.msgs_service = Service.get('Messages')

        self.messages = self.msgs_service.messages

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

        ##sort messages by date
        def comp(m1, m2):
            return cmp(m2.timestamp, m1.timestamp)

        self.list_label = [('label', 'peer'), ('label-number', 'text'),
                           ('status', 'status'), ('direction', 'direction')]

        self.item_list = ElementaryList(self.messages, self.window,
                                        self.edje_file, "item",
                                        self.list_label, comp)

        self.edje_obj.add_callback("*", "messaging", self.create_msg)
        self.item_list.add_callback("*", "messaging", self.adv_msg)
        self.item_list.add_callback("save", "*", self.create_contact)

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

        self.oid = self.contacts.connect('inserted',
                                         self.item_list._redraw_view)

        self.item_list.add_callback("details", "*", self.msg_details)

        parent.emit("unblock")

        i, args = yield WaitFirst(Wait(self.window, 'delete_request'),
                                  Wait(self.window, 'back'),
                                  Wait(self.window.window, 'closing'))
        logger.info('Messages closing')

        if i != 2:
            self.contacts.disconnect(self.oid)
            self.window.delete()
            del self.item_list
Пример #4
0
    def run(self, setting, parent, layout):
        self.edje_file = join(dirname(__file__), 'settings.edj')

        layout.elm_obj.hide()
        self.window = ElementaryListSubwindow(parent, self.edje_file,
                                              "stringsetting", "entry",
                                              layout.elm_obj)
        self.edje_obj = self.window.main_layout

        if setting != None:
            self.edje_obj.edje.signal_emit(str(setting.name), "set_text")

        textbox = Entry(parent.window.elm_obj)

        if setting != None:
            textbox.entry_set(setting.value)

        textbox.size_hint_weight_set(1.0, 1.0)

        self.edje_obj.elm_obj.content_set("entry", textbox)

        textbox.editable_set(True)

        textbox.focus()

        textbox.show()

        i, args = yield WaitFirst(Wait(self.edje_obj, 'save'),
                                  Wait(self.edje_obj, 'back'),
                                  Wait(parent, 'back'))

        if i == 0:  ##save clicked
            text = str(textbox.entry_get()).replace("<br>", "")
            text = text.strip()
            if setting != None:
                self.edje_obj.edje.signal_emit("save-notice", "*")
                self.edje_obj.elm_obj.visible_set(False)
                self.edje_obj.delete()
                layout.elm_obj.show()
                setting.set(text).start()
                parent.window.elm_obj.keyboard_mode_set(
                    gui.ecore.x.ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF)
            else:
                self.edje_obj.elm_obj.visible_set(False)
                #if setting != None:
                self.edje_obj.delete()
                layout.elm_obj.show()
                parent.window.elm_obj.keyboard_mode_set(
                    gui.ecore.x.ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF)
                yield text
        else:
            self.edje_obj.elm_obj.visible_set(False)
            self.edje_obj.delete()
            layout.elm_obj.show()

        parent.window.elm_obj.keyboard_mode_set(
            gui.ecore.x.ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF)
Пример #5
0
 def motion_task(self, pos):
     while True:
         e, args = yield WaitFirst(Wait(self, 'mouse-up'),
                                   Wait(self, 'mouse-motion'))
         if e == 0:
             break
         pos = args[0]
         # we need to compute the angle between the original click
         # pos and the new pos But in fact I am too lazy so I will
         # use an approximation TODO: make it faster by using a
         # step value
         self.angle = (self.click_angle + \
                           (pos - self.click_pos).x / float(self.radius))
Пример #6
0
    def motion_task(self, pos):
        """This is the tasklet we use when we are in a motion"""
        child = self.children[0]
        click_pos = pos[self.axis] - child.pos[self.axis]

        # First we wait to move more than move_distance before we
        # actually move the child
        while True:
            e, args = yield WaitFirst(Wait(self, 'mouse-up'),
                                      Wait(self, 'mouse-motion'))
            pos = args[0]
            if e == 0:
                child.mouse_up(pos)
                return
            if e == 1:
                dist = click_pos + child.pos[self.axis] - pos[self.axis]
                if abs(dist) > self.move_distance():
                    break

        # OK now we are in motion mode
        child.mouse_down_cancel()
        # child.store_surface = True
        last_dist = None
        while True:
            e, args = yield WaitFirst(Wait(self, 'mouse-up'),
                                      Wait(self, 'mouse-motion'))
            pos = args[0]
            if e == 0:
                break
            if e == 1:
                # We use a step of 8
                dist = (pos[self.axis] - self.click_pos) / 8 * 8
                if dist == last_dist:
                    continue
                last_dist = dist
                child.pos = child.pos.set(self.axis, dist)
                # We ensure that we don't go too far
                if child.pos[self.axis] + child.size[self.axis] < \
                        self.size[self.axis]:
                    child.pos = child.pos.set(
                        self.axis,
                        self.size[self.axis] - child.size[self.axis])
                if child.pos[self.axis] > 0:
                    child.pos = child.pos.set(self.axis, 0)
                self.emit('scrolled')

        child.store_surface = False
Пример #7
0
    def run(self, parent, title, msg, option1=None, option2=None):
        """Create an show the message"""
        self.window = ElementaryWindow(str(title))
        self.window.elm_obj.show()
        self.window.elm_obj.color_set(0, 0, 0, 255)
        self.box = ElementaryBox(self.window.elm_obj)
        self.window.elm_obj.resize_object_add(self.box.elm_obj)

        self.label = elementary.Label(self.window.elm_obj)
        self.label.label_set(str(title))
        self.box.elm_obj.pack_end(self.label)
        self.label.size_hint_min_set(440, 50)
        self.label.show()

        self.scroller = ElementaryScroller(self.window)
        self.entry = elementary.Entry(self.window.elm_obj)
        self.entry.entry_set(str(msg))
        self.entry.size_hint_weight_set(1.0, 0.6)
        self.entry.editable_set(False)
        self.entry.show()
        self.scroller.elm_obj.content_set(self.entry)

        self.box.elm_obj.pack_end(self.scroller.elm_obj)

        if option2 == None:

            self.button = elementary.Button(self.window.elm_obj)
            label_text = option1 or "OK"
            self.button.label_set(label_text)
            self.button.on_mouse_up_add(self._on_ok_clicked)
            self.box.elm_obj.pack_end(self.button)
            self.button.show()
        else:
            self.box2 = ElementaryBox(self.window.elm_obj)
            self.box2.elm_obj.horizontal_set(True)
            self.box.elm_obj.pack_end(self.box2.elm_obj)
            self.button1 = elementary.Button(self.window.elm_obj)
            self.button1.label_set(option1)
            self.button1.name_set(option1)
            self.button2 = elementary.Button(self.window.elm_obj)
            self.button2.label_set(option2)
            self.button2.name_set(option2)
            self.box2.elm_obj.pack_end(self.button1)
            self.box2.elm_obj.pack_end(self.button2)

            self.button1.show()
            self.button1.on_mouse_up_add(self._on_clicked)
            self.button2.on_mouse_up_add(self._on_clicked)
            self.button2.show()

        self.window.elm_obj.layer_set(99)

        self.val = None

        yield Wait(self, 'done')
        logger.info("self.val = %s", self.val)
        self.window.elm_obj.delete()
        yield self.val
Пример #8
0
    def run(self, window):
        self.window = gui.Window(window, modal=True)
        frame = self.view(self.window, back_button=True)

        vbox = gui.Box(frame, axis=1)
        self.x_window = gui.XWindow(vbox)

        keyboard = Service('Keyboard').get()
        keyboard.view(vbox)

        # We need to be sure that the xwindow is exposed before we can
        # start the subprocess...
        yield Wait(self.x_window, 'exposed')
        self.xterm = self.x_window.start_app('xterm')

        yield Wait(frame, 'back')
        self.window.destroy()
        os.kill(self.xterm.pid, signal.SIGKILL)
Пример #9
0
 def run(self):
     # We don't create any window, just run in the background...
     # warning; that would only work with gtk or etk backend...
     gsm_service = Service.get('GSM')
     while True:
         call = yield Wait(gsm_service, 'incoming-call')
         logger.info("got incoming call")
         caller_service = Service.get('TeleCaller2')
         yield caller_service.call("None", call)
Пример #10
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()
Пример #11
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()
Пример #12
0
    def run(self, parent, title, msg):
        w = tichy.gui.Window(parent)

        frame = self.view(w, title=title)
        vbox = tichy.gui.Box(frame, axis=1, expand=True)
        tichy.gui.Label(vbox, msg, expand=True)

        b = gui.Button(vbox)
        tichy.gui.Label(b, 'OK')
        yield Wait(b, 'clicked')
        w.destroy()
Пример #13
0
    def run(self,
            window,
            text="",
            name=None,
            input_method=None,
            variable=None):

        logger.info("PIN2 called")
        ##set edje_file
        self.edje_file = join(dirname(__file__), 'telephony.edj')

        self.main = ElementaryLayoutWindow(self.edje_file, "pin_enter")
        #logger.info("PIN2 main generated")

        if hasattr(self.main.topbar, "tb"):
            tb = self.main.topbar.tb.edje
            tb.signal_emit("hide_clock", "*")
            tb.signal_emit("show_pin_title", "*")

        self.edje_obj = self.main.main_layout.edje

        if name != "":
            tb.part_text_set("title", name)

        self.edje_obj.signal_callback_add("*", "sending_pin",
                                          self.call_btn_pressed)
        #self.edje_obj.signal_callback_add("*", "embryo", self.embryo)

        i, args = yield WaitFirst(Wait(self.main, 'value_received'),
                                  Wait(self.main.window, 'closing'))

        if i == 0:  #value_received
            number = self.edje_obj.part_text_get("pin-text")
            if variable != None:
                variable.value = number
            self.main.delete()
            yield number
        elif i == 1:
            mainloop.quit()
Пример #14
0
    def run(self, parent=None, standalone=False):

        ##set edje_file
        self.edje_file = join(dirname(__file__), 'calculator.edj')

        ## edje_file, group, x=1.0, y=1.0, topbar=False, onclick=None
        self.window = ElementaryLayoutWindow(self.edje_file, "main", None,
                                             None, False)
        self.edje_obj = self.window.main_layout

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

        parent.emit("unblock")

        ##wait until main object emits back signal or delete is requested
        i, args = yield WaitFirst(Wait(self.window, 'delete_request'),
                                  Wait(self.window, 'back'),
                                  Wait(self.window.window, 'closing'),
                                  Wait(self.edje_obj, 'back'))
        logger.info('Calculator closing')

        if i != 2:
            self.window.delete()
Пример #15
0
 def set_status(self, val):
     status = self.get_status()
     ret = status
     logger.info("status is: %s", status)
     if status == "unregistered":
         self.pdp_id = yield WaitDBus(self.iface.ActivateContext, self.get_apn(), self.get_user(), self.get_password())
         ret = "active"
     elif status in ["home","roaming","busy"]:
         if self.pdp_id != None:
             logger.info("trying to disconnect PDP")
             yield WaitDBus(self.iface.DeactivateContext)
             logger.info("disconnected PDP")
             self.pdp_id = None
             ret = "unregistered"
         else:
             yield tichy.tasklet.WaitDBus(self.iface.DeactivateContext)
             logger.info("no pdp_id found not disconnecting")
     else:
         ret = "unregistering"
     yield Wait(self,"gprs-status")
     yield ret
Пример #16
0
 def run(self, parent, number, name, contact, mode, layout, *args, **kargs):
     try:
         self.edje_file = os.path.join(os.path.dirname(__file__), 'people.edj')
         number_layout = 0
         text_layout = 0
         send = 0
         
         if contact != None:
             name = unicode(contact.name).encode("utf-8")
             number = str(contact.tel)
             layout.elm_obj.hide()
         
         if number == "":
             full = True
         else:
             full = False
         
         while True:
             if full or mode == "number":
                 parent.window.elm_obj.keyboard_mode_set(gui.ecore.x.ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF)
                 if number_layout == 0:
                     number_layout =  gui.elm_layout(parent.window, self.edje_file, "edit_number")
                     edje_obj = number_layout.elm_obj.edje_get()
                     edje_obj.part_text_set('num_field-text', number)
                     number_layout.elm_obj.show()
                     parent.main_layout.elm_obj.hide()
                 else:
                     number_layout.elm_obj.show()
                 parent.bg.elm_obj.content_set("content-swallow", number_layout.elm_obj)
                 i, args = yield tichy.WaitFirst(Wait(number_layout, 'back'), Wait(number_layout, 'next'))
                 if i == 0: #back
                     print "breaking"
                     break
                 if i == 1: #next
                     number_layout.elm_obj.hide()
                     number = edje_obj.part_text_get('num_field-text') 
                     if mode == "number":
                         send = 1
                         break
             
             if mode != "number":
                 parent.window.elm_obj.keyboard_mode_set(gui.ecore.x.ECORE_X_VIRTUAL_KEYBOARD_STATE_ON)  
                 if text_layout == 0:
                     text_layout = gui.elm_layout(parent.window, self.edje_file, "CreateContact")
                     edje_obj = text_layout.elm_obj.edje_get()
                     text_layout.elm_obj.show()
                     parent.main_layout.elm_obj.hide()
                     textbox = gui.elementary.Entry(parent.window.elm_obj)
                     textbox.single_line_set(True)
                     textbox.color_set(255, 255, 255, 255)
                     textbox.entry_set(name)
                     textbox.size_hint_weight_set(1.0, 1.0)
                     text_layout.elm_obj.content_set('entry', textbox)
                     textbox.editable_set(True)        
                 
                 else:
                     text_layout.elm_obj.show()
                 parent.bg.elm_obj.content_set("content-swallow", text_layout.elm_obj)
                 
                 textbox.focus()
                 textbox.show()
                 
                 i, args = yield tichy.WaitFirst(Wait(text_layout, 'back'), Wait(text_layout, 'save'))
                 
                 if i == 0: #back
                     if full:
                         text_layout.elm_obj.hide()
                         parent.window.elm_obj.keyboard_mode_set(gui.ecore.x.ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF)
                         continue
                     else:
                         break
                 if i == 1: #save
                     send = 1
                     break
         if send == 1:
             if text_layout:
                 text_layout.elm_obj.edje_get().signal_emit("save-notice","*")
             contacts_service = tichy.Service.get('Contacts')
             if contact not in contacts_service.contacts:
                 name = unicode(textbox.entry_get()).replace("<br>","").encode("utf-8")
                 new_contact = contacts_service.create(name.strip(),tel=str(number))
                 contacts_service.add(new_contact)
                 contacts_service.contacts.emit('inserted')
             else:
                 if mode == "name":
                     name = unicode(textbox.entry_get()).replace("<br>","").encode("utf-8")
                     logger.info("updating name")
                     contact.name = name.strip()
                 elif mode == "number":
                     logger.info("updating number")
                     contact.tel = number
                 layout.elm_obj.show()
         parent.window.elm_obj.keyboard_mode_set(gui.ecore.x.ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF)
         if number_layout:
             number_layout.delete()
         if text_layout:
             text_layout.delete()
         parent.restore_orig()    
         ret = "done"
         yield ret
     except Exception, e:
         print e
         print Exception
Пример #17
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()
Пример #18
0
    def run(self, parent, sms, mode, layout=None, *args, **kargs):
        self.dialog = Service.get("Dialog")
        try:
            self.edje_file = join(dirname(__file__), 'messages.edj')
            number_layout = 0
            text_layout = 0
            send = 0
            number = ""
            full = False
            pre_text = None

            self.window = parent

            if layout != None:
                layout.elm_obj.hide()

            if mode != "reply":
                full = True
                number = ""
            else:
                sms.text = ""

            while True:

                if full:

                    parent.window.elm_obj.keyboard_mode_set(
                        ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF)

                    if number_layout == 0:

                        number_layout = ElementaryLayout(
                            parent.window, self.edje_file, "edit_number")

                        edje_obj = number_layout.elm_obj.edje_get()

                        edje_obj.part_text_set('num_field-text', number)

                        number_layout.elm_obj.show()

                        parent.main_layout.elm_obj.hide()

                    else:
                        logger.info("back pressed in text")
                        number_layout.elm_obj.show()
                        edje_obj = number_layout.elm_obj.edje_get()

                    edje_obj.signal_callback_add("num_field_pressed", "*",
                                                 self.num_field_action)
                    self.number_layout = number_layout
                    parent.bg.elm_obj.content_set("content-swallow",
                                                  number_layout.elm_obj)

                    number_layout.connect("too_short", self.error_win,
                                          "number too short")

                    i, args = yield WaitFirst(Wait(number_layout, 'back'),
                                              Wait(number_layout, 'next'))

                    if i == 0:  #back
                        break

                    if i == 1:  #next
                        number_layout.elm_obj.hide()
                        number = edje_obj.part_text_get('num_field-text')
                        sms.peer = number

                if sms.text == "" or mode == "forward":

                    text_layout = ElementaryLayout(parent.window,
                                                   self.edje_file,
                                                   "CreateText")

                    parent.window.elm_obj.keyboard_mode_set(
                        ECORE_X_VIRTUAL_KEYBOARD_STATE_ON)

                    text_layout.elm_obj.layer_set(99)

                    edje_obj = text_layout.elm_obj.edje_get()

                    text_layout.elm_obj.show()

                    parent.main_layout.elm_obj.hide()

                    parent.bg.elm_obj.content_set("content-swallow",
                                                  text_layout.elm_obj)

                    textbox = Entry(parent.window.elm_obj)

                    textbox.color_set(255, 255, 255, 255)

                    if pre_text != None:
                        textbox.entry_set(unicode(pre_text).encode("utf-8"))
                    else:
                        textbox.entry_set(unicode(sms.text).encode("utf-8"))

                    self.counter(textbox, "event", text_layout)

                    textbox.size_hint_weight_set(1.0, 1.0)

                    sc = Scroller(parent.window.elm_obj)
                    sc.content_set(textbox)

                    textbox.line_wrap_set(True)
                    text_layout.elm_obj.content_set('entry', sc)
                    sc.show()

                    textbox.editable_set(True)

                    textbox.focus()
                    textbox.show()

                    textbox.on_key_down_add(self.counter, text_layout)

                    text_layout.connect("send_request", self.send_request,
                                        textbox, sms.peer)

                i, args = yield WaitFirst(Wait(text_layout, 'back'),
                                          Wait(text_layout, 'send'))
                if i == 0:  #back
                    if full:
                        text_layout.elm_obj.hide()
                        logger.info("win set False")
                        parent.window.elm_obj.keyboard_mode_set(
                            ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF)
                        pre_text = unicode(
                            textbox.entry_get()).encode("utf-8").replace(
                                "<br>", "")
                        pre_text = pre_text.strip()
                        textbox.on_key_down_del(self.counter)
                        continue
                    else:
                        logger.debug("breaking")
                        break
                if i == 1:  #send
                    send = 1
                    logger.info("win set False")
                    parent.window.elm_obj.keyboard_mode_set(
                        ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF)
                    break

            logger.info("broke loop")
            if send == 1:
                text = unicode(textbox.entry_get()).encode("utf-8").replace(
                    "<br>", "")
                sms.text = text.strip()
                text_layout.elm_obj.edje_get().signal_emit("save-notice", "*")
                yield self.send_sms(sms)

            if number_layout:
                number_layout.delete()

            if text_layout:
                logger.info("deleting text layout")
                text_layout.delete()
                parent.window.elm_obj.keyboard_mode_set(
                    ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF)

            if layout != None:
                layout.elm_obj.show()
            else:
                parent.restore_orig()

            ret = "done"

            yield ret

        except Exception, e:
            logger.exception('run')
Пример #19
0
                yield call.initiate()

                def call_release_pre(emission, source, param):
                    # XXX: we should connect to the error callback

                    logger.info('call_release_pre')
                    self.edje_obj.signal_callback_del("release", "call",
                                                      call_release_pre)
                    call.release().start()
                    self.storage.call = None
                    logger.info('call_release_pre done')

                self.edje_obj.signal_callback_add("release", "call",
                                                  call_release_pre)

            i, args = yield WaitFirst(Wait(call, 'activated'),
                                      Wait(call, 'released'),
                                      Wait(self.main, 'call_error'))
            if i == 0:  #activated
                logger.debug("call activated")

                if self.audio_service.muted == 1:
                    self.audio_service.audio_toggle()

                self.edje_obj.signal_emit('to_active_state', "*")

                def call_release(emission, source, param):
                    logger.info("releasing call")
                    # XXX: we should connect to the error callback
                    self.edje_obj.signal_callback_del("release", "call",
                                                      call_release)
Пример #20
0
    def run(self, parent=None, standalone=False):
        ##to be standardized
        self.edje_file = join(dirname(__file__), 'inout.edj')

        self.gsm_service = Service.get('GSM')
        self.callLogs = self.gsm_service.logs

        ##get message service and list of all messages
        self.contact_service = Service.get('Contacts')
        self.contacts = self.contact_service.contacts

        ##sort contact by date
        def comp2(m1, m2):
            return cmp(str(m1.name).lower(), str(m2.name).lower())

        self.contacts.sort(comp2)

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

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

        #  We use the Call object to as items in the call log
        self.list_label = [('label', 'number'), ('subtext', 'description')]
        self.item_list = ElementaryList(self.callLogs, self.window,
                                        self.edje_file, "item",
                                        self.list_label, comp)

        self.edje_obj.add_callback("to_edit_mode", "*", self.to_edit_mode)
        self.edje_obj.add_callback("to_default_mode", "*",
                                   self.to_default_mode)

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

        self.oid = self.contacts.connect('inserted',
                                         self.item_list._redraw_view)

        if len(self.callLogs) == 0:
            self.edje_obj.edje.signal_emit("ListEmpty", "python")
            self.oid2 = self.callLogs.connect('inserted', self.restore_edit)

        self.item_list.add_callback("new_call", "*", self.create_call)
        self.item_list.add_callback("new_msg", "*", self.create_msg)
        self.item_list.add_callback("save_number", "*", self.create_contact)

        self.item_list.elm_window = self.window.window

        parent.emit("unblock")

        i, args = yield WaitFirst(Wait(self.window, 'back'),
                                  Wait(self.window, 'delete_request'),
                                  Wait(self.window.window, 'closing'))

        for i in self.callLogs:
            i.missed = False
            i.check()

        self.callLogs.emit("modified")

        if i != 2:
            self.contacts.disconnect(self.oid)
            self.window.delete()
            del self.item_list
Пример #21
0
    def run(self, parent=None, standalone=False):
        #logger.info('launcher launching')
        self.ready = 0
        self.standalone = config.getboolean('standalone', 'activated', False)
        self.advanced = config.getboolean('advanced-mode', 'activated', False)

        self.settings = config.getboolean('settings', 'activated', False)

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

        self.window = ElementaryLayoutWindow(self.edje_file, "main", None,
                                             None, True)

        self.edje_obj = self.window.main_layout
        if hasattr(self.window.topbar, "tb"):
            self.window.topbar.tb.elm_obj.edje_get().signal_emit(
                "hide_clock", "*")

        self.window.window.elm_obj.resize(480, 640 - 64)
        self.active_app = None

        if self.advanced:
            apps = []
            for app in Application.subclasses:
                if app.category == 'launcher':
                    apps.append(app)
        else:
            ##create list of apps from list of registered apps
            apps = ['Paroli-I/O', "Msgs", "Paroli-Dialer", "Paroli-Contacts"]

        box = ElementaryBox(self.window.window.elm_obj)
        self.app_objs = {}
        apps.sort(key=lambda x: x.name)  # sort apps alphabetically.
        for app in apps:
            logger.info("register launcher %s", app.name)
            link_obj = ElementaryLayout(self.window.window, self.edje_file,
                                        'link')
            link_obj.elm_obj.size_hint_min_set(400, 60)
            box.elm_obj.pack_end(link_obj.elm_obj)
            link_obj.elm_obj.show()
            link_obj.edje.part_text_set("texter", app.name)
            link_obj.edje.part_text_set(
                "testing_textblock",
                "<normal>" + app.name + "</normal><small></small>")
            if hasattr(app, 'launcher_info'):
                attr = app.launcher_info
            else:
                attr = 0
            link_obj.elm_obj.show()
            link_obj.add_callback("*", "launch_app", self.launch_app)
            self.app_objs[app.name] = [
                link_obj,
                attr,
            ]

        box.elm_obj.show()
        self.edje_obj.elm_obj.content_set("link-box", box.elm_obj)
        self.storage = Service.get('TeleCom2')
        self.edje_obj.add_callback("*", "launch_app", self.launch_app)
        self.edje_obj.add_callback("*", "embryo", self.embryo)
        self.edje_obj.add_callback("quit_app", "*", self.quit_app)
        ##current hack
        #self.standalone = True

        self.msg = Service.get('Messages')
        if not self.msg.ready:
            self.msg.connect('ready', self.unblock_screen)
        else:
            self.unblock_screen()

        self.busywin = Service.get('BusyWin')

        self.button = Service.get('Buttons')
        self.aux_btn_profile_conn = self.button.connect(
            'aux_button_pressed', self.switch_profile)

        if self.settings:
            self.aux_btn_settings_conn = self.button.connect(
                'aux_button_held', self.open_settings)

        self.prefs = Service.get('Prefs')
        self.audio_service = Service.get('Audio')

        self.ussd = Service.get('Ussd')
        self.ussd.connect('incoming', self.incoming_ussd)
        self.systime = Service.get('SysTime')
        self.alarm = Service.get('Alarm')

        self.ready = 1

        self.window.connect('block', self.block_edje)
        self.window.connect('unblock', self.unblock_edje)

        yield WaitFirst(Wait(self.window, 'backs'),
                        Wait(self.window.window, 'closing'))

        self.dialog = Service.get("Dialog")
        keep_alive = yield self.dialog.option_dialog(
            "shutdown",
            "Keep paroli running in the background? Note: if you click no you will not be able to receive calls anymore",
            "YES", "no")
        logger.debug("keep_alive %s", keep_alive)

        if keep_alive == "no":
            logger.info("keep alive set to no: %s", keep_alive)
            mainloop.quit()
        else:
            logger.info("keep alive set to %s", keep_alive)

        if not self.window.window.elm_obj.is_deleted():
            self.window.delete()  # Don't forget to close the window