added qt stuff

master
Milan Suman 2022-03-19 10:23:42 +05:30
parent 4e193da02f
commit 340a1ef389
3 changed files with 18 additions and 22 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
*.swp *.swp
__pycache__ __pycache__
.spyproject .spyproject
concordenv

View File

@ -1,2 +1,8 @@
# -*- coding: utf-8 -*- from PySide6 import QtCore, QtWidgets
class MainWindow(QtWidgets.QWidget):
def __init__(self):
super().__init__()
self.text = QtWidgets.QLabel("Hello World", alignment=QtCore.Qt.AlignCenter)
self.layout = QtWidgets.QVBoxLayout(self)
self.layout.addWidget(self.text)

31
main.py
View File

@ -1,8 +1,9 @@
#!/usr/bin/python3 #!/usr/bin/python3
import os import os
import tkinter as tk import sys
from tkinter import ttk
import gui_helper import gui_helper
import gui_handler
from PySide6 import QtWidgets
from config import Config from config import Config
################################################################################ ################################################################################
@ -10,9 +11,9 @@ from config import Config
################################################################################ ################################################################################
default_configuration = { default_configuration = {
"window geometry": "640x480" "window geometry": (800, 600)
} }
configuration_file_path = os.path.join(os.path.expanduser("~"), "some_ide_config.json") configuration_file_path = os.path.join(os.path.expanduser("~"), "concorde_ide_config.json")
################################################################################ ################################################################################
# PROGRAM STARTUP # PROGRAM STARTUP
@ -24,21 +25,9 @@ configuration = Config(configuration_file_path, default_configuration)
# PROGRAM MAIN WINDOW # PROGRAM MAIN WINDOW
################################################################################ ################################################################################
main_window = tk.Tk() app = QtWidgets.QApplication([])
main_window.title("IDE") main_window = gui_handler.MainWindow()
main_window.geometry(configuration.get_configuration_value("window geometry")) main_window.resize(800, 600)
main_window.show()
menubar = None sys.exit(app.exec())
def rebuild_menu(structure_dict):
menubar = tk.Menu(main_window)
gui_helper.build_menu(structure_dict, menubar)
main_window.config(menu=menubar)
rebuild_menu(gui_helper.menu_structure)
def handle_exit():
configuration.set_configuration_value("window geometry", main_window.geometry())
main_window.destroy()
main_window.protocol("WM_DELETE_WINDOW", handle_exit)
main_window.mainloop()