Example #1
0
def main():
    #======================= You can Run this program as a Stand Alone App ===========================
    MyPager = RajivSmsModule()
    option = '0'
    while option != 'x':
        print """
+---+------+------+------+------+------+------+
|              Main Menu Options              |
| i - Instant SMS                             |
| c - Chat                                    |
| g - Group SMS                               |
| a - Sms to all contacts in sms_contact.csv  |
| s - set/change signature                    | (current sign: %s)
| l - login/re-login                          | (current user: %s)
| x - Exit                                    |
+---+------+------+------+------+------+------+
""" % (MyPager.get_signature(), MyPager.get_user())
        option = raw_input('Select your option: ')
        if option == 'i': send_instant_sms(MyPager)
        elif option == 'c': start_one_to_one_chat(MyPager)
        elif option == 'g': send_group_sms(MyPager)
        elif option == 'a':
            send_group_sms(MyPager, CONTACT_CSV_FILE="sms_contact.csv")
        elif option == 's':
            MyPager.set_signature(raw_input("enter your new sign: "))
            print "success!!"
        elif option == 's':
            MyPager.set_signature(raw_input("enter your new sign: "))
            print "success!!"
        elif option == 'l':
            MyPager.login()
        elif option != 'x':
            print 'invalid option'
def main():
    # ======================= You can Run this program as a Stand Alone App ===========================
    MyPager = RajivSmsModule()
    option = "0"
    while option != "x":
        print """
+---+------+------+------+------+------+------+
|              Main Menu Options              |
| i - Instant SMS                             |
| c - Chat                                    |
| g - Group SMS                               |
| a - Sms to all contacts in sms_contact.csv  |
| s - set/change signature                    | (current sign: %s)
| l - login/re-login                          | (current user: %s)
| x - Exit                                    |
+---+------+------+------+------+------+------+
""" % (
            MyPager.get_signature(),
            MyPager.get_user(),
        )
        option = raw_input("Select your option: ")
        if option == "i":
            send_instant_sms(MyPager)
        elif option == "c":
            start_one_to_one_chat(MyPager)
        elif option == "g":
            send_group_sms(MyPager)
        elif option == "a":
            send_group_sms(MyPager, CONTACT_CSV_FILE="sms_contact.csv")
        elif option == "s":
            MyPager.set_signature(raw_input("enter your new sign: "))
            print "success!!"
        elif option == "s":
            MyPager.set_signature(raw_input("enter your new sign: "))
            print "success!!"
        elif option == "l":
            MyPager.login()
        elif option != "x":
            print "invalid option"
def main():
    #======================= You can Run this program as a Stand Alone Console App ===========================
    #notify_me("Hey!!","Rajiv-Py-Sms sample application has been started, enjoy sending FREE sms. Check out special messages option for more available features sms.\n~ Rajiv M")
    MyPager = RajivSmsModule()
    option = '0'
    while option != 'x':
        conf_data = MyPager.config()
        print """
+---+------+------+------+------+------+------+
|              Main Menu Options              |
| r - Rajiv Pearl - Special messages          |     +---+---+---+---+---Pager Status:---+---+---+---+---+
| i - Instant SMS                             |     SMS Service    : %s
| c - Chat                                    |     Allowed        : %d chars per sms
| g - Group SMS                               |     Sending method : Sms > %d chars will be - %s
| a - Sms to all contacts in sms_contact.csv  |     Current USER   : %s
| d - Change Service                          |     Signature text : %s
| t - Change Sending method                   |     Login Status   : %s
| s - set/change signature                    |     +---+---+---+---+---+---+---+---+---+---+---+---+---+
| l - login/re-login                          |
| x - Exit                                    |
+---+------+------+------+------+------+------+
"""%(   conf_data['SERVICE'],
        conf_data['allowed_chars'],
        conf_data['allowed_chars'],
        'Split and send as multiple sms' if conf_data['SPLIT_OR_TRUNCATE'] else 'Truncate to %d chars'%(conf_data['allowed_chars']),
        conf_data['USER'],
        conf_data['SIGNATURE'],
        'Logged in' if conf_data['Login_status'] else 'Logged out',
)
        option = raw_input('Select your option: ')
        if   option == 'r': rajivpearl_sms(MyPager)
        elif option == 'i': send_instant_sms(MyPager)
        elif option == 'c': start_one_to_one_chat(MyPager)
        elif option == 'g': send_group_sms(MyPager)
        elif option == 'a': send_group_sms(MyPager,CONTACT_CSV_FILE=os.path.join(DATA_DIR,"sms_contact.csv"))
        elif option == 's': MyPager.config(SIGNATURE = raw_input("enter your new sign: "));print "done!!"
        elif option == 'd':
            AVAILABLE_SERVICES = MyPager.config()['AVAILABLE_SERVICES']
            print "+---+------+------+------+-----+"
            print "    Available SMS Services:     "
            for service in AVAILABLE_SERVICES:
                print "%d - %s"%( AVAILABLE_SERVICES.index(service)+1, service )
            print "+---+------+------+------+-----+"
            my_selection = raw_input("select your favourite service: ")
            MyPager.config(SERVICE = AVAILABLE_SERVICES[ int(my_selection)-1 ])
            print "Service changed!. Attempting Login into current service..."
            MyPager.login()
        elif option == 't':
            print """
+---+------+------+------+-----+
| If sms > allowed characters: |
| s - split and send           |
| t - truncate and send        |
| b - back                     |
+---+------+------+------+-----+"""
            my_sending_method = raw_input("select your sending method: ")
            if   my_sending_method == 's': MyPager.config( SPLIT_OR_TRUNCATE = True )
            elif my_sending_method == 't': MyPager.config( SPLIT_OR_TRUNCATE = False )
def main():
    #======================= You can Run this program as a Stand Alone App ===========================
    MyPager = RajivSmsModule()
    option = '0'
    while option != 'x':
        conf_data = MyPager.config()
        print """
+---+------+------+------+------+------+------+     
|              Main Menu Options              |     +---+---+---+---+---Pager Status:---+---+---+---+---+
| i - Instant SMS                             |     SMS Service    : %s
| c - Chat                                    |     Allowed        : %d chars per sms
| g - Group SMS                               |     Sending method : Sms > %d chars will be - %s
| a - Sms to all contacts in sms_contact.csv  |     Current USER   : %s
| d - Change Service                          |     Signature text : %s
| t - Change Sending method                   |     Login Status   : %s
| s - set/change signature                    |     +---+---+---+---+---+---+---+---+---+---+---+---+---+
| l - login/re-login                          |
| x - Exit                                    |
+---+------+------+------+------+------+------+
""" % (
            conf_data['SERVICE'],
            conf_data['allowed_chars'],
            conf_data['allowed_chars'],
            'Split and send as multiple sms' if conf_data['SPLIT_OR_TRUNCATE']
            else 'Truncate to %d chars' % (conf_data['allowed_chars']),
            conf_data['USER'],
            conf_data['SIGNATURE'],
            'Logged in' if conf_data['Login_status'] else 'Logged out',
        )
        option = raw_input('Select your option: ')
        if option == 'i': send_instant_sms(MyPager)
        elif option == 'c': start_one_to_one_chat(MyPager)
        elif option == 'g': send_group_sms(MyPager)
        elif option == 'a':
            send_group_sms(MyPager, CONTACT_CSV_FILE="sms_contact.csv")
        elif option == 's':
            MyPager.config(SIGNATURE=raw_input("enter your new sign: "))
            print "done!!"
        elif option == 'd':
            AVAILABLE_SERVICES = MyPager.config()['AVAILABLE_SERVICES']
            print "+---+------+------+------+-----+"
            print "    Available SMS Services:     "
            for service in AVAILABLE_SERVICES:
                print "%d - %s" % (AVAILABLE_SERVICES.index(service) + 1,
                                   service)
            print "+---+------+------+------+-----+"
            my_selection = raw_input("select your favourite service: ")
            MyPager.config(SERVICE=AVAILABLE_SERVICES[int(my_selection) - 1])
            print "done!!"
        elif option == 't':
            print """
+---+------+------+------+-----+
| If sms > allowed characters: |
| s - split and send           |
| t - truncate and send        |
+---+------+------+------+-----+"""
            my_sending_method = raw_input("select your sending method: ")
            if my_sending_method == 's': MyPager.config(SPLIT_OR_TRUNCATE=True)
            elif my_sending_method == 't':
                MyPager.config(SPLIT_OR_TRUNCATE=False)
        elif option == 'l':
            MyPager.login()
        elif option != 'x':
            print 'invalid option'
def main():
    #======================= You can Run this program as a Stand Alone App ===========================
    MyPager = RajivSmsModule()
    option = '0'
    while option != 'x':
        conf_data = MyPager.config()
        print """
+---+------+------+------+------+------+------+     
|              Main Menu Options              |     +---+---+---+---+---Pager Status:---+---+---+---+---+
| i - Instant SMS                             |     SMS Service    : %s
| c - Chat                                    |     Allowed        : %d chars per sms
| g - Group SMS                               |     Sending method : Sms > %d chars will be - %s
| a - Sms to all contacts in sms_contact.csv  |     Current USER   : %s
| d - Change Service                          |     Signature text : %s
| t - Change Sending method                   |     Login Status   : %s
| s - set/change signature                    |     +---+---+---+---+---+---+---+---+---+---+---+---+---+
| l - login/re-login                          |
| x - Exit                                    |
+---+------+------+------+------+------+------+
"""%(   conf_data['SERVICE'],
        conf_data['allowed_chars'],
        conf_data['allowed_chars'],
        'Split and send as multiple sms' if conf_data['SPLIT_OR_TRUNCATE'] else 'Truncate to %d chars'%(conf_data['allowed_chars']),
        conf_data['USER'],
        conf_data['SIGNATURE'],
        'Logged in' if conf_data['Login_status'] else 'Logged out',
)
        option = raw_input('Select your option: ')
        if   option == 'i': send_instant_sms(MyPager)
        elif option == 'c': start_one_to_one_chat(MyPager)
        elif option == 'g': send_group_sms(MyPager)
        elif option == 'a': send_group_sms(MyPager,CONTACT_CSV_FILE="sms_contact.csv")
        elif option == 's': MyPager.config(SIGNATURE = raw_input("enter your new sign: "));print "done!!"
        elif option == 'd':
            AVAILABLE_SERVICES = MyPager.config()['AVAILABLE_SERVICES']
            print "+---+------+------+------+-----+"
            print "    Available SMS Services:     "
            for service in AVAILABLE_SERVICES:
                print "%d - %s"%( AVAILABLE_SERVICES.index(service)+1, service )
            print "+---+------+------+------+-----+"
            my_selection = raw_input("select your favourite service: ")
            MyPager.config(SERVICE = AVAILABLE_SERVICES[ int(my_selection)-1 ]);print "done!!"
        elif option == 't':
            print """
+---+------+------+------+-----+
| If sms > allowed characters: |
| s - split and send           |
| t - truncate and send        |
+---+------+------+------+-----+"""
            my_sending_method = raw_input("select your sending method: ")
            if   my_sending_method == 's': MyPager.config( SPLIT_OR_TRUNCATE = True )
            elif my_sending_method == 't': MyPager.config( SPLIT_OR_TRUNCATE = False )