Update examples
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
Display random picture from unsplash.com in a popup
|
||||
|
||||
* Click : open/close popup
|
||||
* Popup item click : display who clicked
|
||||
* ScrollUp/ScrollDown/Double click : display next picture
|
||||
* Right click : exit
|
||||
'''
|
||||
@@ -50,8 +51,8 @@ class PicturePopup(GenericMonitor):
|
||||
with open('/tmp/cat2.jpg', 'wb') as f:
|
||||
f.write(datatowrite)
|
||||
widget = GenericMonitorTextWidget('#%d' % self.imgs_idx, 'color:purple')
|
||||
url_widget = GenericMonitorTextWidget(url, 'color:white;font-weight:bold')
|
||||
picture_widget = GenericMonitorPictureWidget('/tmp/cat2.jpg')
|
||||
url_widget = GenericMonitorTextWidget(url, 'color:white;font-weight:bold', signals={'on-click':'signal'}) # No name here
|
||||
picture_widget = GenericMonitorPictureWidget('/tmp/cat2.jpg', name='NestedWidget', signals={'on-click':'signal'})
|
||||
popup = GenericMonitorPopup([url_widget, picture_widget])
|
||||
signals = {
|
||||
'on-click':'toggle-popup',
|
||||
@@ -68,7 +69,11 @@ class PicturePopup(GenericMonitor):
|
||||
self.imgs_idx += 1
|
||||
|
||||
def _forMe(self, sender):
|
||||
return sender == self.item.getFullName()
|
||||
return str(sender).endswith(self.item.getFullName())
|
||||
|
||||
def onClick(self, sender):
|
||||
if not self._forMe(sender): return
|
||||
print('Click from {}'.format(sender))
|
||||
|
||||
def _onScroll(self, sender):
|
||||
if not self._forMe(sender): return
|
||||
|
||||
Reference in New Issue
Block a user