Kivy: Remove the red dot creation on right clic - kivy

When creating a kivy exe on Windows with Pyinstaller, I still have the right click creating red dot.
Why does right-clicking create an orange dot in the center of the circle? proposed to use this to remove this behavior.
from kivy.config import Config
Config.set('input', 'mouse', 'mouse,multitouch_on_demand')
But when I do, I can't scroll anymore on my page if I stay pressed on a widget.
Isn't there something more precise like deactivate_red_dot rather than deactivated_multitouch which seems to have side effects ? Maybe a method of the Mouse() that we can override ?

venv/Lib/site_packages/kivy/input/providers/mouse.py
Method on_mouse_press
Replace
do_graphics = (not self.disable_multitouch) and (
button != 'left' or 'ctrl' in modifiers)
By
do_graphics = False
I'm not sure if I won't have others sides effects but that seems legit by the behavior I saw on the code.
EDIT:
Actually for my project, the bug with disable multitouchh was on android so I did:
if isWindows():
from kivy.config import Config
Config.set('input', 'mouse', 'mouse,disable_multitouch')
Good side, doesn't change fundamental library. Bad side, disabling multitouch could lead to others sneaky bugs.

Related

How do i change react-native theme to transaperent on ios

how can i change the theme or default background color for ios.. it's conflicting with my background image. I'd like to set it to transparent.. Thanks
First let's understand how scenes in react-native-router-flux works. When you define them in your navigator, like below,
<Scene sceneStyle={{marginTop: 64}} title="Home" key="home" component={Home} />
You simply say that, my content should render below the pre defined navbar. Which can be 54 or 64 depending on your OS. So when you use Router,
<Router navigationBarStyle={{backgroundColor: 'transparent'}}>
and add navigationBarStyle to every Scene you have by introducing that line, you almost forgot what you've done above, setting your Scene to align itself some margin below the navigationBar. Therefore you see nothing (white space) in your simulator.
In order to have what you need, do this where you want your image to appear full screen with navigation controls:
Actions.refresh({
key: 'home',
navigationBarStyle: {backgroundColor: 'transparent'},
sceneStyle: {marginTop: 0},
});
Or you can introduce this settings in your Scene component where you define it.
I tested this solution and it works on iOS, can't tell the same for Android, so please back up your code before making changes. You can further customize it to remove borderBottom line.

kivy on android, change taskbar color

Is it possible to change the taskbar color when fullscreen is set to 0 in buildozer.spec file?
I already tried changing Window.clearcolor value but hence taskbar is not part of Window when fullscreen is 0, taskbar color doesn't change.
How does one do that?
I believe this is the answer for Java, therefore (as inclement said) you need to use pyjnius to access the Java functions from Python and then wrap the code mentioned in the linked answer to something usable from Kivy.
Example (not tested):
from jnius import autoclass
WindowManager = autoclass('android.view.WindowManager')
R = autoclass('android.R')
activity = autoclass('<your.app.name>.PythonActivity').mActivity
window = activity.getWindow();
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS)
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS)
window.setStatusBarColor(activity.getResources().getColor(R.color.my_statusbar_color));
I think only these colors are available, but feel free to try other values. I've seen some issues with android.R importing in Java, so you might want to just use the raw values instead of fetching them from android.R module.

Change found text highlight in a Firefox extension

I'm developing an extension for Firefox which searches terms in a page. And I'd like to change found text highlight color and background. For example, I search for a letter "s" and by default it's selected with a blue rectangle with white text color. So I want to change the blue to the red.
How could I do this via JS?
Edit0:
To select a found text I use document.createRange() and selection.addRange() methods.
I don't know how the default finder selects a found term and applies background to it.
So maybe the 'range' method is not the best.
But I think I'm searching a way to highlight this created range...
Edit1:
Now I've partially resolved the color-changing preoblem. Just add a CSS rule with ::-moz-selection and red background when a text is found and selected. Then for document 'onmousedown' I remove this rule not to leave the default selection as red.
But a new problem is when I find say a digit and it gets a selection the background of that selection is gray (so it looks like a text selection of an inactive window). Then when I click with my mouse somewhere in the document text and press F3 the extension finds the next digit and selects it with the red background. And next findings work right (with red background).
So my purpose is change that initial gray background to red.
Maybe I should change the inactive selection color...
Edit2:
Now I updated my JS code:
var selection=w.getSelection()
var range=w.document.createRange()
range.setStart(foundNode,foundOffset)
range.setEnd(foundNode,foundOffset+foundLength)
selection.removeAllRanges()
selection.addRange(range)
var controller=gBrowser.docShell.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsISelectionDisplay)
.QueryInterface(Ci.nsISelectionController);
controller.setDisplaySelection(controller.SELECTION_ATTENTION)
controller.repaintSelection(controller.SELECTION_NORMAL)
Thanks to Noitidart's answer I found some information on how to use nsISelectionController XPCOM interface to select found text with background. Still I can't set a custom color for this background so that it be different from the default color of found text in Firefox. But setting the ui.textSelectBackgroundAttention preference in about:config to desired color will work with both my extension and default find engine.
I've found that SELECTION_ATTENTION constant is responsible for that background color and the setDisplaySelection method links the color to the selected text. But I couldn't find any implementation of this method. I saw only nsISelectionController idl file with its structure but no correspondent .cpp or .js file implementing this .idl. So I don't have information on how the color is set.
Edit3:
Recently I added the "Highlight All" functionality to my extension. And a new question about color of this highlight has rised. Using the above tecnique will show all the matches with green find color (by default). But it's more comfortable to use a different color to distinguish the current match and others.
So I couldn't find another helpful nsISelectionController constant for the "Highlight All" selection. I simply set this selection to 'DISABLED' type and changed the ui.textSelectBackgroundDisabled about:config pref. This pref is obviously for the selected text background of an inactive window. And it worked for me.
controller.setDisplaySelection(controller.SELECTION_DISABLED)
Another thing is that I'm not sure that the controller.repaintSelection() in the previous Edit is necessary. I guess the selection didn't work without it when I started my experiments with this stuff. But now I removed that line and all still work.
Plus:
And some additional links if somebody will need:
nsISelectionController Reference
Selection Reference
Forum question about highlight
about:config prefs for highlight
An Add-on using a similar tecnique
Finder.jsm and other sources
Also I used some files from Firefox source archive: Firefox 33 Source:
- nsISelectionController.idl [\content\base\public\]
- nsTypeAheadFind.cpp [\toolkit\components\typeaheadfind\]
- Finder.jsm [\toolkit\modules\]
- findbar.xml [\toolkit\content\widgets\]
I asked this question to quicksilver via email and this is what he told me:
You might find this one helpful: https://developer.mozilla.org/en-US/docs/XPCOM_Interface_Reference/nsISelectionController
I'm hardly the master you think I am, actually. :) To change those colors I just change the values for preferences:
ui.textHighlightBackground
ui.textHighlightForeground
ui.textSelectBackgroundAttention -> SELECTION_ATTENTION, it's not a highlight, it's a normal selection (as you would select some text with your mouse and it would turn the regular blue blackground, in windows at least) but it's given "attention", so it has the green background that the find operation reports. Basically it's a way of showing the user "Here I am!!" after firefox automatically selecs the text he searched for.
And I really don't know most of those contants, SELECTION_NORMAL is for normal text selection, like it would be when you select text with your mouse, SELECTION_FIND is for the highlights, and I only know the ON/HIDDEN/OFF/DISABLED ones which are self-explanatory. SELECTION_SPELLCHECK is probably for the auto-correct when you are typing in an editable content node, but I'm just guessing that one from the name.
Also, as far as I know, it's not possible to just create custom selection ranges/contants, as the code simply won't recognize them without editing the C++ code as well. Which is actually one of the reasons I haven't implemented https://github.com/Quicksaver/FindBar-Tweak/issues/76 yet.

No code highlights in fx:Script of flash builder 4.5

It seems all codes inside fx:Script blocks are black with no highlights. That's pretty inconvenient. Can anyone please let me know how to turn it on? Thanks!
First check that the active perspective is "Flash".
Then Window->Preferences. On the left side of the window expand Flash Builder->Editors->Syntax Coloring. On the right side you can set the colors for ActionsScript, CSS and MXML.
If after tinkering around you cannot fix the problem try to delete the "Adobe Flash Builder 4.5" folder located in the user's folder.
Hope this helps
Problem solved. I was using two different namespaces in Application and Module. It's "adobe.com/2006/mxml"; in mx:Application and "library://ns.adobe.com/flex/mx" in mx:Module. After the namespace in mx:Application was made consistent with the one from mx:Module, all syntax are highlighted correctly.

Open Flash Chart - tooltip #x_label# not showing

I'm currently playing with a bar chart implemented through Open Flash Charts (I believe version 1, might be version 2...) with PHP. Unfortunately, we're having real trouble with the tooltip not showing the correct thing. I am trying to get it to show the x-axis label for the hovered-over column, then a ":", then the value of the bar. The code is as follows:
$Colour = '#3465A4';
$BarChart= new bar();
$BarChart->set_values($Bar);
$BarChart->set_colour($Colour);
$BarChart->set_tooltip('#x_label#:#val#');
$x_labels = new x_axis_labels();
$x_labels->set_labels($Roles);
$x_labels->rotate(-60);
$x = new x_axis();
$x->set_labels($x_labels);
$chart = new open_flash_chart();
$chart->add_element($BarChart);
$chart->set_bg_colour( '#FFFFFF' );
$chart->set_x_axis($x);
$tooltip = new tooltip();
$tooltip->set_hover();
$chart->set_tooltip($tooltip);
$JSONArray['my_chart_1'] = $chart->toPrettyString();
As far as I can tell, this should be correct - the bar chart appears, with the correct values (populated from $bar, whose generation is not shown above). However, the hover-over tool-tip for a column only shows ":value" - the label name is missing!
Does anyone know where we might have gone wrong, and how I can fix it?
EDIT:
An update for any Bounty Hunters coming in to try and answer this question. The reason I have not accepted the below answer is that it only provides a work-around, and does not explain why the work-around is necessary. I am looking either for an answer to my original question (how to make the labels show in a normal bar-chart), or a reasonable explanation regarding why one must use a stacked bar chart (including sources makes your answer so much better!). If the latter, example code or an explanation of how stacked charts are created would be much appreciated as well!
If you are happy with the simple bar visuals then use stacked bar (using it with an array of one element will draw it just like the simple bar). That one will replace #x_label# correctly.
Alternatively you can copy the missing code from Bars/Stack.as to other bar types and recompile the code.
As per: http://forums.openflashchart.com/viewtopic.php?p=7433#p7433
It's a bug in OFC2 in the latest versions (at least). I've found what is causing the issue with #x_label#, but my understanding of the code/Flash isn't good enough to know why it's happened/broken.
I've done a quick fix that I need to test some more, but it now works on bar charts. Assuming I've not broken anything else beyond repair, it'll make it's way into the next community release.
If anyone wants the source code changes before the next release let me know.
(I am currently maintaining the community releases)

Resources