From 8d9100f32b50e24ee030ec88ccf3d74650225b23 Mon Sep 17 00:00:00 2001 From: emkael Date: Thu, 27 Jun 2019 13:58:07 +0200 Subject: Main window title --- jfr_playoff/gui/__init__.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/jfr_playoff/gui/__init__.py b/jfr_playoff/gui/__init__.py index 0b17b2e..02ef3bb 100644 --- a/jfr_playoff/gui/__init__.py +++ b/jfr_playoff/gui/__init__.py @@ -1,4 +1,4 @@ -import json, sys +import json, os, sys import tkinter as tk from tkinter import ttk @@ -13,6 +13,9 @@ class PlayoffGUI(tk.Tk): self.geometry('920x640') self.tabs = {} self.newFileIndex = 0 + self._title = tk.StringVar() + self._title.trace('w', self._setTitle) + self._dirty = False def run(self): self.notebook = ttk.Notebook(self) @@ -35,10 +38,18 @@ class PlayoffGUI(tk.Tk): def newFile(self): self.newFileIndex += 1 - self.title('Nowa drabinka %d' % (self.newFileIndex)) + self._title.set('Nowa drabinka %d' % (self.newFileIndex)) self._resetValues() + def _setTitle(self, *args): + self.title('%s - %s%s' % ( + 'TeamyPlayOff', + self._title.get(), + '* ' if self._dirty else '' + )) + def openFile(self, filepath): + self._title.set(os.path.basename(filepath)) self._setValues(json.load(open(filepath))) def getDbConfig(self): -- cgit v1.2.3