← Back to team overview

gtg team mailing list archive

[Merge] lp:~parinporecha/gtg/calendar_hidden_patch into lp:gtg

 

Parin Porecha has proposed merging lp:~parinporecha/gtg/calendar_hidden_patch into lp:gtg.

Requested reviews:
  Gtg developers (gtg)

For more details, see:
https://code.launchpad.net/~parinporecha/gtg/calendar_hidden_patch/+merge/141557

This is a patch for the Bug #1032745 ( Hidden part of calendar ).
I have tested it and it works well.
I have used some if statements to correct the bug and i'm not sure if this is the best way.
If you do know a better way, plz suggest ! :)
-- 
https://code.launchpad.net/~parinporecha/gtg/calendar_hidden_patch/+merge/141557
Your team Gtg developers is requested to review the proposed merge of lp:~parinporecha/gtg/calendar_hidden_patch into lp:gtg.
=== modified file 'GTG/gtk/editor/calendar.py'
--- GTG/gtk/editor/calendar.py	2012-12-13 15:44:18 +0000
+++ GTG/gtk/editor/calendar.py	2013-01-01 18:23:22 +0000
@@ -102,11 +102,23 @@
 
     def show_at_position(self, x, y):
         width, height = self.__window.get_size()
-        self.__window.move(x - width, y - height)
+        screen_width = 0
+        screen_width = gtk.gdk.screen_width()
+        if x < width:	#To display calendar inside the screen when editor window is outside leftside of the screen
+            self.__window.move(2, y - height)
+        elif x > (screen_width-2):	#To display calendar inside the screen when editor window is outside rightside of the screen
+            self.__window.move(screen_width - width - 2, y - height)
+        else:
+            self.__window.move(x - width, y - height)
         self.__window.show()
         ##some window managers ignore move before you show a window. (which
         # ones? question by invernizzi)
-        self.__window.move(x - width, y - height)
+        if x < width:
+            self.__window.move(2, y - height)
+        elif x > (screen_width-2):
+            self.__window.move(screen_width - width - 2, y - height)
+        else:
+            self.__window.move(x - width, y - height)
         self.__window.grab_add()
         #We grab the pointer in the calendar
         gdk.pointer_grab(self.__window.window, True,


Follow ups