Thanks to visit codestin.com
Credit goes to github.com

Skip to content

update documentation after #18966 #22288

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 27, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 19 additions & 11 deletions lib/matplotlib/backends/qt_editor/_formlayout.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@
from numbers import Integral, Real

from matplotlib import _api, colors as mcolors
from ..qt_compat import QtGui, QtWidgets, QtCore, _enum, _to_int
from matplotlib.backends.qt_compat import (
QtGui, QtWidgets, QtCore, _enum, _to_int)

_log = logging.getLogger(__name__)

Expand Down Expand Up @@ -498,8 +499,7 @@ def get(self):

def fedit(data, title="", comment="", icon=None, parent=None, apply=None):
"""
Create form dialog and return result
(if Cancel button is pressed, return None)
Create form dialog

data: datalist, datagroup
title: str
Expand Down Expand Up @@ -541,6 +541,8 @@ def fedit(data, title="", comment="", icon=None, parent=None, apply=None):

if __name__ == "__main__":

_app = QtWidgets.QApplication([])

def create_datalist_example():
return [('str', 'this is a string'),
('list', [0, '1', '3', '4']),
Expand Down Expand Up @@ -568,18 +570,24 @@ def create_datagroup_example():

def apply_test(data):
print("data:", data)
print("result:", fedit(datalist, title="Example",
comment="This is just an <b>example</b>.",
apply=apply_test))
fedit(datalist, title="Example",
comment="This is just an <b>example</b>.",
apply=apply_test)

_app.exec()

# --------- datagroup example
datagroup = create_datagroup_example()
print("result:", fedit(datagroup, "Global title"))
fedit(datagroup, "Global title",
apply=apply_test)
_app.exec()

# --------- datagroup inside a datagroup example
datalist = create_datalist_example()
datagroup = create_datagroup_example()
print("result:", fedit(((datagroup, "Title 1", "Tab 1 comment"),
(datalist, "Title 2", "Tab 2 comment"),
(datalist, "Title 3", "Tab 3 comment")),
"Global title"))
fedit(((datagroup, "Title 1", "Tab 1 comment"),
(datalist, "Title 2", "Tab 2 comment"),
(datalist, "Title 3", "Tab 3 comment")),
"Global title",
apply=apply_test)
_app.exec()