Skip to content
Snippets Groups Projects
Commit 1840b9a4 authored by Maryshca's avatar Maryshca
Browse files

before tabs removal

parent 88aba049
No related branches found
No related tags found
No related merge requests found
......@@ -2,12 +2,10 @@ import dearpygui.dearpygui as dpg
import re
import ctypes
from dpg_gui_styles import GuiStyle, INDENT
from config_manager import ConfigManager
ctypes.windll.shcore.SetProcessDpiAwareness(1)
FONT_PATH = "D:\\fonts\\Montserrat\\static\\Montserrat-Medium.ttf"
ACCENT_COLOR = (0, 119, 200, 100)
class ConfigEditor:
def __init__(self):
dpg.create_context()
......@@ -16,32 +14,18 @@ class ConfigEditor:
self.styles = GuiStyle()
# self.cfg_manager = ConfigManager()
dpg.bind_font(self.styles.montserrat_font)
dpg.bind_theme(self.styles.main_theme)
self.config_data = []
dpg.create_viewport(title='config file editor', width=800, height=600)
dpg.setup_dearpygui()
dpg.show_viewport()
dpg.set_primary_window("main", True)
self.config_data = []
self.tabs = {}
def set_default_styles(self, sender, value):
if value:
dpg.bind_theme(None)
else:
dpg.bind_theme(self.styles.main_theme)
def set_default_font(self, sender, value):
if value:
dpg.bind_font(None)
else:
dpg.bind_font(self.styles.montserrat_font)
def open_file_dialog(self):
dpg.show_item("file_dialog")
def open_file(self, sender, app_data, user_data):
file_path = app_data['file_path_name']
......@@ -62,11 +46,11 @@ class ConfigEditor:
with dpg.window(label="config file editor", width=800, height=600, tag="main"):
with dpg.menu_bar():
with dpg.menu(label="file"):
dpg.add_menu_item(label="open config file", callback=self.open_file_dialog, tag="open_file_btn")
dpg.add_menu_item(label="open config file", callback=lambda _: dpg.show_item("file_dialog"), tag="open_file_btn")
with dpg.menu(label="view"):
dpg.add_menu_item(label="use default theme", check=True, callback=self.set_default_styles, default_value=False)
dpg.add_menu_item(label="use default font", check=True, callback=self.set_default_font, default_value=False)
dpg.add_menu_item(label="use default theme", check=True, callback=lambda _, v: dpg.bind_theme(None if v else self.styles.main_theme), default_value=False)
dpg.add_menu_item(label="use default font", check=True, callback=lambda _, v: dpg.bind_font(None if v else self.styles.montserrat_font), default_value=False)
dpg.add_menu_item(label="show theme editor", callback=dpg.show_style_editor)
with dpg.file_dialog(directory_selector=False, show=False, callback=self.open_file, tag="file_dialog", width=500, height=400):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment