diff --git a/docs/manual/ref/popup.rst b/docs/manual/ref/popup.rst index 565df71..2241d5a 100644 --- a/docs/manual/ref/popup.rst +++ b/docs/manual/ref/popup.rst @@ -17,6 +17,7 @@ flexibility to users, there are a number of different layouts available in the t :exclude-base: :no-commands: :show-config: + :methods: show,hide,unhide,kill,update_controls,bind_callbacks .. _ref-popup-controls: diff --git a/docs/sphinx_qtile_extras.py b/docs/sphinx_qtile_extras.py index 65c85f7..97b36ac 100644 --- a/docs/sphinx_qtile_extras.py +++ b/docs/sphinx_qtile_extras.py @@ -46,6 +46,7 @@ {% if no_config %}:no-config:{% endif %} {% if no_commands %}:no-commands:{% endif %} {% if show_config %}:show-config:{% endif %} + {% if methods %}:methods: {{ methods }}{% endif %} """ ) @@ -177,6 +178,11 @@ .. automethod:: {{ module }}.{{ class_name }}.{{ cmd }} {% endfor %} {% endif %} + {% if has_methods %} + {% for method in methods %} + .. automethod:: {{ module }}.{{ class_name }}.{{ method }} + {% endfor %} + {% endif %} {% endif %} """ ) @@ -219,6 +225,7 @@ class QtileClass(SimpleDirectiveMixin, Directive): "show-config": directives.flag, "no-commands": directives.flag, "exclude-base": directives.flag, + "methods": directives.unchanged, } def make_rst(self): @@ -265,6 +272,8 @@ def make_rst(self): for k, v in widget_shots.items() } + methods = [m for m in self.options.get("methods", "").split(",") if m] + context = { "module": module, "class_name": class_name, @@ -281,7 +290,10 @@ def make_rst(self): "compatibility": getattr(obj, "_qte_compatibility", False), "widget_screenshots": widget_shots, "is_widget": is_widget, + "methods": methods, + "has_methods": bool(methods), } + if context["commandable"]: context["commands"] = [ # Command methods have the "_cmd" attribute so we check for this @@ -300,12 +312,13 @@ class QtileModule(SimpleDirectiveMixin, Directive): # :baseclass: # :no-commands: # :no-config: - optional_arguments = 4 + optional_arguments = 5 option_spec = { "baseclass": directives.unchanged, "no-commands": directives.flag, "exclude-base": directives.flag, "show-config": directives.flag, + "methods": directives.unchanged, } def make_rst(self): @@ -331,6 +344,7 @@ def make_rst(self): "class_name": item, "no_commands": "no-commands" in self.options, "show_config": "show-config" in self.options, + "methods": self.options.get("methods", ""), } rst = qtile_module_template.render(**context) diff --git a/qtile_extras/popup/toolkit.py b/qtile_extras/popup/toolkit.py index c32e535..1b22d63 100644 --- a/qtile_extras/popup/toolkit.py +++ b/qtile_extras/popup/toolkit.py @@ -235,7 +235,7 @@ def show( `relative_to` parameter. The parameter is an integer from 1 to 9 representing the screen broken into a 3x3 grid: - .. :: + .. code:: 1 2 3 @@ -258,7 +258,7 @@ def show( the bar or gap (including any margin) nearest the point on the above grid i.e. if ``relative_to=1`` then the y coordinate would be adjusted for any bar on the top of the screen and the x would be adjusted for any bar on the left. NB If you set - ``relative_to-bar=True`` and you use a float value for x and/or y, the float value is + ``relative_to_bar=True`` and you use a float value for x and/or y, the float value is still calculated by reference to the whole screen's dimensions (i.e. including the space occupied by the bar). @@ -389,7 +389,12 @@ def hide(self): """Hide the popup.""" self.popup.hide() + def unhide(self): + """Unhide the popup.""" + self.popup.unhide() + def kill(self): + """Kill the popup window.""" if self.keyboard_navigation: self.unset_hooks() self.popup.kill() @@ -1553,7 +1558,7 @@ class PopupWidget(_PopupWidget): Mouse clicks are passed on to the widgets. Currently, widgets will be sized based on the dimensions of the control. - This will override any width/stretching settings in thw widget. + This will override any width/stretching settings in the widget. """ defaults = [