예제 #1
0
    def test_todo(self):
        entry = gammu.ReadBackup(os.path.join(TEST_DIR, '02.vcs'))['ToDo'][0]

        # Convert it to vCard
        vt_entry = gammu.EncodeVTODO(entry)
        it_entry = gammu.EncodeITODO(entry)

        # Convert it back to entry
        entry2 = gammu.DecodeVCS(vt_entry)
        entry3 = gammu.DecodeICS(it_entry)

        self.assertEqual(entry2['Type'], entry3['Type'])
예제 #2
0
def main():
    state_machine = gammu.StateMachine()
    if len(sys.argv) == 2:
        state_machine.ReadConfig(Filename=sys.argv[1])
    else:
        state_machine.ReadConfig()
    state_machine.Init()

    # For calendar entry

    # Read entry from phone
    entry = state_machine.GetNextCalendar(Start=True)

    # Convert it to vCard
    vc_entry = gammu.EncodeVCALENDAR(entry)
    ic_entry = gammu.EncodeICALENDAR(entry)

    # Convert it back to entry
    print(gammu.DecodeVCS(vc_entry))
    print(gammu.DecodeICS(ic_entry))

    # For todo entry

    # Read entry from phone
    entry = state_machine.GetNextToDo(Start=True)

    # Convert it to vCard
    vt_entry = gammu.EncodeVTODO(entry)
    it_entry = gammu.EncodeITODO(entry)

    # Convert it back to entry
    print(gammu.DecodeVCS(vt_entry))
    print(gammu.DecodeICS(it_entry))

    # For memory entry

    # Read entry from phone
    entry = state_machine.GetNextMemory(Start=True, Type='ME')

    # Convert it to vCard
    vc_entry = gammu.EncodeVCARD(entry)

    # Convert it back to entry
    print(gammu.DecodeVCARD(vc_entry))
예제 #3
0
# Convert it to vCard
vc_entry = gammu.EncodeVCALENDAR(entry)
ic_entry = gammu.EncodeICALENDAR(entry)

# Convert it back to entry
entry2 = gammu.DecodeVCS(vc_entry)
entry3 = gammu.DecodeICS(ic_entry)

# For todo entry

# Read entry from phone
entry = sm.GetNextToDo(Start=True)

# Convert it to vCard
vt_entry = gammu.EncodeVTODO(entry)
it_entry = gammu.EncodeITODO(entry)

# Convert it back to entry
entry2 = gammu.DecodeVCS(vt_entry)
entry3 = gammu.DecodeICS(it_entry)

# For memory entry

# Read entry from phone
entry = sm.GetNextMemory(Start=True, Type='ME')

# Convert it to vCard
vc_entry = gammu.EncodeVCARD(entry)

# Convert it back to entry
entry2 = gammu.DecodeVCARD(vc_entry)