How do I get sphinx-copybutton and sphinx-thebe to play nicely together? - python-sphinx

While code blocks that are activated with sphinx-thebe contain the copy button on pageload, the copy button disappears the moment they are converted to interactive cells.
I've tried changing the copybutton_selector to everything I can think of (.thebelab-input .cm-s-default, .CodeMirror-code, and so on) but none of them work.

Related

Drag and Drop( ctrl+drag) Problems in Xcode

There are two places within Xcode (version 13.3) where I can't drag and drop anymore.
Trying to move a file to a Group. I have tried just clicking and dragging, control-click, option-click, command-click, none work. Instead of dragging the file, the cursor just moves without the selected/highlighted file and highlights whatever file or group it is hovering over.
Trying to drag a button to a View Controller to make a connection. Instead, a popup window appears with three rows, each with corresponding icon, two lines each (title and object type): View Controller, View, Button. (I can't figure out how to capture that screen since I am already holding the control key and mouse button (track pad) but here is a photo.
Update:. All works fine when using a mouse but these two problems always exist when using the trackpad. I did discover that by pressing the Escape key, I can perform the control-drag (but not move files). I have played with the trackpad settings but have not yet been able to figure out how to get rid of that window that appears.
This popup appears whether I am holding the control, option, or command key.
What xcode version are you using, just tried
#1 is working as expected on my xcode13.0
#2 seems to be working for me too..

wxWidgets pprogrammaticaly move to next input control

I originally had code that set the focus to the first widget in a dialog, in the onInit method. But there were problems with it: if I pressed TAB, indeed focus moved to next control (wxTextCtrl), which got the blue 'focus' color, but the 'focus' color/highlight was not removed from previous focus widget. So now it looked like both first and second control had focus at the same time...
When cycling manually (by pressing TAB) full circle (till last control and then wrap around to the first), suddenly all worked well. That is, when moving focus from first control to next one, the first visually lost focus (blue color was removed) as it should. From now on, only one item had the focus color/highlight.
So instead of setting focus on the first control, I tried a different approach: I set the focus to the last control in the dialog, which is always the OK button. Next, I want to emulate programmatically that a TAB is pressed and received by the dialog. So I wrote this (inside Dialog::onInit):
m_buttonOK->SetFocus();
wxKeyEvent key;
key.SetEventObject(this);
key.SetEventType(wxEVT_CHAR);
key.m_keyCode=WXK_TAB;
ProcessWindowEvent(key);
Now the focus indeed moves away from the OK button, but it does not wrap around to the first control.
Only when I manually press TAB after the dialog opened, the first item gets focus.
Question: why does this wrapping around to set focus on first widget not work with the code shown above?
First of all, your initial problem is almost certainly related to not calling event.Skip() in one of your event handlers, see the note in wxFocusEvent documentation.
Second, you can't send wx events to the native windows, they don't know anything about it. In this particular case you can use wxWindow::Navigate() to do what you want, but generally speaking what you're doing simple can't, and won't, work reliably.

How do i remove the selection drawing from a Qt QGraphicsTextItem

I am developing a Qt 4.8 application using QGraphicsScene on Windows XP.
When the user double clicks on a QGraphicsTextItem, i call
textItem->setTextInteractionFlags(Qt::TextEditorInteraction);
At the next selection change i call
textItem->setTextInteractionFlags(Qt::NoTextInteraction);
This works correctly, but i find no way to remove the inversion of the background color that remains from editing. In the screen shot below, i first double clicked on the first text item and selected the characters "2927". Then i clicked on the second test item and selected "est". I find no way to get rid of the still inverted "2927" in the first text item (although its not in edit mode anymore).
I also tried to call:
textItem->textCursor().clearSelection();
textItem->update();
textItem->setTextInteractionFlags(Qt::NoTextInteraction);
textItem->clearFocus();
But his does not at all change the behavior.
So now i found a workaround:
QString s = textItem->toPlainText();
textItem->setPlainText("");
textItem->setPlainText(s);
textItem->setTextInteractionFlags(Qt::NoTextInteraction);
I dont like that, but it works.
Any hint for a cleaner solution?
Since QGraphicsTextItem::textCursor() returns a copy of the cursor, you have to set it back to the text item for it to have any effect.
QTextCursor cursor(textItem->textCursor());
cursor.clearSelection();
textItem->setTextCursor(cursor);

Need to print only the frame and not the whole page using Google Chrome

When I try to print the webpage, only the frame appears in the print when using IE or other browsers. However, through the google chrome, the whole page gets printed.
I have done a little research and found out that adding the OpenFrame plugin would do the trick. However, I am looking for the solution without the plugins. Our product is used by a number of customers and we can't ask them to install any plugins.
Can we fix this by making CSS changes or scripts.
Using JavaScript you can print frames independently, e.g.
top.frames[1].print()
If you include a print button or listen to print events, you can call your print function that prints only the frame you want.
Or you can use CSS #media print to set what gets printed
Highlight (select) what you want to print, right-click over the selected area and hit print.
p.s.: No other option worked. The add-on (Chrome app) doesn't have a print option, only open in new window and by doing so it sends a new page request and for many sites it won't work.
The best way is to use this "Chrome App" to add a Context sub-menu to your Chrome.
After the installation right click on the frame you want to print, select [This Frame] and the select the option that fits the best with your situation, usually [Open Frame in New tab].
Once you have the frame in a new tab you simply print it with CTRL-P or Right-Click [Print].
#media print { .div-to-not-print {display:none}}
is problematic because
It's not an end-user solution; it has to be done by the page
developer, and
We're talking about frames, which are actually independent pages.
That sort of solution wouldn't allow a user to print two
frames independently.
The suggestion
Click on the File > Print , then use the option Simplify Page
may work in some circumstances, but, for me, it just removes all frames and reverts to the <noframe> content in the frameset page.
As far as I can tell, there is no decent way to print just one frame in a frameset that is already loaded. A Chrome plugin that I haven't tried called "Print This Frame" really just re-loads the frame in a new tab (with a round-trip to the server).
But, without that plugin, if the frame you want to print was created from a hyperlink within the frameset, you can usually load the frame in a separate tab or window just by right-clicking on that link and selecting "Open link in new tab" or "Open link in new window"
Well the only workaround I could suggest is to open the source of the page and find the section
clink on the link and print it.
You should be using CSS:
#media print { .div-to-not-print {display: none} }
In the print version the blocks with class div-to-not-print will be hidden.
I found one another option useful.
Click on the File > Print , then use the option Simplify Page , that does removes useless things from page.
It might not be relevant to specific page you are printing. But i use it often.
Facing the same problem, I found that the most convenient way to control exactly what I wanted to print, thus remove the adds and various elements that just waste paper was to edit the page source directly:
Inspect the page : Ctrl-Shift-I -> this opens a pane with the source code of the page and the layout
By hover'ing over the source code it is really quick to identify the interesting elements that you are interested in, just remove the other ones:
it is a hierarchical representation of the page layout so you can expand the and elements to have more granularity when hover'ing
you may need to change or remove the class of the elements to change the internal layout if you have removed internal columns for example
Here is an example:
Click on the frame of interest
press CTRL+A (on Windows or equivalent on Mac) to select all content of the frame
press CTRL+P or choose print from the context menu
This should show a preview with everything in the frame ready to be saved as PDF or printed to the printer.

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.

Resources