class HobInfoButton(gtk.EventBox): """ This class implements a button-like widget per the Hob visual and UX designs which will display a persistent tooltip, with the contents of tip_markup, when clicked. tip_markup: the Pango Markup to be displayed in the persistent tooltip """ def __init__(self, tip_markup, parent=None): gtk.EventBox.__init__(self) self.image = gtk.Image() self.image.set_from_file(hic.ICON_INFO_DISPLAY_FILE) self.image.show() self.add(self.image) self.tip_markup = tip_markup self.my_parent = parent self.set_events(gtk.gdk.BUTTON_RELEASE | gtk.gdk.ENTER_NOTIFY_MASK | gtk.gdk.LEAVE_NOTIFY_MASK) self.connect("button-release-event", self.button_release_cb) self.connect("enter-notify-event", self.mouse_in_cb) self.connect("leave-notify-event", self.mouse_out_cb) """ When the mouse click is released emulate a button-click and show the associated PersistentTooltip """ def button_release_cb(self, widget, event): from bb.ui.crumbs.hig.propertydialog import PropertyDialog self.dialog = PropertyDialog( title="", parent=self.my_parent, information=self.tip_markup, flags=gtk.DIALOG_DESTROY_WITH_PARENT | gtk.DIALOG_NO_SEPARATOR, ) button = self.dialog.add_button("Close", gtk.RESPONSE_CANCEL) HobAltButton.style_button(button) button.connect("clicked", lambda w: self.dialog.destroy()) self.dialog.show_all() self.dialog.run() """ Change to the prelight image when the mouse enters the widget """ def mouse_in_cb(self, widget, event): self.image.set_from_file(hic.ICON_INFO_HOVER_FILE) """ Change to the stock image when the mouse enters the widget """ def mouse_out_cb(self, widget, event): self.image.set_from_file(hic.ICON_INFO_DISPLAY_FILE)
class HobInfoButton(gtk.EventBox): """ This class implements a button-like widget per the Hob visual and UX designs which will display a persistent tooltip, with the contents of tip_markup, when clicked. tip_markup: the Pango Markup to be displayed in the persistent tooltip """ def __init__(self, tip_markup, parent=None): gtk.EventBox.__init__(self) self.image = gtk.Image() self.image.set_from_file(hic.ICON_INFO_DISPLAY_FILE) self.image.show() self.add(self.image) self.tip_markup = tip_markup self.my_parent = parent self.set_events(gtk.gdk.BUTTON_RELEASE | gtk.gdk.ENTER_NOTIFY_MASK | gtk.gdk.LEAVE_NOTIFY_MASK) self.connect("button-release-event", self.button_release_cb) self.connect("enter-notify-event", self.mouse_in_cb) self.connect("leave-notify-event", self.mouse_out_cb) """ When the mouse click is released emulate a button-click and show the associated PersistentTooltip """ def button_release_cb(self, widget, event): from bb.ui.crumbs.hig.propertydialog import PropertyDialog self.dialog = PropertyDialog(title='', parent=self.my_parent, information=self.tip_markup, flags=gtk.DIALOG_DESTROY_WITH_PARENT | gtk.DIALOG_NO_SEPARATOR) button = self.dialog.add_button("Close", gtk.RESPONSE_CANCEL) HobAltButton.style_button(button) button.connect("clicked", lambda w: self.dialog.destroy()) self.dialog.show_all() self.dialog.run() """ Change to the prelight image when the mouse enters the widget """ def mouse_in_cb(self, widget, event): self.image.set_from_file(hic.ICON_INFO_HOVER_FILE) """ Change to the stock image when the mouse enters the widget """ def mouse_out_cb(self, widget, event): self.image.set_from_file(hic.ICON_INFO_DISPLAY_FILE)
def show_packages_property_dialog(self, properties): information = {} dialog = PropertyDialog(title=properties["name"] + ' ' + "properties", parent=self, information=properties, flags=gtk.DIALOG_DESTROY_WITH_PARENT | gtk.DIALOG_NO_SEPARATOR) dialog.set_modal(False) button = dialog.add_button("Close", gtk.RESPONSE_NO) HobAltButton.style_button(button) button.connect("clicked", lambda w: dialog.destroy()) dialog.run()
def show_packages_property_dialog(self, properties): information = {} dialog = PropertyDialog(title = properties["name"] +' '+ "properties", parent = self, information = properties, flags = gtk.DIALOG_DESTROY_WITH_PARENT | gtk.DIALOG_NO_SEPARATOR) dialog.set_modal(False) button = dialog.add_button("Close", gtk.RESPONSE_NO) HobAltButton.style_button(button) button.connect("clicked", lambda w: dialog.destroy()) dialog.run()