Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.20 KB | None | 0 0
  1. def get_final_window_rect(self):
  2.         """Gets the final size of the main window of guake. The height
  3.        is the window_height property, width is window_width and the
  4.        horizontal alignment is given by window_alignment.
  5.        """
  6.         screen = self.window.get_screen()
  7.         height = self.client.get_int(KEY('/general/window_height'))
  8.         width = 30
  9.         halignment = self.client.get_int(KEY('/general/window_halignment'))
  10.  
  11.         # get the rectangle just from the first/default monitor in the
  12.         # future we might create a field to select which monitor you
  13.         # wanna use
  14.         window_rect = screen.get_monitor_geometry(0)
  15.         total_width = window_rect.width
  16.         window_rect.height = window_rect.height * height / 100
  17.         window_rect.width = window_rect.width * width / 100
  18.  
  19.         if width < total_width:
  20.             if halignment == ALIGN_LEFT:
  21.                 window_rect.x = (total_width - window_rect.width) / 2
  22.             elif halignment == ALIGN_LEFT:
  23.                 window_rect.x = 0
  24.             elif halignment == ALIGN_RIGHT:
  25.                 window_rect.x = total_width - window_rect.width
  26.         window_rect.y = 0
  27.         return window_rect
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement