Steuerung der Oberfläche über eine cfg-Datei
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
[Fenster]
|
||||
CanvasBreite=950
|
||||
CanvasHoehe=1450
|
||||
Dimension=970x900
|
||||
@@ -22,7 +22,7 @@ class Environment:
|
||||
def build_gui(model, configs, env, sivasid=None, uselocal=True):
|
||||
root = tk.Tk()
|
||||
#root = ttk.Window()
|
||||
app = App(root)
|
||||
app = App(root, configs)
|
||||
|
||||
controller = Controller(model, app)
|
||||
controller.set_env(env)
|
||||
|
||||
+9
-4
@@ -1700,18 +1700,19 @@ class RightFrameZusatzinfos(AllFrames):
|
||||
self.zusatzinfos_bendef_text.delete('1.0', 'end')
|
||||
|
||||
class App():
|
||||
def __init__(self, root):
|
||||
def __init__(self, root, config):
|
||||
"""Standardgui mit Baum zur Anwahl der Teile des Assemblies"""
|
||||
|
||||
self._root = root
|
||||
self._config = config
|
||||
self.build_widgets()
|
||||
|
||||
def build_widgets(self):
|
||||
""" baue alle Frames der Gui auf
|
||||
"""
|
||||
|
||||
# Defaultgrösse des Fensters
|
||||
self._root.geometry('970x900')
|
||||
Dimension = self._config.Gui.get('Fenster', 'Dimension')
|
||||
self._root.geometry(Dimension)
|
||||
|
||||
style = ttk.Style(self._root)
|
||||
style.theme_use('clam')
|
||||
@@ -1723,7 +1724,11 @@ class App():
|
||||
container.pack()
|
||||
|
||||
# hier im Canvas ist der linke und Rechte Frame drin
|
||||
self._canvas = tk.Canvas(container, width=950, height=1450)
|
||||
|
||||
# CanvasBreite gesteuert durch gui.cfg
|
||||
width = self._config.Gui.get('Fenster', 'CanvasBreite')
|
||||
height = self._config.Gui.get('Fenster', 'CanvasHoehe')
|
||||
self._canvas = tk.Canvas(container, width=width, height=height)
|
||||
self._canvas.pack(side="left", fill="both", expand=True)
|
||||
|
||||
# zum Verschieben des Canvas: Eine globale Scrollbar ganz rechts
|
||||
|
||||
@@ -484,6 +484,10 @@ class InvaldCharsConfig():
|
||||
def get(self):
|
||||
return self._characters
|
||||
|
||||
class GuiConfig(IniBasedConfig):
|
||||
"""Auslesen der Zusatzinformationen die aus dem Änderungsindex abgeleitet werden"""
|
||||
def __init__(self, config_dir='.', config_file='gui.cfg'):
|
||||
super().__init__(config_dir, config_file)
|
||||
|
||||
class Configs:
|
||||
"""Sammlung aller Configdateien """
|
||||
@@ -500,6 +504,7 @@ class Configs:
|
||||
self.Werkstoffe = WerkstoffeConfig(cfg_dir)
|
||||
self.Zusatz = ZusatzConfig(cfg_dir)
|
||||
self.InvalidChars = InvaldCharsConfig(cfg_dir)
|
||||
self.Gui = GuiConfig(cfg_dir)
|
||||
|
||||
self.TOSGruppen = TOSGroupsConfig(cfg_dir)
|
||||
self.Materialien = MaterialTransConfig(cfg_dir)
|
||||
|
||||
Reference in New Issue
Block a user