Commit Graph

47 Commits

Author SHA1 Message Date
Kevin Martin
02ebb17558 Eliminate many "doing what you told me to" messages
These messages were perhaps originally intended as a debuggin aid but now add clutter to the output panes. Remaining messges are mostly the result of methods to display attributes of an object (which one could call from the Python console) or actually provide some information which would not be obvious from the circumstances
2024-02-02 08:58:45 -05:00
Roy-043
0eb8f1f750 Draft: Avoid draftToolBar.getDefaultColor outside DraftGui.py
The draftToolBar.getDefaultColor() function is an indirect way of retreiving a parameter. It is better to avoid it where possible.
2024-02-01 18:02:10 +01:00
Roy-043
12444a1d6b Draft: implement new get_param functions (step 3)
See #11677
2023-12-12 20:20:03 +01:00
Roy-043
b4c3a0d963 Draft: update Draft_ApplyStyle
The command now applies all style properties from `utils.get_default_annotation_style()` and `utils.get_default_shape_style()`.

Additionally: minor improvements to gui_setstyle.py.
2023-12-02 13:11:08 +01:00
Roy-043
92d69c9641 Draft: update Draft_SetStyle
* Added handling of DefaultShapeVertexColor, DefaultShapePointSize, DefaultAnnoLineColor and DefaultAnnoLineWidth preferences.
* Rearranged the task panel.

Additionally the DefaultDrawStyle and DefaultDisplayMode preferences are now applied by format_object in gui_utils.py.
2023-11-30 21:19:48 +01:00
Roy-043
6c015072eb Draft: implement DefaultAnnoLineWidth and DefaultAnnoLineColor prefs
The format_object function in gui_utils.py still requires some work (in connection with the Draft_SetStyle command). This will be done later.
2023-11-29 23:06:17 +01:00
Roy-043
484bbf3807 Draft: improve handling of anno DisplayMode and LineSpacing
* DisplayMode controlled by new pref DefaultAnnoDisplayMode. This replaces the old dimstyle pref.
* LineSpacing pref is now used when creating annotations. Will be added to prefs ui later.
* format_object no longer changes FontSize as this conflicted with the height parameter in the make_text function.
* make_text function updated.
2023-11-27 15:45:56 +01:00
Roy-043
387d1d1fd9 Draft: Gui.ActiveDocument.ActiveView.getActiveObject has changed
See #10405.
2023-11-24 12:08:28 +01:00
Roy-043
a1b8a2ec70 Draft: Change get_3d_view to only return the active 3D view (#11050)
Related issue:
#10634

Also needed to avoid warnings from the PlaneGui class.
2023-10-15 14:28:32 +02:00
Roy-043
ba6a45d9db Draft: Fix get_diffuse_color function (#9932) 2023-07-18 10:45:38 +02:00
Yorik van Havre
aed5db5f10 Draft: allow autogroup to add an object to both a layer and an Arch/NativeIFC container 2023-06-13 12:24:14 +02:00
Yorik van Havre
acb05aad15 Draft: Provision for NativeIFC autogrouping 2023-06-07 13:02:49 +02:00
luzpaz
129d5882a7 Migrate domain name from freecadweb to freecad (#9352)
* Migrate domain name from freecadweb to freecad
* Migrate src/Mod/Material files
* Migrate Stylesheet related files
* Migrate *.svg files
* Migrate miscellaneous files
* Migrate some build files
* Migrate recently added TD AR_IRAM template files

Closes #6415
2023-04-24 15:19:20 -05:00
luzpaz
516509dbf0 Draft: [skip ci] fix typo in source comment (#8434)
Fixed typo in `draftutils/gui_utils.py`
2023-02-11 21:02:27 +01:00
Roy-043
6cc22f2a54 [Draft] fix Draft_Mirror diffuse color issue. (#8427) 2023-02-11 11:18:00 +01:00
Roy-043
0c1994e749 Draft: Update gui_setstyle.py and gui_utils.py (#8195) 2023-01-14 20:07:59 +01:00
Roy-043
b9542289c5 Draft: Update gui_utils.py (#8191) 2023-01-14 13:53:38 +01:00
wmayer
a5e561b31d Base: fix Matrix4D::hasScale
* If all column vectors of the 3x3 sub-matrix are equal the function incorrectly claims that it's uniform scaling.
* Detect also non-uniform scaling and if was applied from the left or right side
* Replace the int with an enum and expose it to Python
* Add several new unit tests
2022-02-15 21:05:11 +01:00
Roy-043
cc447a061c Draft: Fix issues with translate and _tr (#5351) 2022-01-08 00:04:53 +01:00
Yorik van Havre
0e7314068c Arch: BuildingParts autogrouping
Arch BuildingParts now gained a new set of View properties that allows
to define a "capture box". Subsequent Draft and Arch objects, or anything
else that uses Draft.autogroup(), will be automatically added to that
BuildingPart if they are inside the capture box.
2021-10-14 14:42:46 +02:00
Roy-043
deda3668c9 Draft: fix dim symbol issues 2021-09-23 10:45:21 +02:00
Syres916
f76c9926da [Draft] gui_utils Added FIXME comment to assist..
... revisiting in future
2021-08-02 15:19:22 +01:00
Syres916
a049b9118b [Draft] gui_utils Coin import addition 2021-07-18 19:52:31 +01:00
Syres916
5e1ae4e72d [Draft] gui_utils Minor bugfix on change to...
...Draft Wb with grid enabled. Please backport to 0.19 branch, see discussion https://forum.freecadweb.org/viewtopic.php?f=3&t=60251
2021-07-17 21:52:30 +01:00
carlopav
d115db2cbb Draft: Autogroup, insert guard to prevent cyclic references
ref. Forum discussion: Draft_OrthoArray: Crash when using active Std_Part. https://forum.freecadweb.org/viewtopic.php?f=23&t=59155&p=508132#p508132

Autogroup try to add new created Draft Objects into the active Part, but if the Part is used as a Base for the new object this could create a cyclic reference. 
This behaviour is prevented by adding a check for " obj in active_part.InListRecursive"
2021-06-06 11:21:21 +02:00
carlopav
f050f77343 Draft: Autogroup, rename variables to more readable names 2021-06-05 17:07:32 +02:00
Yorik van Havre
317177dad6 Draft: Fixed default color for new dimensions (now uses DefautTextColor instead of DefaultLineColor) 2021-04-23 15:46:39 +02:00
Benjamin Nauck
6d37a38437 Draft: Simplify load_texture after py3 requirement
This commit does the following things:
 * Remove python2 support
 * Using a bytearray instead of chr list to build up the binary data.
   this also removes the need of using char encoding.
2021-03-10 20:49:29 +01:00
Yorik van Havre
bff31175cb Draft: better checks for no active document 2020-11-16 13:25:12 +01:00
Yorik van Havre
88f5fc20b1 Draft: Condensed the Draft toolbar style buttons into one with more options 2020-11-10 14:14:18 +01:00
Yorik van Havre
4134315434 Draft: Fixed translation of construction group 2020-10-12 16:11:31 +02:00
vocx-fc
49e1ff1bcf Draft: get_bbox function to get the bounding box from RootNode
Normally the bounding box is taken from `Shape.BoundBox`.
Certain objects don't have a `Shape`, like `App::FeaturePythons`,
so the bounding box is calculated from `ViewObject.RootNode`.
2020-09-30 12:06:48 +02:00
vocx-fc
6a3de864e7 Draft: add modules of draftutils to the proper Doxygen group
This includes `gui_utils`, `init_draft_statusbar`, `init_tools`,
`messages`, `todo`, `translate`, `utils`.

These are added to the `draftutils` Doxygen group
so that the functions contained in each module are listed
appropriately in the automatically generated documentation.
2020-07-17 13:01:45 +02:00
vocx-fc
94b0fe1599 Draft: clean up ViewProviderLabel class
Various improvements in style, PEP8, spacing, docstrings.

Improve the methods to update the text, the arrow, and the frame
of the label.

Options to handle `Justification` and `LineSpacing` are added.
These can be handled just like with the `ViewProviderText` object,
as the internal text node is the same, a `SoAsciiText`.

Nevertheless, currently the leader line and the frame that are
drawn for the label don't consider the correction in position
for the `Justification` or `Linespacing` so the graphics
may be overlapped in certain situations.
2020-07-10 12:23:43 +02:00
vocx-fc
22e9cf8921 Draft: clean up ViewProviderText class
Various improvements in style, PEP8, spacing, docstrings.

The list of strings is set to empty before being assigned again.
This solves a problem of the text not being updated correctly.

In the past some `try-except` blocks were there to catch and
ignore certain exceptions that apparently were caused by a
race condition, where certain properties are not assigned
to the object before they are used. These errors
don't seem to occur in v0.19, so we removed the exception
handling. We leave comments mentioning the issue
in case it re-appears.

The `DisplayMode` is swapped, so now `'2D text'` means that the
text always faces the camera, and `'3D text'` means that the
text can be positioned in different orientations in the 3D space.
This is consistent with the `Draft Label` behavior.

A function `draftutils.gui_utils.migrate_text_display_mode`
is provided to help migrate older objects of type `Text`
or `DraftText` to the new display mode.
2020-07-10 12:23:43 +02:00
vocx-fc
a719859054 Draft: adjust the text size for Labels with format_object
This function, `draftutils.gui_utils.format_object`,
takes the value defined in the `DrafToolBar`, and uses it
to specify the `FontSize` for `Text` objects.

Now it specifies the `TextSize` for `Label` elements as well.
2020-06-15 09:59:57 +02:00
carlopav
a98e2076db Draft: Edit reordering 1
Started a general refactor to handle all the conversion between global and object coordinate system inside the main methods and just use object coordinates inside object functions.
Draft: Edit reordering 2

Fixed Editing of Part objects according to the new refactor
Draft: fix in autogroup function for dimensions


Draft: fixed Polygon editing when inscribed or circumscribed


Draft: Edit support for Ellipse object


.


Draft: Edit docstrings


Draft: Edit reordering 3


Draft: Fixed Edit for structure object

And also refactor Edit methods that control special object display during editing.
Draft: Fixed edit for arch wall object
2020-05-25 13:37:55 +02:00
carlopav
ff3bdf86bc [Draft] Improved Autogroup to handle Draft Annotations
Draft Dimension, Label and Text are now correctly auto-added to Part container
2020-04-16 11:37:10 +02:00
vocx-fc
a101e911f9 Draft: gui_utils, add small stylistic changes
These changes are added by carlopav in pull request #3102.
We add them in this commit already so that this branch and
that branch are easier to rebase and merge.
2020-04-07 18:12:06 +02:00
vocx-fc
691a3cdf08 Draft: gui_utils, autogroup return when GuiUp is False 2020-04-07 18:12:06 +02:00
vocx-fc
3b6c06d095 Draft: gui_utils.py clean up imports
Small spacing fixes like imports in separate lines
for more clarity, and the position of the license.
Also use the new `messages` module to provide the functions
to print text to the console.
2020-04-07 18:12:06 +02:00
carlopav
d637895943 [Draft] Autogroup bugfix 2020-01-27 10:12:02 +01:00
carlopav
44a521f7c1 [Draft] Autogroup: better support for App::Link
https://forum.freecadweb.org/viewtopic.php?f=23&t=40400&start=30#p360248
Reference to forum topic.
small fix


small fix
2020-01-18 17:51:21 +01:00
carlopav
202eac3d6c Merge remote-tracking branch 'upstream/master' into DraftModifiersAppPart 2020-01-16 14:30:10 +01:00
wmayer
3af5139865 Draft: only try to import FreeCADGui, coin and QtGui if FreeCAD.GuiUp is true 2020-01-15 12:24:18 +01:00
carlopav
15046b03a0 [Draft] Autogroup changes to include App::Part
[Draft] merged with recent changes


[Draft] App part support small fix
2020-01-13 23:13:38 +01:00
vocx-fc
ce2441c0b2 Draft: new module for GUI utility functions
Many auxiliary tools used by `Draft.py` can be defined
in another module. Many functions are moved to this module
so that `Draft.py` isn't as big and hard to maintain.

The following is a list o functions that were moved:
`get3DView`, `autogroup`, `dimSymbol`, `dimDash`,
`removeHidden`, `formatObject`, `getSelection`,
`getSelectionEx`, `select`, `loadTexture`.

Moreover, many of these functions were renamed
to comply better with PEP8 guidelines,
particularly the use of `snake_case`. For example,
`get3DView` is now `get_3d_view`.

Aliases are provided for the old names so that
other functions and classes that depend on these
won't break. The new names should be the official
programming interface, while the old names
should be deprecated at some point in the future.
2020-01-10 10:04:07 +01:00