Grubuntu / PieMenu

Fork of PieMenu, with some improvements
10 stars 5 forks source link

WIP: Replace definition of GUI via code with the loading of a UI file #77

Open hasecilu opened 5 months ago

hasecilu commented 5 months ago

I mentioned once that could be useful to invoke the GUI from an actual UI file instead of having all deinfed via code because it would make the code easier to read and find important function, the code have more than 4500 loc which for a single file seems to much.

This PR introduces the use of a UI file by adding a new button in the PieMenu settings dialog (for testing purposes), the idea is to explore if is convenient that the DialogTest() class replace a lot of loc on the InitGui.py file (still not done).

Most of the UI elements have same name, string and tooltips as in the code but could be that some are wrong, need to check.

Anyway, this is still not finished:

image

UI elements hierarchy

graph LR
    A[preferencesWidget\nLayout: QVBoxLayout]
    A --> C[piemenuWidget\nLayout: QHBoxLayout]
    A --> D[vSplitter - QSplitter]
    D --> E[tabs]
    D --> F[toolBarTab\nLayout: QVBoxLayout\nText: Toolbars]
    D --> G[pieButtons\nLayout: QVBoxLayout]
    D --> H[showPiemenu\nLayout: QVBoxLayout]
    C --> I[piemenuBoxGroup\nLayout: QHBoxLayout]
    C --> J[`**buttonBackToSettings**`\nText: Return to setings...]
    I --> L[**buttonExistingToolBar**\nText: Workbenches toolbars...]
    E --> M[piemenuTab\nText: PieMenu]
    E --> N[widgetContainer\nText: Tools]
    E --> Ñ[contextTab\nText: Context]
    E --> O[settingsTab\nText: Settings]
    G --> P[buttonListWidget - QTableWidget\nHeader: Shortcut, Action]
    H --> Q[buttonListWidget - QTableWidget\nHeader: Preview]

    ZS[pieMenuDialogLayout \nLayout: QVBoxLayout]
    ZS --> A
    ZS --> ZU[button_layout\nLayout: QVBoxLayout]
    ZU --> ZV[layoutInfoShortcut\nLayout: QHBoxLayout]
    ZV --> ZT[infoShortcut  QLabel\nText: void]
    ZU --> ZZ[button_row_layout\nLayout: QHBoxLayout]
    ZZ --> ZY[info_button\nText: About]
    ZZ --> ZX[close_button\nText: Close]
    ZZ --> ZWW[doc_button\nText: Documentation]

    I --> YO[layoutAddRemove \nLayout: QVBoxLayout]
    YO --> YP[buttonIconPieMenu\nTooltip: Set icon to ...]
    YO --> YQ[cBox\nUsed to select menu]
    YO --> YR[buttonAddPieMenu]
    YO --> YS[buttonRemovePieMenu]
    YO --> YT[buttonRenamePieMenu]
    YO --> YU[buttonCopyPieMenu ]
    YO --> YV[buttonExistingToolBar ]
Grubuntu commented 1 month ago

Congratulations for all this work. Unfortunately I don't use QtDesigner, and I don't really have time to learn new software at the moment so I can't help you in this development.

When you are ready we will push this code. Thanks for your work.

hasecilu commented 1 month ago

Basically for now the UI file still needs some tweaks and I would need to connect all the events. I'll try to finish before 1.0.

I just have a doubt regarding tabToolBar QTabWidget, is it planned to be used later or can be removed? It seems unused.

    tabToolBar = QtGui.QTabWidget()

    toolBarTab = QtGui.QWidget()
    toolBarTab.setLayout(toolBarTabLayout)

    tabToolBar.addTab(toolBarTab, translate("ToolBarsTab", "ToolBars")) # used but never called

    vSplitter = QtGui.QSplitter()
    vSplitter.insertWidget(1, tabs)
    vSplitter.insertWidget(2, toolBarTab)
    ...
Grubuntu commented 1 month ago

EDIT : !!! I didn't check it properly : 'tabToolBar' and 'toolBarTab' are necessary, you should not delete it. !!!

Grubuntu commented 2 weeks ago

I just have a doubt regarding tabToolBar QTabWidget, is it planned to be used later or can be removed? It seems unused.

Sorry, I didn't check it properly : 'tabToolBar' and 'toolBarTab' are necessary, you should not delete it.

hasecilu commented 2 weeks ago

Ok I'll add it, I've been busy on other FreeCAD things so I don't think will be changes soon.

Meanwhile if there are things you want to change of the wiki page let me know, if UI is not changing soon images can be updated.