Manipulator WorkBench

Info about new community or project announcements, implemented features, classes, modules or APIs. Might get technical!
PLEASE DO NOT POST HELP REQUESTS OR OTHER DISCUSSIONS HERE!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
f3nix
Posts: 346
Joined: Sat May 30, 2015 11:58 am

Re: Manipulator WorkBench

Post by f3nix »

Hi once again.

I think the main issue is missing layouts for some objects. See screenshot.

Cheers,
Mateusz

EDIT: added two more screenshots.
Attachments
with_layouts.png
with_layouts.png (27.22 KiB) Viewed 2950 times
without_layouts.png
without_layouts.png (19.8 KiB) Viewed 2950 times
Screenshot_20200125_064732.png
Screenshot_20200125_064732.png (73.82 KiB) Viewed 2956 times
User avatar
easyw-fc
Veteran
Posts: 3633
Joined: Thu Jul 09, 2015 9:34 am

Re: Manipulator WorkBench

Post by easyw-fc »

Hi Mateusz
thanks for going into this issue :D
f3nix wrote: Sat Jan 25, 2020 5:37 am I have played with using the layouts and I have the caliper working quite good.
great!
f3nix wrote: Sat Jan 25, 2020 5:37 am One thing is missing. Not all images are in svg format. The png files are missing.
All the images should be in svg format and should be embedded inside the macro...
EDIT:
I used the pngs only to have a reference in Qt designer... Ithink Qt4 designer didn't support svg icon, but I'm not sure
/EDIT
@line 1580 at Caliper you can find the list of icons

Code: Select all

# embedded button images
Caliper.py#L1580

I used to convert the icons with the following script:

Code: Select all

#!/usr/bin/python
# -*- coding: utf-8 -*-


import base64
import argparse, sys, os

args=sys.argv

if len (args) >1:
    fullfname=args[1]
    ext = os.path.splitext(os.path.basename(args[1]))[1]
    fname=os.path.splitext(os.path.basename(args[1]))[0]
    with open(fullfname, "rb") as image_file:
        encoded_string = base64.b64encode(image_file.read())
    with open(fname+"-b64.txt", "wb") as eb64_file:
        eb64_file.write(encoded_string)
Then the b64 encoded images could be decoded back to svg.
Here a sample to decode the images:

Code: Select all

#!/usr/bin/python
# -*- coding: utf-8 -*-


import base64
import argparse, sys, os

fname = '/home/mau/Downloads/myimage_svg'

close_img=\
"""
PD94bW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AxLjM2MjIgMTMsMTAzOS40ODcyIgogICAgICAgaWQ9InBhdGgzMDAyLTYtNS0yIgogICAgICAgaW5rc2NhcGU6Y29ubmVjdG9yLWN1cnZhdHVyZT0iMCIKICAgICAgIHNvZGlwb2RpOm5vZGV0eXBlcz0iY2MiIC8+CiAgPC9nPgo8L3N2Zz4K
"""

decoded_string = base64.b64decode(close_img)
print(decoded_string)

with open(fname+"-decoded.svg", "wb") as svg_file:
    svg_file.write(decoded_string)
Please let me know which image you miss and I will provide it.
Maurice
User avatar
f3nix
Posts: 346
Joined: Sat May 30, 2015 11:58 am

Re: Manipulator WorkBench

Post by f3nix »

Hi Maurice!
Thank you for the great tips. That got me going. I have tested the caliper and it looks good. Auto scaling when moving from high dpi monitor to a normal monitor seems to work good too (screenshots attached).

I have one more problem. The file measure-tool-docked-v1.5.ui does not seem to be in sync with the code used in Caliper.py. It is missing the blabel button (enable extra label). Could you please check that out?

Cheers,
Mateusz
Attachments
non-high-dpi.mesure.png
non-high-dpi.mesure.png (89.69 KiB) Viewed 2868 times
high-dpi-measure.png
high-dpi-measure.png (34.62 KiB) Viewed 2868 times
User avatar
f3nix
Posts: 346
Joined: Sat May 30, 2015 11:58 am

Re: Manipulator WorkBench

Post by f3nix »

Hi.
Here are the files for align and mover tools. Please test them and write what you think. I can make a pull request if you like it.

Thanks for the awesome tools! :)

Cheers,
Mateusz

P.S. The python files were hand edited since the uic does not do a good job with all the parameters.
Attachments
difference.png
difference.png (131.96 KiB) Viewed 2859 times
mover-tool-docked-v1.9-highdpi.ui
(23.72 KiB) Downloaded 70 times
mover-highdpi.py
(16.42 KiB) Downloaded 90 times
align-tool-docked-v1.6-highdpi.ui
(22.14 KiB) Downloaded 83 times
align-highdpi.py
(15.18 KiB) Downloaded 71 times
User avatar
easyw-fc
Veteran
Posts: 3633
Joined: Thu Jul 09, 2015 9:34 am

Re: Manipulator WorkBench

Post by easyw-fc »

f3nix wrote: Sun Jan 26, 2020 11:45 pm Hi.
Here are the files for align and mover tools. Please test them and write what you think. I can make a pull request if you like it.
Hi Mateusz

would you please point me to your repository @ github?
I will have a look at the code there and test the changes.

About the Caliper ui, I found the latest file... please find it attached
measure-tool-docked-v1.8_ui.zip
(2.13 KiB) Downloaded 75 times
f3nix wrote: Sun Jan 26, 2020 11:45 pm Thanks for the awesome tools! :)
Cheers,
Mateusz

P.S. The python files were hand edited since the uic does not do a good job with all the parameters.
would you please point out which edits did you do?
Maurice
User avatar
f3nix
Posts: 346
Joined: Sat May 30, 2015 11:58 am

Re: Manipulator WorkBench

Post by f3nix »

Hi.
easyw-fc wrote: Mon Jan 27, 2020 6:35 am
f3nix wrote: Sun Jan 26, 2020 11:45 pm Hi.
Here are the files for align and mover tools. Please test them and write what you think. I can make a pull request if you like it.
Hi Mateusz

would you please point me to your repository @ github?
I will have a look at the code there and test the changes.
Here it is: https://github.com/f3nix/Manipulator

easyw-fc wrote: Mon Jan 27, 2020 6:35 am About the Caliper ui, I found the latest file... please find it attached
measure-tool-docked-v1.8_ui.zip
Thanks :) The new file is already converted in my repo.

easyw-fc wrote: Mon Jan 27, 2020 6:35 am would you please point out which edits did you do?
I have been using pyside2-uic tool.
1. I had to replace all QtWidgets with QtGui.
2. I had to add QtCore.Qt.AlignTop for the left upper buttons (the uic does not add them automatically - maybe a bug?)

Thanks for supporting me through this process.

Cheers,
Mateusz
User avatar
easyw-fc
Veteran
Posts: 3633
Joined: Thu Jul 09, 2015 9:34 am

Re: Manipulator WorkBench

Post by easyw-fc »

f3nix wrote: Mon Jan 27, 2020 6:14 pm Here it is: https://github.com/f3nix/Manipulator
....
I have been using pyside2-uic tool.
1. I had to replace all QtWidgets with QtGui.
2. I had to add QtCore.Qt.AlignTop for the left upper buttons (the uic does not add them automatically - maybe a bug?)

Thanks for supporting me through this process.

Cheers,
Mateusz
Hi Mateusz
thanks for your work on this HIDPI issue...
I'll have a look at the ui and I'll be back asap.

Maurice
User avatar
easyw-fc
Veteran
Posts: 3633
Joined: Thu Jul 09, 2015 9:34 am

Re: Manipulator WorkBench

Post by easyw-fc »

f3nix wrote: Mon Jan 27, 2020 6:14 pm Mateusz
Hi,
I've played a bit with the new layout, but what I'm missing is the ability to resize the full Dialog, make the other controls hidden...
I'm going to play a bit more and I'll update you here
Maurice
User avatar
easyw-fc
Veteran
Posts: 3633
Joined: Thu Jul 09, 2015 9:34 am

Re: Manipulator WorkBench

Post by easyw-fc »

Hi Mateusz
I've just added a hdpi branch to my repo
https://github.com/easyw/Manipulator/tree/hdpi
you can test the new Aligner with your HDPI screen
.. and, if you want, adapt the other tools...
then just poke me here or make a PR to the hdpi branch and I will merge it and finalizing the merging.
ATM I cannot find a way to keep the old behavior to minimize the dialog but the dialog can be placed behind the Combo Tab... so there is not a big defeat though...

Here some notes:
f3nix wrote: Mon Jan 27, 2020 6:14 pm I have been using pyside2-uic tool.
I'm using pyuic5 from pyqt5-dev-tools
f3nix wrote: Mon Jan 27, 2020 6:14 pm 1. I had to replace all QtWidgets with QtGui.
I just have added

Code: Select all

QtWidgets = QtGui
before the declaration of the 'class Ui_DockWidget(object)'
this is fixing the rest of the code
f3nix wrote: Mon Jan 27, 2020 6:14 pm 2. I had to add QtCore.Qt.AlignTop for the left upper buttons (the uic does not add them automatically - maybe a bug?)
I moved the icons and that solved this issue in Aligner.

EDIT:
I have an issue with aligner because the 4 check boxes act all together instead of by row.
EDIT2:
Now it should work... still not the best solution
mario52
Veteran
Posts: 4692
Joined: Wed May 16, 2012 2:13 pm

Re: Manipulator WorkBench

Post by mario52 »

hi

for PySide2 Qt5 you must restore QtWidgets see my example code

mario
Maybe you need a special feature, go into Macros_recipes and Code_snippets, Topological_data_scripting.
My macros on Gist.github here complete macros Wiki and forum.
Post Reply