Ejemplo n.º 1
0
 def __send_message(self, number, message, status):
     from way2sms import send
     import time
     database = DataBase()
     customer_id = database.get_default()[2]
     for text in message:
         text = text.strip()
         status[number][0] = status[number][0] and send(customer_id, number, text)
         time.sleep(1.4)
     status[number][1] = True
     return
Ejemplo n.º 2
0
 def re_log_in(unused_widget, unused_event):
     from way2sms import login
     import time
     database = DataBase()
     user = database.get_default()
     thread.start_new_thread(login, (str(user[0]), user[1], True))
     database.close()
     time.sleep(3.4)
     self.__generalize_status_bar()
     self.__push_status_message('<span font_desc="belgrano 10"><b>  Try to <span foreground="#0000FF">re send</span> once more</b></span>')
     return
Ejemplo n.º 3
0
    def __init__(self):
        super(AccountManager, self).__init__()
        self.set_size_request(260, 220)
        self.set_modal(True)
        self.set_title('Account Manager')
        self.set_icon_from_file(ICON_PATH + '/admin.png')
        vbox = gtk.VBox(True, 4)
        scroll = gtk.ScrolledWindow()
        scroll.set_size_request(140, -1)
        scroll.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
        scroll.set_border_width(8)
        alignment = gtk.Alignment(0.5, 0, 0, 0)
        alignment.set_border_width(8)
        from database import DataBase
        database = DataBase()
        users = database.get_user()
        def mark_default(radio):
            'mark the default user bold faced'

            for radio in radio.get_group():
                if radio.get_active():
                    number = radio.get_label()
                    radio.get_child().set_markup('<span font_desc="CrashNumberingGothic">\
<b>' + number + '</b></span>')
                    continue
                radio.get_child().set_markup('<span font_desc="CrashNumberingGothic">' +
                                             radio.get_label() + '</span>')
            return
        radio = gtk.RadioButton(None, str(users[0][0]))
        radio.connect('toggled', mark_default)
        vbox.pack_start(radio)
        for user in users[1:]:
            vbox.pack_start(gtk.RadioButton(radio, str(user[0])))
        default_user = str(database.get_default()[0])
        database.close()
        for radio in radio.get_group():
            if radio.get_label() == default_user:
                radio.set_active(True)
                break
        mark_default(radio)
        alignment.add(vbox)
        scroll.add_with_viewport(alignment)
        scroll.get_child().modify_bg(gtk.STATE_NORMAL,
                                     gtk.gdk.color_parse('#ffffff'))
        vbox = gtk.VBox(False, 4)
        vbox.pack_start(scroll, True, True)
        hbox = gtk.HBox(True, 10)
        add = Button(ICON_PATH + '/add-account.png', 'Add New Account', 30, 30)
        add.connect('clicked', self.__add_user, radio, vbox)
        remove = Button(ICON_PATH + '/remove-account.png', 'Remove Account',
                        30, 30)
        remove.connect('clicked', self.__remove_user, radio, vbox)
        save = Button(ICON_PATH + '/save.png', 'Save Account\n Information',
                      30, 30)
        save.connect('clicked', self.__save, radio)
        hbox.pack_start(add)
        hbox.pack_start(remove)
        alignment = gtk.Alignment(0.5, 0, 0, 0)
        alignment.add(hbox)
        vbox.pack_start(alignment, False, False)
        alignment = gtk.Alignment(0.5, 0, 0, 0)
        alignment.add(save)
        vbox.pack_start(alignment, False, False)
        self.add(vbox)
        self.connect('destroy', self.__save, radio)
        self.show_all()