Extract calculating font sizes to calc_font_sizes() method.
Extract calculating font sizes to calc_font_sizes() method.
diff --git a/qwerty.py b/qwerty.py
index 1c92641..aec4c1e 100755
--- a/qwerty.py
+++ b/qwerty.py
@@ -558,9 +558,6 @@ class KeyEditDialog(object):
class GUI(object):
def __init__(self):
global sections
- global LABEL_FONT_SIZE
- global DESC_FONT_SIZE
- global KEY_FONT_SIZE
self.buttons = {}
self.sbuttons = []
@@ -581,9 +578,7 @@ class GUI(object):
self.width, self.height = self.window.get_size()
self.window.set_decorated(decorate)
- LABEL_FONT_SIZE = LABEL_FONT_SIZE_COEF * self.height
- DESC_FONT_SIZE = DESC_FONT_SIZE_COEF * self.height
- KEY_FONT_SIZE = KEY_FONT_SIZE_COEF * self.height
+ self.calc_font_sizes()
for c in ALPHABET:
self.buttons[c] = SuperButton(c)
@@ -640,6 +635,16 @@ class GUI(object):
self.collect_windows()
+ def calc_font_sizes(self):
+ global LABEL_FONT_SIZE
+ global DESC_FONT_SIZE
+ global KEY_FONT_SIZE
+
+ LABEL_FONT_SIZE = LABEL_FONT_SIZE_COEF * self.height
+ DESC_FONT_SIZE = DESC_FONT_SIZE_COEF * self.height
+ KEY_FONT_SIZE = KEY_FONT_SIZE_COEF * self.height
+
+
def convert_class(self,clss):
if isinstance(clss, tuple):
return clss