Skip to content

Commit

Permalink
chore: typing
Browse files Browse the repository at this point in the history
  • Loading branch information
phil65 committed Jan 26, 2021
1 parent a00e741 commit ac03c67
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions prettyqt/custom_widgets/sidebarwidget.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
from __future__ import annotations

from typing import Callable, Dict, Optional, Union
from typing import Callable, Dict, Literal, Optional, Union

from prettyqt import gui, iconprovider, widgets
from prettyqt.qt import QtCore, QtWidgets
from prettyqt.utils import types


AreaStr = Literal["top", "bottom"]


class SidebarWidget(widgets.MainWindow):
BUTTON_WIDTH = 100
SETTINGS_BUTTON_HEIGHT = 28
Expand All @@ -15,7 +18,7 @@ def __init__(
self,
parent: Optional[QtWidgets.QWidget] = None,
show_settings: bool = False,
main_layout: Union[str, QtWidgets.QLayout] = "vertical",
main_layout: Union[widgets.widget.LayoutStr, QtWidgets.QLayout] = "vertical",
):
super().__init__(parent=parent)
self.button_map: Dict[QtWidgets.QWidget, QtWidgets.QToolButton] = {}
Expand Down Expand Up @@ -61,7 +64,7 @@ def add_tab(
icon: types.IconType = None,
show: bool = False,
shortcut: Optional[str] = None,
area: str = "top",
area: AreaStr = "top",
):
self.area.box.add(item)
# button = widgets.ToolButton()
Expand Down Expand Up @@ -137,7 +140,7 @@ def set_tab(self, item: Union[str, int, widgets.Widget]):
def add_spacer(self) -> widgets.Widget:
return self.sidebar.add_spacer()

def add_separator(self, text: Optional[str] = None, area: str = "top"):
def add_separator(self, text: Optional[str] = None, area: AreaStr = "top"):
if area == "top":
self.sidebar.add_separator(text, before=self.spacer_action)
else:
Expand All @@ -150,7 +153,7 @@ def add_action(
callback: Callable = None,
checkable: bool = False,
shortcut: Optional[str] = None,
area: str = "top",
area: AreaStr = "top",
):
# act = self.sidebar.add_action(label=title,
# icon=icon,
Expand Down

0 comments on commit ac03c67

Please sign in to comment.