def _get_xembed_background_image(self): """ load the desktop background image in Unity """ try: pixbuf = self._xid_background_image except AttributeError: size, size_mm = get_monitor_dimensions(self) filename = config.get_desktop_background_filename() if not filename or \ size[0] <= 0 or size[1] <= 0: pixbuf = None else: try: # load image pixbuf = GdkPixbuf.Pixbuf.new_from_file(filename) # Scale image to mimic the behavior of gnome-screen-saver. # Take the largest, aspect correct, centered rectangle # that fits on the monitor. rm = Rect(0, 0, size[0], size[1]) rp = Rect(0, 0, pixbuf.get_width(), pixbuf.get_height()) ra = rm.inscribe_with_aspect(rp) pixbuf = pixbuf.new_subpixbuf(*ra) pixbuf = pixbuf.scale_simple(size[0], size[1], GdkPixbuf.InterpType.BILINEAR) except Exception as ex: # private exception gi._glib.GError when # librsvg2-common wasn't installed _logger.error("_get_xembed_background_image(): " + \ unicode_str(ex)) pixbuf = None self._xid_background_image = pixbuf return pixbuf
def _get_popup_size(self, window): DEFAULT_POPUP_SIZE_MM = 18.0 MAX_POPUP_SIZE_PX = 120.0 # fall-back if phys. monitor size unavail. gdk_win = window.get_window() w = config.keyboard.touch_feedback_size if w == 0: sz, sz_mm = get_monitor_dimensions(window) if sz[0] > 0 and sz_mm[0] > 0: default_size_mm = DEFAULT_POPUP_SIZE_MM # scale for hires displays if gdk_win: try: default_size_mm *= gdk_win.get_scale_factor( ) # from Gdk 3.10 except AttributeError: pass w = sz[0] * default_size_mm / sz_mm[0] elif sz[0] > 0: w = min(sz[0] / 12.0, MAX_POPUP_SIZE_PX) else: # LP #1633284 w = MAX_POPUP_SIZE_PX return w, w * (1.0 + LabelPopup.ARROW_HEIGHT)
def _get_xembed_background_image(self): """ load the desktop background image in Unity """ try: pixbuf = self._xid_background_image except AttributeError: size, size_mm = get_monitor_dimensions(self) filename = config.get_desktop_background_filename() if not filename: pixbuf = None else: try: # load image pixbuf = GdkPixbuf.Pixbuf.new_from_file(filename) # Scale image to mimic the behavior of gnome-screen-saver. # Take the largest, aspect correct, centered rectangle # that fits on the monitor. rm = Rect(0, 0, size[0], size[1]) rp = Rect(0, 0, pixbuf.get_width(), pixbuf.get_height()) ra = rm.inscribe_with_aspect(rp) pixbuf = pixbuf.new_subpixbuf(*ra) pixbuf = pixbuf.scale_simple(size[0], size[1], GdkPixbuf.InterpType.BILINEAR) except Exception as ex: # private exception gi._glib.GError when # librsvg2-common wasn't installed _logger.error("_get_xembed_background_image(): " + \ unicode_str(ex)) pixbuf = None self._xid_background_image = pixbuf return pixbuf
def _get_popup_size(self, window): DEFAULT_POPUP_SIZE_MM = 18.0 MAX_POPUP_SIZE_PX = 120.0 # fall-back if phys. monitor size unavail. w = config.keyboard.touch_feedback_size if w == 0: sz, sz_mm = get_monitor_dimensions(window) if sz and sz_mm: if sz[0] and sz_mm[0]: w = sz[0] * DEFAULT_POPUP_SIZE_MM / sz_mm[0] else: w = min(sz[0] / 12.0, MAX_POPUP_SIZE_PX) else: w = MAX_POPUP_SIZE_PX return w, w * (1.0 + LabelPopup.ARROW_HEIGHT)
def _get_popup_size(self, window): DEFAULT_POPUP_SIZE_MM = 18.0 MAX_POPUP_SIZE_PX = 120.0 # fall-back if phys. monitor size unavail. w = config.keyboard.touch_feedback_size if w == 0: sz, sz_mm = get_monitor_dimensions(window) if sz and sz_mm: if sz[0] and sz_mm[0]: w = sz[0] * DEFAULT_POPUP_SIZE_MM / sz_mm[0] else: w = min(sz[0] / 12.0, MAX_POPUP_SIZE_PX) else: w = MAX_POPUP_SIZE_PX # To check Change Popup Size checkbox enbable or not in Inputabilibty Tab # If check then add new height and widht to current popup size if config.scanner.scan_popup_size_change_enabled : #In scan_width=config.scanner.scan_popup_width #In scan_height=config.scanner.scan_popup_height #In return w + scan_width , w * (1.0 + LabelPopup.ARROW_HEIGHT)+ scan_height #In return w, w * (1.0 + LabelPopup.ARROW_HEIGHT)