I'm trying to make a new UI to visualize my Alloy instances. I've got an A4Solution and have been successful in extracting atoms, relations, checking atom signatures BUT I can't seem to understand how to project the instance on some sig.
I've noticed that I can try to use the edu.mit.csail.sdg.alloy4viz.AlloyInstance, I've got options to project there, but that'd imply in starting over, from a different angle.
Would that be the way to go? I'd prefer to extract that from the A4Solution object.
Thanks
You might want to look at the edu.mit.csail.sdg.alloy4viz.StaticProjector class and its project methods---that's how the Alloy Visualizer implements projections. If your visualization uses the edu.mit.csail.sdg.alloy4viz.AlloyModel class, you should be able to reuse the existing code in StaticProjector; from your post it seems, however, that you'd prefer not use any of the alloy4viz classes, in which case it should not be too difficult to understand how StaticProjector works and reapply the same ideas to your project. Or you could convert an A4Solution object to an AlloyInstance[1] and build your visualizer around the alloy4viz classes, which, in my opinion, would be a good way to go about your project.
[1] something like:
a4sol.writeXML("instance.xml")
AlloyInstance inst = StaticInstanceReader.parseInstance(new File("instance.xml"));
Related
I'm fairly new to developing GUIs, and especially new to JavaFX/TornadoFX, and I'm not really sure how to do what I'm trying to do.
The gist is I'm trying to make a small IDE, and I want to be able to provide the TornadoFX App a particular Interpreter for the IDE:
class IDE(i: Interpreter) : App(IDEView::class)
But this doesn't work, since the configuration to run the App in IntelliJ just points to the IDE class, and doesn't specify what the parameter is.
Why I try to run it, basically it complains that the IDE class did not get the arguments it needs, but there is no way (in the configuration to run the App in IntelliJ) to specify parameters. If I create my own main and manually use:
launch<IDE>()
I can pass arguments, but the only thing it accepts are command line args (like an Array of Strings).
I'm planning on trying to follow the MVC pattern as closely as possible, and the Interpreter (interface) here is basically the Model behind everything. This is a project I'm working on with a friend, so he's working on the Model, and I'm going to be making the Controller and View. If there's no "clean" way to provide a custom Model, then I can just hard code it straight into the App, but I'd prefer to avoid that (and learn how to do it properly).
I have certain Modules that I would like to setup to be referencable by multiple solutions, as the code always behaves in basically the same manner (ex. code for logging errors). They make no sense as classes, so it seems like a class library is out; and I haven't seen any other suggestions for sharing code between solutions.
So I'm left wondering what would be the best way to create one thing that I can just use across multiple solutions to avoid having to rewrite the same code?
It sounds like a class library is exactly what you want. Build it, reference it within each solution, and code against it. One source, multiple solutions running off that code.
You could also implement the functionality into a separate piece such as an API. This is dependent on the function of the code obviously, but logging errors is a good use case.
I'm using wxFormBuilder to write a series of GUI applications. So far it has worked wonderfully, but the documentation on their homepage is a broken link.
What I'd like to do is combine my programs into one program, each as a different tab in a wxNotebook. However, I can only get wxFormBuilder to generate one class, the class for my frame. Ideally, what I'd like is for each panel to be its own class, so then I can override each class individually, and not be stuck with one giant class which contains all the event handlers for 5 different applications.
Is this possible with wxFormBuilder? Is there a different program which would allow me to do this more easily?
I'm open to other wx programs, but can't departure from Python, and I'd really rather not have to write the wx code by hand.
Some people like wxGlade, Boa Constructor (old) or XRCed (included with wxPython). You might experiment with those. I've heard good things about wxFormBuilder, so I'm a little surprised it doesn't have that capability. Here are some links: http://www.oneminutepython.com/
http://sturlamolden.blogspot.com/2008/03/howto-using-wxformbuilder-with-wxpython.html
http://www.blog.pythonlibrary.org/2010/05/11/wxpython-an-introduction-to-xrc/
Hope that helps a little.
I have created a new 1.6 Sharp Architecture project.
I have marked my only Entity with HasUniqueDomainSignatureAttribute and one string property marked DomainSignatureAttribute.
I create 2 entities with the same DomainSignature and I'm able to save them both thous having duplicates.
Am I missing some configuration? As I was under the impression that this would work out of the box.
Before saving you should manually check entity for validness. I don't know how it is done now, but in previos versions each entitity had a property IsValid.
Well yes, the Validation method IsValid() is on the Entities.
But from the documentation I get the impression that if using NHibernate and NHibernate.Validators the repositories should validate the entities before Insert and Update.
As in the documentation on nhforge.org
In SharpArch.Data.NHibernate.NHibernateSession following snippet is called each time Init() is used.
Those things make me wonder why it doesn't work.
I could roll my own, but that seems like waste if it's already there.
Can anyone point me in the right direction? Also the SchemaExport util should use the validators when generating the scripts.
I am new to PyQt and Qt Designer and I'm trying to create an easy method for relating qWidgets with the tables and columns in an SQLite database. My idea was to tag each qWidget in designer with two custom properties, one with the table name and one with the column name. Later, I would use the info provided by designer to build my own class which creates a relationship between the qwidets and SQLite database.
Adding the custom properties in Designer seems to work fine however, the code for these custom properties do not get generated when converting the xml of designer into python (using UIC). Has anyone done this successfully? Perhaps there is a better way to do this?
Thanks,
Eric
If you added a property in Designer called "myproperty", fetch it with...
mywidget.property("myproperty")
This works fine in pyqt 4.8.3, perhaps it did not work in previous versions.
Check out this article Eric. Particularly look at the section titled "Producing a Plugin." River Bank Computing has another great PyQt reference.
EDIT:
I've been doing some more reading and I can't find a way to have this done automatically for you. If you are ok with with adding dynamic properties at run-time instead of design time you could accomplish the same end result. Here is an explanation of the setProperty() method in QObject, from which QWidget inherits.
If that doesn't work for you then it seems you might be better off going with a less generic approach. Instead of using a generic QWidget, you might be able to use a custom class derived from QSqlTableModel to keep track of your connection info. Another way would be to just use a QTableView and do the queries yourself to populate the data. Here and here are articles on databases in Qt. You might some inspiration for a new design from one of them.
I have not had great luck with using the Designer tool -- usually I end up doing a few rough layout, using pyuic and then editing and adding other stuff by hand.
It sounds like you could easily accomplish your task by creating your own custom class that inherits from QWidget and has the additional properties that you described. With my experiences trying to use custom widgets in the designer, I think the 'easier' way is to just write the class yourself and then set the layout by hand.
I know this doesn't exactly answer your question, but maybe you will try some of my suggestions.