diff --git a/gui/images/svg_icons/icon_add_user.svg b/gui/images/svg_icons/icon_add_user.svg
index 52c916f..2a51754 100644
--- a/gui/images/svg_icons/icon_add_user.svg
+++ b/gui/images/svg_icons/icon_add_user.svg
@@ -7,25 +7,25 @@
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
- width="20"
- height="14"
- viewBox="0 0 5.2916665 3.7041665"
+ width="18"
+ height="12.6"
+ viewBox="0 0 4.7624998 3.3337502"
version="1.1"
- id="svg8"
- inkscape:version="1.0 (4035a4fb49, 2020-05-01)"
+ id="svg1123"
+ inkscape:version="1.0.2-2 (e86c870879, 2021-01-15)"
sodipodi:docname="icon_add_user.svg">
+ id="defs1117" />
+ id="metadata1120">
@@ -53,9 +53,9 @@
inkscape:groupmode="layer"
id="layer1">
+ id="path835"
+ style="fill:#c3ccdf;fill-opacity:1;stroke:#000000;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="M 3.6497773,1.1647547e-4 V 0.67623793 H 2.9666794 V 1.101212 H 3.6497773 V 1.7773335 H 4.0794021 V 1.101212 H 4.7624999 V 0.67623793 H 4.0794021 V 1.1647547e-4 Z M 1.8870942,0.11929524 c -0.4018392,0.0027 -0.7261184,0.32608639 -0.7261184,0.72379299 -6.3e-5,0.39986437 0.3273236,0.72436537 0.7313507,0.72437427 0.4040261,-8.9e-6 0.731986,-0.3245099 0.7319319,-0.72437427 -8.9e-6,-0.3998092 -0.3279598,-0.72377385 -0.7319319,-0.72379299 -0.0018,-8.96e-6 -0.00343,-8.96e-6 -0.00523,0 z m 0.00349,0.45229799 c 6.75e-4,-3.4e-6 0.00107,-3.4e-6 0.00174,0 0.1516867,7.2e-6 0.2749798,0.1213713 0.2749831,0.271495 2.04e-5,0.1501443 -0.1232761,0.27207297 -0.2749831,0.27207637 -0.1517074,-3.4e-6 -0.2744255,-0.12193207 -0.2744019,-0.27207637 0,-0.1493342 0.1217718,-0.2704812 0.2726578,-0.271495 z M 1.8620957,1.8424458 C 0.22979836,1.8424458 2.0111711e-7,3.3336336 2.0111711e-7,3.3336336 H 3.7474457 c 0,0 -0.2530506,-1.4911879 -1.88535,-1.4911878 z"
+ sodipodi:nodetypes="cccccccccccccsccccsssccccsssccs" />
diff --git a/gui/images/svg_icons/icon_file.svg b/gui/images/svg_icons/icon_file.svg
new file mode 100644
index 0000000..3cd93a9
--- /dev/null
+++ b/gui/images/svg_icons/icon_file.svg
@@ -0,0 +1,63 @@
+
+
diff --git a/gui/images/svg_icons/icon_folder.svg b/gui/images/svg_icons/icon_folder.svg
new file mode 100644
index 0000000..48fe08f
--- /dev/null
+++ b/gui/images/svg_icons/icon_folder.svg
@@ -0,0 +1,62 @@
+
+
diff --git a/gui/images/svg_icons/icon_folder_open.svg b/gui/images/svg_icons/icon_folder_open.svg
new file mode 100644
index 0000000..ec541bc
--- /dev/null
+++ b/gui/images/svg_icons/icon_folder_open.svg
@@ -0,0 +1,63 @@
+
+
diff --git a/gui/images/svg_icons/icon_heart.svg b/gui/images/svg_icons/icon_heart.svg
new file mode 100644
index 0000000..ba64b5c
--- /dev/null
+++ b/gui/images/svg_icons/icon_heart.svg
@@ -0,0 +1,62 @@
+
+
diff --git a/gui/images/svg_icons/icon_home.svg b/gui/images/svg_icons/icon_home.svg
new file mode 100644
index 0000000..c5619cf
--- /dev/null
+++ b/gui/images/svg_icons/icon_home.svg
@@ -0,0 +1,66 @@
+
+
diff --git a/gui/images/svg_icons/icon_save.svg b/gui/images/svg_icons/icon_save.svg
new file mode 100644
index 0000000..c5074df
--- /dev/null
+++ b/gui/images/svg_icons/icon_save.svg
@@ -0,0 +1,61 @@
+
+
diff --git a/gui/images/svg_icons/icon_search.svg b/gui/images/svg_icons/icon_search.svg
index b072584..a4cc81f 100644
--- a/gui/images/svg_icons/icon_search.svg
+++ b/gui/images/svg_icons/icon_search.svg
@@ -7,37 +7,37 @@
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
- sodipodi:docname="icon_search.svg"
- inkscape:version="1.0 (4035a4fb49, 2020-05-01)"
- id="svg8"
+ width="16"
+ height="16"
+ viewBox="0 0 4.2333332 4.2333335"
version="1.1"
- viewBox="0 0 6.6145832 3.9687499"
- height="15"
- width="25">
+ id="svg1123"
+ inkscape:version="1.0.2-2 (e86c870879, 2021-01-15)"
+ sodipodi:docname="icon_search.svg">
+ id="defs1117" />
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="52.312834"
+ inkscape:cx="8.0000001"
+ inkscape:cy="8"
+ inkscape:document-units="mm"
+ inkscape:current-layer="layer1"
+ inkscape:document-rotation="0"
+ showgrid="false"
+ units="px"
+ inkscape:window-width="1920"
+ inkscape:window-height="1027"
+ inkscape:window-x="1912"
+ inkscape:window-y="-8"
+ inkscape:window-maximized="1" />
+ id="metadata1120">
@@ -49,12 +49,12 @@
+ id="layer1">
+ style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-variant-east-asian:normal;font-feature-settings:normal;font-variation-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;shape-margin:0;inline-size:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#c3ccdf;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.218994;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate;stop-color:#000000"
+ d="M 1.6396931,4.2071667e-5 C 1.2208792,4.2071667e-5 0.80092396,0.16261109 0.48210957,0.48143454 0.16327384,0.800258 0,1.2196884 0,1.6386495 0,2.0576106 0.16160985,2.4675692 0.48210957,2.7958645 0.80030529,3.1140693 1.2195565,3.2687664 1.6396931,3.2687664 c 0.326953,0 0.6520287,-0.093012 0.9216913,-0.2856184 l 0.074773,-0.054079 1.30442,1.3042642 0.2927559,-0.292317 -1.3044201,-1.3042749 0.052373,-0.074239 C 3.174992,2.2835717 3.2686768,1.956855 3.2686768,1.6386076 3.2686768,1.2183238 3.113275,0.79959737 2.7950686,0.48139258 2.4762542,0.16256913 2.0585389,1.0166667e-7 1.6397144,1.0166667e-7 Z m 0,0.410321188333 c 0.3096197,0 0.6271968,0.11840947 0.8643903,0.36473232 0.2350494,0.23595492 0.3536302,0.54726912 0.3536302,0.86355392 0,0.3095436 -0.1191034,0.6195671 -0.3536302,0.863106 l -0.00213,0.00213 C 2.2647992,2.7410351 1.9490035,2.8587833 1.6393517,2.8587833 c -0.3096624,0 -0.6276981,-0.1177482 -0.86483828,-0.3548871 l -0.002133,-0.00213 C 0.53785329,2.2582166 0.41873922,1.9481931 0.41873922,1.6386495 c 0,-0.3170314 0.11927406,-0.6287403 0.35542221,-0.8648979 C 1.0111842,0.52861273 1.330116,0.41036326 1.6389997,0.41036326 Z" />
diff --git a/gui/images/svg_icons/icon_widgets.svg b/gui/images/svg_icons/icon_widgets.svg
new file mode 100644
index 0000000..d0171c2
--- /dev/null
+++ b/gui/images/svg_icons/icon_widgets.svg
@@ -0,0 +1,101 @@
+
+
diff --git a/gui/uis/windows/main_window/functions_main_window.py b/gui/uis/windows/main_window/functions_main_window.py
new file mode 100644
index 0000000..6794af1
--- /dev/null
+++ b/gui/uis/windows/main_window/functions_main_window.py
@@ -0,0 +1,27 @@
+# ///////////////////////////////////////////////////////////////
+#
+# 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 QT CORE
+# ///////////////////////////////////////////////////////////////
+from qt_core import *
+
+# FUNCTIONS
+class FunctionsMainWindow:
+ pass
\ No newline at end of file
diff --git a/gui/uis/windows/main_window/ui_main.py b/gui/uis/windows/main_window/ui_main.py
index d7e4a5d..86c8829 100644
--- a/gui/uis/windows/main_window/ui_main.py
+++ b/gui/uis/windows/main_window/ui_main.py
@@ -38,6 +38,10 @@ from gui.widgets import *
# ///////////////////////////////////////////////////////////////
from . setup_main_window import *
+# IMPORT FUNCTIONS MAIN WINDOW
+# ///////////////////////////////////////////////////////////////
+from . functions_main_window import *
+
# PY WINDOW
# ///////////////////////////////////////////////////////////////
class UI_MainWindow(object):
@@ -111,8 +115,8 @@ class UI_MainWindow(object):
app_parent = self.central_widget, # For tooltip parent
dark_one = self.themes["app_color"]["dark_one"]
)
+ self.left_menu.add_menus(self.settings["add_menus"])
self.left_menu_layout.addWidget(self.left_menu)
- print(self.themes["app_color"]["dark_one"])
# ADD LEFT COLUMN
# Add here the left column with Stacked Widgets
diff --git a/gui/widgets/py_left_menu/py_left_menu.py b/gui/widgets/py_left_menu/py_left_menu.py
index ccd0045..756b4fa 100644
--- a/gui/widgets/py_left_menu/py_left_menu.py
+++ b/gui/widgets/py_left_menu/py_left_menu.py
@@ -26,10 +26,14 @@ from . py_div import PyDiv
# PY LEFT MENU
# ///////////////////////////////////////////////////////////////
class PyLeftMenu(QWidget):
+ clicked = Signal(str)
+ released = Signal(str)
+
def __init__(
self,
parent = None,
app_parent = None,
+ buttons = None,
dark_one = "#1b1e23",
dark_three = "#21252d",
dark_four = "#272c36",
@@ -45,6 +49,8 @@ class PyLeftMenu(QWidget):
maximum_width = 240,
icon_path = "gui/images/svg_icons/icon_menu.svg",
icon_path_close = "gui/images/svg_icons/icon_menu_close.svg",
+ toggle_text = "Hide Menu",
+ toggle_tooltip = "Expand/Retract menu"
):
super(PyLeftMenu, self).__init__()
@@ -74,41 +80,73 @@ class PyLeftMenu(QWidget):
# SET BG COLOR
self.bg.setStyleSheet(f"background: {dark_one}; border-radius: {radius};")
- self.button = PyLeftMenuButton(
- app_parent,
- "Add user menu",
- "Test tooltip",
- )
- self.button.clicked.connect(lambda: self.toggle_animation())
-
# TOGGLE BUTTON AND DIV MENUS
# ///////////////////////////////////////////////////////////////
self.toggle_button = PyLeftMenuButton(
app_parent,
- "Hide Menu",
- "Expand/Retract menu",
+ text = toggle_text,
+ tooltip_text = toggle_tooltip,
icon_path = icon_path
)
self.toggle_button.clicked.connect(self.toggle_animation)
self.div_top = PyDiv(dark_four)
# ADD TO TOP LAYOUT
+ # ///////////////////////////////////////////////////////////////
self.top_layout.addWidget(self.toggle_button)
self.top_layout.addWidget(self.div_top)
- self.top_layout.addWidget(self.button) # Apagar
- # BUTTON WIDGETS
+ # ADD TO BOTTOM LAYOUT
# ///////////////////////////////////////////////////////////////
- self.div_button = PyDiv(dark_four)
- self.settings_button = PyLeftMenuButton(
- app_parent,
- "Settings",
- "Open settings",
- icon_path="gui/images/svg_icons/icon_settings.svg"
- )
- self.bottom_layout.addWidget(self.div_button)
- self.bottom_layout.addWidget(self.settings_button)
+ self.div_bottom = PyDiv(dark_four)
+ self.div_bottom.hide()
+ self.bottom_layout.addWidget(self.div_bottom)
+ # ADD BUTTONS
+ # ///////////////////////////////////////////////////////////////
+ self.add_menus(buttons)
+
+ # ADD BUTTONS TO LEFT MENU
+ # Add btns and emit signals
+ # ///////////////////////////////////////////////////////////////
+ def add_menus(self, parameters):
+ if parameters != None:
+ for parameter in parameters:
+ _btn_icon = parameter['btn_icon']
+ _btn_id = parameter['btn_id']
+ _btn_text = parameter['btn_text']
+ _btn_tooltip = parameter['btn_tooltip']
+ _show_top = parameter['show_top']
+ _is_active = parameter['is_active']
+
+ self.menu = PyLeftMenuButton(
+ self._app_parent,
+ text = _btn_text,
+ btn_id = _btn_id,
+ tooltip_text = _btn_tooltip,
+ icon_path = _btn_icon,
+ is_active = _is_active
+ )
+ self.menu.clicked.connect(self.btn_clicked)
+ self.menu.released.connect(self.btn_released)
+
+ # ADD TO LAYOUT
+ if _show_top:
+ self.top_layout.addWidget(self.menu)
+ else:
+ self.div_bottom.show()
+ self.bottom_layout.addWidget(self.menu)
+
+ # LEFT MENU EMIT SIGNALS
+ # ///////////////////////////////////////////////////////////////
+ def btn_clicked(self):
+ self.clicked.emit(self.menu)
+
+ def btn_released(self):
+ self.released.emit(self.menu)
+
+ # EXPAND / RETRACT LEF MENU
+ # ///////////////////////////////////////////////////////////////
def toggle_animation(self):
if self.toggle_button._is_toggle_active:
self.toggle_button.set_active_toggle(False)
@@ -122,19 +160,16 @@ class PyLeftMenu(QWidget):
if self.width() == self._minimum_width:
self.animation.setStartValue(self.width())
self.animation.setEndValue(self._maximum_width)
- # ACTIVE
- self.button.set_active(True)
else:
self.animation.setStartValue(self.width())
self.animation.setEndValue(self._minimum_width)
- # ACTIVE
- self.button.set_active(False)
self.animation.setEasingCurve(QEasingCurve.InOutCubic)
- self.animation.setDuration(self._duration_time)
+ self.animation.setDuration(self._duration_time)
self.animation.start()
# SET APP LAYOUT
+ # ///////////////////////////////////////////////////////////////
def setup_ui(self):
# ADD MENU LAYOUT
self.left_menu_layout = QVBoxLayout(self)
diff --git a/gui/widgets/py_left_menu/py_left_menu_button.py b/gui/widgets/py_left_menu/py_left_menu_button.py
index 4011792..4c0e29a 100644
--- a/gui/widgets/py_left_menu/py_left_menu_button.py
+++ b/gui/widgets/py_left_menu/py_left_menu_button.py
@@ -29,6 +29,7 @@ class PyLeftMenuButton(QPushButton):
self,
app_parent,
text,
+ btn_id = None,
tooltip_text = "",
margin = 4,
dark_one = "#1b1e23",
@@ -52,6 +53,7 @@ class PyLeftMenuButton(QPushButton):
self.setCursor(Qt.PointingHandCursor)
self.setMaximumHeight(50)
self.setMinimumHeight(50)
+ self.setObjectName(btn_id)
# APP PATH
app_path = os.path.abspath(os.getcwd())
@@ -170,6 +172,11 @@ class PyLeftMenuButton(QPushButton):
if not is_active:
self._set_icon_color = self._icon_color
self.repaint()
+
+ # RETURN IF IS ACTIVE MENU
+ # ///////////////////////////////////////////////////////////////
+ def is_active(self):
+ return self._is_active
# SET ACTIVE TOGGLE
# ///////////////////////////////////////////////////////////////
@@ -262,6 +269,7 @@ class PyLeftMenuButton(QPushButton):
def mouseReleaseEvent(self, event):
if event.button() == Qt.LeftButton:
self.change_style(QEvent.MouseButtonRelease)
+ return self.released.emit()
# MOVE TOOLTIP
# ///////////////////////////////////////////////////////////////
diff --git a/main.py b/main.py
index 31efc01..7bf97d6 100644
--- a/main.py
+++ b/main.py
@@ -62,10 +62,43 @@ class MainWindow(QMainWindow):
self.hide_grips = True # Show/Hide resize grips
SetupMainWindow.setup(self)
+ # GET SIGNALS WHEN LEFT MENU BTN IS CLICKED / RELEASED
+ # ///////////////////////////////////////////////////////////////
+ self.ui.left_menu.clicked.connect(self.left_menu_btn_clicked)
+ self.ui.left_menu.clicked.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):
diff --git a/settings.json b/settings.json
index dd84267..8c9a4b5 100644
--- a/settings.json
+++ b/settings.json
@@ -18,5 +18,63 @@
"minimum" : 240,
"maximum" : 240
},
+ "add_menus" : [
+ {
+ "btn_icon" : "gui/images/svg_icons/icon_home.svg",
+ "btn_id" : "btn_home",
+ "btn_text" : "Home",
+ "btn_tooltip" : "Home page",
+ "show_top" : true,
+ "is_active" : false
+ },
+ {
+ "btn_icon" : "gui/images/svg_icons/icon_widgets.svg",
+ "btn_id" : "btn_widgets",
+ "btn_text" : "Open Widgets",
+ "btn_tooltip" : "Show custom widgets",
+ "show_top" : true,
+ "is_active" : false
+ },
+ {
+ "btn_icon" : "gui/images/svg_icons/icon_add_user.svg",
+ "btn_id" : "btn_add_user",
+ "btn_text" : "Add Users",
+ "btn_tooltip" : "Add users",
+ "show_top" : true,
+ "is_active" : false
+ },
+ {
+ "btn_icon" : "gui/images/svg_icons/icon_file.svg",
+ "btn_id" : "btn_new_file",
+ "btn_text" : "New File",
+ "btn_tooltip" : "Create new file",
+ "show_top" : true,
+ "is_active" : false
+ },
+ {
+ "btn_icon" : "gui/images/svg_icons/icon_folder_open.svg",
+ "btn_id" : "btn_open_file",
+ "btn_text" : "Open File",
+ "btn_tooltip" : "Open file",
+ "show_top" : true,
+ "is_active" : false
+ },
+ {
+ "btn_icon" : "gui/images/svg_icons/icon_save.svg",
+ "btn_id" : "btn_save",
+ "btn_text" : "Save File",
+ "btn_tooltip" : "Save file",
+ "show_top" : true,
+ "is_active" : false
+ },
+ {
+ "btn_icon" : "gui/images/svg_icons/icon_settings.svg",
+ "btn_id" : "btn_settings",
+ "btn_text" : "Settings",
+ "btn_tooltip" : "Open settings",
+ "show_top" : false,
+ "is_active" : false
+ }
+ ],
"theme_name": "default"
}
\ No newline at end of file