Commit Graph

18 Commits

Author SHA1 Message Date
Roy-043
fa49577838 Draft: Improve logic of Draft_Label texts
The proposed code fixes the following issues:
1. There is no check if the target object itself has a property that matches the label type.
2. If a subelement is selected that does not have the label type property, the value from the main object is displayed instead.
3. The default text is an empty string.

Example:

Currently If you select a vertex of a wire, and select "Length" as the label type, you will get the length of the wire. With the new code the text will then be "Length not available for (sub)object".

Forum topic (issue #1):
https://forum.freecad.org/viewtopic.php?t=86222
2024-03-20 18:29:01 +01:00
Chris Hennes
f4c348464c Draft: Translate label type combobox (#10228) 2023-08-17 15:36:37 +02:00
Roy-043
fb65b58007 Draft: Improvements related to #8081 (#8211)
DisplayMode of Text was not updated. Some houskeeping
2023-01-20 20:33:35 +01:00
Roy-043
34f43a245c Draft: Fix inconsistent properties of Draft annotations 2022-12-23 16:49:56 +01:00
Roy
3ad8c1680f Draft: Draft_Label fix label type list 2021-12-10 18:40:43 +01:00
vocx-fc
42599838f4 Draft: add modules of draftobjects to the proper Doxygen group
This includes `array`, `base`, `bezcurve`, `block`, `bspline`,
`circle`, `clone`, `dimension`, `draft_annotation`, `draftlink`,
`drawingview`, `ellipse`, `facebinder`, `fillet`, `label`,
`patharray`, `point`, `pointarray`, `polygon`, `rectangle`,
`shape2dview`, `shapestring`, `text`, `wire`, `wwproxy`.

These are added to the `draftobjects` Doxygen group
so that the functions and classes contained in each module
are listed appropriately in the automatically generated
documentation.
2020-07-17 13:01:45 +02:00
vocx-fc
466ae17a4a Draft: hide properties not used in the Label object
When `LabelType` is `'Custom'`, the `Target` property
is hidden and `CustomText` is shown.

For other values of `LabelType`, `Target` is shown,
and in turn `CustomText` is hidden.

This avoids showing unused information in the property editor.
2020-06-15 10:01:04 +02:00
vocx-fc
bbdd9abcdc Draft: combine two types of labels using functions
We use smaller functions to return a list of strings corresponding
to each basic value of `LabelType`. Then the final `Text` value
can be defined as a simple value, or as the concatenation
of two smaller lists, depending on the value of `LabelType`.

Since we have 8 basic values, we could return up to 8^2
combinations, but at the moment we only return 8 basic
values and 5 simple combinations, which are the ones
that make the most sense.

In the future we could define new properties, say, `LabelType2`
and `LabelType3`, to be able to combine two or three types
of strings in an arbitrary fashion. At the moment, the possible
combinations are hard coded in `LabelType`.
2020-06-15 10:01:04 +02:00
vocx-fc
d3d904e381 Draft: organize the execute code of the Label in a function
Instead of placing the entire code in the `execute` method,
a `return_info` function is used to return the specific string
that we wish to display depending on the `Target` object,
 the `LabelType`, and subelement in `Target`, if any.

We also make the code more readable by using smaller variables,
and avoiding notations with lists of lists (`variable[0][1][6:]`).
2020-06-15 10:01:04 +02:00
vocx-fc
40e707ef4b Draft: set the properties of the Label class through functions
There are three general types of properties, target, leader,
and label; so we set the 9 properties using three functions,
and provide better documentation in the tooltips
for each property.
2020-06-15 10:01:04 +02:00
vocx-fc
c7eab9c65e Draft: move make_label function to its own module
Also perform several improvements such as PEP8 cleanup,
writing complete docstrings, type checking the input arguments,
and deprecating the older call.

Update `Draft.py`, the Gui Command, the unit test, and test script
as well.
2020-06-15 10:01:04 +02:00
carlopav
904f3408bc Draft: fixed wrong QT_TRANSLATE_NOOP usage in Draft Objects
.
2020-06-09 11:55:46 +02:00
carlopav
125d0ca84d Draft: various cleanup
Mainly added an empty line at the end of each file and changed docstrings.
2020-05-15 14:43:26 +02:00
carlopav
cbeca1b4a6 Draft: fix ScaleMultiplier on annotation objects
Object auto create the property when opening an old Draft annotation
.
2020-05-04 10:53:54 +02:00
luz.paz
0c326f094f [skip ci] fix documentation typos
Found via codespell v1.17.0.dev0  
```
codespell -q 3 -L aci,ake,aline,alle,alledges,alocation,als,ang,anid,ba,beginn,behaviour,bloaded,byteorder,calculater,cancelled,cancelling,cas,cascade,centimetre,childs,colour,colours,commen,connexion,currenty,dof,doubleclick,dum,eiter,elemente,ende,feld,finde,findf,freez,hist,iff,indicies,initialisation,initialise,initialised,initialises,initialisiert,ist,kilometre,lod,mantatory,methode,metres,millimetre,modell,nd,noe,normale,normaly,nto,numer,oder,orgin,orginx,orginy,ot,pard,pres,programm,que,recurrance,rougly,seperator,serie,sinc,strack,substraction,te,thist,thru,tread,uint,unter,vertexes,wallthickness,whitespaces -S ./.git,*.po,*.ts,./ChangeLog.txt,./src/3rdParty,./src/Mod/Assembly/App/opendcm,./src/CXX,./src/zipios++,./src/Base/swig*,./src/Mod/Robot/App/kdl_cp,./src/Mod/Import/App/SCL,./src/WindowsInstaller,./src/Doc/FreeCAD.uml
```
2020-04-20 12:59:09 +02:00
carlopav
131961c2a8 [Draft] Cleanup splitted annotatation objects
- corrected super() methods to be Py2 compatible
- further cleanup of the code.
further cleanup


changed again to avoid super method


updated super() functions


updated to correct the parent classess targeted by super()
2020-04-16 11:37:10 +02:00
carlopav
164bbabbd8 [Draft] Cleanup of Annotation style branch
Further cleanup and guarded imports of Gui in modules.

.
2020-04-16 11:37:10 +02:00
carlopav
85bf45937e [Draft] Splitted object Text and Label from Draft.py
And based them on Draft Annotation object
2020-04-16 11:37:10 +02:00