Skip to content

Commit 84933f0

Browse files
authored
Model Designer updates plus text colors (#10787)
* Model designer - colors added * Text and screenshot update/fix * Show feature count * table reorder * fix conf.py * remove unnecessary conf.py changes
2 parents a9a9107 + 5e38721 commit 84933f0

File tree

4 files changed

+167
-28
lines changed

4 files changed

+167
-28
lines changed

conf.py

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
import os
2626
from hashlib import md5
2727
from sphinx.roles import MenuSelection
28+
from docutils import nodes
29+
from docutils.parsers.rst import roles
2830

2931
project = 'QGIS Documentation'
3032
copyright = '2002-now, QGIS project'
@@ -161,10 +163,6 @@
161163
'isLtr': False,
162164
}
163165

164-
# Add custom CSS when a top bar is needed to be shown (for testing or outdated versions)
165-
if html_context['isTesting'] or html_context['outdated']:
166-
html_css_files = ['css/qgis_topbar.css']
167-
168166
# Add custom tags to allow display of text based on the branch status
169167
if html_context['isTesting']:
170168
tags.add('testing')
@@ -255,6 +253,23 @@ def calculate_tx_slug(filepath):
255253
# A list of warning codes to suppress arbitrary warning messages.
256254
suppress_warnings = ["config.cache"]
257255

256+
# -- Custom text roles for colored sockets ---------------------------------
257+
258+
def make_colored_role(color_name):
259+
def role(name, rawtext, text, lineno, inliner, options={}, content=[]):
260+
node = nodes.inline(text, text)
261+
node['classes'].append(color_name)
262+
return [node], []
263+
return role
264+
265+
colors = [
266+
"red", "blue", "green", "kaki", "turquoise",
267+
"purple", "slate", "darkgray", "midgray"
268+
]
269+
270+
for c in colors:
271+
roles.register_local_role(c, make_colored_role(c))
272+
258273
# -- Options for LaTeX output --------------------------------------------------
259274

260275
latex_engine = 'xelatex'
@@ -327,7 +342,22 @@ def calculate_tx_slug(filepath):
327342
\\newunicodechar{\u25BA}{$\u25BA$}
328343
\\newunicodechar{′}{\\ensuremath{^{\\prime}}}
329344
\\newunicodechar{″}{\\ensuremath{^{\\prime\\prime}}}
330-
\\newunicodechar{​}{ }''',
345+
\\newunicodechar{​}{ }'''
346+
347+
348+
# Add specific text roles with color display
349+
'''
350+
\\usepackage{xcolor}
351+
\\newcommand{\\DUrolered}[1]{{\\color[HTML]{FF0000} #1}}
352+
\\newcommand{\\DUroleblue}[1]{{\\color[HTML]{229DD6} #1}}
353+
\\newcommand{\\DUrolegreen}[1]{{\\color[HTML]{33C91C} #1}}
354+
\\newcommand{\\DUrolekaki}[1]{{\\color[HTML]{B4B400} #1}}
355+
\\newcommand{\\DUroleturquoise}[1]{{\\color[HTML]{00B4B4} #1}}
356+
\\newcommand{\\DUrolepurple}[1]{{\\color[HTML]{8044C9} #1}}
357+
\\newcommand{\\DUroleslate}[1]{{\\color[HTML]{6464FF} #1}}
358+
\\newcommand{\\DUroledarkgray}[1]{{\\color[HTML]{505050} #1}}
359+
\\newcommand{\\DUrolemidgray}[1]{{\\color[HTML]{808080} #1}}
360+
''',
331361

332362
# Latex figure float alignment
333363
# use ‘H’ to disable floating, and position the figures strictly in the order they appear in the source
124 KB
Loading

docs/user_manual/processing/modeler.rst

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,12 @@ View menu
198198
-
199199
-
200200
- Displays comments associated to every algorithm or input in the model designer
201+
* - |checkbox| :guilabel:`Show Feature Count`
202+
-
203+
-
204+
- Displays the number of features on the links between algorithms,
205+
for vector layer connections. The model must be run at least once
206+
to populate the feature counts.
201207
* - |unchecked| :guilabel:`Enable Snapping`
202208
-
203209
-
@@ -436,13 +442,70 @@ A visual edge follows the cursor and completes the connection when released.
436442
To remove a connection, drag the edge away from the input socket.
437443
The algorithm dialogs update automatically to reflect changes made using the drag-and-drop interface.
438444

445+
In the model designer, input and output sockets are color-coded to indicate
446+
the type of data they accept or produce. The same color coding applies to
447+
rubber bands and parameter bullets on the canvas.
448+
The color is a visual aid only; compatibility between sockets is determined
449+
by the parameter type.
450+
451+
The following table describes the meaning of each socket color.
452+
453+
.. list-table::
454+
:header-rows: 1
455+
:widths: 25 35 40
456+
457+
* - Socket color
458+
- Data type category
459+
- Description
460+
* - :green:`Green`
461+
- Boolean
462+
- ``True`` / ``False`` values.
463+
* - :purple:`Purple`
464+
- Enumerations
465+
- Predefined selectable values (enum parameters). The selected value is
466+
shown using its descriptive label rather than its numeric index.
467+
* - :blue:`Blue`
468+
- Numerical types
469+
- Numbers, matrices, vectors, distances, durations, and other numeric values.
470+
* - :slate:`Slate blue`
471+
- Textual types
472+
- Strings, dates, coordinate reference systems (CRS), HTML content, and other text-based values.
473+
* - :kaki:`Kaki`
474+
- Vector and geometry types
475+
- Vector geometries and vector layers, including meshes, point clouds, extents, vector tiles, and any object containing geometry.
476+
* - :turquoise:`Turquoise`
477+
- Raster types
478+
- Raster images and raster layers.
479+
* - :darkgray:`Dark gray`
480+
- File system types
481+
- File and directory paths.
482+
* - :midgray:`Mid gray`
483+
- Other types
484+
- Parameters that do not fit into the above categories.
485+
486+
Sockets can only be connected when their data types are compatible.
487+
Parameter bullets use the same color coding as sockets: a bullet is outlined
488+
when the parameter holds its default value, and filled when a non-default value
489+
is set or a parameter box is connected. The label of each parameter is followed
490+
by its current value, which updates immediately as values are changed or
491+
parameter boxes are connected.
492+
493+
When a parameter box is unfolded, its output section also shows the data type
494+
and current value being passed downstream.
495+
439496
.. _figure_model_model:
440497

441498
.. figure:: img/models_model.png
442499
:align: center
443500

444501
A complete model
445502

503+
The model designer can display the number of features flowing through
504+
the connections between algorithms. Feature counts are shown on the links
505+
between algorithm inputs and outputs, and apply to vector layers only.
506+
The model must be run at least once before feature counts can be displayed.
507+
Feature counts can be toggled on or off via :menuselection:`View --> Show Feature Count`.
508+
446509
With the :menuselection:`Edit --> Add Group Box` tool, you can add a draggable
447510
*box* to the canvas. This feature is very
448511
useful in big models to group related elements in the modeler canvas and to keep the

themes/rtd_qgis/static/css/qgis_docs.css

Lines changed: 69 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,47 +3,53 @@
33

44
/* Customize for QGIS Documentation*/
55
.rst-content .guilabel {
6-
background:#7fbbe3
6+
background: #7fbbe3
77
}
88

99
/* adds scrollbar to side navigator and keep showing the top title block */
1010
.wy-side-nav-search {
11-
margin-bottom: 0;
11+
margin-bottom: 0;
1212
}
13+
1314
.wy-side-scroll {
14-
width: auto;
15-
overflow-y: hidden;
16-
display: flex;
17-
flex-direction: column;
15+
width: auto;
16+
overflow-y: hidden;
17+
display: flex;
18+
flex-direction: column;
1819
}
20+
1921
.wy-menu.wy-menu-vertical {
20-
overflow-y: auto;
22+
overflow-y: auto;
2123
}
2224

2325
/*rtd theme does not render menuselection, so let's apply guilabel settings to it*/
2426
.rst-content .menuselection {
25-
background:#7fbbe3;
26-
font-size: 80%;
27-
border:1px solid #7fbbe3;
28-
font-weight:700;
29-
border-radius:4px;
30-
padding:2.4px 6px;
31-
margin:auto 2px
27+
background: #7fbbe3;
28+
font-size: 80%;
29+
border: 1px solid #7fbbe3;
30+
font-weight: 700;
31+
border-radius: 4px;
32+
padding: 2.4px 6px;
33+
margin: auto 2px
3234
}
35+
3336
/*keyboard text are by default rendered bigger*/
3437
.rst-content .kbd {
35-
font-size: 90%
38+
font-size: 90%
3639
}
40+
3741
.outdated {
3842
/* only to be visible for outdated releases*/
3943
background: #ffbaba;
4044
color: #6a0e0e;
4145
}
46+
4247
.isTesting {
4348
/* only to be visible in testing*/
4449
background: #f3fbfb;
4550
color: black;
4651
}
52+
4753
.outdated,
4854
.isTesting {
4955
/* top banner for testing and outdated docs*/
@@ -59,7 +65,7 @@
5965

6066
/* Widen space for the documentation content*/
6167
.wy-nav-content {
62-
max-width: 1260px;
68+
max-width: 1260px;
6369
}
6470

6571
/* Avoid images being too big on bigger screen*/
@@ -73,15 +79,15 @@
7379
from https://rackerlabs.github.io/docs-rackspace/tools/rtd-tables.html */
7480
@media screen and (min-width: 767px) {
7581

76-
.wy-table-responsive table td {
77-
/* !important prevents the common CSS stylesheets from overriding
82+
.wy-table-responsive table td {
83+
/* !important prevents the common CSS stylesheets from overriding
7884
this as on RTD they are loaded after this stylesheet */
79-
white-space: normal !important;
80-
}
85+
white-space: normal !important;
86+
}
8187

82-
.wy-table-responsive {
83-
overflow: auto !important;
84-
}
88+
.wy-table-responsive {
89+
overflow: auto !important;
90+
}
8591
}
8692

8793
.toc-columns ul {
@@ -101,3 +107,43 @@ from https://rackerlabs.github.io/docs-rackspace/tools/rtd-tables.html */
101107
display: none;
102108
}
103109
}
110+
111+
112+
/* Add specific text roles with color display, allowing to write e.g., :blue:`Blue socket` */
113+
@import url("default.css");
114+
115+
.red {
116+
color: #FF0000;
117+
}
118+
119+
.blue {
120+
color: #229DD6;
121+
}
122+
123+
.green {
124+
color: #33C91C;
125+
}
126+
127+
.kaki {
128+
color: #B4B400;
129+
}
130+
131+
.turquoise {
132+
color: #00B4B4;
133+
}
134+
135+
.purple {
136+
color: #8044C9;
137+
}
138+
139+
.slate {
140+
color: #6464FF;
141+
}
142+
143+
.darkgray {
144+
color: #505050;
145+
}
146+
147+
.midgray {
148+
color: #808080;
149+
}

0 commit comments

Comments
 (0)