# /////////////////////////////////////////////////////////////// # # BY: WANDERSON M.PIMENTA # PROJECT MADE WITH: Qt Designer and PySide6 # V: 1.0.0 # # This project can be used freely for all uses, as long as they maintain the # respective credits only in the Python scripts, any information in the visual # interface (GUI) can be modified without any implication. # # There are limitations on Qt licenses if you want to use your products # commercially, I recommend reading them on the official website: # https://doc.qt.io/qtforpython/licenses.html # # /////////////////////////////////////////////////////////////// # IMPORT PACKAGES AND MODULES # /////////////////////////////////////////////////////////////// import sys import os # IMPORT QT CORE # /////////////////////////////////////////////////////////////// from qt_core import * # IMPORT SETTINGS # /////////////////////////////////////////////////////////////// from gui.core.json_settings import Settings # IMPORT PY ONE DARK WINDOWS # /////////////////////////////////////////////////////////////// # MAIN WINDOW from gui.uis.windows.main_window import * # IMPORT PY ONE DARK WIDGETS # /////////////////////////////////////////////////////////////// from gui.widgets import * # ADJUST QT FONT DPI FOR HIGHT SCALE # /////////////////////////////////////////////////////////////// os.environ["QT_FONT_DPI"] = "96" # MAIN WINDOW # /////////////////////////////////////////////////////////////// class MainWindow(QMainWindow): def __init__(self): QMainWindow.__init__(self) # SETUP MAIN WINDOw # Load widgets from "gui\uis\main_window\ui_main.py" # /////////////////////////////////////////////////////////////// self.ui = UI_MainWindow() self.ui.setup_ui(self) # LOAD SETTINGS # /////////////////////////////////////////////////////////////// settings = Settings() self.settings = settings.items # SETUP MAIN WINDOW # /////////////////////////////////////////////////////////////// self.hide_grips = True # Show/Hide resize grips SetupMainWindow.setup(self) # LEFT MENUS / GET SIGNALS WHEN LEFT MENU BTN IS CLICKED / RELEASED # /////////////////////////////////////////////////////////////// # ADD MENUS self.ui.left_menu.add_menus(SetupMainWindow.add_left_menus) # SET SIGNALS self.ui.left_menu.clicked.connect(self.left_menu_btn_clicked) self.ui.left_menu.released.connect(self.left_menu_btn_released) # SHOW MAIN WINDOW # /////////////////////////////////////////////////////////////// self.show() # LEFT MENU BTN IS CLICKED # Run function when btn is clicked # Check funtion by object name / btn_id # /////////////////////////////////////////////////////////////// def left_menu_btn_clicked(self): # GET BT CLICKED btn = self.ui.left_menu.sender() if btn.objectName() == "btn_add_user": if btn.is_active(): btn.set_active(False) else: btn.set_active(True) # DEBUG print(f"Button {btn.objectName()}, clicked!") # LEFT MENU BTN IS RELEASED # Run function when btn is released # Check funtion by object name / btn_id # /////////////////////////////////////////////////////////////// def left_menu_btn_released(self): # GET BT CLICKED btn = self.ui.left_menu.sender() # DEBUG print(f"Button {btn.objectName()}, released!") # RESIZE EVENT # /////////////////////////////////////////////////////////////// def resizeEvent(self, event): SetupMainWindow.resize_grips(self) # MOUSE CLICK EVENTS # /////////////////////////////////////////////////////////////// def mousePressEvent(self, event): # SET DRAG POS WINDOW self.dragPos = event.globalPos() # SETTINGS WHEN TO START # Set the initial class and also additional parameters of the "QApplication" class # /////////////////////////////////////////////////////////////// if __name__ == "__main__": # APPLICATION app = QApplication(sys.argv) # app.setWindowIcon(QIcon("icon.ico")) window = MainWindow() sys.exit(app.exec_())