What's wrong with my PyQt animation? - animation

So I've got a pair of buttons, one with a label, the other with a "delete" icon. The delete button will eventually delete some files, but right now I'm playing with the UI. The buttons are in a GridLayout with a spacer between them. I figure if I shrink the size of the button with the label, it'll "compress" as the spacer enlarges to fill the space. At least that's how it works in Qt Designer.
My button size definition is very simple:
ui.labelbutton.setMaximumSize(QSize(315, 50))
So I figure the animation should be relatively simple as well. I followed the format of another answer I found here, and I've got this:
def anim(self):
animation = QPropertyAnimation(self, b'maximumSize')
animation.setDuration(3000)
animation.startValue(QSize(315, 50))
animation.endValue(QSize(10, 50))
animation.start()
self.animation = animation
I pass it one of the label buttons (after extracting it from the layout - it's dynamically built). And I get an error:
animation.startValue(QSize(315, 50))
TypeError: startValue(self): too many arguments
According to all the examples and documentation I can find, that should be correct - a QSize is really just one argument, isn't it?
Anyone have a guess at how I can add some pointless eye candy to my application? Thanks.

Related

Oracle Reports-How To Add Field Object To Repeating Frame

I want to add field object to an existing repeating frame.But when I drag the field, new frame is generated.
See Image below.
I want to do is put the field F_PO_NUMBER under R_INVOICE frame.
Doble-click on the Paper Layout node.
Touch R_INVOICE repeating frame on the Object Navigator.
Change Fill colour of R_INVOICE by selecting a different than that already has ( colour palette pointers are located on the left side of the Paper Layout ).
Let's choose gray as fill colour, and then there will appear a great gray box on the Paper Layout.
Just drag F_PO_NUMBER to the inside of that gray box. If some frames or objects slides as you drag F_PO_NUMBER, apply immediately an undo by pressing Ctrl+Z, and play with Flex On/Off or Confine On/Off buttons up to your object is able to be removed into that gray box.
I'd suggest you to
create a backup copy of that RDF file - you might need to restore the report if something goes wrong
go to paper layout editor
turn flex OFF (so that frames wouldn't stretch)
select any field in the R_INVOICE frame (for example, F_INVOICE_NUMBER)
copy/paste it (Ctrl+C / Ctrl+V)
a new item (named F_INVOICE_NUMBER1) will be created slightly right & below from the original item)
move it to a new position
if necessary, switch flex ON (and, possibly, confine ON/OFF), but be very careful because you might spoil current layout, and - if you do that - it might be difficult to revert changes. Undo works only 1 level back
change its name & source so that they are appropriate (i.e. F_PO_NUMBER)
save & run the report. Hopefully, it'll be OK.
P.S. As you already have the R_1 frame (which is useless), I'd suggest you to remove (in paper layout editor) it, as well as current F_PO_NUMBER field (visible on your screenshot).

Position Buttons inside UIStackView

This sounds like a really simple issue but somehow I do not know how to easily solve it. Inside one row (UIStackView horizontal), I am trying to place two buttons (Cancel and OK) so that Cancel button will be at 1/4 (of the whole length) from left and Ok will be at the 3/4 (of the whole length) from left. I would like the buttons to be fixed length and not stretching to occupy the whole row.
Is there a way to solve it with just one UIStackView with 2 buttons? I am sure there a lots of alternatives (programing a view / use 3 UIStackViews).
Thanks.
hope you can find an easy way using equalWidthconstraints instead for UIStackView.
ie.
1. You should place both buttons in a sam line.and make sure both button's width are same .
2.then you select both buttons and put EqualWidthConstraint.
3.After that pin the left button with top,left and right .
4.pin the right button with right,top spaces,
5.then you double click on the equalwidthconstraints and give Multiplier as you needed ; like 1:4,3:4 something like that. Thank you

Show hide symbol in Adobe Edge

Just trying to get my head around Adobe Edge. What I want to achieve sounds simple but having real trouble. I have a button element, that when mouseover, displays an animated symbol I have.
Currently my code,on the button is Mouseout:
sym.$("pgicatext2").hide();
and mouseover:
sym.$("pgicatext2").show();
This doesn't seem to be working. I can achieve the result if, I turn off the movie symbol, and use this code on the button
sym.$("pgicatext2").toggle();
The trouble is of course it doesn't replay the animation every time you mouse over, and all the while it's hidden it's playing the animation.
I see its been a month since you posted this. Hopefully you solved your issue. Your code for hiding and showing looks right. One thing I have had happen in some of my projects is that I inadvertently placed an object or symbol with 0% opacity on top of a button or something I had a mouse over event. Make sure that the button you have does not have anything layered on top of it. Another thing would be to turn off autoplay of your symbol, and add sym.$("pgicatext2").play(); into your mouse over. I know those are pretty obvious answers, but sometimes it is easy to forget the obvious.
Please get through following steps:
Check if the button is over all other visible layers ('Elements'
tab). Maybe setting cursor to 'pointer' will help to check it.
Use 'Mouseenter' and 'Mouseleave' instead of 'Mouseover' and
'Mouseout'. The difference is explained here.
Make sure that your animated symbols 'autoplay' option is off. If
you did not tick it off while creating the symbol, just set Playback
to 'Stop' on Stage at the very beginning of the timeline
Lets do some coding. Lets assume that your animated symbols name is
"film". You need to set following actions to your button element:
Mouseenter:
sym.$("film").show();
sym.getSymbol("film").play();
this basically shows up your 'film' element and plays 'film' symbol
Mouseleave:
sym.$("film").hide();
sym.getSymbol("film").stop(0);
this one hides your 'film' element and stops 'film' symbol at the beginning of animation (0ms)
Enjoy!

GTK - Don't highlight buttons on select / hover

I'm trying to write a kiosk GUI in ruby/gtk on ubuntu. I'm pretty fluent in ruby, but new to writing GUIs and not great with linux.
I'm using a touch screen, and am using our own images for buttons, e.g.
button_image = Gtk::Image.new(Gdk::Pixbuff.new "images/button_image.png")
#button = Gtk::Button.new
#button.add(button_image)
#button.set_relief(Gtk::RELIEF_NONE)
My issue is that when the buttons are pressed or remain selected (or hovered over, although this is less relevant with a touch screen), gtk shows fat, square borders around them. Obviously it's applying gtk's prelight / selected / active lighting to the buttons. I've tried changing the button properties in various ways, and also tryied hacking apart my theme, and while I can modify how the highlighting looks, I can't seem to completely get rid of it. Changing the color of the highlight via my theme is easy, but if I remove my setting there's still a default I can't get rid of.
Does anyone know if there's a way to stop it, or possibly make it transparent? Thanks in advance!
Sounds like you want to use exactly your image for the whole button, instead of putting an image inside the normal GtkButton - but still use all the normal behavior of the button.
The easiest way to do this is to just override the drawing. If you are on gtk2, connect to the "expose-event" signal, do your drawing there, and return true so that the default handler doesn't get run. If you are on gtk3, connect to the "draw" signal and do the same.
I tried meddling with the drawing as Federico suggested, but found that the most direct way to address this was instead to use an event box rather than a button. Event boxes accept clicks just like buttons, but don't respond to selecting, hovering, etc. In ruby, the code looks like this:
image = Gtk::Image.new("myfile.png")
event_box = Gtk::EventBox.new.add(image)
event_box.visible_window = false
event_box.signal_connect("button_press_event") do
puts "Clicked."
end
Most of this is exactly like a button; the *visible_window* method, obviously, keeps the event box from being visible under the button image.

How can I position QDockWidgets as the screen shot shows using code?

I want a Qt window to come up with the following arrangement of dock widgets on the right.
alt text http://img72.imageshack.us/img72/6180/docksonside.png
Qt allows you to provide an argument to the addDockWidget method of QMainWindow to specify the position (top, bottom, left or right) but apparently not how two QDockWidgets placed on the same side will be arranged.
Here is the code that adds the dock widgets. this uses PyQt4 but it should be the same for Qt with C++
self.memUseGraph = mem_use_widget(self)
self.memUseDock = QDockWidget("Memory Usage")
self.memUseDock.setObjectName("Memory Usage")
self.memUseDock.setWidget(self.memUseGraph)
self.addDockWidget(Qt.DockWidgetArea(Qt.RightDockWidgetArea),self.memUseDock)
self.diskUsageGraph = disk_usage_widget(self)
self.diskUsageDock = QDockWidget("Disk Usage")
self.diskUsageDock.setObjectName("Disk Usage")
self.diskUsageDock.setWidget(self.diskUsageGraph)
self.addDockWidget(Qt.DockWidgetArea(Qt.RightDockWidgetArea),self.diskUsageDock)
When this code is used to add both of them to the right side, one is above the other, not like the screen shot I made. The way I made that shot was to drag them there with the mouse after starting the program, but I need it to start that way.
You can use QMainWindow::splitDockWidget .
From the docs:
Splits the space covered by the first dock widget into two parts, moves the first dock widget into the first part, and moves the second dock widget into the second part.
The orientation specifies how the space is divided: A Qt::Horizontal split places the second dock widget to the right of the first; a Qt::Vertical split places the second dock widget below the first.
You have to set QMainWindow::dockNestingEnabled to true first (but I guess you already did that).
I never tried it but I think you can set the orientation of the dock widget when adding it to the main window:
void QMainWindow::addDockWidget ( Qt::DockWidgetArea area, QDockWidget * dockwidget, Qt::Orientation orientation )

Resources