Giter VIP home page Giter VIP logo

Comments (32)

yodalee avatar yodalee commented on September 22, 2024

I think I can take some survey on this issue.


Btw when I search for command line parser, here are some recommended result:
Boost.Program_options //I think this is overkill
tclap at http://tclap.sourceforge.net //I think this is just fine, just small enough to wrap into qucs.

However, the cmd options is currently not so complex to use library to handle, I think I will focus on the input/output function.

from qucs.

guitorri avatar guitorri commented on September 22, 2024

Thanks for looking into it.
I agree with you, focus on the function that creates the output image/pdf is move important than how the command line looks like. Let us leave the command line parser for another issue/feature.

By the way, the existing CLI was added with the commit: 1b817bc

Back then I added the comand to input (load) and output (save) an schematic. Just to be able to automate tests (https://github.com/Qucs/qucs-test) and make sure we don't break anything while doing the port to Qt4.

from qucs.

yodalee avatar yodalee commented on September 22, 2024

Actually there is already qt5
My friend write a layout reader all in qt5: https://github.com/aitjcize/QCamber
If porting to Qt4 is not under progress yet, maybe directly skip to Qt5?

from qucs.

guitorri avatar guitorri commented on September 22, 2024

The porting to Qt4 is ongoing. The priority is not to break what we have. The strategy is first to get rid of Qt3Support, me and another developers are working on it. It takes time and has do be made right. We need to port the whole schematic to the Qt Graphics framework (the same your friend uses in QCamber). This also takes time. After that it should be rather smooth to go to Qt5. But first we want to stabilize in Qt4 to have it as reference.

from qucs.

yodalee avatar yodalee commented on September 22, 2024

current argument --netlist or -n will transfer .sch to netlist file, so now we wanna add option that output can be other format?

from qucs.

guitorri avatar guitorri commented on September 22, 2024

Maybe we can have :
-p, --print convert Qucs schematic into a printable format (derived from -o FILE.[png,pdf])

In the end:
$qucs -p -i file.sch -o figure.png

from qucs.

yodalee avatar yodalee commented on September 22, 2024

XDD, we got the same thought, I just add this option 10 min ago.
But there is something to be decide, what if user input
$qucs -n -p -i file.sch -o figure.png

from qucs.

guitorri avatar guitorri commented on September 22, 2024

It will be cough as an error... no?

from qucs.

yodalee avatar yodalee commented on September 22, 2024

no, but we have do decide the action.
the program should transfer schematic to figure or change to a netlist with name figure.png

from qucs.

guitorri avatar guitorri commented on September 22, 2024

There should be only one operation at a time, the '-n' and the '-p' at the same should not be allowed.

from qucs.

yodalee avatar yodalee commented on September 22, 2024

OK I see.

from qucs.

guitorri avatar guitorri commented on September 22, 2024

Maybe something like this:

else if (!operation.isEmpty())
   if (!strcmp(argv[i], "-n") || !strcmp(argv[i], "--netlist")) 
     operation ="netlist";
   else if (!strcmp(argv[i], "-p") || !strcmp(argv[i], "--print")) 
     operation = "print";

It should capture only one operation, if two are given it wont parse, and error out.

from qucs.

guitorri avatar guitorri commented on September 22, 2024

Your PR #42 is now on the branch https://github.com/Qucs/qucs/tree/yodalee-issue32-cli-print
Let us please work on this branch to develop this feature further.

It is looking good, but if there are Diagrams along with the Schematic they are not printed. It would be nice to have it also printed.

I tried to reuse some parts from here: https://github.com/Qucs/qucs/blob/master/qucs/qucs/qucs.cpp#L3111
I managed to create .png but the Diagrams are also not painted...

from qucs.

yodalee avatar yodalee commented on September 22, 2024

I found the reason of why diagrams didn't show.
In schematic_file.cpp :: loadDocument() : 899, it prevent schematic load diagrams and painting if the GUI is not running. I remove the guard and got seg. fault during load file, I think the loading use some GUI only properties, and may be difficult to remove.

from qucs.

guitorri avatar guitorri commented on September 22, 2024

You mean: https://github.com/Qucs/qucs/blob/master/qucs/qucs/schematic_file.cpp#L898
I don't recall exactly why, but did that in 1b817bc.
I guess at that time I was only interested on what was necessary for the netlist.

from qucs.

yodalee avatar yodalee commented on September 22, 2024

This is a little difficult to fix, but I will keep trying to separate the gui part and non-gui part.
In the meantime, I think we can first ignore the painting and diagrams, and discuss the further command line argument about other options.

from qucs.

yodalee avatar yodalee commented on September 22, 2024

I just fix diagram error, it use gui font setting in qucsmain, so it raise seg fault when gui is not initial.

from qucs.

guitorri avatar guitorri commented on September 22, 2024

Yep. I also just found it.

This was the traceback while loading a schematci with a rect diagram:

RectDiagram::calcDiagram() + 95 (rectdiagram.cpp:132)
RectDiagram::RectDiagram(int, int) + 134 (rectdiagram.cpp:50)
RectDiagram::RectDiagram(int, int) + 33 (rectdiagram.cpp:51)
Schematic::loadDiagrams(QTextStream*, Q3PtrList<Diagram>*) + 784 (schematic_file.cpp:747)
Schematic::loadDocument() + 2740 (schematic_file.cpp:899)
openSchematic(QString) + 401 (main.cpp:640)

Whit this I got it to render the diagram frame, but not the data on it: https://gist.github.com/guitorri/4c95439e050b878926ab

This is also related: https://github.com/Qucs/qucs/blob/master/qucs/qucs/wirelabel.cpp#L200

Maybe we can handle with the document font differently...

from qucs.

yodalee avatar yodalee commented on September 22, 2024

I just send a pull request, you can see that diagram is being draw ( you have to call update reloadGraph()). I'm now trying to draw painting and symbol, see what will happen.
BTW, I wanna ask, how to make <symbol> field got something in there? I try many component, but still got no <symbol> data.

from qucs.

guitorri avatar guitorri commented on September 22, 2024

Nice!

from qucs.

yodalee avatar yodalee commented on September 22, 2024

Now I'm working on painting, I think only Text painting need similar modification.
I cannot test on symbol, because I don't know how to create symbol tag.
I think you can think about the other arguments about the options to be supported

from qucs.

guitorri avatar guitorri commented on September 22, 2024

The '' is only filled if you create a Circuit Symbol (icon) for a sub-circuit schematic.

Have here a project with sub-circuits:
https://www.dropbox.com/s/k120l0deje8rss0/opa27_prj_v1.zip?dl=0

The timelist and truthtable are still crashing the application.
Have here the schematics I am using to test the Qt3-Qt4 port. All Diagrams should be represented in here:
https://www.dropbox.com/s/4u51ymd5fk6apf2/diagrams_prj.zip?dl=0

from qucs.

yodalee avatar yodalee commented on September 22, 2024

Hi, @guitorri, I print open opa_spice.sch and printing is successful.
I think we can close this issue and open another issue for cmd line argument?

from qucs.

yodalee avatar yodalee commented on September 22, 2024

I'm not quite sure what crop [up, down, left, righ] is.
I didn't find anything similar in QPrinter property

from qucs.

guitorri avatar guitorri commented on September 22, 2024

Well crop is perhaps a bit too fancy, it was just an idea, perhaps we can skip this for the moment. This can also be done with other tools.

Imagine you want to trim/crop 2cm from the top border, 5cm form the bottom... you could give the amounts you want to cut out. Later on we could fetch the position of individual Diagrams, or a certain area of the schematic, crop them out and build a report for instance...

Note that I could use your code on most of the projects in: https://github.com/Qucs/qucs-test
The schematics older than 0.0.10 need to be updated to be printable on the CLI, but there I still want to see if we can get some information about backward compatibility...

Later I hope make the examples web-page more interesting by automatically creating project pages containing their printouts and perhaps some documentation.

from qucs.

yodalee avatar yodalee commented on September 22, 2024

I'm currently working on print in pdf format with argument. After that I'll try to copy the function in qucs.cpp to save data into png and svg format.


Btw I wanna say that, you can create as many issue as you can. Since there are nine branches on qucs/qucs, but we know little about what we can do to this project. If you can create issues about what you wanna do/make/achieve and give a clear description. I think there are many volunteers in github can help you accomplish it.

from qucs.

yodalee avatar yodalee commented on September 22, 2024

I think we can merge this into master branch, or wait the re-factor done to eliminate duplicated code.

from qucs.

guitorri avatar guitorri commented on September 22, 2024

Hi @yodalee, I guess one copy is OK, on the 3rd duplication we know we need refactoring...
The code is ready to merge in https://github.com/Qucs/qucs/tree/yodalee-issue32-rebase
Do you want to add/change something further?

from qucs.

yodalee avatar yodalee commented on September 22, 2024

I think it's fine to merged.

from qucs.

yodalee avatar yodalee commented on September 22, 2024

Maybe the yodalee-issue32-cli-print branch can be deleted? I'm not sure about it.

from qucs.

guitorri avatar guitorri commented on September 22, 2024

I guess it is already deleted. Did you 'git prune' your local?

from qucs.

yodalee avatar yodalee commented on September 22, 2024

My fault XDD

from qucs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.