~flimm/epidermis/icon-theme-bugfix

« back to all changes in this revision

Viewing changes to epidermis/pigments/pack.py

  • Committer: David D Lowe
  • Date: 2011-01-04 22:50:19 UTC
  • Revision ID: daviddlowe.flimm@gmail.com-20110104225019-uo31kb54cbxjt5vt
Tidy up code with better comments.
Deleted unused functions.

Show diffs side-by-side

added added

removed removed

Lines of Context:
50
50
        self.humanName[language] = humanName
51
51
    
52
52
    def get_state(self):
53
 
        """Pack's are either STATE_EMPTY, STATE_INFO or STATE_INCOMPLETE"""
 
53
        """Packs are either STATE_EMPTY, STATE_INFO or STATE_INCOMPLETE"""
54
54
        # TODO: to be redone, add states?
55
55
        print "get_state; codeName: %s humanName %s ownPigments %s" % (self.codeName, self.humanName, self.ownPigments)
56
56
        if self.codeName == "" and self.humanName == {"en":""} and len(self.ownPigments) == 0:
70
70
    
71
71
    @staticmethod
72
72
    def __extract_in_temp(filePath, shell=None):
73
 
        """Extracts the downloaded pigment to /tmp/epidermis/installer
 
73
        """Extract the downloaded pigment to /tmp/epidermis/installer
74
74
        shell is the Shell object that should be used
75
 
        Not the same as the Pigment object's private method"""
 
75
        Not the same as the Pigment object's private method
 
76
        
 
77
        """
76
78
        if not os.path.exists(filePath):
77
79
            raise(ep_exceptions.FileNotFoundException(filePath))
78
80
        if shell is None:
87
89
        shell.do(["tar", "-xf", "%s.tar" % fileName[:-8]], cwd="/tmp/epidermis/pack")
88
90
    
89
91
    def install(self, installationDirectory, progressCallback=None, shell=None):
90
 
        """Installs all of the pack's owned pigments, leaving the skins
91
 
        until last"""
 
92
        """Install all of the pack's owned pigments, leaving the skins
 
93
        until last
 
94
        
 
95
        """
92
96
        if shell is None:
93
97
            shell = SubprocessShell()
94
98
            shell.prepare()
116
120
            progressCallback(1.0)
117
121
    
118
122
    def load(self, filePath):
119
 
        """Loads the pack and its owned Pigment objects"""
 
123
        """Load the pack and its owned Pigment objects"""
120
124
        self.__extract_in_temp(filePath)
121
125
        self.read("/tmp/epidermis/pack/information/pigment.xml")
122
126
        # non skins first
136
140
                raise(ep_exceptions.MissingFileInPigment(self, ff))
137
141
    
138
142
    def read(self, filePath):
139
 
        """Reads the XML file passed
140
 
        Note: doesn't load pigment objects"""
 
143
        """Read the XML file passed
 
144
        Note: doesn't load pigment objects
 
145
        
 
146
        """
141
147
        if not os.path.exists(filePath):
142
148
            raise(ep_exceptions.FileNotFoundException(file))
143
149
        from xml.dom import minidom