Tree view with floating window - odoo

When I move my mouse to a row in tree view and stay here for a second, I want to see a floating window. (Like in developer mode.)
How Can I solve it? Any idea?

When you declare your field or fields that get rendered on a listview make sure you give to the __init__ method the help='My Floating Test' argument. That will cause a floating window to be shown when you hover on that field.
For example check:
addons/account/models/account.py
tag_ids = fields.Many2many('account.account.tag', 'account_account_account_tag', string='Tags', help="Optional tags you may want to assign for custom reporting")
The string on the help attribu will be shown on all the views that render this field upon hovering on it and pausing for 1 second.
If you want to modify the window that is shown, you can extend the
t-name="WidgetLabel.tooltip" template that is located in addons/web/static/src/xml/base_common.xml

Related

Valid displayAt() range in GMS

Images can be displayed at a specific location with the DisplayAt() command.
Does anyone know the valid range?
For example, DisplayAt(-9000, -9000) is that valid? What is the total valid range?
Of course in the example the image would not be seen within the GMS frame, but that is exactly what I need.
Thanks
Yes, negative values are completely ok and will indeed "place" the image outside the visible range of the window.
There is nothing like a "valid" range - the coordindates are just numbers. ( There is likely a limit when the value exceeds the value-range of the internallly used variable type to store the coordinates, possiblye long (4 byte signed integer). )
Just be aware that concepts like "front most" window will also apply if an image is outside the "visible" range. Images will f.e. also show up in the ImageBrowser regardless of their position on the workspace. The same is true for iterating through images on a workspace using f.e. CountImageDocuments() and GetImageDocument()
Some commands ( I think ShowImage() ) might have addtional code to ensure that images stay "visible" and might therefore shift the image back into the workspace range. Also using "auto-arrange" will take images from the "off" and place them back into the visible range.
So if you deliberatly use "off-screen" display, this is ok, but it might create some unintended side-effects. What is the exact purpose of using it this way? There might be more suitable concepts. (f.e. one can create imageDocuments and add ImageDisplays to them without the need of showing the imageDocument.) Image may also be temporarilly "hidden". Finally, one might condiser shiftung "unwanted" images onto a separate workspace.

Create WKInterfaceButton with image and left aligned text

I want to use a WKInterfaceButton for my watch app, that looks like the buttons in the watch settings:
with two main attributes:
It should contain a small image on the left
its title should be aligned to the left
I didn't found any possibility to align the title of a button to the left. I already tried to use a group instead (then it would work), but when I use a group I can't use the the shape of WKInterfaceButton.
Here's how I would do it...
Create a button
Make that button type a group
Within that button-group, place two groups inside it. The group on the left will contain the image. The group on the right will contain a label
So place an image in the left group, and a label in the right group.
Adjust the margins, length, heights of these groups until you get the desired look.
Give the button-group a length relative to container of "1" and a height of "size to fit content"
For the inner group that will contain the image, give it a length of relative to container of "0.2" (maybe)
For the inner group on the right that will contain the label, give it a length of relative to container of "0.8" (so that together the two groups make 1)
Give both groups a height of relative to container (1)
use WKInterfaceButton Content as Group and place image and label in it.
While i haven't tried this myself i think what you're looking for to match the watch settings is a table view. Define a table view in the interface controller of your story board and add your image and label to the row(s). There's an example of how to do this in the programming guide for apple kit.

selecting first span value from a group in selenium

I would want to select the first instance of an element in a page where many number of such elements are present with 'ID' which will not be same always.
for example, visit, http://www.sbobet.com/euro which lists lot of sports and odds, where I want to click on the first odds.
and the html structure would be like this,
I want to click on this first span value and proceed with some test case.
Any help on how to achieve this ?
There could be two approaches two the problem:
1. If you are sure you will always need only the first instance:
driver.FindElementsByClassName("OddsR")[0];
If not, then you have collection of elemets and you can access an of those
2. Also, you can first identify any closest enclosing div and then you can use the same snippet as above:
driver.FindElementsByClassName("OddsR")[0];
This one is a better approach if page is a bit dynamic in nature
Use #class attribute. If OddsR class you are intrested in is the 1st one on the page then just use Driver.FindElement(By.ClassName("OddsR")). Webdriver will pick the 1st occurence (no matter if there are more)
Have checked your link and I agree with alecxe, you should probably start with div. But i would suggest a simpler selector :
css = "div.MarketBd span.OddsR"
The above selector will always point to the first span of "OddsR" class within div of "MarketBd" class.
Thanks for the response.
I am finally able to click on the element, by this XPATH,
"//span[#class='OddsR']"
This clicks on the first occurrence of 'OddsR' values, without giving any index.

What does setTextMatrix of contentByte class in iText do?

I am using iText and am very new to it. There have been several situations where I think I could have figured out the problem with my code if I knew what I was doing - I use examples without knowing the workings behind the code, and even as I look at the source I can't figure out what the programmer was thinking.
What does setTextMatrix of contentByteArray in iText do? And how do I figure out the parameter values I need?
For example:
cb.setTextMatrix(1, 0);
The input parameters are x,y coordinates in points, unless CTM scaling was defined.
0,0 would be the bottom left of the template you are referencing.
The position is the 'baseline' of the text, rather than the top or the bottom.
Transcribed from this source:
https://sourceforge.net/p/itext/mailman/message/12855218/
first parameter sets left margin, second parameter sets bottom margin.

Displaying/Formatting Tabular Data (web)

In my example I have a table where each row is a user for example. Columns could include their name, address, email address, etc. I now need to add a column for (hypothetical example) their cat's names. While most people will have no cats and some people will have 1- 2 cats there will be the occasional person with 20 cats that create one very long row in the table. This is giving me an issue in presentation and for filtering/searching for cat names. Is there a good solution to displaying this type of data?
Have the first 50 (or whatever) characters of the field displayed as normal then put the rest in a block with its visibility set to hidden through CSS. Include a link / button / icon that will allow the user to toggle the visibility so they can see the entire value.
Several options:
Set a maximum width for the cell and allow the data to wrap
Place the content inside a wrapper tag (such as a div) and set the div with a fixed width/height and style of overflow:hidden to ensure that a particularly long word doesn't force out the width of the cell.
Truncate the output text on the server side
For cases #2 and #3, set the Title attribute of the TD tag to contain the full non-truncated text. This will present itself as a tooltip when hovering over the cell.
I would mention other CSS-based solutions but they're very sparsely supported right now, so not worth mentioning.
You might want to try doing something like what SO does. Namely, once someone reaches a certain point in their Rep, it suffixes the number and appromixates it. Ex. 10k instead of 10,236.
That way the numbers don't get out of hand.