diff options
author | emkael <emkael@tlen.pl> | 2019-06-02 22:23:25 +0200 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2019-06-02 22:23:25 +0200 |
commit | 0e1ec567ea1cfffd69cd43816a6b851735a97f99 (patch) | |
tree | 9c6b0c77c5b01d51f0564a550be51bcbe7290707 /jfr_playoff | |
parent | b53a4f555f8560de419924692b3c9017f4cc949c (diff) |
Translations configuration frame
Diffstat (limited to 'jfr_playoff')
-rw-r--r-- | jfr_playoff/gui/frames/translations.py | 40 | ||||
-rw-r--r-- | jfr_playoff/gui/tabs.py | 6 |
2 files changed, 46 insertions, 0 deletions
diff --git a/jfr_playoff/gui/frames/translations.py b/jfr_playoff/gui/frames/translations.py new file mode 100644 index 0000000..94af787 --- /dev/null +++ b/jfr_playoff/gui/frames/translations.py @@ -0,0 +1,40 @@ +#coding=utf-8 + +import copy + +import tkinter as tk +from tkinter import ttk + +from ..frames import RepeatableFrame, WidgetRepeater, ScrollableFrame +from ...i18n import PLAYOFF_I18N_DEFAULTS + +class TranslationRow(RepeatableFrame): + def renderContent(self): + self.key = tk.StringVar() + (ttk.Entry(self, textvariable=self.key, width=40)).pack( + side=tk.LEFT) + self.value = tk.StringVar() + (ttk.Entry(self, textvariable=self.value, width=80)).pack( + side=tk.RIGHT) + + def setValue(self, value): + self.key.set(value[0]) + self.value.set(value[1]) + +class TranslationConfigurationFrame(ScrollableFrame): + + def setTranslations(self, translations): + translations = copy.copy(PLAYOFF_I18N_DEFAULTS) + translations.update(translations) + values = [] + for value in translations.iteritems(): + values.append(value) + self.repeater.setValue(values) + + def renderContent(self, container): + self.repeater = WidgetRepeater(container, TranslationRow) + self.repeater.pack(side=tk.TOP, fill=tk.BOTH, expand=True) + + self.setTranslations({}) + +__all__ = ['TranslationConfigurationFrame'] diff --git a/jfr_playoff/gui/tabs.py b/jfr_playoff/gui/tabs.py index c2c6bbe..2d96ce7 100644 --- a/jfr_playoff/gui/tabs.py +++ b/jfr_playoff/gui/tabs.py @@ -10,6 +10,7 @@ import tkMessageBox as tkmb from .frames import getIntVal from .frames.team import * from .frames.network import * +from .frames.translations import * from ..data import PlayoffData from ..db import PlayoffDB @@ -199,5 +200,10 @@ class TranslationsTab(PlayoffTab): def title(self): return 'TĹ‚umaczenia' + def renderContent(self, container): + self.translationsFrame = TranslationConfigurationFrame( + container, vertical=True) + self.translationsFrame.pack(side=tk.TOP, fill=tk.BOTH, expand=True) + __all__ = ['MainSettingsTab', 'TeamsTab', 'MatchesTab', 'SwissesTab', 'NetworkTab', 'VisualTab', 'StyleTab', 'TranslationsTab'] |