Save new version when updating

Julien LepillerFri Jun 22 21:24:25+0200 2018

3ea32ca

Save new version when updating

offlate/manager.py

7474
                    "info": data})
7575
        self.writeProjects()
7676
77+
    def update(self):
78+
        for p in self.projects:
79+
            proj = self.project_list[p['name']]
80+
            p['info'] = proj.data
81+
7782
    def writeProjects(self):
7883
        with open(self.basedir + '/projects.json', 'w') as f:
7984
            f.write(json.dumps(self.projects))

offlate/systems/tp.py

2323
        self.name = name
2424
        self.lang = lang
2525
        self.basedir = ''
26-
        self.info = data
26+
        self.data = data
2727
        if "version" in data:
2828
            self.version = data['version']
2929

6464
        tree = html.fromstring(page.content)
6565
        pot = tree.xpath('//a[contains(@href,"POT-file")]/text()')
6666
        self.version = re.sub(self.name+'-(.*).pot$', '\\1', str(pot[0]))
67+
        self.data['version'] = self.version
6768
6869
    def updateFileName(self):
6970
        self.filename = self.name + '-' + self.version + '.' + self.lang + '.po'

offlate/window.py

456456
457457
    def update(self):
458458
        self.tabs.currentWidget().update()
459+
        self.manager.update()
460+
        self.manager.writeProjects()
459461
460462
    def closeProject(self):
461463
        self.tabs.removeTab(self.tabs.currentIndex())