Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/ReckonPrimer.activity/collection.py
blob: a90d82d9dee79589b02c39a2fe7314cb781ae596 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# -*- coding: utf-8 -*-

'''
date: 07.01.2010
description: test class "collection" to test our new idea for saving all tasks
'''

import gtk
import pickle
import os

class CollectionTest:
#    __data = None
#    __title = None
#    __description = None
    #__pic = None

    def __init__(self):
        self.__data = []
        self.__title = "Collection"
        self.__description = "Description"
        #self.__pic = gtk.gdk.pixbuf_new_from_file("collection.png")

    '''
    def __init__(self, title, description, pic):
        self.__data = []
        self.__title = title
        self.__description = description
        self.__pic = pic
    '''

#    def getData(self):
#        return self.__data
#
#    def setData(self, data):
#        self.__data = data
#
#    def getTitle(self):
#        return self.__title
#
#    def setTitle(self, title):
#        self.__title = title
#
#    def getDescription(self):
#        return self.__description
#
#    def setDescription(self, description):
#        self.__description = description
#
#    ''' keep for need, TODO icon reformatting icon to string 
#    def getPic(self):
#        return self.__pic
#    
#    def setPic(self, pic):
#        self.__pic = pic
#    '''
#
#    def get_data_from_pickle(self):
#        path = os.path.join(os.getcwd(), "data/Collection.data")
#        f = open(path, "rb")
#        root = pickle.load(f)
#        f.close()
#        return root
#
#    def set_data_in_pickle(self, root):
#        path = os.path.join(os.getcwd(), "data/Collection.data")
#        f = open(path, "wb")
#        pickle.dump(root, f)
#        f.close()
#
#
#    def insert_object(self, obj, pos):
#        root = self.get_data_from_pickle()
#        list = root.getData()
#
#        if (pos == None):
#            list.append(obj) # sonderfall ganz hinten einfügen
#        else:
#            max = len(pos)
#            for i in range(len(pos)):
#                try:
#                    if isinstance(list[pos[i]], CollectionTest):
#                        list = list[pos[i]].getData()
#                        if (i == (max - 1)):
#                            list.append(obj)
#                    else:
#                        list.insert(pos[i], obj)
#                except IndexError:
#                    list.append(obj) # wenn in eigener collection verschoben wird, wurde ja element schon gelöscht daher passt index nicht mehr
#
#        self.set_data_in_pickle(root)
#
#
#    def get_object(self, pos):
#        root = self.get_data_from_pickle()
#
#        list = root.getData()
#
#        # find object and return it to insert it in collection
#        for i in range(len(pos)):
#            if isinstance(list[pos[i]], CollectionTest):
#                obj = list[pos[i]]
#                list = list[pos[i]].getData()
#            else:
#                obj = list[pos[i]]
#
#        list = root.getData()
#        max = len(pos)
#
#        # find object and delete it in current collection
#        for i in range(len(pos)):
#            if isinstance(list[pos[i]], CollectionTest):
#                if (i == (max - 1)):
#                    #collection löschen (evt. abfrage ob wirklich gelöscht werden soll inkl. kinder)
#                    list.remove(obj)
#                else:
#                    list = list[pos[i]].getData()
#            else:
#                #task löschen
#                list.remove(obj)
#
#        self.set_data_in_pickle(root)
#        return obj