holoviews table - adding custome tooltips - python-3.x

Im building a dashboard using Panel, Holoviews and Bokeh.
One of the widgets in the dashboard is a table - which I create by using hv.Table.
This table is a part of an interact widget and current layout works fine.
Now I want to add tooltips to two of the colums in the table.
The tooltips should link to a url based on another columns value.
I've tried following solutions presented in this question with no success.
The problems are in the generated layout of the panel, widgets are squashed together and not visible(code throws no exceptions).
To my understanding(might be wrong), things get weird when using Bokeh's DataTable instead of holoviews's.
Any suggestions would be appreciated,
import panel as pn
import holoviews as hv
from panel.interact import interact
def get_grower_table(grower):
grower_df = growers_dfs[grower]
p = hv.Table(grower_df)
return p
grower_ghs_view = interact(get_growers_table, grower=['MIAO', 'BAO'],)
dashboard = pn.Columns(pn.Row(grower_ghs_view))

Related

Get the contents of a widget in a layout in PyQt

I recently decided to create a small application that simply reads the files in a compressed file and renames them. I went through several UI modules and decided to use PyQt6.
To achieve this, I first created a QWidget that holds the widgets QPushButton and QLineEdit.
The user then types the new name into the QLineEdit widget and select the QPushButton if the file has to be excluded.
Now, this widget that was created will be added into a QVBoxLayout which is then set as the QScrollArea layout.
Here's my problem:
Once I was done creating the scroll area and the list, I wanted to retrieve the content of each widget. For this purpose, I use the findChild method. But it only returns the address of the object.
Is there any way to get the text stored in QLineEdit of each widget? Is it possible to retrieve the text just by knowing its address?
Here's what I tried:
for index in range(self.layout.count()):
widget = self.layout.itemAt(index).widget()
nameFromLineEdit = widget.findChild(QLineEdit).text()
print(nameFromLineEdit)

Upload data from a grid by import scenarios

I created a grid inside a tab in Stock Items screen and I would like to know whether it is possible to upload data from a simple grid by import scenarios.
any suggestion?
Thanks!

wxPython - Tooltips for notebook tabs

I'm creating a GUI using wxPython that uses the wx.Notebook widget.
Since I removed the labels on the Notebook tabs for design purposes,
I would like to add tooltips for each tab individually that show
the tab's purpose.
I thought I could use the AddPage() method of the Notebook class. But it only returns bool values, so that I cannot use the SetToolTip() method for either tab.
How would I go about doing that?
This is not something that is built-in to the wx.Notebook widget. You could probably do it yourself by binding to wx.EVT_MOTION and checking you mouse's position to determine when to set a tooltip.
The AUINotebook might be a better choice since it has a TabHitTest method. Someone on the wxPython group mentioned a way to add tooltips to it here: http://wxpython-users.1045709.n5.nabble.com/setting-a-tooltip-on-auinotebook-tab-td5548750.html
Here's the code they ended up using in the mouse over event handler:
def OnMouseOver(self, evt):
""" mouse over on a tab """
desc = None
n = self.GetSelection()
if n != -1:
page_info = self._tabs.GetPage(n)
ctrl, ctrl_idx = self.FindTab(page_info.window)
if ctrl:
ctrl.SetToolTipString(desc)

QScrollArea widgets and layouts - PySide/PyQt

I've read endless examples on nullege, as well as previous questions on this topic on SO. I'm thoroughly confused with trying to set up a QScrollArea within my PySide UI project. Here's what I'm trying to achieve:
A QWidget or QFrame which acts as a container on a page.
The QWidget/QFrame contains 8 Pixmapped labels.
Only 2 of the Pixmapped labels can 'fit' within the visible part of the screen at a time.
A QScrollArea is utilised such that the entire range of the QWidget/QFrame can be seen, using the horizontal scroll bars.
In theory this is really quite simple, but I just can't figure out how the QScrollArea links with the QWidget/QFrame, and whether I need a QLayout as well. At the moment, the horizontal scroll bars are present, but scrolling is unavailable. Here's what I have so far:
#Oscar Home Scroll Area - Scroll Area#
self.ScrollAreaOscarHome = QtGui.QScrollArea(self)
self.ScrollAreaOscarHome.setGeometry(QtCore.QRect(12, 180, 1000, 570))
self.ScrollAreaOscarHome.setVisible(True)
self.ScrollAreaOscarHome.setFrameShape(QtGui.QFrame.NoFrame)
self.ScrollAreaOscarHome.setObjectName("ScrollAreaOscarHome")
self.ScrollAreaOscarHome.setWidgetResizable(True)
self.ScrollAreaOscarHome.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn)
self.ScrollAreaOscarHome.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
#Oscar Home Container Widget - Widget#
self.WidgetOscarHomeContainer = QtGui.QWidget()
self.WidgetOscarHomeContainer.setGeometry(QtCore.QRect(12, 180, 2000, 570))
self.WidgetOscarHomeContainer.setObjectName("WidgetOscarHomeContainer")
self.ScrollAreaOscarHome.setWidget(self.WidgetOscarHomeContainer)
#Oscar Home Horizontal Layout - QHBoxLayout#
self.OscarHomeHorizontalLayout = QtGui.QHBoxLayout(self.WidgetOscarHomeContainer)
I've included the QHBoxLayout section above because previous examples I've read used the Layout, but I'm not sure how it fits in to the Widget and the ScrollArea.
Am I on the right track here? I'm not getting any errors, and the ScrollArea is displaying as I'd like, but the ScrollArea and Widget (which is much wider than the ScrollArea) don't seem to be linked at all.
Any guidance would be greatly appreciated!

Collapsible accordion not showing content when initialized collapsed

I'm using twitter bootstrap with JSF-2.2.4 and Spring 3.2.4 Framework. I've built a collapsible accordion based on the following tutorial: http://getbootstrap.com/javascript/#collapse
The code seems to work fine, but only if I start with opened accordions, meaning that I add the 'in' class to the div which inherits the content which is supposed to be collapsed. If I remove the 'in' class the accordion is opened by clicking the appropriate link, but the content is no displayed.
Content is plot created with plotfaces.
Any ideas?
Edit: I just tried filling the box with an image. This seems to work. Maybe this helps narrowing down the problem.
I don't know how this plotfaces work, but i expect your problem similair to fullcalendar not visible until button is clicked or window resized?
Try to set .collapse {display;block; visibilty:hidden;} instead of display none. If this don't helps try to focus on the height of the element. The plugin change the height from 0 to auto but on initial load the height is not set.

Resources