ChangeLog: Use an ordered dict for items

This way we respect the ordering of the original text file instead of a
random ordering.
This commit is contained in:
Arjen Hiemstra 2015-09-11 14:43:46 +02:00
parent 907f53240d
commit 7f9ad28a1f

View File

@ -13,6 +13,7 @@ from PyQt5.QtQml import QQmlComponent, QQmlContext
from PyQt5.QtCore import QUrl, pyqtSlot, QObject from PyQt5.QtCore import QUrl, pyqtSlot, QObject
import os.path import os.path
import collections
catalog = i18nCatalog("cura") catalog = i18nCatalog("cura")
@ -55,7 +56,7 @@ class ChangeLog(Extension, QObject,):
return result return result
def loadChangeLogs(self): def loadChangeLogs(self):
self._change_logs = {} self._change_logs = collections.OrderedDict()
with open(os.path.join(PluginRegistry.getInstance().getPluginPath("ChangeLogPlugin"), "ChangeLog.txt"), 'r',-1, "utf-8") as f: with open(os.path.join(PluginRegistry.getInstance().getPluginPath("ChangeLogPlugin"), "ChangeLog.txt"), 'r',-1, "utf-8") as f:
open_version = None open_version = None
open_header = None open_header = None
@ -65,7 +66,7 @@ class ChangeLog(Extension, QObject,):
line = line.replace("[","") line = line.replace("[","")
line = line.replace("]","") line = line.replace("]","")
open_version = Version(line) open_version = Version(line)
self._change_logs[Version(line)] = {} self._change_logs[Version(line)] = collections.OrderedDict()
elif line.startswith("*"): elif line.startswith("*"):
open_header = line.replace("*","") open_header = line.replace("*","")
self._change_logs[open_version][open_header] = [] self._change_logs[open_version][open_header] = []